From: Andrew Elder Date: Sat, 27 Oct 2012 14:14:55 +0000 (-0400) Subject: mrpd: debug output changes X-Git-Tag: submit/tizen/20130820.101009~36^2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b280b7e173b8715f75192ba63ce2147f2fb2c3a3;p=profile%2Fivi%2FOpenAVB.git mrpd: debug output changes --- diff --git a/daemons/mrpd/mmrp.c b/daemons/mrpd/mmrp.c index 3a024dc..9a3d3d5 100644 --- a/daemons/mrpd/mmrp.c +++ b/daemons/mrpd/mmrp.c @@ -1363,13 +1363,13 @@ int mmrp_send_notifications(struct mmrp_attribute *attrib, int notify) switch (notify) { case MRP_NOTIFY_NEW: - snprintf(msgbuf, MAX_MRPD_CMDSZ - 1, "MNE %s", stage); + snprintf(msgbuf, MAX_MRPD_CMDSZ - 1, "MNE %s\n", stage); break; case MRP_NOTIFY_JOIN: - snprintf(msgbuf, MAX_MRPD_CMDSZ - 1, "MJO %s", stage); + snprintf(msgbuf, MAX_MRPD_CMDSZ - 1, "MJO %s\n", stage); break; case MRP_NOTIFY_LV: - snprintf(msgbuf, MAX_MRPD_CMDSZ - 1, "MLE %s", stage); + snprintf(msgbuf, MAX_MRPD_CMDSZ - 1, "MLE %s\n", stage); break; default: goto free_msgbuf; @@ -1422,7 +1422,7 @@ int mmrp_dumptable(struct sockaddr_in *client) attrib = MMRP_db->attrib_list; if (attrib == NULL) { - sprintf(msgbuf, "Empty"); + sprintf(msgbuf, "MMRP:Empty\n"); } while (NULL != attrib) { diff --git a/daemons/mrpd/mrpctl.c b/daemons/mrpd/mrpctl.c index e4b9f69..d690cb3 100644 --- a/daemons/mrpd/mrpctl.c +++ b/daemons/mrpd/mrpctl.c @@ -116,7 +116,10 @@ process_ctl_msg(char *buf, int buflen, struct sockaddr_in *client) { */ /* XXX */ - printf("RESP:%s from SRV %d (bytes=%d)\n", buf, client->sin_port, buflen); + if (buf[1] == ':') + printf("?? RESP:\n%s", buf); + else + printf("MRPD ---> %s", buf); fflush(stdout); return(0); } @@ -142,12 +145,11 @@ recv_ctl_msg() { msg.msg_namelen = sizeof(client_addr); msg.msg_iov = &iov; msg.msg_iovlen = 1; - printf("recv msg ... \n"); bytes = recvmsg(control_socket, &msg, 0); if (bytes < 0) goto out; return(process_ctl_msg(msgbuf, bytes, &client_addr) ); out: - printf("recv'd bad msg ... \n"); + //printf("recv'd bad msg ... \n"); free (msgbuf); return(-1); @@ -164,7 +166,7 @@ send_control_msg( char *notify_data, int notify_len) { inet_aton("127.0.0.1", &addr.sin_addr); addr_len = sizeof(addr); -printf("sending message\n"); + //printf("sending message\n"); if (control_socket != -1) return(sendto(control_socket, notify_data, notify_len, 0, (struct sockaddr *)&addr, addr_len)); @@ -204,6 +206,7 @@ main(int argc, char *argv[]) { int c; int rc = 0; char *msgbuf; + int status; for (;;) { c = getopt(argc, argv, "hdlmvsi:"); @@ -232,17 +235,14 @@ main(int argc, char *argv[]) { sprintf(msgbuf,"M++:M=010203040506"); rc = send_control_msg(msgbuf, 1500 ); - memset(msgbuf,0,1500); sprintf(msgbuf,"M++:M=ffffffffffff"); rc = send_control_msg(msgbuf, 1500 ); - memset(msgbuf,0,1500); sprintf(msgbuf,"V++:I=0002"); rc = send_control_msg(msgbuf, 1500 ); -#endif memset(msgbuf,0,1500); sprintf(msgbuf,"M++:M=060504030201"); rc = send_control_msg(msgbuf, 1500 ); @@ -274,11 +274,6 @@ main(int argc, char *argv[]) { sprintf(msgbuf,"M--:S=1"); rc = send_control_msg(msgbuf, 1500 ); - - memset(msgbuf,0,1500); - sprintf(msgbuf,"V++:I=0002"); - rc = send_control_msg(msgbuf, 1500 ); - sprintf(msgbuf,"V--:I=0002"); rc = send_control_msg(msgbuf, 1500 ); @@ -296,7 +291,6 @@ main(int argc, char *argv[]) { sprintf(msgbuf,"S--:S=DEADBEEFBADFCA11"); rc = send_control_msg(msgbuf, 1500); - memset(msgbuf,0,1500); sprintf(msgbuf,"S++:S=FFEEDDCCBBAA9988,A=112233445567,V=0002,Z=576,I=8000,P=96,L=1000"); rc = send_control_msg(msgbuf, 1500); @@ -321,6 +315,15 @@ main(int argc, char *argv[]) { sprintf(msgbuf,"S-L:L=F00F00F00F00F000"); rc = send_control_msg(msgbuf, 1500); +#endif + + memset(msgbuf,0,1500); + sprintf(msgbuf,"V++:I=0002"); + rc = send_control_msg(msgbuf, 1500 ); + + memset(msgbuf,0,1500); + sprintf(msgbuf,"S+L:L=0050c24edb0a0001,D=2"); + rc = send_control_msg(msgbuf, 1500); do { memset(msgbuf,0,1500); @@ -332,7 +335,10 @@ main(int argc, char *argv[]) { memset(msgbuf,0,1500); sprintf(msgbuf,"S??"); rc = send_control_msg(msgbuf, 1500 ); - recv_ctl_msg(); + status = 0; + while (status >= 0) { + status = recv_ctl_msg(); + } sleep(1); } while (1); out: diff --git a/daemons/mrpd/msrp.c b/daemons/mrpd/msrp.c index 445a2b4..99353c4 100644 --- a/daemons/mrpd/msrp.c +++ b/daemons/mrpd/msrp.c @@ -2169,6 +2169,8 @@ msrp_emit_listenvectors(unsigned char *msgbuf, unsigned char *msgbuf_eof, listen_declare_end = listen_declare_idx; + printf("######listen_declare_end %d\n", listen_declare_end); + for (listen_declare_idx = 0; listen_declare_idx < ((listen_declare_end / 4) * 4); listen_declare_idx += 4) { @@ -2465,13 +2467,13 @@ int msrp_send_notifications(struct msrp_attribute *attrib, int notify) switch (notify) { case MRP_NOTIFY_NEW: - sprintf(msgbuf, "SNE %s %s", variant, regsrc); + sprintf(msgbuf, "SNE %s %s\n", variant, regsrc); break; case MRP_NOTIFY_JOIN: - sprintf(msgbuf, "SJO %s %s", variant, regsrc); + sprintf(msgbuf, "SJO %s %s\n", variant, regsrc); break; case MRP_NOTIFY_LV: - sprintf(msgbuf, "SLE %s %s", variant, regsrc); + sprintf(msgbuf, "SLE %s %s\n", variant, regsrc); break; default: goto free_msgbuf; @@ -2523,6 +2525,9 @@ int msrp_dumptable(struct sockaddr_in *client) msgbuf_wrptr = msgbuf; attrib = MSRP_db->attrib_list; + if (attrib == NULL) { + sprintf(msgbuf, "MSRP:Empty\n"); + } while (NULL != attrib) { if (MSRP_LISTENER_TYPE == attrib->type) { diff --git a/daemons/mrpd/mvrp.c b/daemons/mrpd/mvrp.c index fcdbdef..0a3ec0f 100644 --- a/daemons/mrpd/mvrp.c +++ b/daemons/mrpd/mvrp.c @@ -922,16 +922,18 @@ int mvrp_send_notifications(struct mvrp_attribute *attrib, int notify) attrib->registrar.macaddr[1], attrib->registrar.macaddr[2], attrib->registrar.macaddr[3], - attrib->registrar.macaddr[4], attrib->registrar.macaddr[5]); + attrib->registrar.macaddr[4], + attrib->registrar.macaddr[5]); + switch (attrib->registrar.mrp_state) { case MRP_IN_STATE: - sprintf(stage, "VIN %s %s\n", variant, regsrc); + sprintf(stage, "VIN %s %s", variant, regsrc); break; case MRP_LV_STATE: - sprintf(stage, "VLV %s %s\n", variant, regsrc); + sprintf(stage, "VLV %s %s", variant, regsrc); break; case MRP_MT_STATE: - sprintf(stage, "VMT %s %s\n", variant, regsrc); + sprintf(stage, "VMT %s %s", variant, regsrc); break; default: break; @@ -939,13 +941,13 @@ int mvrp_send_notifications(struct mvrp_attribute *attrib, int notify) switch (notify) { case MRP_NOTIFY_NEW: - snprintf(msgbuf, MAX_MRPD_CMDSZ - 1, "VNE %s", stage); + snprintf(msgbuf, MAX_MRPD_CMDSZ - 1, "VNE %s\n", stage); break; case MRP_NOTIFY_JOIN: - snprintf(msgbuf, MAX_MRPD_CMDSZ - 1, "VJO %s", stage); + snprintf(msgbuf, MAX_MRPD_CMDSZ - 1, "VJO %s\n", stage); break; case MRP_NOTIFY_LV: - snprintf(msgbuf, MAX_MRPD_CMDSZ - 1, "VLE %s", stage); + snprintf(msgbuf, MAX_MRPD_CMDSZ - 1, "VLE %s\n", stage); break; default: goto free_msgbuf; @@ -977,6 +979,7 @@ int mvrp_dumptable(struct sockaddr_in *client) char *variant; char *regsrc; struct mvrp_attribute *attrib; + char mrp_state[8]; msgbuf = (char *)malloc(MAX_MRPD_CMDSZ); if (NULL == msgbuf) @@ -996,29 +999,26 @@ int mvrp_dumptable(struct sockaddr_in *client) msgbuf_wrptr = msgbuf; attrib = MVRP_db->attrib_list; + if (attrib == NULL) { + sprintf(msgbuf, "MVRP:Empty\n"); + } while (NULL != attrib) { - sprintf(variant, "%04x", attrib->attribute); - sprintf(regsrc, "R=%02x%02x%02x%02x%02x%02x", + sprintf(variant, "V:I=%04x", attrib->attribute); + + mrp_decode_state(&attrib->registrar, &attrib->applicant, + mrp_state, sizeof(mrp_state)); + + sprintf(regsrc, "R=%02x%02x%02x%02x%02x%02x %s", attrib->registrar.macaddr[0], attrib->registrar.macaddr[1], attrib->registrar.macaddr[2], attrib->registrar.macaddr[3], attrib->registrar.macaddr[4], - attrib->registrar.macaddr[5]); - switch (attrib->registrar.mrp_state) { - case MRP_IN_STATE: - sprintf(stage, "VIN %s %s\n", variant, regsrc); - break; - case MRP_LV_STATE: - sprintf(stage, "VLV %s %s\n", variant, regsrc); - break; - case MRP_MT_STATE: - sprintf(stage, "VMT %s %s\n", variant, regsrc); - break; - default: - break; - } + attrib->registrar.macaddr[5], + mrp_state); + + sprintf(stage, "%s %s\n", variant, regsrc); sprintf(msgbuf_wrptr, "%s", stage); msgbuf_wrptr += strnlen(stage, 128); attrib = attrib->next;