-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserver.h
48 lines (35 loc) · 900 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
/*
server.h - General Server Interface Definition
Author: Wenyu "Hearson" Zhang
E-mail: zhangw@purdue.edu
This file is a part of:
Project 3 - Building a HTTP Server
CS290 - System Programming, Fall 2010
Purdue University
For more information, please contact the author.
*/
#ifndef _SERVER_H_
#define _SERVER_H_
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include "service.h"
class Server {
public:
Server();
virtual ~Server();
void initialize(int port, Service *origService, int sizeOfService);
int startListen();
void stopListen();
int callServiceHandler(int sockfd, struct sockaddr_in clientIP);
// Interface functions
virtual int run() = 0;
protected:
int _port, _sizeOfService;
Service *_origService;
struct sockaddr_in _serverIP;
int _masterSocket;
bool _initialized;
};
#endif // _SERVER_H_