-#include "socket.h"
-#include "socketengine.h"
-#include "wildcard.h"
-
-using namespace irc::sockets;
-
-/* Used when comparing CIDR masks for the modulus bits left over.
- * A lot of ircd's seem to do this:
- * ((-1) << (8 - (mask % 8)))
- * But imho, it sucks in comparison to a nice neat lookup table.
- */
-const unsigned char inverted_bits[8] = { 0x00, /* 00000000 - 0 bits - never actually used */
- 0x80, /* 10000000 - 1 bits */
- 0xC0, /* 11000000 - 2 bits */
- 0xE0, /* 11100000 - 3 bits */
- 0xF0, /* 11110000 - 4 bits */
- 0xF8, /* 11111000 - 5 bits */
- 0xFC, /* 11111100 - 6 bits */
- 0xFE /* 11111110 - 7 bits */
-};
-
-
-ListenSocket::ListenSocket(InspIRCd* Instance, int port, char* addr) : ServerInstance(Instance), desc("plaintext"), bind_addr(addr), bind_port(port)
-{
- this->SetFd(OpenTCPSocket(addr));
- if (this->GetFd() > -1)
- {
- if (!Instance->BindSocket(this->fd,port,addr))
- this->fd = -1;
-#ifdef IPV6
- if ((!*addr) || (strchr(addr,':')))
- this->family = AF_INET6;
- else
-#endif
- this->family = AF_INET;
- Instance->SE->AddFd(this);
- }
-}
-
-ListenSocket::~ListenSocket()
-{
- if (this->GetFd() > -1)
- {
- ServerInstance->SE->DelFd(this);
- ServerInstance->Logs->Log("SOCKET", DEBUG,"Shut down listener on fd %d", this->fd);
- if (ServerInstance->SE->Shutdown(this, 2) || ServerInstance->SE->Close(this))
- ServerInstance->Logs->Log("SOCKET", DEBUG,"Failed to cancel listener: %s", strerror(errno));
- this->fd = -1;
- }
-}
-