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

int nl_sendmsg ( struct nl_handle *  handle,
struct nl_msg *  msg,
struct msghdr *  hdr 

Send netlink message with control over sendmsg() message header.

  • handle Netlink handle.
  • msg Netlink message to be sent.
  • hdr Sendmsg() message header.
    Number of characters sent on sucess or a negative error code.

Definition at line 457 of file nl.c.

References NL_CB_MSG_OUT, nl_handle_get_cb(), NL_PROCEED, nlmsg_hdr(), and nlmsghdr::nlmsg_len.

Referenced by nl_send().

      struct nl_cb *cb;
      int ret;

      struct iovec iov = {
            .iov_base = (void *) nlmsg_hdr(msg),
            .iov_len = nlmsg_hdr(msg)->nlmsg_len,

      hdr->msg_iov = &iov;
      hdr->msg_iovlen = 1;

      nlmsg_set_src(msg, &handle->h_local);

      cb = nl_handle_get_cb(handle);
      if (cb->cb_set[NL_CB_MSG_OUT])
            if (nl_cb_call(cb, NL_CB_MSG_OUT, msg) != NL_PROCEED)
                  return 0;

      ret = sendmsg(handle->h_fd, hdr, 0);
      if (ret < 0)
            return nl_errno(errno);

      return ret;

Generated by  Doxygen 1.6.0   Back to index