summaryrefslogtreecommitdiff
path: root/src/socketengine.cpp
diff options
context:
space:
mode:
authorburlex <burlex@e03df62e-2008-0410-955e-edbf42e46eb7>2007-09-04 12:36:05 +0000
committerburlex <burlex@e03df62e-2008-0410-955e-edbf42e46eb7>2007-09-04 12:36:05 +0000
commite51c8a5cf66d1d3eb475b967f99587b5a59ca442 (patch)
treee886e012e37b99a8d107a5ec1caf37e5f01fa537 /src/socketengine.cpp
parent4c83624ed825ca123401a45c8d2844ba6453a85b (diff)
* Fixed some incorrect declarations in IOCPEngine
* Fixed the virtual socket wrapper functions in IOCPEngine {these should really be inlined on unix} * Fixed several compilation issues under Win32 * Fixed calls to close() which should've been changed to SE->Close() + Added a crashdump saving system to Win32 builds. Dumps are saved in the format of dump-<exename>-<year>-<month>-<day>-<hour>-<minute>-<second>.dmp in the working directory. Enabled by default, undefine ENABLE_CRASHDUMPS to disable. + Added m_operflood, this is a module I've had lying around for some time but some users may like it as it allows unreal-like behaviour without increasing flood limits for non-opers. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8015 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/socketengine.cpp')
-rw-r--r--src/socketengine.cpp63
1 files changed, 37 insertions, 26 deletions
diff --git a/src/socketengine.cpp b/src/socketengine.cpp
index d8291073e..3e4fc7815 100644
--- a/src/socketengine.cpp
+++ b/src/socketengine.cpp
@@ -100,6 +100,17 @@ bool SocketEngine::BoundsCheckFd(EventHandler* eh)
return true;
}
+#ifdef WINDOWS
+
+int SocketEngine::Accept(EventHandler* fd, sockaddr *addr, socklen_t *addrlen) { return -1; }
+int SocketEngine::Close(int fd) { return -1; }
+int SocketEngine::Close(EventHandler* fd) { return -1; }
+int SocketEngine::Blocking(int fd) { return -1; }
+int SocketEngine::NonBlocking(int fd) { return -1; }
+int SocketEngine::GetSockName(EventHandler* fd, sockaddr *name, socklen_t* namelen) { return -1; }
+int SocketEngine::RecvFrom(EventHandler* fd, void *buf, size_t len, int flags, sockaddr *from, socklen_t *fromlen) { return -1; }
+
+#else
int SocketEngine::Accept(EventHandler* fd, sockaddr *addr, socklen_t *addrlen)
{
@@ -111,14 +122,26 @@ int SocketEngine::Close(EventHandler* fd)
return close(fd->GetFd());
}
-int SocketEngine::Send(EventHandler* fd, const void *buf, size_t len, int flags)
+int SocketEngine::Close(int fd)
{
- return send(fd->GetFd(), buf, len, flags);
+ return close(fd);
}
-int SocketEngine::Recv(EventHandler* fd, void *buf, size_t len, int flags)
+int SocketEngine::Blocking(int fd)
+{
+ int flags = fcntl(fd, F_GETFL, 0);
+ return fcntl(fd, F_SETFL, flags ^ O_NONBLOCK);
+}
+
+int SocketEngine::NonBlocking(int fd)
+{
+ int flags = fcntl(fd, F_GETFL, 0);
+ return fcntl(fd, F_SETFL, flags | O_NONBLOCK);
+}
+
+int SocketEngine::GetSockName(EventHandler* fd, sockaddr *name, socklen_t* namelen)
{
- return recv(fd->GetFd(), buf, len, flags);
+ return getsockname(fd->GetFd(), name, namelen);
}
int SocketEngine::RecvFrom(EventHandler* fd, void *buf, size_t len, int flags, sockaddr *from, socklen_t *fromlen)
@@ -126,26 +149,26 @@ int SocketEngine::RecvFrom(EventHandler* fd, void *buf, size_t len, int flags, s
return recvfrom(fd->GetFd(), buf, len, flags, from, fromlen);
}
-int SocketEngine::SendTo(EventHandler* fd, const void *buf, size_t len, int flags, const sockaddr *to, socklen_t tolen)
+#endif
+
+int SocketEngine::Send(EventHandler* fd, const void *buf, size_t len, int flags)
{
- return sendto(fd->GetFd(), buf, len, flags, to, tolen);
+ return send(fd->GetFd(), (const char*)buf, len, flags);
}
-int SocketEngine::Connect(EventHandler* fd, const sockaddr *serv_addr, socklen_t addrlen)
+int SocketEngine::Recv(EventHandler* fd, void *buf, size_t len, int flags)
{
- return connect(fd->GetFd(), serv_addr, addrlen);
+ return recv(fd->GetFd(), (char*)buf, len, flags);
}
-int SocketEngine::Blocking(int fd)
+int SocketEngine::SendTo(EventHandler* fd, const void *buf, size_t len, int flags, const sockaddr *to, socklen_t tolen)
{
- int flags = fcntl(fd, F_GETFL, 0);
- return fcntl(fd, F_SETFL, flags ^ O_NONBLOCK);
+ return sendto(fd->GetFd(), (const char*)buf, len, flags, to, tolen);
}
-int SocketEngine::NonBlocking(int fd)
+int SocketEngine::Connect(EventHandler* fd, const sockaddr *serv_addr, socklen_t addrlen)
{
- int flags = fcntl(fd, F_GETFL, 0);
- return fcntl(fd, F_SETFL, flags | O_NONBLOCK);
+ return connect(fd->GetFd(), serv_addr, addrlen);
}
int SocketEngine::Shutdown(EventHandler* fd, int how)
@@ -153,33 +176,21 @@ int SocketEngine::Shutdown(EventHandler* fd, int how)
return shutdown(fd->GetFd(), how);
}
-
int SocketEngine::Bind(int fd, const sockaddr *my_addr, socklen_t addrlen)
{
return bind(fd, my_addr, addrlen);
}
-int SocketEngine::GetSockName(EventHandler* fd, sockaddr *name, socklen_t* namelen)
-{
- return getsockname(fd->GetFd(), name, namelen);
-}
-
int SocketEngine::Listen(int sockfd, int backlog)
{
return listen(sockfd, backlog);
}
-
int SocketEngine::Shutdown(int fd, int how)
{
return shutdown(fd, how);
}
-int SocketEngine::Close(int fd)
-{
- return close(fd);
-}
-
void SocketEngine::RecoverFromFork()
{
}