summaryrefslogtreecommitdiff
path: root/include/socket.h
blob: 89b5ca1a40399e6f6fd5fbd2abe4d3ffc94b4fc4 (plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
/*       +------------------------------------+
 *       | Inspire Internet Relay Chat Daemon |
 *       +------------------------------------+
 *
 *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
 *                       E-mail:
 *                <brain@chatspike.net>
 *           	  <Craig@chatspike.net>
 *     
 * Written by Craig Edwards, Craig McLure, and others.
 * This program is free but copyrighted software; see
 *            the file COPYING for details.
 *
 * ---------------------------------------------------
 */

#ifndef INSPIRCD_SOCKET_H
#define INSPIRCD_SOCKET_H

/* This is where we'll define wrappers for socket IO stuff, for neat winsock compatability */

#ifndef WIN32

#include <arpa/inet.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <unistd.h>
#include <fcntl.h>
#include <poll.h>
#include <netdb.h>
#include <errno.h>

#else

#include <windef.h>
#include <winsock2.h>
typedef int socklen_t;

#endif

#include "inspircd_config.h"

/* macros to the relevant system address description structs */
#ifdef IPV6

typedef struct sockaddr_in6 insp_sockaddr;
typedef struct in6_addr     insp_inaddr;

#else

typedef struct sockaddr_in  insp_sockaddr;
typedef struct in_addr      insp_inaddr;

#endif

int OpenTCPSocket(); 
bool BindSocket(int sockfd, insp_sockaddr client, insp_sockaddr server, int port, char* addr);
int BindPorts(bool bail);

#endif