--- mqtt/inc/mqttd.h 2012/04/24 08:06:08 1.2.2.5 +++ mqtt/inc/mqttd.h 2012/05/05 13:39:27 1.2.2.9 @@ -2,8 +2,11 @@ #define __MQTTD_H +#define API_SERVER_SIDE +#include + + struct tagStore { - char st_qos; u_short st_msgid; mqtt_subscr_t st_subscr; @@ -42,8 +45,9 @@ struct tagSession { char *msg; } sess_will; - /* Data Storage by QoS class */ - SLIST_HEAD(tStore, tagStore) sess_txque[MQTT_QOS_RESERVED]; + /* session subscriptions */ + SLIST_HEAD(tStore, tagStore) sess_subscr; + TAILQ_ENTRY(tagSession) sess_node; }; typedef TAILQ_HEAD(, tagSession) sessions_t; @@ -59,8 +63,8 @@ struct tagPub { TAILQ_ENTRY(tagPub) pub_node; }; typedef TAILQ_HEAD(, tagPub) pubs_t; -#define PUB_LOCK pthread_mutex_lock(&mtx_pub) -#define PUB_UNLOCK pthread_mutex_unlock(&mtx_pub) +#define PUBS_LOCK pthread_mutex_lock(&mtx_pub) +#define PUBS_UNLOCK pthread_mutex_unlock(&mtx_pub) extern sessions_t Sessions; @@ -68,6 +72,11 @@ extern pubs_t Pubs; extern sched_root_task_t *root; extern cfg_root_t cfg; extern pthread_mutex_t mtx_sess, mtx_pub; + + +/* function prototypes */ +void finiSession(struct tagSession *sess); +void *startSession(sched_task_t *task); #endif