version 1.1.2.4, 2011/12/09 13:43:55
|
version 1.2.2.9, 2012/05/05 13:39:27
|
Line 2
|
Line 2
|
#define __MQTTD_H |
#define __MQTTD_H |
|
|
|
|
|
#define API_SERVER_SIDE |
|
#include <mqttapi.h> |
|
|
|
|
struct tagStore { |
struct tagStore { |
char st_qos; |
|
u_short st_msgid; |
u_short st_msgid; |
|
|
mqtt_subscr_t st_subscr; |
mqtt_subscr_t st_subscr; |
Line 14 struct tagStore {
|
Line 17 struct tagStore {
|
struct tagSession { |
struct tagSession { |
/* client session thread id */ |
/* client session thread id */ |
pthread_t sess_tid; |
pthread_t sess_tid; |
|
pthread_mutex_t sess_mtx; |
|
/* server dispatcher */ |
|
mqtt_srv_t *sess_srv; |
|
|
/* client network settings */ |
/* client network settings */ |
int sess_sock; |
int sess_sock; |
Line 39 struct tagSession {
|
Line 45 struct tagSession {
|
char *msg; |
char *msg; |
} sess_will; |
} sess_will; |
|
|
/* Data Storage by QoS class */ | /* session subscriptions */ |
SLIST_HEAD(qosStore, tagStore) sess_store[MQTT_QOS_RESERVED]; | SLIST_HEAD(tStore, tagStore) sess_subscr; |
|
|
TAILQ_ENTRY(tagSession) sess_node; |
TAILQ_ENTRY(tagSession) sess_node; |
}; |
}; |
|
|
typedef TAILQ_HEAD(, tagSession) sessions_t; |
typedef TAILQ_HEAD(, tagSession) sessions_t; |
|
#define SESS_ELEM_LOCK(x) pthread_mutex_lock(&(x)->sess_mtx) |
|
#define SESS_ELEM_UNLOCK(x) pthread_mutex_unlock(&(x)->sess_mtx) |
|
#define SESS_LOCK pthread_mutex_lock(&mtx_sess) |
|
#define SESS_UNLOCK pthread_mutex_unlock(&mtx_sess) |
|
|
|
struct tagPub { |
|
ait_val_t pub_name; |
|
mqtt_msg_t pub_packet; |
|
|
|
TAILQ_ENTRY(tagPub) pub_node; |
|
}; |
|
typedef TAILQ_HEAD(, tagPub) pubs_t; |
|
#define PUBS_LOCK pthread_mutex_lock(&mtx_pub) |
|
#define PUBS_UNLOCK pthread_mutex_unlock(&mtx_pub) |
|
|
|
|
extern sessions_t Sessions; |
extern sessions_t Sessions; |
|
extern pubs_t Pubs; |
extern sched_root_task_t *root; |
extern sched_root_task_t *root; |
extern sl_config cfg; | 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 |
#endif |