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

int nl_sendmsg ( struct nl_sock *  sk,
struct nl_msg *  msg,
struct msghdr *  hdr 

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

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

Definition at line 205 of file nl.c.

References NL_CB_MSG_OUT, NL_OK, 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, &sk->s_local);

      cb = sk->s_cb;
      if (cb->cb_set[NL_CB_MSG_OUT])
            if (nl_cb_call(cb, NL_CB_MSG_OUT, msg) != NL_OK)
                  return 0;

      ret = sendmsg(sk->s_fd, hdr, 0);
      if (ret < 0)
            return -nl_syserr2nlerr(errno);

      return ret;

Generated by  Doxygen 1.6.0   Back to index