Diff for /mqtt/example/Attic/cmds.c between versions 1.1.2.3 and 1.1.2.9

version 1.1.2.3, 2011/11/21 14:55:10 version 1.1.2.9, 2011/11/28 13:19:38
Line 1 Line 1
 #include <stdio.h>  #include <stdio.h>
   #include <string.h>
 #include <sys/types.h>  #include <sys/types.h>
 #include <aitmqtt.h>  #include <aitmqtt.h>
   
Line 7  int Line 8  int
 main()  main()
 {  {
         mqtt_msg_t *m;          mqtt_msg_t *m;
           mqtt_subscr_t s[4];
         int i;          int i;
   
         m = mqtt_msgAlloc(0);          m = mqtt_msgAlloc(0);
Line 19  main() Line 21  main()
                 printf("%d\n", ((u_char*) m->msg_base)[i]);                  printf("%d\n", ((u_char*) m->msg_base)[i]);
   
         /* pub* */          /* pub* */
        printf("publish=%d/%d\n", m->msg_len, mqtt_msgPUBLISH(m, "AAA/bbb/CCC/ddd", 7, 0, 2));        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]);
         printf("puback=%d/%d\n", m->msg_len, mqtt_msgPUBACK(m, 10));          printf("puback=%d/%d\n", m->msg_len, mqtt_msgPUBACK(m, 10));
Line 36  main() Line 38  main()
                 printf("%d\n", ((u_char*) m->msg_base)[i]);                  printf("%d\n", ((u_char*) m->msg_base)[i]);
   
         /* sub* */          /* sub* */
           memset(s, 0, sizeof s);
           s[0].sub_topic._size = 3;
           s[0].sub_topic._base = "a/b";
           s[0].sub_ret = MQTT_QOS_ACK;
           s[1].sub_topic._size = 3;
           s[1].sub_topic._base = "c/d";
           s[1].sub_ret = MQTT_QOS_ONCE;
           s[2].sub_topic._size = 7;
           s[2].sub_topic._base = "x/y/z/Q";
           s[2].sub_ret = MQTT_QOS_EXACTLY;
           printf("subscribe=%d/%d\n", m->msg_len, mqtt_msgSUBSCRIBE(m, s, 10, 0, 0));
           for (i = 0; i < m->msg_len; i++)
                   printf("%d\n", ((u_char*) m->msg_base)[i]);
           printf("suback=%d/%d\n", m->msg_len, mqtt_msgSUBACK(m, s, 10));
           for (i = 0; i < m->msg_len; i++)
                   printf("%d\n", ((u_char*) m->msg_base)[i]);
           printf("unsubscribe=%d/%d\n", m->msg_len, mqtt_msgUNSUBSCRIBE(m, s, 10, 0, 1));
           for (i = 0; i < m->msg_len; i++)
                   printf("%d\n", ((u_char*) m->msg_base)[i]);
           printf("unsuback=%d/%d\n", m->msg_len, mqtt_msgUNSUBACK(m, 10));
           for (i = 0; i < m->msg_len; i++)
                   printf("%d\n", ((u_char*) m->msg_base)[i]);
   
           /* ping* */
           printf("pingreq=%d/%d\n", m->msg_len, mqtt_msgPINGREQ(m));
           for (i = 0; i < m->msg_len; i++)
                   printf("%d\n", ((u_char*) m->msg_base)[i]);
           printf("pingresp=%d/%d\n", m->msg_len, mqtt_msgPINGRESP(m));
           for (i = 0; i < m->msg_len; i++)
                   printf("%d\n", ((u_char*) m->msg_base)[i]);
   
           printf("disconnect=%d/%d\n", m->msg_len, mqtt_msgDISCONNECT(m));
           for (i = 0; i < m->msg_len; i++)
                   printf("%d\n", ((u_char*) m->msg_base)[i]);
   
         mqtt_msgFree(&m, 42);          mqtt_msgFree(&m, 42);
         return 0;          return 0;

Removed from v.1.1.2.3  
changed lines
  Added in v.1.1.2.9


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>