| version 1.2, 2012/06/20 15:02:23 | version 1.3, 2012/06/28 11:06:17 | 
| Line 21  main() | Line 21  main() | 
 | m = mqtt_msgAlloc(0); | m = mqtt_msgAlloc(0); | 
 | /* conn* */ | /* conn* */ | 
 | printf("connect=%d/%d\n", m->msg_len, mqtt_msgCONNECT(m, "MRYN", 0, "aaaaa", NULL, "bbb", NULL, 0, 0, 0)); | printf("connect=%d/%d\n", m->msg_len, mqtt_msgCONNECT(m, "MRYN", 0, "aaaaa", NULL, "bbb", NULL, 0, 0, 0)); | 
| for (i = 0; i < m->msg_len; i++) | //        for (i = 0; i < m->msg_len; i++) | 
| printf("%d\n", ((u_char*) m->msg_base)[i]); | //                printf("%d\n", ((u_char*) m->msg_base)[i]); | 
 | t = msg = NULL; | t = msg = NULL; | 
 | cack = mqtt_readCONNECT(m, &ka, cid, sizeof cid, user, sizeof user, pass, sizeof pass, &t, &msg); | cack = mqtt_readCONNECT(m, &ka, cid, sizeof cid, user, sizeof user, pass, sizeof pass, &t, &msg); | 
 | flg.flags = cack.reserved; | flg.flags = cack.reserved; | 
| Line 39  main() | Line 39  main() | 
 | if (msg) | if (msg) | 
 | free(msg); | free(msg); | 
 | printf("connack=%d/%d\n", m->msg_len, mqtt_msgCONNACK(m, 1)); | printf("connack=%d/%d\n", m->msg_len, mqtt_msgCONNACK(m, 1)); | 
| for (i = 0; i < m->msg_len; i++) | //        for (i = 0; i < m->msg_len; i++) | 
| printf("%d\n", ((u_char*) m->msg_base)[i]); | //                printf("%d\n", ((u_char*) m->msg_base)[i]); | 
 | printf("read connack=%d\n", mqtt_readCONNACK(m)); | printf("read connack=%d\n", mqtt_readCONNACK(m)); | 
 | getchar(); | getchar(); | 
 |  |  | 
 | /* pub* */ | /* pub* */ | 
 | printf("publish=%d/%d\n", m->msg_len, mqtt_msgPUBLISH(m, "AAA/bbb/CCC/ddd", 7, 0, 2, 0, "OLE!!!", 7)); | printf("publish=%d/%d\n", m->msg_len, mqtt_msgPUBLISH(m, "AAA/bbb/CCC/ddd", 7, 0, 2, 0, "OLE!!!", 7)); | 
| for (i = 0; i < m->msg_len; i++) | //        for (i = 0; i < m->msg_len; i++) | 
| printf("%d\n", ((u_char*) m->msg_base)[i]); | //                printf("%d\n", ((u_char*) m->msg_base)[i]); | 
 | if (!(len = mqtt_readPUBLISH(m, topic, sizeof topic, &msgID, (void**) &pub))) { | if (!(len = mqtt_readPUBLISH(m, topic, sizeof topic, &msgID, (void**) &pub))) { | 
 | printf("Error:: mqtt_readPUBLISH() #%d - %s\n", mqtt_GetErrno(), mqtt_GetError()); | printf("Error:: mqtt_readPUBLISH() #%d - %s\n", mqtt_GetErrno(), mqtt_GetError()); | 
 | return 2; | return 2; | 
| } | } else | 
|  | hdr = (struct mqtthdr*) m->msg_base; | 
 | printf("read publish: dup=%d qos=%d retain=%d\n", hdr->mqtt_msg.dup, hdr->mqtt_msg.qos, hdr->mqtt_msg.retain); | printf("read publish: dup=%d qos=%d retain=%d\n", hdr->mqtt_msg.dup, hdr->mqtt_msg.qos, hdr->mqtt_msg.retain); | 
 | printf("++> topic=%s MessageID=%d DATA=(%d)%s\n", topic, msgID, len, pub); | printf("++> topic=%s MessageID=%d DATA=(%d)%s\n", topic, msgID, len, pub); | 
 | free(pub); | free(pub); | 
 | printf("puback=%d/%d\n", m->msg_len, mqtt_msgPUBACK(m, 10)); | printf("puback=%d/%d\n", m->msg_len, mqtt_msgPUBACK(m, 10)); | 
