]> git.ipfire.org Git - people/ms/systemd.git/blame - socket-util.h
first attempt in implementinging execution logic
[people/ms/systemd.git] / socket-util.h
CommitLineData
42f4e3c4
LP
1/*-*- Mode: C; c-basic-offset: 8 -*-*/
2
3#ifndef foosocketutilhfoo
4#define foosocketutilhfoo
5
6#include <sys/socket.h>
7#include <netinet/in.h>
8#include <sys/un.h>
9
10#include "macro.h"
11#include "util.h"
12
13typedef struct Address {
14 union {
15 struct sockaddr sa;
16 struct sockaddr_in in4;
17 struct sockaddr_in6 in6;
18 struct sockaddr_un un;
19 struct sockaddr_storage storage;
20 } sockaddr;
21
22 /* We store the size here explicitly due to the weird
23 * sockaddr_un semantics for abstract sockets */
24 socklen_t size;
25
26 /* Socket type, i.e. SOCK_STREAM, SOCK_DGRAM, ... */
27 int type;
28
29 /* Only for INET6 sockets: issue IPV6_V6ONLY sockopt */
30 bool bind_ipv6_only;
31} Address;
32
33#define address_family(a) ((a)->sockaddr.sa.sa_family)
34
35int address_parse(Address *a, const char *s);
36int address_print(const Address *a, char **p);
37int address_verify(const Address *a);
38int address_listen(const Address *a, int backlog);
39
40#endif