X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsocketengine.cpp;h=668335e6b17c0abcee8ed42a92415c7e23ab9efb;hb=b0e469b0bbdbc76692364e1f52ef613cc02a2a06;hp=4c164f31edeb05945cddc1a67a96b594a6b9d144;hpb=3a6885d6a1d30f6e2eb9b1fcd20e949768267318;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/socketengine.cpp b/src/socketengine.cpp index 4c164f31e..668335e6b 100644 --- a/src/socketengine.cpp +++ b/src/socketengine.cpp @@ -2,56 +2,52 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev. - * E-mail: - * - * + * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * See: http://www.inspircd.org/wiki/index.php/Credits * - * Written by Craig Edwards, Craig McLure, and others. * This program is free but copyrighted software; see * the file COPYING for details. * * --------------------------------------------------- */ -#include "inspircd_config.h" -#include "globals.h" #include "inspircd.h" -#ifdef USE_EPOLL -#include -#endif -#ifdef USE_KQUEUE -#include -#include -#include -#endif -#include -#include #include "socketengine.h" -#include "helperfuncs.h" -SocketEngine::SocketEngine() +int EventHandler::GetFd() { - printf("Something blew up in your face. class SocketEngine is an abstract class and configure must\n"); - printf("select a socket engine to derive from it such as EPollEngine, KQueueEngine or SelectEngine.\n"); - printf("Rerun configure, and try again.\n"); - exit(0); + return this->fd; } -SocketEngine::~SocketEngine() +void EventHandler::SetFd(int FD) { - log(DEBUG,"SocketEngine::~SocketEngine()"); + this->fd = FD; } -char SocketEngine::GetType(int fd) +bool EventHandler::Readable() +{ + return true; +} + +bool EventHandler::Writeable() +{ + return false; +} + +void SocketEngine::WantWrite(EventHandler* eh) +{ +} + +SocketEngine::SocketEngine(InspIRCd* Instance) : ServerInstance(Instance) +{ + memset(ref, 0, sizeof(ref)); +} + +SocketEngine::~SocketEngine() { - if ((fd < 0) || (fd > MAX_DESCRIPTORS)) - return X_EMPTY_SLOT; - /* Mask off the top bit used for 'read/write' state */ - return (ref[fd] & ~0x80); } -bool SocketEngine::AddFd(int fd, bool readable, char type) +bool SocketEngine::AddFd(EventHandler* eh) { return true; } @@ -60,10 +56,17 @@ bool SocketEngine::HasFd(int fd) { if ((fd < 0) || (fd > MAX_DESCRIPTORS)) return false; - return (ref[fd] != 0); + return ref[fd]; } -bool SocketEngine::DelFd(int fd) +EventHandler* SocketEngine::GetRef(int fd) +{ + if ((fd < 0) || (fd > MAX_DESCRIPTORS)) + return false; + return ref[fd]; +} + +bool SocketEngine::DelFd(EventHandler* eh, bool force) { return true; } @@ -78,7 +81,7 @@ int SocketEngine::GetRemainingFds() return 0; } -int SocketEngine::Wait(int* fdlist) +int SocketEngine::DispatchEvents() { return 0; } @@ -87,3 +90,4 @@ std::string SocketEngine::GetName() { return "misconfigured"; } +