-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsocket.h
37 lines (25 loc) · 985 Bytes
/
socket.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef __AC_DAT__SOCKET__H__
#define __AC_DAT__SOCKET__H__
#include <event2/bufferevent.h>
#include "thread.h"
typedef void (Handler)(struct bufferevent *bufferEvent, void *handlerContext);
struct socketInfo;
struct serverConfig;
struct server;
void socketJobHandler(void * restrict userData);
struct serverConfig *createServerConfig(
int backlog,
const struct timeval *clientTimeout,
const struct timeval *serverTimeout,
Handler *handler,
void *handlerData
);
void serverConfig_free(struct serverConfig *config);
struct server *createServer(const struct serverConfig *config, struct workerPool *pool);
void server_run(struct server *server, const struct socketInfo *socketInfo);
void server_stop(struct server *server);
void server_free(struct server *server);
struct socketInfo *createUnixSocketInfo(const char path[104]);
struct socketInfo *createTCPSocketInfo(int port);
void socketInfo_free(struct socketInfo *pointer);
#endif