summaryrefslogtreecommitdiff
path: root/src/socket-util.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-04-10 03:27:00 +0200
committerLennart Poettering <lennart@poettering.net>2011-04-10 03:27:00 +0200
commit7a22745ac3c267edf89a23a920a28d86df5d0f9a (patch)
tree111d4115e6c740bc6df2f5dbcca00415c18a8432 /src/socket-util.h
parentb9a2a36b519ccd79c4198e7dda4e657d597a14ad (diff)
socket: support netlink sockets
Diffstat (limited to 'src/socket-util.h')
-rw-r--r--src/socket-util.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/socket-util.h b/src/socket-util.h
index 4743c37686..0e891ec2b2 100644
--- a/src/socket-util.h
+++ b/src/socket-util.h
@@ -26,6 +26,8 @@
#include <netinet/in.h>
#include <sys/un.h>
#include <net/if.h>
+#include <asm/types.h>
+#include <linux/netlink.h>
#include "macro.h"
#include "util.h"
@@ -35,6 +37,7 @@ union sockaddr_union {
struct sockaddr_in in4;
struct sockaddr_in6 in6;
struct sockaddr_un un;
+ struct sockaddr_nl nl;
struct sockaddr_storage storage;
};
@@ -47,6 +50,9 @@ typedef struct SocketAddress {
/* Socket type, i.e. SOCK_STREAM, SOCK_DGRAM, ... */
int type;
+
+ /* Socket protocol, IPPROTO_xxx, usually 0, except for netlink */
+ int protocol;
} SocketAddress;
typedef enum SocketAddressBindIPv6Only {
@@ -60,6 +66,7 @@ typedef enum SocketAddressBindIPv6Only {
#define socket_address_family(a) ((a)->sockaddr.sa.sa_family)
int socket_address_parse(SocketAddress *a, const char *s);
+int socket_address_parse_netlink(SocketAddress *a, const char *s);
int socket_address_print(const SocketAddress *a, char **p);
int socket_address_verify(const SocketAddress *a);
@@ -77,6 +84,7 @@ int socket_address_listen(
int *ret);
bool socket_address_is(const SocketAddress *a, const char *s, int type);
+bool socket_address_is_netlink(const SocketAddress *a, const char *s);
bool socket_address_equal(const SocketAddress *a, const SocketAddress *b);
@@ -85,6 +93,9 @@ bool socket_address_needs_mount(const SocketAddress *a, const char *prefix);
const char* socket_address_bind_ipv6_only_to_string(SocketAddressBindIPv6Only b);
SocketAddressBindIPv6Only socket_address_bind_ipv6_only_from_string(const char *s);
+const char* netlink_family_to_string(int b);
+int netlink_family_from_string(const char *s);
+
bool socket_ipv6_is_supported(void);
#endif