]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/socket.h
The IPV6 stuff compiles now, with compile-correct ipv6 code. I dont know if this...
[user/henk/code/inspircd.git] / include / socket.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
6  *                       E-mail:
7  *                <brain@chatspike.net>
8  *                <Craig@chatspike.net>
9  *     
10  * Written by Craig Edwards, Craig McLure, and others.
11  * This program is free but copyrighted software; see
12  *            the file COPYING for details.
13  *
14  * ---------------------------------------------------
15  */
16
17 #ifndef INSPIRCD_SOCKET_H
18 #define INSPIRCD_SOCKET_H
19
20 #include <arpa/inet.h>
21 #include <sys/time.h>
22 #include <sys/resource.h>
23 #include <sys/types.h>
24 #include <sys/socket.h>
25 #include <sys/stat.h>
26 #include <netinet/in.h>
27 #include <unistd.h>
28 #include <fcntl.h>
29 #include <poll.h>
30 #include <netdb.h>
31 #include <errno.h>
32
33 #include "inspircd_config.h"
34
35 /* macros to the relevant system address description structs */
36 #ifdef IPV6
37
38 typedef struct sockaddr_in6 insp_sockaddr;
39 typedef struct in6_addr     insp_inaddr;
40 #define AF_FAMILY AF_INET6
41
42 #else
43
44 typedef struct sockaddr_in  insp_sockaddr;
45 typedef struct in_addr      insp_inaddr;
46 #define AF_FAMILY AF_INET
47
48 #endif
49
50 const char* insp_ntoa(insp_inaddr n);
51 int insp_aton(const char* a, insp_inaddr* n);
52
53 int OpenTCPSocket(); 
54 bool BindSocket(int sockfd, insp_sockaddr client, insp_sockaddr server, int port, char* addr);
55 int BindPorts(bool bail);
56
57 #endif