From 3e67be8a5106c06c3a93cde2d068279a75c94f88 Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 24 Aug 2005 16:10:49 +0000 Subject: Changed comments git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1622 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/socketengine.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'include/socketengine.h') diff --git a/include/socketengine.h b/include/socketengine.h index c99ffa517..8c74ce044 100644 --- a/include/socketengine.h +++ b/include/socketengine.h @@ -1,3 +1,20 @@ +/* +------------------------------------+ + * | Inspire Internet Relay Chat Daemon | + * +------------------------------------+ + * + * Inspire is copyright (C) 2002-2005 ChatSpike-Dev. + * E-mail: + * + * + * + * Written by Craig Edwards, Craig McLure, and others. + * This program is free but copyrighted software; see + * the file COPYING for details. + * + * --------------------------------------------------- + */ + +// Fill the engine with client file descriptors pending an action #define epoll_fill int i = epoll_wait(ep, event, 1, 5); \ if (i > 0) \ @@ -33,6 +50,8 @@ #define engine_fill select_fill #endif +// how to determine if a socket needs attention if further checks are needed + #define epoll_check ((cu->fd != FD_MAGIC_NUMBER) && (cu->fd != -1)) #define kqueue_check ((cu->fd != FD_MAGIC_NUMBER) && (cu->fd != -1)) @@ -49,6 +68,8 @@ #define engine_check select_check #endif +// how to clean up an exiting client + #define epoll_cleanup log(DEBUG,"InspIRCd: Exited: %s",cu->nick); \ kill_link(cu,"Client exited"); \ log(DEBUG,"Bailing from client exit"); \ @@ -78,6 +99,8 @@ #endif +// how to scan the set for fd's requiring action + #define select_scanset for (count = 0; count < boundPortCount; count++) \ { \ FD_SET (openSockfd[count], &selectFds); \ @@ -121,6 +144,8 @@ #define engine_scanset select_scanset #endif +// how to populate the list with fds before asking for change notification + #define epoll_server_populate i = epoll_wait(sep, event, 1, EP_DELAY); \ if (i > 0) \ { \ @@ -167,6 +192,8 @@ #define engine_server_populate select_server_populate #endif +// a list of variables used specifically by this engine + #define kqueue_structs struct kevent ke; \ struct kevent ke_list[33]; \ struct timespec ts; @@ -186,6 +213,8 @@ #define engine_structs select_structs #endif +// how to initialise the engine before using it + #define select_init while(0); #define kqueue_init kq = kqueue(); \ @@ -219,6 +248,8 @@ #define engine_init select_init #endif +// how to fill the engine with a list of server fd's + #define select_server_fill log(DEFAULT,"Using standard select socket engine."); #define epoll_server_fill log(DEFAULT,"epoll socket engine is enabled. Filling listen list. boundPortcount=%d",boundPortCount); \ @@ -292,6 +323,7 @@ #define engine_server_fill select_server_fill #endif +// how to delete a client fd from the engine #define kqueue_delete_fd struct kevent ke; \ EV_SET(&ke, user->fd, EVFILT_READ, EV_DELETE, 0, 0, NULL); \ @@ -323,6 +355,8 @@ #define engine_delete_fd select_delete_fd #endif +// how to add a client fd to the engine + #define select_add_fd while(0); #define epoll_add_fd struct epoll_event ev; \ @@ -354,6 +388,8 @@ #define engine_add_fd select_add_fd #endif +// what is this engine called? + #ifdef USE_KQUEUE #define engine_name "kqueue" #endif -- cgit v1.2.3