Annotation of mqtt/inc/mqttd.h, revision 1.2.2.7
1.2 misho 1: #ifndef __MQTTD_H
2: #define __MQTTD_H
3:
4:
1.2.2.7 ! misho 5: #define API_SERVER_SIDE
! 6: #include <mqttapi.h>
! 7:
! 8:
1.2 misho 9: struct tagStore {
10: char st_qos;
11: u_short st_msgid;
12:
13: mqtt_subscr_t st_subscr;
14:
1.2.2.4 misho 15: SLIST_ENTRY(tagStore) st_node;
1.2 misho 16: };
17:
18: struct tagSession {
19: /* client session thread id */
20: pthread_t sess_tid;
1.2.2.2 misho 21: pthread_mutex_t sess_mtx;
1.2.2.1 misho 22: /* server dispatcher */
23: mqtt_srv_t *sess_srv;
1.2 misho 24:
25: /* client network settings */
26: int sess_sock;
27: u_short sess_ka;
28: /* client send retry in miliseconds, if client not receive message */
29: u_int sess_retry;
30: /* message work buffer */
31: mqtt_msg_t *sess_buf;
32:
33: /* authentication user info */
34: char sess_cid[MAX_CONNID];
35: char sess_user[MAX_CRED];
36: char sess_pass[MAX_CRED];
37: char sess_addr[64];
38:
39: /* connect flags */
40: char sess_clean;
41: struct {
42: char flag;
43: char qos;
44: char retain;
45: char *topic;
46: char *msg;
47: } sess_will;
48:
1.2.2.6 misho 49: /* session subscriptions */
50: SLIST_HEAD(tStore, tagStore) sess_subscr;
51:
1.2 misho 52: TAILQ_ENTRY(tagSession) sess_node;
53: };
54: typedef TAILQ_HEAD(, tagSession) sessions_t;
1.2.2.4 misho 55: #define SESS_ELEM_LOCK(x) pthread_mutex_lock(&(x)->sess_mtx)
56: #define SESS_ELEM_UNLOCK(x) pthread_mutex_unlock(&(x)->sess_mtx)
1.2.2.5 misho 57: #define SESS_LOCK pthread_mutex_lock(&mtx_sess)
58: #define SESS_UNLOCK pthread_mutex_unlock(&mtx_sess)
59:
60: struct tagPub {
61: ait_val_t pub_name;
62: mqtt_msg_t pub_packet;
63:
64: TAILQ_ENTRY(tagPub) pub_node;
65: };
66: typedef TAILQ_HEAD(, tagPub) pubs_t;
1.2.2.6 misho 67: #define PUBS_LOCK pthread_mutex_lock(&mtx_pub)
68: #define PUBS_UNLOCK pthread_mutex_unlock(&mtx_pub)
1.2 misho 69:
70:
71: extern sessions_t Sessions;
1.2.2.5 misho 72: extern pubs_t Pubs;
1.2 misho 73: extern sched_root_task_t *root;
1.2.2.3 misho 74: extern cfg_root_t cfg;
1.2 misho 75: extern pthread_mutex_t mtx_sess, mtx_pub;
76:
77:
78: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>