diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/socket.h | 27 | ||||
-rw-r--r-- | include/socketengine.h | 32 | ||||
-rw-r--r-- | include/socketengine_iocp.h | 12 | ||||
-rw-r--r-- | include/socketengine_kqueue.h | 1 |
4 files changed, 44 insertions, 28 deletions
diff --git a/include/socket.h b/include/socket.h index 57725b95f..861acc1f1 100644 --- a/include/socket.h +++ b/include/socket.h @@ -37,23 +37,6 @@ #include "inspircd_config.h" #include "socketengine.h" -/* Accept Define */ -#ifdef CONFIG_USE_IOCP -/* IOCP wrapper for accept() */ -#define _accept(s, addr, addrlen) __accept_socket(s, addr, addrlen, m_acceptEvent) -/* IOCP wrapper for getsockname() */ -#define _getsockname(fd, sockptr, socklen) __getsockname(fd, sockptr, socklen, m_acceptEvent) -/* IOCP wrapper for recvfrom() */ -#define _recvfrom(s, buf, len, flags, from, fromlen) __recvfrom(s, buf, len, flags, from, fromlen, ((IOCPEngine*)ServerInstance->SE)->udp_ov) -#else -/* No wrapper for recvfrom() */ -#define _recvfrom recvfrom -/* No wrapper for accept() */ -#define _accept accept -/* No wrapper for getsockname() */ -#define _getsockname getsockname -#endif - /* Contains irc-specific definitions */ namespace irc { @@ -148,16 +131,6 @@ namespace irc */ CoreExport int insp_aton(const char* a, insp_inaddr* n); - /** Make a socket file descriptor a blocking socket - * @param s A valid file descriptor - */ - CoreExport void Blocking(int s); - - /** Make a socket file descriptor into a nonblocking socket - * @param s A valid file descriptor - */ - CoreExport void NonBlocking(int s); - /** Create a new valid file descriptor using socket() * @return On return this function will return a value >= 0 for success, * or a negative value upon failure (negative values are invalid file diff --git a/include/socketengine.h b/include/socketengine.h index e502a8c04..46a267fb1 100644 --- a/include/socketengine.h +++ b/include/socketengine.h @@ -277,6 +277,38 @@ public: * which can be handled by the socket engine. */ virtual bool BoundsCheckFd(EventHandler* eh); + + virtual int Accept(EventHandler* fd, sockaddr *addr, socklen_t *addrlen); + + virtual int Close(EventHandler* fd); + + virtual int Close(int fd); + + virtual int Send(EventHandler* fd, const void *buf, size_t len, int flags); + + virtual int Recv(EventHandler* fd, void *buf, size_t len, int flags); + + virtual int RecvFrom(EventHandler* fd, void *buf, size_t len, int flags, sockaddr *from, socklen_t *fromlen); + + virtual int SendTo(EventHandler* fd, const void *buf, size_t len, int flags, const sockaddr *to, socklen_t tolen); + + virtual int Connect(EventHandler* fd, const sockaddr *serv_addr, socklen_t addrlen); + + virtual int Blocking(int fd); + + virtual int NonBlocking(int fd); + + virtual int Shutdown(EventHandler* fd, int how); + + virtual int Shutdown(int fd, int how); + + virtual int Bind(int fd, const sockaddr *my_addr, socklen_t addrlen); + + virtual int Listen(int sockfd, int backlog); + + virtual int GetSockName(EventHandler* fd, sockaddr *name, socklen_t* namelen); + + virtual void RecoverFromFork(); }; #endif diff --git a/include/socketengine_iocp.h b/include/socketengine_iocp.h index ad3e58157..e45f8e726 100644 --- a/include/socketengine_iocp.h +++ b/include/socketengine_iocp.h @@ -6,7 +6,7 @@ * See: http://www.inspircd.org/wiki/index.php/Credits * * This program is free but copyrighted software; see - * the file COPYING for details. + * the file COPYING for details. * * --------------------------------------------------- */ @@ -212,6 +212,16 @@ public: EventHandler* GetIntRef(int fd); bool BoundsCheckFd(EventHandler* eh); + + virtual int Accept(EventHandler* fd, sockaddr *addr, socklen_t *addrlen); + + virtual int RecvFrom(EventHandler* fd, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen); + + virtual int Blocking(int fd); + + virtual int NonBlocking(int fd); + + virtual int GetSockName(EventHandler* fd, sockaddr *name, socklen_t* name); }; /** Creates a SocketEngine diff --git a/include/socketengine_kqueue.h b/include/socketengine_kqueue.h index e7413d4bb..c34075cd2 100644 --- a/include/socketengine_kqueue.h +++ b/include/socketengine_kqueue.h @@ -53,6 +53,7 @@ public: virtual int DispatchEvents(); virtual std::string GetName(); virtual void WantWrite(EventHandler* eh); + virtual void RecoverFromFork(); }; /** Creates a SocketEngine |