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

struct nl_msg* nlmsg_build ( struct nlmsghdr hdr  )  [read]

Build a new netlink message

  • hdr Netlink message header template
Builds a new netlink message with a tailroom for the netlink message header. If hdr is not NULL it will be used as a template for the netlink message header, otherwise the header is left blank.

Returns:
Newly allocated netlink message or NULL

Definition at line 373 of file msg.c.

Referenced by nl_send_simple(), and rtnl_neightbl_build_change_request().

{
      struct nl_msg *nm;

      nm = nlmsg_new();
      if (nm && hdr) {
            int size = nm->nm_nlh->nlmsg_len;
            memcpy(nm->nm_nlh, hdr, sizeof(*hdr));
            nm->nm_nlh->nlmsg_len = size;
      }

      return nm;
}


Generated by  Doxygen 1.6.0   Back to index