/usr/include/libnl3/netlink/msg.h is in libnl-3-dev 3.2.29-0ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | /*
* netlink/msg.c Netlink Messages Interface
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_MSG_H_
#define NETLINK_MSG_H_
#include <netlink/netlink.h>
#include <netlink/object.h>
#include <netlink/attr.h>
#ifdef __cplusplus
extern "C" {
#endif
#define NL_DONTPAD 0
/**
* @ingroup msg
* @brief
* Will cause the netlink port to be set to the port assigned to
* the netlink icoket ust before sending the message off.
*
* @note Requires the use of nl_send_auto()!
*/
#define NL_AUTO_PORT 0
#define NL_AUTO_PID NL_AUTO_PORT
/**
* @ingroup msg
* @brief
* May be used to refer to a sequence number which should be
* automatically set just before sending the message off.
*
* @note Requires the use of nl_send_auto()!
*/
#define NL_AUTO_SEQ 0
struct nl_msg;
struct nl_tree;
struct ucred;
extern int nlmsg_size(int);
extern int nlmsg_total_size(int);
extern int nlmsg_padlen(int);
extern void * nlmsg_data(const struct nlmsghdr *);
extern int nlmsg_datalen(const struct nlmsghdr *);
extern void * nlmsg_tail(const struct nlmsghdr *);
/* attribute access */
extern struct nlattr * nlmsg_attrdata(const struct nlmsghdr *, int);
extern int nlmsg_attrlen(const struct nlmsghdr *, int);
/* message parsing */
extern int nlmsg_valid_hdr(const struct nlmsghdr *, int);
extern int nlmsg_ok(const struct nlmsghdr *, int);
extern struct nlmsghdr * nlmsg_next(struct nlmsghdr *, int *);
extern int nlmsg_parse(struct nlmsghdr *, int, struct nlattr **,
int, struct nla_policy *);
extern struct nlattr * nlmsg_find_attr(struct nlmsghdr *, int, int);
extern int nlmsg_validate(struct nlmsghdr *, int, int,
struct nla_policy *);
extern struct nl_msg * nlmsg_alloc(void);
extern struct nl_msg * nlmsg_alloc_size(size_t);
extern struct nl_msg * nlmsg_alloc_simple(int, int);
extern void nlmsg_set_default_size(size_t);
extern struct nl_msg * nlmsg_inherit(struct nlmsghdr *);
extern struct nl_msg * nlmsg_convert(struct nlmsghdr *);
extern void * nlmsg_reserve(struct nl_msg *, size_t, int);
extern int nlmsg_append(struct nl_msg *, void *, size_t, int);
extern int nlmsg_expand(struct nl_msg *, size_t);
extern struct nlmsghdr * nlmsg_put(struct nl_msg *, uint32_t, uint32_t,
int, int, int);
extern struct nlmsghdr * nlmsg_hdr(struct nl_msg *);
extern void nlmsg_get(struct nl_msg *);
extern void nlmsg_free(struct nl_msg *);
/* attribute modification */
extern void nlmsg_set_proto(struct nl_msg *, int);
extern int nlmsg_get_proto(struct nl_msg *);
extern size_t nlmsg_get_max_size(struct nl_msg *);
extern void nlmsg_set_src(struct nl_msg *, struct sockaddr_nl *);
extern struct sockaddr_nl *nlmsg_get_src(struct nl_msg *);
extern void nlmsg_set_dst(struct nl_msg *, struct sockaddr_nl *);
extern struct sockaddr_nl *nlmsg_get_dst(struct nl_msg *);
extern void nlmsg_set_creds(struct nl_msg *, struct ucred *);
extern struct ucred * nlmsg_get_creds(struct nl_msg *);
extern char * nl_nlmsgtype2str(int, char *, size_t);
extern int nl_str2nlmsgtype(const char *);
extern char * nl_nlmsg_flags2str(int, char *, size_t);
extern int nl_msg_parse(struct nl_msg *,
void (*cb)(struct nl_object *, void *),
void *);
extern void nl_msg_dump(struct nl_msg *, FILE *);
/**
* @name Iterators
* @{
*/
/**
* @ingroup msg
* Iterate over a stream of attributes in a message
* @arg pos loop counter, set to current attribute
* @arg nlh netlink message header
* @arg hdrlen length of family header
* @arg rem initialized to len, holds bytes currently remaining in stream
*/
#define nlmsg_for_each_attr(pos, nlh, hdrlen, rem) \
nla_for_each_attr(pos, nlmsg_attrdata(nlh, hdrlen), \
nlmsg_attrlen(nlh, hdrlen), rem)
/**
* Iterate over a stream of messages
* @arg pos loop counter, set to current message
* @arg head head of message stream
* @arg len length of message stream
*/
#define nlmsg_for_each(pos, head, len) \
for (int rem = len, pos = head; \
nlmsg_ok(pos, rem); \
pos = nlmsg_next(pos, &rem))
#define nlmsg_for_each_msg(pos, head, len, rem) \
nlmsg_for_each(pos, head, len)
/** @} */
#ifdef __cplusplus
}
#endif
#endif
|