chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
password-agent: actually really don't access unallocated memory
[elogind.git]
/
src
/
socket-util.h
diff --git
a/src/socket-util.h
b/src/socket-util.h
index 993972c458380bdff080980f9be2c7bf18fea509..8ccbd371cfe8021ba932cf331ff8c395ac89ab9b 100644
(file)
--- a/
src/socket-util.h
+++ b/
src/socket-util.h
@@
-1,4
+1,4
@@
-/*-*- Mode: C; c-basic-offset: 8 -*-*/
+/*-*- Mode: C; c-basic-offset: 8
; indent-tabs-mode: nil
-*-*/
#ifndef foosocketutilhfoo
#define foosocketutilhfoo
#ifndef foosocketutilhfoo
#define foosocketutilhfoo
@@
-26,18
+26,23
@@
#include <netinet/in.h>
#include <sys/un.h>
#include <net/if.h>
#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"
#include "macro.h"
#include "util.h"
+union sockaddr_union {
+ struct sockaddr sa;
+ struct sockaddr_in in4;
+ struct sockaddr_in6 in6;
+ struct sockaddr_un un;
+ struct sockaddr_nl nl;
+ struct sockaddr_storage storage;
+};
+
typedef struct SocketAddress {
typedef struct SocketAddress {
- union {
- struct sockaddr sa;
- struct sockaddr_in in4;
- struct sockaddr_in6 in6;
- struct sockaddr_un un;
- struct sockaddr_storage storage;
- } sockaddr;
+ union sockaddr_union sockaddr;
/* We store the size here explicitly due to the weird
* sockaddr_un semantics for abstract sockets */
/* We store the size here explicitly due to the weird
* sockaddr_un semantics for abstract sockets */
@@
-45,6
+50,9
@@
typedef struct SocketAddress {
/* Socket type, i.e. SOCK_STREAM, SOCK_DGRAM, ... */
int type;
/* 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 {
} SocketAddress;
typedef enum SocketAddressBindIPv6Only {
@@
-58,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);
#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);
int socket_address_print(const SocketAddress *a, char **p);
int socket_address_verify(const SocketAddress *a);
@@
-68,11
+77,15
@@
int socket_address_listen(
int backlog,
SocketAddressBindIPv6Only only,
const char *bind_to_device,
int backlog,
SocketAddressBindIPv6Only only,
const char *bind_to_device,
+ bool free_bind,
+ bool transparent,
mode_t directory_mode,
mode_t socket_mode,
mode_t directory_mode,
mode_t socket_mode,
+ const char *label,
int *ret);
int *ret);
-bool socket_address_is(const SocketAddress *a, const char *s);
+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);
bool socket_address_equal(const SocketAddress *a, const SocketAddress *b);
@@
-81,4
+94,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* 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
#endif