version 1.1.2.3, 2011/12/09 09:53:54
|
version 1.2.2.11, 2012/05/22 14:15:04
|
Line 2
|
Line 2
|
#define __MQTTD_H |
#define __MQTTD_H |
|
|
|
|
|
#define API_SERVER_SIDE |
|
#include <mqttapi.h> |
|
|
|
|
|
struct tagStore { |
|
u_short st_msgid; |
|
|
|
mqtt_subscr_t st_subscr; |
|
|
|
SLIST_ENTRY(tagStore) st_node; |
|
}; |
|
|
struct tagSession { |
struct tagSession { |
pthread_t sess_tid; | /* server dispatcher */ |
mqtt_msg_t *sess_buf; | mqtt_srv_t *sess_srv; |
|
|
int sess_sock; | /* client network settings */ |
io_sockaddr_t sess_addr; | int sess_sock; |
struct timeval sess_ka; | u_short u_short sess_ka; |
| /* client send retry in miliseconds, if client not receive message */ |
| u_int sess_retry; |
| /* message work buffer */ |
| mqtt_msg_t *sess_buf; |
|
|
char sess_cid[MAX_CONNID]; | /* authentication user info */ |
char sess_user[MAX_CRED]; | char sess_cid[MAX_CONNID]; |
char sess_pass[MAX_CRED]; | char sess_user[MAX_CRED]; |
| char sess_pass[MAX_CRED]; |
| char sess_addr[64]; |
|
|
char clear; | /* connect flags */ |
| char sess_clean; |
struct { |
struct { |
char flag; | char flag; |
char qos; | char qos; |
char retain; | char retain; |
char *topic; | char *topic; |
char *msg; | char *msg; |
} sess_will; |
} sess_will; |
|
|
TAILQ_ENTRY(tagSession) sess_node; | /* session subscriptions */ |
}; | SLIST_HEAD(tStore, tagStore) sess_subscr; |
|
|
|
TAILQ_ENTRY(tagSession) sess_node; |
|
}; |
typedef TAILQ_HEAD(, tagSession) sessions_t; |
typedef TAILQ_HEAD(, tagSession) sessions_t; |
|
|
|
|
extern sessions_t Sessions; |
extern sessions_t Sessions; |
|
extern sched_root_task_t *root; |
|
extern cfg_root_t cfg; |
|
|
|
|
|
/* function prototypes */ |
|
void *startSession(sched_task_t *task); |
|
|
|
|
#endif |
#endif |