-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.h
45 lines (39 loc) · 1.12 KB
/
header.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
/******************************************
* HTTP Proxy
*
* File: header.h
* Date: 29 Dec 2011
* Author: Xiaomou Wang
* Email: [email protected]
* Description: contains required header files, constant definitions and auxiliary functions
*****************************************/
#ifndef http_sock_header
#define http_sock_header
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <typeinfo>
#include <iostream>
using namespace std;
// Use this buffer size whenever
// you want to open a buffer to store data.
const int BUFFER_SIZE = 1000000;
// The server should allow up to
// 10 concurrent connections.
const int MAX_CONCURRENT = 10;
// log error.
void error(char *msg);
// read from socket.
ssize_t read1(int fd, void *vptr, size_t n) throw (int);
// write to a socket.
ssize_t write1(int fd, void *vptr, size_t n) throw (int);
// get the address struct.
struct hostent* get_ipaddr(char *name, int connfd);
#endif http_sock_header