Annotation of mqtt/inc/mqttd.h, revision 1.2.2.6
1.2 misho 1: #ifndef __MQTTD_H
2: #define __MQTTD_H
3:
4:
5: struct tagStore {
6: char st_qos;
7: u_short st_msgid;
8:
9: mqtt_subscr_t st_subscr;
10:
1.2.2.4 misho 11: SLIST_ENTRY(tagStore) st_node;
1.2 misho 12: };
13:
14: struct tagSession {
15: /* client session thread id */
16: pthread_t sess_tid;
1.2.2.2 misho 17: pthread_mutex_t sess_mtx;
1.2.2.1 misho 18: /* server dispatcher */
19: mqtt_srv_t *sess_srv;
1.2 misho 20:
21: /* client network settings */
22: int sess_sock;
23: u_short sess_ka;
24: /* client send retry in miliseconds, if client not receive message */
25: u_int sess_retry;
26: /* message work buffer */
27: mqtt_msg_t *sess_buf;
28:
29: /* authentication user info */
30: char sess_cid[MAX_CONNID];
31: char sess_user[MAX_CRED];
32: char sess_pass[MAX_CRED];
33: char sess_addr[64];
34:
35: /* connect flags */
36: char sess_clean;
37: struct {
38: char flag;
39: char qos;
40: char retain;
41: char *topic;
42: char *msg;
43: } sess_will;
44:
1.2.2.6 ! misho 45: /* session scheduler */
! 46: sched_root_task_t *sess_root;
! 47:
! 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>