File:  [ELWIX - Embedded LightWeight unIX -] / mqtt / example / Attic / cmds.c
Revision 1.1.2.3: download - view: text, annotated - select for diffs - revision graph
Mon Nov 21 14:55:10 2011 UTC (12 years, 7 months ago) by misho
Branches: mqtt1_0
finish pub* ut

#include <stdio.h>
#include <sys/types.h>
#include <aitmqtt.h>


int
main()
{
	mqtt_msg_t *m;
	int i;

	m = mqtt_msgAlloc(0);
	/* conn* */
	printf("connect=%d/%d\n", m->msg_len, mqtt_msgCONNECT(m, "MRYN", "aaaaa", NULL, "bbb", NULL, 0, 0, 0));
	for (i = 0; i < m->msg_len; i++)
		printf("%d\n", ((u_char*) m->msg_base)[i]);
	printf("connack=%d/%d\n", m->msg_len, mqtt_msgCONNACK(m, 1));
	for (i = 0; i < m->msg_len; i++)
		printf("%d\n", ((u_char*) m->msg_base)[i]);

	/* pub* */
	printf("publish=%d/%d\n", m->msg_len, mqtt_msgPUBLISH(m, "AAA/bbb/CCC/ddd", 7, 0, 2));
	for (i = 0; i < m->msg_len; i++)
		printf("%d\n", ((u_char*) m->msg_base)[i]);
	printf("puback=%d/%d\n", m->msg_len, mqtt_msgPUBACK(m, 10));
	for (i = 0; i < m->msg_len; i++)
		printf("%d\n", ((u_char*) m->msg_base)[i]);
	printf("pubrec=%d/%d\n", m->msg_len, mqtt_msgPUBREC(m, 11));
	for (i = 0; i < m->msg_len; i++)
		printf("%d\n", ((u_char*) m->msg_base)[i]);
	printf("pubrel=%d/%d\n", m->msg_len, mqtt_msgPUBREL(m, 12));
	for (i = 0; i < m->msg_len; i++)
		printf("%d\n", ((u_char*) m->msg_base)[i]);
	printf("pubcomp=%d/%d\n", m->msg_len, mqtt_msgPUBCOMP(m, 13));
	for (i = 0; i < m->msg_len; i++)
		printf("%d\n", ((u_char*) m->msg_base)[i]);

	/* sub* */

	mqtt_msgFree(&m, 42);
	return 0;
}

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