forked from dileepramesh/Reliable-UDP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.h
51 lines (42 loc) · 1.28 KB
/
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
/*
* server.h - Private header for the server program
*
* October 2012
*/
#ifndef SERVER_H
#define SERVER_H
#include "./unpv13e_solaris2.10/lib/unp.h"
#include "./unpv13e_solaris2.10/lib/unpifi.h"
/* Defines */
#define SERVER_INPUT "server.in"
#define MAX_CONNECTIONS 100 /* Maximum number of interfaces */
#define MAX_CLIENTS 100 /* Maximum number of clients */
#define IFNAME_LEN 16 /* Same as IFI_NAME in unpifi.h */
#define IP_LEN 16
#define LOCALHOST_IP "127.0.0.1"
#define FILE_CHUNK_SIZE (1024 * 1024)
#define MAX_BUFFER_SIZE (1024 * 1024)
/* Datastructures */
typedef struct cli_info_s {
char ip[IP_LEN];
int port;
int connection_sock;
int connection_port;
int pid;
int valid;
} cli_info_t;
typedef struct conn_info_s {
char ifname[IFNAME_LEN];
int sock;
struct sockaddr_in ip;
struct sockaddr_in netmask;
struct sockaddr_in subnet;
} conn_info_t;
typedef struct server_params_s {
int port;
conn_info_t conn[MAX_CONNECTIONS];
cli_info_t cli_info[MAX_CLIENTS];
int conn_count;
int cli_count;
} server_params_t;
#endif /* SERVER_H */