summaryrefslogtreecommitdiffstats
path: root/src/peer.h
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-05-25 23:10:26 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-05-25 23:10:26 +0200
commit6a249659bf167aa8e7f72917e9c9f23ba9477e1c (patch)
treea75f565a96a05bdee12ade33fbd25146597b7b1a /src/peer.h
parentc9da7ad1de089f109a3798ff19bede86348150aa (diff)
downloadfastd-6a249659bf167aa8e7f72917e9c9f23ba9477e1c.tar
fastd-6a249659bf167aa8e7f72917e9c9f23ba9477e1c.zip
Unify fastd_peer_group_t and fastd_peer_group_config_t into a single structure
Diffstat (limited to 'src/peer.h')
-rw-r--r--src/peer.h18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/peer.h b/src/peer.h
index c44f599..f29545a 100644
--- a/src/peer.h
+++ b/src/peer.h
@@ -48,7 +48,6 @@ struct fastd_peer {
uint64_t id; /**< A unique ID assigned to each peer */
const fastd_peer_config_t *config; /**< The peer's fastd_peer_config_t */
- fastd_peer_group_t *group; /**< The peer's peer group */
/** The socket used by the peer. This can either be a common bound socket or a
dynamic, unbound socket that is used exclusively by this peer */
@@ -99,7 +98,7 @@ struct fastd_peer_config {
fastd_remote_config_t *remotes; /**< A linked list of the peer's remote entries */
char *key; /**< The peer's public key */
bool floating; /**< Specifies if the peer has any floating remotes (or no remotes at all) */
- const fastd_peer_group_config_t *group; /**< The peer group the peer belongs to */
+ const fastd_peer_group_t *group; /**< The peer group the peer belongs to */
fastd_protocol_peer_config_t *protocol_config; /**< The protocol-specific configuration of the peer */
};
@@ -109,14 +108,6 @@ struct fastd_peer_group {
fastd_peer_group_t *parent;
fastd_peer_group_t *children;
- const fastd_peer_group_config_t *conf;
-};
-
-struct fastd_peer_group_config {
- fastd_peer_group_config_t *next;
- fastd_peer_group_config_t *parent;
- fastd_peer_group_config_t *children;
-
char *name;
fastd_string_stack_t *peer_dirs;
@@ -243,6 +234,13 @@ static inline bool fastd_peer_is_established(const fastd_peer_t *peer) {
}
}
+static inline const fastd_peer_group_t * fastd_peer_get_group(const fastd_peer_t *peer) {
+ if (peer->config)
+ return peer->config->group;
+ else
+ return conf.peer_group;
+}
+
static inline bool fastd_remote_is_dynamic(const fastd_remote_t *remote) {
return remote->config->hostname;
}