summaryrefslogtreecommitdiffstats
path: root/src/peer.h
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-01-14 00:59:49 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-01-14 00:59:49 +0100
commit51a1da3272c58e631fc5cecb181327bcceb5f311 (patch)
treea214a6a609a71023c472cd998f11225b3f9a5332 /src/peer.h
parent7815904f1136339d47329a3871d9939eac34f830 (diff)
downloadfastd-51a1da3272c58e631fc5cecb181327bcceb5f311.tar
fastd-51a1da3272c58e631fc5cecb181327bcceb5f311.zip
Allow to configure methods per peer group
Diffstat (limited to 'src/peer.h')
-rw-r--r--src/peer.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/peer.h b/src/peer.h
index ca03e2f..3181544 100644
--- a/src/peer.h
+++ b/src/peer.h
@@ -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);