Teonet library  0.4.7
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
net_tcp.h
Go to the documentation of this file.
1 
10 #ifndef NET_TCP_H
11 #define NET_TCP_H
12 
13 #include <pbl.h>
14 //#include "ev_mgr.h"
15 //extern int total_clients; // Total number of connected clients
16 
20 typedef struct ksnTcpClass {
21 
22  void *ke;
23  PblMap *map;
24 
25 } ksnTcpClass;
26 
30 typedef struct ev_ksnet_io {
31  ev_io io;
32  void (*ksnet_cb) (struct ev_loop *loop, struct ev_ksnet_io *watcher, int revents, int fd);
33  void (*tcpServerAccept_cb) (struct ev_loop *loop, ev_io *w, int revents);
34  int fd;
35  int events;
36  void *data;
37  PblMap *clients_map;
38 } ev_ksnet_io;
39 
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 ksnTcpClass *ksnTcpInit(void *ke);
46 void ksnTcpDestroy(ksnTcpClass *kt);
47 
48 struct ev_io *ksnTcpCb(struct ev_loop *loop, ev_ksnet_io *w, int fd, void (*ksnet_read_cb)(struct ev_loop *loop, ev_io *watcher, int revents), void* data);
49 void ksnTcpCbStop(struct ev_loop *loop, ev_io *watcher, int close_flg, int remove_flg);
50 
51 int ksnTcpServerCreate(ksnTcpClass *kt, int port, void (*ksnet_cb) (struct ev_loop *loop, struct ev_ksnet_io *watcher, int revents, int fd), void *data, int *port_created);
52 void ksnTcpServerStop(ksnTcpClass *kt, int sd);
54 void ksnTcpServerStopAllClients(ksnTcpClass *kt, int sd);
55 int ksnTcpGetServer(ksnTcpClass *kt, int sd);
56 
57 int ksnTcpClientCreate(ksnTcpClass *kt, int port, const char *server);
58 
59 #ifdef __cplusplus
60 }
61 #endif
62 
63 #endif /* NET_TCP_H */
void(* tcpServerAccept_cb)(struct ev_loop *loop, ev_io *w, int revents)
Definition: net_tcp.h:33
void(* ksnet_cb)(struct ev_loop *loop, struct ev_ksnet_io *watcher, int revents, int fd)
Definition: net_tcp.h:32
struct ev_ksnet_io ev_ksnet_io
KSNet event io.
const char data[]
Make it with: gcc -o post-callback post-callback.c -lcurl.
Definition: post-callback.c:23
void ksnTcpServerStop(ksnTcpClass *kt, int sd)
ev_io io
Definition: net_tcp.h:31
int events
Definition: net_tcp.h:35
int ksnTcpClientCreate(ksnTcpClass *kt, int port, const char *server)
void ksnTcpDestroy(ksnTcpClass *kt)
int fd
Definition: net_tcp.h:34
void * ke
Pointer to ksnetEvMgrClass.
Definition: net_tcp.h:22
ksnTcpClass * ksnTcpInit(void *ke)
void ksnTcpServerStopAll(ksnTcpClass *kt)
#define ke
PblMap * map
Servers MAP.
Definition: net_tcp.h:23
PblMap * clients_map
TCP clients MAP.
Definition: net_tcp.h:37
struct ksnTcpClass ksnTcpClass
File: net_tcp.h Author: Kirill Scherba.
void ksnTcpServerStopAllClients(ksnTcpClass *kt, int sd)
void * data
Definition: net_tcp.h:36
void ksnTcpCbStop(struct ev_loop *loop, ev_io *watcher, int close_flg, int remove_flg)
ev_io w
Definition: teol0cli.c:23
int ksnTcpGetServer(ksnTcpClass *kt, int sd)
File: net_tcp.h Author: Kirill Scherba.
Definition: net_tcp.h:20
struct ev_io * ksnTcpCb(struct ev_loop *loop, ev_ksnet_io *w, int fd, void(*ksnet_read_cb)(struct ev_loop *loop, ev_io *watcher, int revents), void *data)
int ksnTcpServerCreate(ksnTcpClass *kt, int port, void(*ksnet_cb)(struct ev_loop *loop, struct ev_ksnet_io *watcher, int revents, int fd), void *data, int *port_created)
int fd
Definition: teol0cli.c:22
KSNet event io.
Definition: net_tcp.h:30