X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fsocket.h;h=4387797df0c350ad638729f083d46a41d27d785b;hb=40b67389a9ac1ef3f37ce93dd95e76c474edd511;hp=3e681f1c4b27b4fde7e2fa428e26cfcb30cfad4b;hpb=d066a23b4d2904717e3b5099dd02d25f7fd9d07a;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/socket.h b/include/socket.h index 3e681f1c4..4387797df 100644 --- a/include/socket.h +++ b/include/socket.h @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * Inspire is copyright (C) 2002-2004 ChatSpike-Dev. + * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev. * E-mail: * * @@ -14,25 +14,39 @@ * --------------------------------------------------- */ -#include -#include - -enum InspSocketState { I_DISCONNECTED, I_CONNECTING, I_CONNECTED, I_LISTENING }; - -class InspSocket -{ -private: - int fd; - std::string host; - int port; - InspSocketState state; -public: - InspSocket(); - InspSocket(std::string host, int port, bool listening); - void Poll(); - virtual int OnConnected(); - virtual int OnError(); - virtual int OnDisconnect(); - virtual int OnIncomingConnection(); - ~InspSocket(); -}; +#ifndef INSPIRCD_SOCKET_H +#define INSPIRCD_SOCKET_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#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