Teonet library  0.4.7
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
teo_ws.h
Go to the documentation of this file.
1 
10 #ifndef TEO_WS_H
11 #define TEO_WS_H
12 
13 #include "teo_web.h"
14 
15 typedef struct teoWSClass teoWSClass;
19 struct teoWSClass {
20 
22  PblMap* map;
23 
24  // Public methods
25 
30  void (*destroy)(teoWSClass *kws);
31 
44  teoLNullConnectData * (*add)(teoWSClass *kws, void *nc_p,
45  const char *server, const int port, char *login);
46 
47  /*
48  * Disconnect WS client from L0 server, remove it from connected map and stop
49  * READ watcher
50  *
51  * @param kws Pointer to teoWSClass
52  * @param nc_p Pointer to mg_connection structure
53  *
54  * @return Return true at success
55  */
56  int (*remove)(teoWSClass *kws, void *nc_p);
57 
69  int (*handler)(teoWSClass *kws, int ev, void *nc_p, void *data, size_t data_length);
70 
84  ssize_t (*send)(teoWSClass *kws, void *nc_p, int cmd,
85  const char *to_peer_name, void *data, size_t data_length);
86 
97  int (*processMsg)(teoWSClass *kws, void *nc_p, void *data, size_t data_length);
98 
99 };
100 
104 typedef struct teoWSmapData {
105 
106  teoLNullConnectData *con;
107  ev_io w;
108 
109 } teoWSmapData;
110 
111 #ifdef __cplusplus
112 extern "C" {
113 #endif
114 
116 
117 
118 #ifdef __cplusplus
119 }
120 #endif
121 
122 #endif /* TEO_WS_H */
123 
void(* destroy)(teoWSClass *kws)
Destroy teonet HTTP module].
Definition: teo_ws.h:30
ssize_t(* send)(teoWSClass *kws, void *nc_p, int cmd, const char *to_peer_name, void *data, size_t data_length)
Send command to L0 server.
Definition: teo_ws.h:84
Websocket L0 connector map data.
Definition: teo_ws.h:104
const char data[]
Make it with: gcc -o post-callback post-callback.c -lcurl.
Definition: post-callback.c:23
File: teo_web.h Author: Kirill Scherba kirill@scherba.ru
Definition: teo_web.h:21
PblMap * map
Hash Map to store websocket clients.
Definition: teo_ws.h:22
teoWSClass * teoWSInit(ksnHTTPClass *kh)
This module label.
Definition: teo_ws.c:53
ksnHTTPClass * kh
Pointer to ksnHTTPClass.
Definition: teo_ws.h:21
struct teoWSmapData teoWSmapData
Websocket L0 connector map data.
ev_io w
L0 client watcher.
Definition: teo_ws.h:107
int(* processMsg)(teoWSClass *kws, void *nc_p, void *data, size_t data_length)
Process websocket message.
Definition: teo_ws.h:97
int(* handler)(teoWSClass *kws, int ev, void *nc_p, void *data, size_t data_length)
Teonet L0 websocket event handler.
Definition: teo_ws.h:69
Websocket L0 connector class data.
Definition: teo_ws.h:19
teoLNullConnectData * con
Pointer to L0 client connect data.
Definition: teo_ws.h:106