]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Comments
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 17 Jun 2007 19:29:11 +0000 (19:29 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 17 Jun 2007 19:29:11 +0000 (19:29 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7382 e03df62e-2008-0410-955e-edbf42e46eb7

include/socket.h
include/socketengine.h
include/socketengine_iocp.h
include/socketengine_ports.h
include/timer.h
include/typedefs.h

index db0aa7f9258d16c45fe8915470d5c61024659515..57725b95fedc0edcc4168c73c3126e18b05b9c90 100644 (file)
 
 /* 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
 {
        /** This namespace contains various protocol-independent helper classes.
@@ -170,9 +177,13 @@ class CoreExport ListenSocket : public EventHandler
        /** The creator/owner of this object
         */
        InspIRCd* ServerInstance;
+       /** Socket description (shown in stats p) */
        std::string desc;
+       /** Socket address family */
        int family;
+       /** Address socket is bound to */
        std::string bind_addr;
+       /** Port socket is bound to */
        int bind_port;
  public:
        /** Create a new listening socket
@@ -190,17 +201,20 @@ class CoreExport ListenSocket : public EventHandler
        {
                desc = description;
        }
-
+       /** Get description for socket
+        */
        const std::string& GetDescription()
        {
                return desc;
        }
-
+       /** Get port number for socket
+        */
        int GetPort()
        {
                return bind_port;
        }
-
+       /** Get IP address socket is bound to
+        */
        std::string &GetIP()
        {
                return bind_addr;
@@ -208,3 +222,4 @@ class CoreExport ListenSocket : public EventHandler
 };
 
 #endif
+
index 330e3911c5f145c9786c6cc2f24ce32c4dbf3a54..ce701beff4a14ac3f510737ecc42bc19c2467987 100644 (file)
  */
 enum EventType
 {
+       /** Read event */
        EVENT_READ      =       0,
+       /** Write event */
        EVENT_WRITE     =       1,
+       /** Error event */
        EVENT_ERROR     =       2
 };
 
@@ -139,9 +142,13 @@ class CoreExport EventHandler : public Extensible
        /** Pointer to read event. We delete this so the buffer can't be used
         * after the socket is deleted, and so it doesn't leak memory
         */
-       void * m_readEvent;
-       void * m_writeEvent;
-       void * m_acceptEvent;
+       void* m_readEvent;
+       /** Pointer to a write event.
+        */
+       void* m_writeEvent;
+       /** Pointer to an accept event.
+        */
+       void* m_acceptEvent;
 
 #endif
 };
@@ -286,3 +293,4 @@ public:
 };
 
 #endif
+
index 5de7af03f25ee5fc807c1dcc6ffb1b07684d94e0..01c764088acdf0de3d474a19cdee94146db76afe 100644 (file)
 #include "inspircd.h"
 #include "socketengine.h"
 
+/** Socket overlapped event types
+ */
 enum SocketIOEvent
 {
+       /** Read ready */
        SOCKET_IO_EVENT_READ_READY                      = 0,
+       /** Write ready */
        SOCKET_IO_EVENT_WRITE_READY                     = 1,
+       /** Accept ready */
        SOCKET_IO_EVENT_ACCEPT                          = 2,
+       /** Error occured */
        SOCKET_IO_EVENT_ERROR                           = 3,
+       /** Number of events */
        NUM_SOCKET_IO_EVENTS                            = 4,
 };
 
+/** Represents a windows overlapped IO event
+ */
 class Overlapped
 {
  public:
+       /** Overlap event */
        OVERLAPPED m_overlap;
+       /** Type of event */
        SocketIOEvent m_event;
 #ifdef WIN64
+       /** Parameters */
        unsigned __int64 m_params;
 #else
+       /** Parameters */
        unsigned long m_params;
 #endif
-
+       /** Create an overlapped event
+        */
        Overlapped(SocketIOEvent ev, int params) : m_event(ev), m_params(params)
        {
                memset(&m_overlap, 0, sizeof(OVERLAPPED));
        }
 };
 
+/** Specific to UDP sockets with overlapped IO
+ */
 struct udp_overlap
 {
        unsigned char udp_buffer[600];
@@ -57,12 +73,16 @@ struct udp_overlap
        unsigned long udp_sockaddr_len;
 };
 
+/** Specific to accepting sockets with overlapped IO
+ */
 struct accept_overlap
 {
        int socket;
        char buf[1024];
 };
 
+/** Implementation of SocketEngine that implements windows IO Completion Ports
+ */
 class IOCPEngine : public SocketEngine
 {
        /** Creates a "fake" file descriptor for use with an IOCP socket.
@@ -192,10 +212,6 @@ public:
        udp_overlap * udp_ov;\r
 };
 
-//typedef void(*OpHandler)(EventHandler)
-/** Event Handler Array
- */
-
 /** Creates a SocketEngine
  */
 class SocketEngineFactory
index 84b57e3fd2ff3c1a79fd3c8cd54adcd4165ecb4b..a5951a138b6dd70245a775943ce9318cca0f7457 100644 (file)
 #include "inspircd.h"
 #include "socketengine.h"
 #include <port.h>
-#define EP_DELAY 5
 
 class InspIRCd;
 
-/** A specialisation of the SocketEngine class, designed to use linux 2.6 epoll().
+/** A specialisation of the SocketEngine class, designed to use solaris 10 I/O completion ports
  */
 class PortsEngine : public SocketEngine
 {
@@ -39,11 +38,11 @@ private:
         */
        port_event_t events[MAX_DESCRIPTORS];
 public:
-       /** Create a new EPollEngine
+       /** Create a new PortsEngine
         * @param Instance The creator of this object
         */
        PortsEngine(InspIRCd* Instance);
-       /** Delete an EPollEngine
+       /** Delete a PortsEngine
         */
        virtual ~PortsEngine();
        virtual bool AddFd(EventHandler* eh);
@@ -66,3 +65,4 @@ public:
 };
 
 #endif
+
index 3fb2ed32b9e56937fe76b448f0a7e96703f5f68b..ef8b82e31f64d728d662c35769af20842e162a9a 100644 (file)
@@ -153,3 +153,4 @@ class CoreExport TimerManager : public Extensible
 };
 
 #endif
+
index d59c6ad7f02aac7a54575bcf72f208bfefafc4e9..f101e161557a388edb3ab8aaba4a9cc54bdc974e 100644 (file)
 #include "globals.h"
 
 #ifndef WIN32
+/** User hash (POSIX systems with GCC)
+ */
 typedef nspace::hash_map<std::string, userrec*, nspace::hash<string>, irc::StrHashComp> user_hash;
+/** Channel hash (POSIX systems with GCC)
+ */
 typedef nspace::hash_map<std::string, chanrec*, nspace::hash<string>, irc::StrHashComp> chan_hash;
 #else
+/** User hash (windows systems with visual studio)
+ */
 typedef nspace::hash_map<std::string, userrec*, nspace::hash_compare<string, less<string> > > user_hash;
+/** Channel hash (windows systems with visual studio)
+ */
 typedef nspace::hash_map<std::string, chanrec*, nspace::hash_compare<string, less<string> > > chan_hash;
 #endif
 
+/** Server name cache
+ */
 typedef std::vector<std::string*> servernamelist;
+
+/** A cached text file stored line by line.
+ */
 typedef std::deque<std::string> file_cache;
 
 #endif
+