File:  [ELWIX - Embedded LightWeight unIX -] / libaitmqtt / example / test_enclen.c
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Thu Jan 26 13:07:33 2012 UTC (12 years, 5 months ago) by misho
CVS tags: MAIN, HEAD
Initial revision

    1: #include <stdio.h>
    2: #include <stdlib.h>
    3: #include <netinet/in.h>
    4: #include "aitmqtt.h"
    5: 
    6: int
    7: main(int argc, char **argv)
    8: {
    9: 	unsigned int x;
   10: 	unsigned char *p = (unsigned char*) &x;
   11: 
   12: 	if (argc < 2)
   13: 		return 1;
   14: 	else
   15: 		x = strtol(argv[1], NULL, 0);
   16: 
   17: 	x = mqtt_encodeLen(x);
   18: 	printf("encode:: %u (wire)-> %02x %02x %02x %02x\n", x, p[0], p[1], p[2], p[3]);
   19: 
   20: 	printf("sizeof len=%d\n", mqtt_sizeLen(x));
   21: 
   22: 	return 0;
   23: }

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