Annotation of libaitmqtt/inc/mqttapi.h, revision 1.1.2.2
1.1.2.1 misho 1: #ifndef __MQTTAPI_H
2: #define __MQTTAPI_H
3:
4:
1.1.2.2 ! misho 5: #include "aitmqtt.h"
! 6:
! 7:
! 8: /* MQTT server structure & hooks */
! 9:
! 10: /* MQTT command callback. 1st argument is (mqtt_srv_t*) server handle */
! 11: typedef int (*mqtt_cb_t)(void* /*mqtt_srv_t**/, void *);
! 12: typedef struct {
! 13: mqtt_cb_t cmds[MQTT_TYPE_MAX];
! 14:
! 15: int sock;
! 16: mqtt_msg_t *buf;
! 17: } mqtt_srv_t;
! 18: #define mqtt_srv_setCmd(x, _cmd, _func) (assert((x)), (x)->cmds[(_cmd)] = (_func))
! 19: #define mqtt_srv_getCmd(x, _cmd) (assert((x)), (x)->cmds[(_cmd)])
! 20:
! 21:
! 22: /*
! 23: * mqtt_srv_Init() Init server side actor
! 24: *
! 25: * @sock = Client socket from accept()
! 26: * @buf = Message buffer
! 27: * return: NULL error or !=NULL allocated server handle
! 28: */
! 29: mqtt_srv_t *mqtt_srv_Init(int sock, mqtt_msg_t * __restrict buf);
! 30: /*
! 31: * mqtt_srv_Fini() Finish MQTT server side support
! 32: *
! 33: * @psrv = Server handle
! 34: * return: none
! 35: */
! 36: void mqtt_srv_Fini(mqtt_srv_t ** __restrict psrv);
! 37: /*
! 38: * mqtt_srv_Dispatch() MQTT server dispatcher
! 39: *
! 40: * @srv = Server handle
! 41: * @arg = Argument pass to command callback
! 42: * return: -1 error or 0 ok
! 43: */
! 44: int mqtt_srv_Dispatch(mqtt_srv_t * __restrict srv, void *arg);
! 45:
! 46:
1.1.2.1 misho 47: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>