diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-01-14 00:59:49 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-01-14 00:59:49 +0100 |
commit | 51a1da3272c58e631fc5cecb181327bcceb5f311 (patch) | |
tree | a214a6a609a71023c472cd998f11225b3f9a5332 /src/peer.h | |
parent | 7815904f1136339d47329a3871d9939eac34f830 (diff) | |
download | fastd-51a1da3272c58e631fc5cecb181327bcceb5f311.tar fastd-51a1da3272c58e631fc5cecb181327bcceb5f311.zip |
Allow to configure methods per peer group
Diffstat (limited to 'src/peer.h')
-rw-r--r-- | src/peer.h | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -121,6 +121,7 @@ struct fastd_peer_group { /* constraints */ int max_connections; /**< The maximum number of connections to allow in this group; -1 for no limit */ + fastd_string_stack_t *methods; /**< The list of configured method names */ }; /** An entry for a MAC address seen at another peer */ @@ -265,6 +266,20 @@ static inline bool fastd_peer_is_socket_dynamic(const fastd_peer_t *peer) { return (!peer->sock || !peer->sock->addr); } +/** Returns the configured methods for a peer's group */ +static inline const fastd_string_stack_t * fastd_peer_get_methods(const fastd_peer_t *peer) { + if (!peer) + return conf.peer_group->methods; + + const fastd_peer_group_t *group; + for (group = peer->group; group; group = group->parent) { + if (group->methods) + return group->methods; + } + + return NULL; +} + /** Checks if a MAC address is a normal unicast address */ static inline bool fastd_eth_addr_is_unicast(fastd_eth_addr_t addr) { return ((addr.data[0] & 1) == 0); |