diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-11-01 15:11:40 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-11-01 15:11:40 +0100 |
commit | cb98cbc593309d4781dfb873b018a5d4e12ad118 (patch) | |
tree | c5c0760dbd36cabec9d421f678b5ebd4d59ed25e /src/peer.h | |
parent | 86df5dbefec807234e9a458da00acbbd2e0e6649 (diff) | |
download | fastd-cb98cbc593309d4781dfb873b018a5d4e12ad118.tar fastd-cb98cbc593309d4781dfb873b018a5d4e12ad118.zip |
Dynamically create and destroy sockets without fixed binds
Diffstat (limited to 'src/peer.h')
-rw-r--r-- | src/peer.h | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -35,7 +35,7 @@ struct _fastd_peer { const fastd_peer_config *config; - const fastd_socket *sock; + fastd_socket *sock; fastd_peer_address address; bool established; @@ -88,7 +88,8 @@ void fastd_peer_reset(fastd_context *ctx, fastd_peer *peer); void fastd_peer_delete(fastd_context *ctx, fastd_peer *peer); fastd_peer* fastd_peer_add(fastd_context *ctx, fastd_peer_config *conf); void fastd_peer_set_established(fastd_context *ctx, fastd_peer *peer); -bool fastd_peer_claim_address(fastd_context *ctx, fastd_peer *peer, const fastd_socket *sock, const fastd_peer_address *addr); +bool fastd_peer_claim_address(fastd_context *ctx, fastd_peer *peer, fastd_socket *sock, const fastd_peer_address *addr); +void fastd_peer_reset_socket(fastd_context *ctx, fastd_peer *peer); const fastd_eth_addr* fastd_get_source_address(const fastd_context *ctx, fastd_buffer buffer); const fastd_eth_addr* fastd_get_dest_address(const fastd_context *ctx, fastd_buffer buffer); @@ -119,6 +120,10 @@ static inline void fastd_peer_seen(fastd_context *ctx, fastd_peer *peer) { peer->seen = ctx->now; } +static inline bool fastd_peer_is_socket_dynamic(const fastd_peer *peer) { + return (!peer->sock || !peer->sock->addr); +} + static inline bool fastd_eth_addr_is_unicast(const fastd_eth_addr *addr) { return ((addr->data[0] & 1) == 0); } |