From 51a1da3272c58e631fc5cecb181327bcceb5f311 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 14 Jan 2015 00:59:49 +0100 Subject: Allow to configure methods per peer group --- src/peer.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/peer.h') 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); -- cgit v1.2.3