diff options
author | Martin Willi <martin@revosec.ch> | 2013-03-18 10:09:35 +0100 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2013-03-18 10:09:35 +0100 |
commit | cb14ecb1d3345ae183a364ca903cf2b28ce48a23 (patch) | |
tree | 2e1a7740eaa767245c398cb3ada40107ad9767c4 /src/libhydra/plugins/kernel_netlink/kernel_netlink_shared.h | |
parent | 3a23794fa2387934c98b3bfe17f1aaf129339a07 (diff) | |
parent | 94163816fad436423b6e6f0764ae582f0b8be9c1 (diff) | |
download | strongswan-cb14ecb1d3345ae183a364ca903cf2b28ce48a23.tar.bz2 strongswan-cb14ecb1d3345ae183a364ca903cf2b28ce48a23.tar.xz |
Merge branch 'netlink-align'
Fixes some Netlink alignment issues, and then refactors Netlink XFRM message
attribute handling.
Diffstat (limited to 'src/libhydra/plugins/kernel_netlink/kernel_netlink_shared.h')
-rw-r--r-- | src/libhydra/plugins/kernel_netlink/kernel_netlink_shared.h | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/libhydra/plugins/kernel_netlink/kernel_netlink_shared.h b/src/libhydra/plugins/kernel_netlink/kernel_netlink_shared.h index dfd27a21a..8be935bc3 100644 --- a/src/libhydra/plugins/kernel_netlink/kernel_netlink_shared.h +++ b/src/libhydra/plugins/kernel_netlink/kernel_netlink_shared.h @@ -42,7 +42,8 @@ struct netlink_socket_t { * @param out received netlink message * @param out_len length of the received message */ - status_t (*send)(netlink_socket_t *this, struct nlmsghdr *in, struct nlmsghdr **out, size_t *out_len); + status_t (*send)(netlink_socket_t *this, struct nlmsghdr *in, + struct nlmsghdr **out, size_t *out_len); /** * Send a netlink message and wait for its acknowledge. @@ -67,11 +68,23 @@ netlink_socket_t *netlink_socket_create(int protocol); /** * Creates an rtattr and adds it to the given netlink message. * - * @param hdr netlink message - * @param rta_type type of the rtattr - * @param data data to add to the rtattr - * @param buflen length of the netlink message buffer + * @param hdr netlink message + * @param rta_type type of the rtattr + * @param data data to add to the rtattr + * @param buflen length of the netlink message buffer */ -void netlink_add_attribute(struct nlmsghdr *hdr, int rta_type, chunk_t data, size_t buflen); +void netlink_add_attribute(struct nlmsghdr *hdr, int rta_type, chunk_t data, + size_t buflen); + +/** + * Reserve space in a netlink message for given size and type, returning buffer. + * + * @param hdr netlink message + * @param buflen size of full netlink buffer + * @param type RTA type + * @param len length of RTA data + * @return buffer to len bytes of attribute data, NULL on error + */ +void* netlink_reserve(struct nlmsghdr *hdr, int buflen, int type, int len); #endif /* KERNEL_NETLINK_SHARED_H_ */ |