Lines Matching refs:msg
94 struct ng_mesg msg; in NgSendMsg() local
97 memset(&msg, 0, sizeof(msg)); in NgSendMsg()
98 msg.header.version = NG_VERSION; in NgSendMsg()
99 msg.header.typecookie = cookie; in NgSendMsg()
100 msg.header.token = atomic_fetch_add(&gMsgId, 1) & INT_MAX; in NgSendMsg()
101 msg.header.flags = NGF_ORIG; in NgSendMsg()
102 msg.header.cmd = cmd; in NgSendMsg()
103 snprintf((char *)msg.header.cmdstr, NG_CMDSTRSIZ, "cmd%d", cmd); in NgSendMsg()
106 if (NgDeliverMsg(cs, path, &msg, args, arglen) < 0) in NgSendMsg()
108 return (msg.header.token); in NgSendMsg()
187 const struct ng_mesg *msg, const void *args, size_t arglen) in NgSendReplyMsg() argument
192 rep = *msg; in NgSendReplyMsg()
210 struct ng_mesg *msg; in NgDeliverMsg() local
219 if ((buf = malloc(sizeof(*msg) + arglen)) == NULL) { in NgDeliverMsg()
226 msg = (struct ng_mesg *) buf; in NgDeliverMsg()
229 *msg = *hdr; in NgDeliverMsg()
230 msg->header.arglen = arglen; in NgDeliverMsg()
231 memcpy(msg->data, args, arglen); in NgDeliverMsg()
242 (msg->header.flags & NGF_RESP) ? "RESPONSE" : "MESSAGE"); in NgDeliverMsg()
244 _NgDebugMsg(msg, sg->sg_data); in NgDeliverMsg()
248 if (sendto(cs, msg, sizeof(*msg) + arglen, in NgDeliverMsg()
259 if (msg->header.cmd & NGM_HASREPLY && !(msg->header.flags & NGF_RESP)) { in NgDeliverMsg()
353 struct ng_mesg *msg, *ascii; in NgRecvAsciiMsg() local
361 msg = (struct ng_mesg *)buf; in NgRecvAsciiMsg()
362 ascii = (struct ng_mesg *)msg->data; in NgRecvAsciiMsg()
365 if (NgRecvMsg(cs, msg, bufSize, path) < 0) in NgRecvAsciiMsg()
367 memcpy(reply, msg, sizeof(*msg)); in NgRecvAsciiMsg()
371 NGM_BINARY2ASCII, msg, sizeof(*msg) + msg->header.arglen) < 0) in NgRecvAsciiMsg()
373 if (NgRecvMsg(cs, msg, bufSize, NULL) < 0) in NgRecvAsciiMsg()