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

int nl_send_simple ( struct nl_handle *  handle,
int  type,
int  flags,
void *  buf,
size_t  size 
)

Send simple netlink message using nl_send_auto_complete()

  • handle Netlink handle.
  • type Netlink message type.
  • flags Netlink message flags.
  • buf Data buffer.
  • size Size of data buffer.
Builds a netlink message with the specified type and flags and appends the specified data as payload to the message.

See also:
nl_send_auto_complete()
Returns:
Number of characters sent on success or a negative error code.

Definition at line 556 of file nl.c.

References nl_send_auto_complete(), nlmsg_append(), nlmsg_build(), nlmsg_free(), nlmsghdr::nlmsg_len, and nlmsg_msg_size().

Referenced by nl_rtgen_request().

{
      int err;
      struct nl_msg *msg;
      struct nlmsghdr nlh = {
            .nlmsg_len = nlmsg_msg_size(0),
            .nlmsg_type = type,
            .nlmsg_flags = flags,
      };

      msg = nlmsg_build(&nlh);
      if (!msg)
            return nl_errno(ENOMEM);

      if (buf && size)
            nlmsg_append(msg, buf, size, 1);

      err = nl_send_auto_complete(handle, msg);
      nlmsg_free(msg);

      return err;
}


Generated by  Doxygen 1.6.0   Back to index