Annotation of mqtt/example/cmds.c, revision 1.1.2.3
1.1.2.1 misho 1: #include <stdio.h>
2: #include <sys/types.h>
3: #include <aitmqtt.h>
4:
5:
6: int
7: main()
8: {
9: mqtt_msg_t *m;
10: int i;
11:
12: m = mqtt_msgAlloc(0);
13: /* conn* */
14: printf("connect=%d/%d\n", m->msg_len, mqtt_msgCONNECT(m, "MRYN", "aaaaa", NULL, "bbb", NULL, 0, 0, 0));
15: for (i = 0; i < m->msg_len; i++)
16: printf("%d\n", ((u_char*) m->msg_base)[i]);
17: printf("connack=%d/%d\n", m->msg_len, mqtt_msgCONNACK(m, 1));
18: for (i = 0; i < m->msg_len; i++)
19: printf("%d\n", ((u_char*) m->msg_base)[i]);
20:
21: /* pub* */
1.1.2.3 ! misho 22: printf("publish=%d/%d\n", m->msg_len, mqtt_msgPUBLISH(m, "AAA/bbb/CCC/ddd", 7, 0, 2));
1.1.2.1 misho 23: for (i = 0; i < m->msg_len; i++)
24: printf("%d\n", ((u_char*) m->msg_base)[i]);
1.1.2.3 ! misho 25: printf("puback=%d/%d\n", m->msg_len, mqtt_msgPUBACK(m, 10));
! 26: for (i = 0; i < m->msg_len; i++)
! 27: printf("%d\n", ((u_char*) m->msg_base)[i]);
! 28: printf("pubrec=%d/%d\n", m->msg_len, mqtt_msgPUBREC(m, 11));
! 29: for (i = 0; i < m->msg_len; i++)
! 30: printf("%d\n", ((u_char*) m->msg_base)[i]);
! 31: printf("pubrel=%d/%d\n", m->msg_len, mqtt_msgPUBREL(m, 12));
! 32: for (i = 0; i < m->msg_len; i++)
! 33: printf("%d\n", ((u_char*) m->msg_base)[i]);
! 34: printf("pubcomp=%d/%d\n", m->msg_len, mqtt_msgPUBCOMP(m, 13));
! 35: for (i = 0; i < m->msg_len; i++)
! 36: printf("%d\n", ((u_char*) m->msg_base)[i]);
! 37:
! 38: /* sub* */
1.1.2.1 misho 39:
40: mqtt_msgFree(&m, 42);
41: return 0;
42: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>