From 64d0bef9efd4a82b7a132b490328c80e67431041 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 18 Oct 2015 04:44:14 +0200 Subject: peer_group: add fastd_peer_group_lookup_peer_shell_command macro to simplify shell command lookup --- src/peer_group.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/peer_group.h') diff --git a/src/peer_group.h b/src/peer_group.h index edba73e..69974a4 100644 --- a/src/peer_group.h +++ b/src/peer_group.h @@ -95,3 +95,17 @@ struct fastd_peer_group { const fastd_peer_t *_peer = (peer); \ _peer ? fastd_peer_group_lookup(_peer->group, attr) : &conf.peer_group->attr; \ }) + +/** + Looks up an shell command attribute in the peer group tree, for a given peer + + Returns a pointer to the attribute, going up the group tree to the first group + where the attribute is not NULL if such a group exists. Uses the default group + if no peer is given. + + @param peer the peer + @param attr the name of the shell command member + + \hideinitializer + */ +#define fastd_peer_group_lookup_peer_shell_command(peer, attr) container_of(fastd_peer_group_lookup_peer(peer, attr.command), fastd_shell_command_t, command) -- cgit v1.2.3