Lines Matching refs:msg

205 int nl_sendmsg(struct nl_sock *sk, struct nl_msg *msg, struct msghdr *hdr)  in nl_sendmsg()  argument
210 nlmsg_set_src(msg, &sk->s_local); in nl_sendmsg()
214 if (nl_cb_call(cb, NL_CB_MSG_OUT, msg) != NL_OK) in nl_sendmsg()
235 int nl_send_iovec(struct nl_sock *sk, struct nl_msg *msg, struct iovec *iov, unsigned iovlen) in nl_send_iovec() argument
249 dst = nlmsg_get_dst(msg); in nl_send_iovec()
254 creds = nlmsg_get_creds(msg); in nl_send_iovec()
269 return nl_sendmsg(sk, msg, &hdr); in nl_send_iovec()
281 int nl_send(struct nl_sock *sk, struct nl_msg *msg) in nl_send() argument
284 .iov_base = (void *) nlmsg_hdr(msg), in nl_send()
285 .iov_len = nlmsg_hdr(msg)->nlmsg_len, in nl_send()
288 return nl_send_iovec(sk, msg, &iov, 1); in nl_send()
291 void nl_auto_complete(struct nl_sock *sk, struct nl_msg *msg) in nl_auto_complete() argument
295 nlh = nlmsg_hdr(msg); in nl_auto_complete()
302 if (msg->nm_protocol == -1) in nl_auto_complete()
303 msg->nm_protocol = sk->s_proto; in nl_auto_complete()
323 int nl_send_auto_complete(struct nl_sock *sk, struct nl_msg *msg) in nl_send_auto_complete() argument
327 nl_auto_complete(sk, msg); in nl_send_auto_complete()
330 return cb->cb_send_ow(sk, msg); in nl_send_auto_complete()
332 return nl_send(sk, msg); in nl_send_auto_complete()
353 struct nl_msg *msg; in nl_send_simple() local
355 msg = nlmsg_alloc_simple(type, flags); in nl_send_simple()
356 if (!msg) in nl_send_simple()
360 err = nlmsg_append(msg, buf, size, NLMSG_ALIGNTO); in nl_send_simple()
366 err = nl_send_auto_complete(sk, msg); in nl_send_simple()
368 nlmsg_free(msg); in nl_send_simple()
406 struct msghdr msg = { in nl_recv() local
427 msg.msg_controllen = CMSG_SPACE(sizeof(struct ucred)); in nl_recv()
428 msg.msg_control = calloc(1, msg.msg_controllen); in nl_recv()
432 n = recvmsg(sk->s_fd, &msg, flags); in nl_recv()
443 free(msg.msg_control); in nl_recv()
450 msg.msg_flags & MSG_TRUNC) { in nl_recv()
456 } else if (msg.msg_flags & MSG_CTRUNC) { in nl_recv()
457 msg.msg_controllen *= 2; in nl_recv()
458 msg.msg_control = realloc(msg.msg_control, msg.msg_controllen); in nl_recv()
466 if (msg.msg_namelen != sizeof(struct sockaddr_nl)) { in nl_recv()
467 free(msg.msg_control); in nl_recv()
472 for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) { in nl_recv()
481 free(msg.msg_control); in nl_recv()
485 free(msg.msg_control); in nl_recv()
490 #define NL_CB_CALL(cb, type, msg) \ argument
492 err = nl_cb_call(cb, type, msg); \
512 struct nl_msg *msg = NULL; in recvmsgs() local
531 nlmsg_free(msg); in recvmsgs()
532 msg = nlmsg_convert(hdr); in recvmsgs()
533 if (!msg) { in recvmsgs()
538 nlmsg_set_proto(msg, sk->s_proto); in recvmsgs()
539 nlmsg_set_src(msg, &nla); in recvmsgs()
541 nlmsg_set_creds(msg, creds); in recvmsgs()
546 NL_CB_CALL(cb, NL_CB_MSG_IN, msg); in recvmsgs()
552 NL_CB_CALL(cb, NL_CB_SEQ_CHECK, msg); in recvmsgs()
555 NL_CB_CALL(cb, NL_CB_INVALID, msg); in recvmsgs()
580 NL_CB_CALL(cb, NL_CB_SEND_ACK, msg); in recvmsgs()
593 NL_CB_CALL(cb, NL_CB_FINISH, msg); in recvmsgs()
602 NL_CB_CALL(cb, NL_CB_SKIPPED, msg); in recvmsgs()
612 NL_CB_CALL(cb, NL_CB_OVERRUN, msg); in recvmsgs()
629 NL_CB_CALL(cb, NL_CB_INVALID, msg); in recvmsgs()
652 NL_CB_CALL(cb, NL_CB_ACK, msg); in recvmsgs()
658 NL_CB_CALL(cb, NL_CB_VALID, msg); in recvmsgs()
665 nlmsg_free(msg); in recvmsgs()
669 msg = NULL; in recvmsgs()
679 nlmsg_free(msg); in recvmsgs()
721 static int ack_wait_handler(struct nl_msg *msg, void *arg) in ack_wait_handler() argument