struct nlmsghdr
{
__u32 nlmsg_len; /* Length of message including header */
__u16 nlmsg_type; /* Message content */
__u16 nlmsg_flags;/* Additional flags */
__u32 nlmsg_seq; /* Sequence number */
__u32 nlmsg_pid; /* PID of the process that opened the socket */
};
struct nlmsgerr
{
int error; /* negative errno or 0 for acks. */
struct nlmsghdr msg; /* message header that caused the error */
};
After each nlmsghdr the payload follows. nlmsg_type can be one of the standard message types: NLMSG_NOOP message is to be ignored, NLMSG_ERROR the message signals an error and the payload contains a nlmsgerr structure, NLMSG_DONE message terminates a multipart message, A netlink family usually specifies more message types, see the appropriate man pages for that, e.g. rtnetlink(7) for NETLINK_ROUTE. Standard Flag bits in nlmsg_flags | NLM_F_REQUEST | set on all request messages | NLM_F_MULTI | the message is part of a multipart message terminated by NLMSG_DONE | NLM_F_ACK | reply with an acknowledgment on success | NLM_F_ECHO | echo this request | Additional flag bits for GET requests | NLM_F_ROOT | Return the complete table instead of a single entry. | NLM_F_MATCH | Not implemented yet. | NLM_F_ATOMIC | Return an atomic snapshot of the table. | NLM_F_DUMP | not documented yet. | Additional flag bits for NEW requests | NLM_F_REPLACE | Override existing object. | NLM_F_EXCL | Dont replace if the object already exists. | NLM_F_CREATE | Create object if it doesnt already exist. | NLM_F_APPEND | Add to the end of the object list. | Note that NLM_F_ATOMIC requires CAP_NET_ADMIN or super user rights. |