libmnl  1.0.4
Modules | Functions | Variables
Netlink message helpers
Collaboration diagram for Netlink message helpers:

Modules

 Netlink message batch helpers
 

Functions

size_t mnl_nlmsg_size (size_t len)
 
size_t mnl_nlmsg_get_payload_len (const struct nlmsghdr *nlh)
 
struct nlmsghdr * mnl_nlmsg_put_header (void *buf)
 
void * mnl_nlmsg_put_extra_header (struct nlmsghdr *nlh, size_t size)
 
void * mnl_nlmsg_get_payload (const struct nlmsghdr *nlh)
 
void * mnl_nlmsg_get_payload_offset (const struct nlmsghdr *nlh, size_t offset)
 
bool mnl_nlmsg_ok (const struct nlmsghdr *nlh, int len)
 
struct nlmsghdr * mnl_nlmsg_next (const struct nlmsghdr *nlh, int *len)
 
void * mnl_nlmsg_get_payload_tail (const struct nlmsghdr *nlh)
 
bool mnl_nlmsg_seq_ok (const struct nlmsghdr *nlh, unsigned int seq)
 
bool mnl_nlmsg_portid_ok (const struct nlmsghdr *nlh, unsigned int portid)
 
void mnl_nlmsg_fprintf (FILE *fd, const void *data, size_t datalen, size_t extra_header_size)
 

Variables

void * mnl_nlmsg_batch::buf
 
size_t mnl_nlmsg_batch::limit
 
size_t mnl_nlmsg_batch::buflen
 
void * mnl_nlmsg_batch::cur
 
bool mnl_nlmsg_batch::overflow
 

Detailed Description

Netlink message:

        |<----------------- 4 bytes ------------------->|
        |<----- 2 bytes ------>|<------- 2 bytes ------>|
        |-----------------------------------------------|
        |      Message length (including header)        |
        |-----------------------------------------------|
        |     Message type     |     Message flags      |
        |-----------------------------------------------|
        |           Message sequence number             |
        |-----------------------------------------------|
        |                 Netlink PortID                |
        |-----------------------------------------------|
        |                                               |
        .                   Payload                     .
        |_______________________________________________|

There is usually an extra header after the the Netlink header (at the beginning of the payload). This extra header is specific of the Netlink subsystem. After this extra header, it comes the sequence of attributes that are expressed in Type-Length-Value (TLV) format.