diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-10-18 04:44:14 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-10-18 04:44:14 +0200 |
commit | 64d0bef9efd4a82b7a132b490328c80e67431041 (patch) | |
tree | b802f49e2434519e22afd384fff3f85bd401a2da /src/peer_group.h | |
parent | 412e341def88b0734fbac2c2f19fcecf2486ee86 (diff) | |
download | fastd-64d0bef9efd4a82b7a132b490328c80e67431041.tar fastd-64d0bef9efd4a82b7a132b490328c80e67431041.zip |
peer_group: add fastd_peer_group_lookup_peer_shell_command macro to simplify shell command lookup
Diffstat (limited to 'src/peer_group.h')
-rw-r--r-- | src/peer_group.h | 14 |
1 files changed, 14 insertions, 0 deletions
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) |