36 |
/** Server thread model. */ |
/** Server thread model. */ |
37 |
typedef enum _lscp_server_mode_t |
typedef enum _lscp_server_mode_t |
38 |
{ |
{ |
39 |
LSCP_SERVER_THREAD = 0, |
LSCP_SERVER_THREAD = 0, |
40 |
LSCP_SERVER_SELECT = 1 |
LSCP_SERVER_SELECT = 1 |
41 |
|
|
42 |
} lscp_server_mode_t; |
} lscp_server_mode_t; |
43 |
|
|
45 |
/** Connection mode notification. */ |
/** Connection mode notification. */ |
46 |
typedef enum _lscp_connect_mode_t |
typedef enum _lscp_connect_mode_t |
47 |
{ |
{ |
48 |
LSCP_CONNECT_OPEN = 0, |
LSCP_CONNECT_OPEN = 0, |
49 |
LSCP_CONNECT_CLOSE = 1 |
LSCP_CONNECT_CLOSE = 1 |
50 |
|
|
51 |
} lscp_connect_mode_t; |
} lscp_connect_mode_t; |
52 |
|
|
59 |
/** Client connection descriptor struct. */ |
/** Client connection descriptor struct. */ |
60 |
typedef struct _lscp_connect_t |
typedef struct _lscp_connect_t |
61 |
{ |
{ |
62 |
struct _lscp_server_t *server; |
struct _lscp_server_t *server; |
63 |
lscp_socket_agent_t client; |
lscp_socket_agent_t client; |
64 |
lscp_event_t events; |
lscp_event_t events; |
65 |
struct _lscp_connect_t *prev; |
struct _lscp_connect_t *prev; |
66 |
struct _lscp_connect_t *next; |
struct _lscp_connect_t *next; |
67 |
|
|
68 |
} lscp_connect_t; |
} lscp_connect_t; |
69 |
|
|
70 |
/** Client connection list struct. */ |
/** Client connection list struct. */ |
71 |
typedef struct _lscp_connect_list_t |
typedef struct _lscp_connect_list_t |
72 |
{ |
{ |
73 |
lscp_connect_t *first; |
lscp_connect_t *first; |
74 |
lscp_connect_t *last; |
lscp_connect_t *last; |
75 |
unsigned int count; |
unsigned int count; |
76 |
lscp_mutex_t mutex; |
lscp_mutex_t mutex; |
77 |
|
|
78 |
} lscp_connect_list_t; |
} lscp_connect_list_t; |
79 |
|
|
80 |
/** Server callback procedure prototype. */ |
/** Server callback procedure prototype. */ |
81 |
typedef lscp_status_t (*lscp_server_proc_t) |
typedef lscp_status_t (*lscp_server_proc_t) |
82 |
( |
( |
83 |
lscp_connect_t *pConnect, |
lscp_connect_t *pConnect, |
84 |
const char *pchBuffer, |
const char *pchBuffer, |
85 |
int cchBuffer, |
int cchBuffer, |
86 |
void *pvData |
void *pvData |
87 |
); |
); |
88 |
|
|
89 |
/** Server descriptor struct. */ |
/** Server descriptor struct. */ |
90 |
typedef struct _lscp_server_t |
typedef struct _lscp_server_t |
91 |
{ |
{ |
92 |
lscp_server_mode_t mode; |
lscp_server_mode_t mode; |
93 |
lscp_connect_list_t connects; |
lscp_connect_list_t connects; |
94 |
lscp_server_proc_t pfnCallback; |
lscp_server_proc_t pfnCallback; |
95 |
void *pvData; |
void *pvData; |
96 |
lscp_socket_agent_t agent; |
lscp_socket_agent_t agent; |
97 |
|
|
98 |
} lscp_server_t; |
} lscp_server_t; |
99 |
|
|