diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2015-12-21 03:27:41 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2015-12-21 03:33:18 +0100 |
commit | 23c212e7f1e80a3c6b88b49918972bc28375bd51 (patch) | |
tree | e2e162e5f3454ba1213435acf5980bbc4e4ed5d3 /lib/socket.h | |
parent | e92a4b855f668e8ac685ad79c288ff182ebd110b (diff) |
Follow-up work on integration
Diffstat (limited to 'lib/socket.h')
-rw-r--r-- | lib/socket.h | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/socket.h b/lib/socket.h index fbea92aa..b067eb54 100644 --- a/lib/socket.h +++ b/lib/socket.h @@ -67,18 +67,14 @@ void sk_set_tbsize(sock *s, uint val); /* Resize TX buffer, keeping content */ void sk_set_tbuf(sock *s, void *tbuf); /* Switch TX buffer, NULL-> return to internal */ void sk_dump_all(void); -static inline int sk_send_buffer_empty(sock *sk) -{ return sk->tbuf == sk->tpos; } - +static inline int sk_is_ipv4(sock *s) +{ return s->af == AF_INET; } -#ifdef IPV6 -#define sk_is_ipv4(X) 0 -#define sk_is_ipv6(X) 1 -#else -#define sk_is_ipv4(X) 1 -#define sk_is_ipv6(X) 0 -#endif +static inline int sk_is_ipv6(sock *s) +{ return s->af == AF_INET6; } +static inline int sk_send_buffer_empty(sock *sk) +{ return sk->tbuf == sk->tpos; } int sk_setup_multicast(sock *s); /* Prepare UDP or IP socket for multicasting */ int sk_join_group(sock *s, ip_addr maddr); /* Join multicast group on sk iface */ |