Logo Search packages:      
Sourcecode: libnl2 version File versions  Download package

void* genlmsg_put ( struct nl_msg *  msg,
uint32_t  pid,
uint32_t  seq,
int  family,
int  hdrlen,
int  flags,
uint8_t  cmd,
uint8_t  version 
)

Add generic netlink header to netlink message

  • msg netlink message
  • pid netlink process id or NL_AUTO_PID
  • seq sequence number of message or NL_AUTO_SEQ
  • family generic netlink family
  • hdrlen length of user specific header
  • flags message flags
  • cmd generic netlink command
  • version protocol version
Returns pointer to user specific header.

Definition at line 246 of file genl.c.

References nlmsg_data(), and nlmsg_put().

{
      struct nlmsghdr *nlh;
      struct genlmsghdr hdr = {
            .cmd = cmd,
            .version = version,
      };

      nlh = nlmsg_put(msg, pid, seq, family, GENL_HDRLEN + hdrlen, flags);
      if (nlh == NULL)
            return NULL;

      memcpy(nlmsg_data(nlh), &hdr, sizeof(hdr));
      NL_DBG(2, "msg %p: Added generic netlink header cmd=%d version=%d\n",
             msg, cmd, version);

      return nlmsg_data(nlh) + GENL_HDRLEN;
}


Generated by  Doxygen 1.6.0   Back to index