| for (i = 0; i < m->msg_len; i++) | //        for (i = 0; i < m->msg_len; i++) | 
| printf("%d\n", ((u_char*) m->msg_base)[i]); | //                printf("%d\n", ((u_char*) m->msg_base)[i]); | 
 | printf("read puback=%d\n", mqtt_readPUBACK(m)); | printf("read puback=%d\n", mqtt_readPUBACK(m)); | 
 | printf("pubrec=%d/%d\n", m->msg_len, mqtt_msgPUBREC(m, 11)); | printf("pubrec=%d/%d\n", m->msg_len, mqtt_msgPUBREC(m, 11)); | 
| for (i = 0; i < m->msg_len; i++) | //        for (i = 0; i < m->msg_len; i++) | 
| printf("%d\n", ((u_char*) m->msg_base)[i]); | //                printf("%d\n", ((u_char*) m->msg_base)[i]); | 
 | printf("read pubrec=%d\n", mqtt_readPUBREC(m)); | printf("read pubrec=%d\n", mqtt_readPUBREC(m)); | 
 | printf("pubrel=%d/%d\n", m->msg_len, mqtt_msgPUBREL(m, 12)); | printf("pubrel=%d/%d\n", m->msg_len, mqtt_msgPUBREL(m, 12)); | 
| for (i = 0; i < m->msg_len; i++) | //        for (i = 0; i < m->msg_len; i++) | 
| printf("%d\n", ((u_char*) m->msg_base)[i]); | //                printf("%d\n", ((u_char*) m->msg_base)[i]); | 
 | printf("read pubrel=%d\n", mqtt_readPUBREL(m)); | printf("read pubrel=%d\n", mqtt_readPUBREL(m)); | 
 | printf("pubcomp=%d/%d\n", m->msg_len, mqtt_msgPUBCOMP(m, 13)); | printf("pubcomp=%d/%d\n", m->msg_len, mqtt_msgPUBCOMP(m, 13)); | 
| for (i = 0; i < m->msg_len; i++) | //        for (i = 0; i < m->msg_len; i++) | 
| printf("%d\n", ((u_char*) m->msg_base)[i]); | //                printf("%d\n", ((u_char*) m->msg_base)[i]); | 
 | printf("read pubcomp=%d\n", mqtt_readPUBCOMP(m)); | printf("read pubcomp=%d\n", mqtt_readPUBCOMP(m)); | 
 | getchar(); | getchar(); | 
 |  |  | 
| Line 98  main() | Line 99  main() | 
 | (char*) ss[i].sub_topic.msg_base); | (char*) ss[i].sub_topic.msg_base); | 
 | mqtt_subFree(&ss); | mqtt_subFree(&ss); | 
 | printf("suback=%d/%d\n", m->msg_len, mqtt_msgSUBACK(m, s, 10)); | printf("suback=%d/%d\n", m->msg_len, mqtt_msgSUBACK(m, s, 10)); | 
| for (i = 0; i < m->msg_len; i++) | //        for (i = 0; i < m->msg_len; i++) | 
| printf("%d\n", ((u_char*) m->msg_base)[i]); | //                printf("%d\n", ((u_char*) m->msg_base)[i]); | 
 | printf("read suback=%d\n", (len = mqtt_readSUBACK(m, &msgID, &qoses))); | printf("read suback=%d\n", (len = mqtt_readSUBACK(m, &msgID, &qoses))); | 
 | for (i = 0; i < len; i++) | for (i = 0; i < len; i++) | 
 | printf(" >>> QoS=%d\n", qoses[i]); | printf(" >>> QoS=%d\n", qoses[i]); | 
 | free(qoses); | free(qoses); | 
 | printf("unsubscribe=%d/%d\n", m->msg_len, mqtt_msgUNSUBSCRIBE(m, s, 10, 0, 1)); | printf("unsubscribe=%d/%d\n", m->msg_len, mqtt_msgUNSUBSCRIBE(m, s, 10, 0, 1)); | 
