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

int nl_send_simple ( struct nl_sock *  sk,
int  type,
int  flags,
void *  buf,
size_t  size 
)

Send simple netlink message using nl_send_auto_complete()

  • sk Netlink socket.
  • 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 328 of file nl.c.

References nl_send_auto_complete(), nlmsg_alloc_simple(), nlmsg_append(), and nlmsg_free().

Referenced by genl_send_simple(), nfnl_send_simple(), and nl_rtgen_request().

{
      int err;
      struct nl_msg *msg;

      msg = nlmsg_alloc_simple(type, flags);
      if (!msg)
            return -NLE_NOMEM;

      if (buf && size) {
            err = nlmsg_append(msg, buf, size, NLMSG_ALIGNTO);
            if (err < 0)
                  goto errout;
      }
      

      err = nl_send_auto_complete(sk, msg);
errout:
      nlmsg_free(msg);

      return err;
}


Generated by  Doxygen 1.6.0   Back to index