summaryrefslogtreecommitdiff
path: root/socket-util.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-01-23 03:35:54 +0100
committerLennart Poettering <lennart@poettering.net>2010-01-23 03:35:54 +0100
commit542563babda739f7aee468c3eaaab6315ffa4224 (patch)
tree76a11b38d8e6bbb2908fd1d8ba86bd34f6c1f2fd /socket-util.h
parent5cb5a6ffc33667c93e9bc3572534dcaa684046e3 (diff)
rework socket handling
Diffstat (limited to 'socket-util.h')
-rw-r--r--socket-util.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/socket-util.h b/socket-util.h
index 711f7740a8..bea3a8931b 100644
--- a/socket-util.h
+++ b/socket-util.h
@@ -10,7 +10,7 @@
#include "macro.h"
#include "util.h"
-typedef struct Address {
+typedef struct SocketAddress {
union {
struct sockaddr sa;
struct sockaddr_in in4;
@@ -25,16 +25,19 @@ typedef struct Address {
/* Socket type, i.e. SOCK_STREAM, SOCK_DGRAM, ... */
int type;
+} SocketAddress;
- /* Only for INET6 sockets: issue IPV6_V6ONLY sockopt */
- bool bind_ipv6_only;
-} Address;
+typedef enum SocketAddressBindIPv6Only {
+ SOCKET_ADDRESS_DEFAULT,
+ SOCKET_ADDRESS_BOTH,
+ SOCKET_ADDRESS_IPV6_ONLY
+} SocketAddressBindIPv6Only;
-#define address_family(a) ((a)->sockaddr.sa.sa_family)
+#define socket_address_family(a) ((a)->sockaddr.sa.sa_family)
-int address_parse(Address *a, const char *s);
-int address_print(const Address *a, char **p);
-int address_verify(const Address *a);
-int address_listen(const Address *a, int backlog);
+int socket_address_parse(SocketAddress *a, const char *s);
+int socket_address_print(const SocketAddress *a, char **p);
+int socket_address_verify(const SocketAddress *a);
+int socket_address_listen(const SocketAddress *a, int backlog, SocketAddressBindIPv6Only only);
#endif