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