lscp_server.h | lscp_server.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
#ifndef __LSCP_SERVER_H | #ifndef __LSCP_SERVER_H | |||
#define __LSCP_SERVER_H | #define __LSCP_SERVER_H | |||
#include "lscp_socket.h" | #include "lscp_socket.h" | |||
#if defined(__cplusplus) | #if defined(__cplusplus) | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
//------------------------------------------------------------------------- | //------------------------------------------------------------------------- | |||
// Server mode. | ||||
typedef enum _lscp_server_mode_t | ||||
{ | ||||
LSCP_SERVER_THREAD = 0, | ||||
LSCP_SERVER_SELECT = 1 | ||||
} lscp_server_mode_t; | ||||
//------------------------------------------------------------------------- | ||||
// Server sockets. | // Server sockets. | |||
struct _lscp_server_t; | struct _lscp_server_t; | |||
typedef struct _lscp_connect_t | typedef struct _lscp_connect_t | |||
{ | { | |||
struct _lscp_server_t *server; | struct _lscp_server_t *server; | |||
lscp_socket_agent_t client; | lscp_socket_agent_t client; | |||
int port; | int port; | |||
int ping; | int ping; | |||
skipping to change at line 45 | skipping to change at line 55 | |||
} lscp_connect_list_t; | } lscp_connect_list_t; | |||
typedef lscp_status_t (*lscp_server_proc_t) | typedef lscp_status_t (*lscp_server_proc_t) | |||
( | ( | |||
lscp_connect_t *pConnect, | lscp_connect_t *pConnect, | |||
const char *pchBuffer, | const char *pchBuffer, | |||
int cchBuffer, | int cchBuffer, | |||
void *pvData | void *pvData | |||
); | ); | |||
typedef struct _lscp_server_t { | typedef struct _lscp_server_t | |||
{ | ||||
lscp_server_mode_t mode; | ||||
lscp_connect_list_t connects; | lscp_connect_list_t connects; | |||
lscp_server_proc_t pfnCallback; | lscp_server_proc_t pfnCallback; | |||
void *pvData; | void *pvData; | |||
lscp_socket_agent_t tcp; | lscp_socket_agent_t tcp; | |||
lscp_socket_agent_t udp; | lscp_socket_agent_t udp; | |||
lscp_thread_t *pWatchdog; | lscp_thread_t *pWatchdog; | |||
int iWatchdog; | int iWatchdog; | |||
int iSleep; | int iSleep; | |||
} lscp_server_t; | } lscp_server_t; | |||
lscp_server_t* lscp_server_create (int iPort, lscp_server_proc_t pfnC allback, void *pvData); | lscp_server_t* lscp_server_create (int iPort, lscp_server_proc_t pfnC allback, void *pvData); | |||
lscp_server_t* lscp_server_create_ex (int iPort, lscp_server_proc_t pfnC allback, void *pvData, lscp_server_mode_t mode); | ||||
lscp_status_t lscp_server_join (lscp_server_t *pServer); | lscp_status_t lscp_server_join (lscp_server_t *pServer); | |||
lscp_status_t lscp_server_destroy (lscp_server_t *pServer); | lscp_status_t lscp_server_destroy (lscp_server_t *pServer); | |||
lscp_status_t lscp_server_broadcast (lscp_server_t *pServer, const char *pchBuffer, int cchBuffer); | lscp_status_t lscp_server_broadcast (lscp_server_t *pServer, const char *pchBuffer, int cchBuffer); | |||
lscp_status_t lscp_server_result (lscp_connect_t *pConnect, const ch ar *pchBuffer, int cchBuffer); | lscp_status_t lscp_server_result (lscp_connect_t *pConnect, const ch ar *pchBuffer, int cchBuffer); | |||
lscp_status_t lscp_server_subscribe (lscp_connect_t *pConnect, int iPor t); | lscp_status_t lscp_server_subscribe (lscp_connect_t *pConnect, int iPor t); | |||
lscp_status_t lscp_server_unsubscribe (lscp_connect_t *pConnect, const ch ar *pszSessionID); | lscp_status_t lscp_server_unsubscribe (lscp_connect_t *pConnect, const ch ar *pszSessionID); | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 14 lines changed or added | |||