| for (i = 0; i < m->msg_len; i++) | //        for (i = 0; i < m->msg_len; i++) | 
| printf("%d\n", ((u_char*) m->msg_base)[i]); | //                printf("%d\n", ((u_char*) m->msg_base)[i]); | 
 | if (mqtt_readUNSUBSCRIBE(m, &msgID, &ss) == -1) { | if (mqtt_readUNSUBSCRIBE(m, &msgID, &ss) == -1) { | 
 | printf("Error:: mqtt_readUNSUBSCRIBE() #%d - %s\n", mqtt_GetErrno(), mqtt_GetError()); | printf("Error:: mqtt_readUNSUBSCRIBE() #%d - %s\n", mqtt_GetErrno(), mqtt_GetError()); | 
 | return 3; | return 3; | 
| Line 117  main() | Line 118  main() | 
 | printf(" >>> Topic(%d)=%s\n", ss[i].sub_topic.msg_len, (char*) ss[i].sub_topic.msg_base); | printf(" >>> Topic(%d)=%s\n", ss[i].sub_topic.msg_len, (char*) ss[i].sub_topic.msg_base); | 
 | mqtt_subFree(&ss); | mqtt_subFree(&ss); | 
 | printf("unsuback=%d/%d\n", m->msg_len, mqtt_msgUNSUBACK(m, 10)); | printf("unsuback=%d/%d\n", m->msg_len, mqtt_msgUNSUBACK(m, 10)); | 
| for (i = 0; i < m->msg_len; i++) | //        for (i = 0; i < m->msg_len; i++) | 
| printf("%d\n", ((u_char*) m->msg_base)[i]); | //                printf("%d\n", ((u_char*) m->msg_base)[i]); | 
 | printf("read unsuback=%d\n", mqtt_readUNSUBACK(m)); | printf("read unsuback=%d\n", mqtt_readUNSUBACK(m)); | 
 | getchar(); | getchar(); | 
 |  |  | 
 | /* ping* */ | /* ping* */ | 
 | printf("pingreq=%d/%d\n", m->msg_len, mqtt_msgPINGREQ(m)); | printf("pingreq=%d/%d\n", m->msg_len, mqtt_msgPINGREQ(m)); | 
| for (i = 0; i < m->msg_len; i++) | //        for (i = 0; i < m->msg_len; i++) | 
| printf("%d\n", ((u_char*) m->msg_base)[i]); | //                printf("%d\n", ((u_char*) m->msg_base)[i]); | 
 | printf("read pingreq=%d\n", mqtt_readPINGREQ(m)); | printf("read pingreq=%d\n", mqtt_readPINGREQ(m)); | 
 | printf("pingresp=%d/%d\n", m->msg_len, mqtt_msgPINGRESP(m)); | printf("pingresp=%d/%d\n", m->msg_len, mqtt_msgPINGRESP(m)); | 
| for (i = 0; i < m->msg_len; i++) | //        for (i = 0; i < m->msg_len; i++) | 
| printf("%d\n", ((u_char*) m->msg_base)[i]); | //                printf("%d\n", ((u_char*) m->msg_base)[i]); | 
 | printf("read pingresp=%d\n", mqtt_readPINGRESP(m)); | printf("read pingresp=%d\n", mqtt_readPINGRESP(m)); | 
 |  |  | 
 | printf("disconnect=%d/%d\n", m->msg_len, mqtt_msgDISCONNECT(m)); | printf("disconnect=%d/%d\n", m->msg_len, mqtt_msgDISCONNECT(m)); | 
| for (i = 0; i < m->msg_len; i++) | //        for (i = 0; i < m->msg_len; i++) | 
| printf("%d\n", ((u_char*) m->msg_base)[i]); | //                printf("%d\n", ((u_char*) m->msg_base)[i]); | 
 | printf("read disconnect=%d\n", mqtt_readDISCONNECT(m)); | printf("read disconnect=%d\n", mqtt_readDISCONNECT(m)); | 
 |  |  | 
 | mqtt_msgFree(&m, 42); | mqtt_msgFree(&m, 42); |