-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserver.h
52 lines (33 loc) · 848 Bytes
/
server.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef CS_SOCKET_SERVER
#define CS_SOCKET_SERVER
#include "common.h"
#define MAX_CLIENT 255
struct ConnInfo
{
struct Server* server;
int clientFD;
int clientID;
pthread_t thread;
};
struct Server{
int mainFD;
pthread_t sekreterThread;
void* (*OnNewClient)(void *connInfo);
int isRunning;
int lastClientID;
struct ConnInfo* conns[MAX_CLIENT];
};
typedef struct ConnInfo ConnInfo;
typedef struct Server Server;
Server* createTCPServer(int port);
void startSekreter(Server* server);
void closeServer(Server*);
ConnInfo* getConnInfo(Server* server, int clientID);
void addConnInfo(Server* server, ConnInfo* connInfo);
void removeConnInfo(Server* server, int clientID);
/* ftp spesific */
void* ElciThread (void* connInfo);
/* private funcs */
int acceptNewClient(int socketFd);
void* SekreterThread( void* server );
#endif