Annotation of libaitmqtt/inc/mqttapi.h, revision 1.1.2.3

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: 
1.1.2.3 ! misho      22: #ifdef API_SERVER_SIDE
1.1.2.2   misho      23: /*
                     24:  * mqtt_srv_Init() Init server side actor
                     25:  *
                     26:  * @sock = Client socket from accept()
                     27:  * @buf = Message buffer
                     28:  * return: NULL error or !=NULL allocated server handle
                     29:  */
                     30: mqtt_srv_t *mqtt_srv_Init(int sock, mqtt_msg_t * __restrict buf);
                     31: /*
                     32:  * mqtt_srv_Fini() Finish MQTT server side support
                     33:  *
                     34:  * @psrv = Server handle
                     35:  * return: none
                     36:  */
                     37: void mqtt_srv_Fini(mqtt_srv_t ** __restrict psrv);
                     38: /*
                     39:  * mqtt_srv_Dispatch() MQTT server dispatcher
                     40:  *
                     41:  * @srv = Server handle
                     42:  * @arg = Argument pass to command callback
                     43:  * return: -1 error or 0 ok
                     44:  */
                     45: int mqtt_srv_Dispatch(mqtt_srv_t * __restrict srv, void *arg);
1.1.2.3 ! misho      46: #endif
        !            47: 
        !            48: /*
        !            49:  * mqtt_KeepAlive() - Keep Alive check routine
        !            50:  *
        !            51:  * @sock = connected socket
        !            52:  * @ka = keep alive timeout
        !            53:  * @tries = tries for receive correct ping response, usually ==1
        !            54:  * return: -1 error, 0 host is alive, 1 timeout session or 2 broken session
        !            55:  */
        !            56: int mqtt_KeepAlive(int sock, unsigned short ka, unsigned char tries);
        !            57: 
        !            58: #ifdef API_CLIENT_SIDE
        !            59: #endif
1.1.2.2   misho      60: 
                     61: 
1.1.2.1   misho      62: #endif

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