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

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

Convert a netlink message received from a netlink socket to a nl_msg

  • hdr Netlink message received from netlink socket.
Allocates a new netlink message and copies all of the data pointed to by hdr into the new message object.

Returns:
Newly allocated netlink message or NULL.

Definition at line 484 of file msg.c.

References nlmsg_free(), and nlmsghdr::nlmsg_len.

{
      struct nl_msg *nm;

      nm = __nlmsg_alloc(NLMSG_ALIGN(hdr->nlmsg_len));
      if (!nm)
            goto errout;

      memcpy(nm->nm_nlh, hdr, hdr->nlmsg_len);

      return nm;
errout:
      nlmsg_free(nm);
      return NULL;
}


Generated by  Doxygen 1.6.0   Back to index