diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-14 16:07:04 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-14 16:07:04 +0000 |
commit | 48e477893fdc3cd87b46e445b1e3e2d1395c4b94 (patch) | |
tree | b693bc8ebdc16392728bb7767bb0fc3da8d07701 /docs/man/man3 | |
parent | 997ba7e5be054e9927acec538c5c04a15482b941 (diff) |
Removed depreciated docs
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2420 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'docs/man/man3')
-rw-r--r-- | docs/man/man3/ConfigReader.3 | 270 | ||||
-rw-r--r-- | docs/man/man3/FileReader.3 | 82 | ||||
-rw-r--r-- | docs/man/man3/ModuleFactory.3 | 10 | ||||
-rw-r--r-- | docs/man/man3/Server.3 | 694 | ||||
-rw-r--r-- | docs/man/man3/ServerConfig.3 | 214 | ||||
-rw-r--r-- | docs/man/man3/channels.cpp.3 | 2 | ||||
-rw-r--r-- | docs/man/man3/inspircd_io.h.3 | 4 | ||||
-rw-r--r-- | docs/man/man3/ircd_connector.3 | 487 | ||||
-rw-r--r-- | docs/man/man3/modules.cpp.3 | 2 | ||||
-rw-r--r-- | docs/man/man3/modules.h.3 | 10 | ||||
-rw-r--r-- | docs/man/man3/serverrec.3 | 733 | ||||
-rw-r--r-- | docs/man/man3/servers.cpp.3 | 150 | ||||
-rw-r--r-- | docs/man/man3/servers.h.3 | 46 |
13 files changed, 724 insertions, 1980 deletions
diff --git a/docs/man/man3/ConfigReader.3 b/docs/man/man3/ConfigReader.3 index 009733cae..f0236bfe9 100644 --- a/docs/man/man3/ConfigReader.3 +++ b/docs/man/man3/ConfigReader.3 @@ -84,7 +84,7 @@ Allows reading of values from configuration files This class allows a module to It may either be instantiated with one parameter or none. Constructing the class using one parameter allows you to specify a path to your own configuration file, otherwise, inspircd.conf is read. .PP -Definition at line 1525 of file modules.h. +Definition at line 1529 of file modules.h. .SH "Constructor & Destructor Documentation" .PP .SS "ConfigReader::ConfigReader ()" @@ -93,19 +93,19 @@ Default constructor. .PP This constructor initialises the ConfigReader class to read the inspircd.conf file as specified when running ./configure. .PP -Definition at line 734 of file modules.cpp. +Definition at line 739 of file modules.cpp. .PP References cache, ServerConfig::ClearStack(), CONF_FILE_NOT_FOUND, error, errorlog, ServerConfig::LoadConf(), and readerror. .PP .nf -735 { -736 Config->ClearStack(); -737 this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out); -738 this->errorlog = new std::stringstream(std::stringstream::in | std::stringstream::out); -739 this->readerror = Config->LoadConf(CONFIG_FILE,this->cache,this->errorlog); -740 if (!this->readerror) -741 this->error = CONF_FILE_NOT_FOUND; -742 } +740 { +741 Config->ClearStack(); +742 this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out); +743 this->errorlog = new std::stringstream(std::stringstream::in | std::stringstream::out); +744 this->readerror = Config->LoadConf(CONFIG_FILE,this->cache,this->errorlog); +745 if (!this->readerror) +746 this->error = CONF_FILE_NOT_FOUND; +747 } .fi .PP .SS "ConfigReader::ConfigReader (\fBstd::string\fP filename)" @@ -114,19 +114,19 @@ Overloaded constructor. .PP This constructor initialises the ConfigReader class to read a user-specified config file .PP -Definition at line 754 of file modules.cpp. +Definition at line 759 of file modules.cpp. .PP References cache, ServerConfig::ClearStack(), CONF_FILE_NOT_FOUND, error, errorlog, ServerConfig::LoadConf(), and readerror. .PP .nf -755 { -756 Config->ClearStack(); -757 this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out); -758 this->errorlog = new std::stringstream(std::stringstream::in | std::stringstream::out); -759 this->readerror = Config->LoadConf(filename.c_str(),this->cache,this->errorlog); -760 if (!this->readerror) -761 this->error = CONF_FILE_NOT_FOUND; -762 }; +760 { +761 Config->ClearStack(); +762 this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out); +763 this->errorlog = new std::stringstream(std::stringstream::in | std::stringstream::out); +764 this->readerror = Config->LoadConf(filename.c_str(),this->cache,this->errorlog); +765 if (!this->readerror) +766 this->error = CONF_FILE_NOT_FOUND; +767 }; .fi .PP .SS "ConfigReader::~ConfigReader ()" @@ -135,17 +135,17 @@ Default destructor. .PP This method destroys the ConfigReader class. .PP -Definition at line 745 of file modules.cpp. +Definition at line 750 of file modules.cpp. .PP References cache, and errorlog. .PP .nf -746 { -747 if (this->cache) -748 delete this->cache; -749 if (this->errorlog) -750 delete this->errorlog; -751 } +751 { +752 if (this->cache) +753 delete this->cache; +754 if (this->errorlog) +755 delete this->errorlog; +756 } .fi .PP .SH "Member Function Documentation" @@ -156,41 +156,41 @@ Dumps the list of errors in a config file to an output location. .PP If bail is true, then the program will abort. If bail is false and user points to a valid user record, the error report will be spooled to the given user by means of NOTICE. if bool is false AND user is false, the error report will be spooled to all opers by means of a NOTICE to all opers. .PP -Definition at line 833 of file modules.cpp. +Definition at line 838 of file modules.cpp. .PP References errorlog, connection::fd, and userrec::nick. .PP .nf -834 { -835 if (bail) -836 { -837 printf('There were errors in your configuration:\n%s',errorlog->str().c_str()); -838 exit(0); -839 } -840 else +839 { +840 if (bail) 841 { -842 char dataline[1024]; -843 if (user) -844 { -845 WriteServ(user->fd,'NOTICE %s :There were errors in the configuration file:',user->nick); -846 while (!errorlog->eof()) -847 { -848 errorlog->getline(dataline,1024); -849 WriteServ(user->fd,'NOTICE %s :%s',user->nick,dataline); -850 } -851 } -852 else -853 { -854 WriteOpers('There were errors in the configuration file:',user->nick); -855 while (!errorlog->eof()) -856 { -857 errorlog->getline(dataline,1024); -858 WriteOpers(dataline); -859 } -860 } -861 return; -862 } -863 } +842 printf('There were errors in your configuration:\n%s',errorlog->str().c_str()); +843 exit(0); +844 } +845 else +846 { +847 char dataline[1024]; +848 if (user) +849 { +850 WriteServ(user->fd,'NOTICE %s :There were errors in the configuration file:',user->nick); +851 while (!errorlog->eof()) +852 { +853 errorlog->getline(dataline,1024); +854 WriteServ(user->fd,'NOTICE %s :%s',user->nick,dataline); +855 } +856 } +857 else +858 { +859 WriteOpers('There were errors in the configuration file:',user->nick); +860 while (!errorlog->eof()) +861 { +862 errorlog->getline(dataline,1024); +863 WriteOpers(dataline); +864 } +865 } +866 return; +867 } +868 } .fi .PP .SS "int ConfigReader::Enumerate (\fBstd::string\fP tag)" @@ -199,14 +199,14 @@ Counts the number of times a given tag appears in the config file. .PP This method counts the number of times a tag appears in a config file, for use where there are several tags of the same kind, e.g. with opers and connect types. It can be used with the index value of \fBConfigReader::ReadValue\fP to loop through all copies of a multiple instance tag. .PP -Definition at line 866 of file modules.cpp. +Definition at line 871 of file modules.cpp. .PP References cache, and ServerConfig::EnumConf(). .PP .nf -867 { -868 return Config->EnumConf(cache,tag.c_str()); -869 } +872 { +873 return Config->EnumConf(cache,tag.c_str()); +874 } .fi .PP .SS "int ConfigReader::EnumerateValues (\fBstd::string\fP tag, int index)" @@ -215,14 +215,14 @@ Returns the number of items within a tag. .PP For example if the tag was <test tag='blah' data='foo'> then this function would return 2. Spaces and newlines both qualify as valid seperators between values. .PP -Definition at line 871 of file modules.cpp. +Definition at line 876 of file modules.cpp. .PP References cache, and ServerConfig::EnumValues(). .PP .nf -872 { -873 return Config->EnumValues(cache, tag.c_str(), index); -874 } +877 { +878 return Config->EnumValues(cache, tag.c_str(), index); +879 } .fi .PP .SS "long ConfigReader::GetError ()" @@ -231,16 +231,16 @@ Returns the last error to occur. .PP Valid errors can be found by looking in \fBmodules.h\fP. Any nonzero value indicates an error condition. A call to \fBGetError()\fP resets the error flag back to 0. .PP -Definition at line 826 of file modules.cpp. +Definition at line 831 of file modules.cpp. .PP References error. .PP .nf -827 { -828 long olderr = this->error; -829 this->error = 0; -830 return olderr; -831 } +832 { +833 long olderr = this->error; +834 this->error = 0; +835 return olderr; +836 } .fi .PP .SS "bool ConfigReader::ReadFlag (\fBstd::string\fP tag, \fBstd::string\fP name, int index)" @@ -249,26 +249,26 @@ Retrieves a boolean value from the config file. .PP This method retrieves a boolean value from the config file. Where multiple copies of the tag exist in the config file, index indicates which of the values to retrieve. The values '1', 'yes' and 'true' in the config file count as true to ReadFlag, and any other value counts as false. .PP -Definition at line 780 of file modules.cpp. +Definition at line 785 of file modules.cpp. .PP References cache, CONF_VALUE_NOT_FOUND, error, and ServerConfig::ReadConf(). .PP .nf -781 { -782 char val[MAXBUF]; -783 char t[MAXBUF]; -784 char n[MAXBUF]; -785 strlcpy(t,tag.c_str(),MAXBUF); -786 strlcpy(n,name.c_str(),MAXBUF); -787 int res = Config->ReadConf(cache,t,n,index,val); -788 if (!res) -789 { -790 this->error = CONF_VALUE_NOT_FOUND; -791 return false; -792 } -793 std::string s = val; -794 return ((s == 'yes') || (s == 'YES') || (s == 'true') || (s == 'TRUE') || (s == '1')); -795 } +786 { +787 char val[MAXBUF]; +788 char t[MAXBUF]; +789 char n[MAXBUF]; +790 strlcpy(t,tag.c_str(),MAXBUF); +791 strlcpy(n,name.c_str(),MAXBUF); +792 int res = Config->ReadConf(cache,t,n,index,val); +793 if (!res) +794 { +795 this->error = CONF_VALUE_NOT_FOUND; +796 return false; +797 } +798 std::string s = val; +799 return ((s == 'yes') || (s == 'YES') || (s == 'true') || (s == 'TRUE') || (s == '1')); +800 } .fi .PP .SS "long ConfigReader::ReadInteger (\fBstd::string\fP tag, \fBstd::string\fP name, int index, bool needs_unsigned)" @@ -277,38 +277,38 @@ Retrieves an integer value from the config file. .PP This method retrieves an integer value from the config file. Where multiple copies of the tag exist in the config file, index indicates which of the values to retrieve. Any invalid integer values in the tag will cause the objects error value to be set, and any call to \fBGetError()\fP will return CONF_INVALID_NUMBER to be returned. needs_unsigned is set if the number must be unsigned. If a signed number is placed into a tag which is specified unsigned, 0 will be returned and \fBGetError()\fP will return CONF_NOT_UNSIGNED .PP -Definition at line 797 of file modules.cpp. +Definition at line 802 of file modules.cpp. .PP References cache, CONF_NOT_A_NUMBER, CONF_NOT_UNSIGNED, CONF_VALUE_NOT_FOUND, error, and ServerConfig::ReadConf(). .PP .nf -798 { -799 char val[MAXBUF]; -800 char t[MAXBUF]; -801 char n[MAXBUF]; -802 strlcpy(t,tag.c_str(),MAXBUF); -803 strlcpy(n,name.c_str(),MAXBUF); -804 int res = Config->ReadConf(cache,t,n,index,val); -805 if (!res) -806 { -807 this->error = CONF_VALUE_NOT_FOUND; -808 return 0; -809 } -810 for (unsigned int i = 0; i < strlen(val); i++) +803 { +804 char val[MAXBUF]; +805 char t[MAXBUF]; +806 char n[MAXBUF]; +807 strlcpy(t,tag.c_str(),MAXBUF); +808 strlcpy(n,name.c_str(),MAXBUF); +809 int res = Config->ReadConf(cache,t,n,index,val); +810 if (!res) 811 { -812 if (!isdigit(val[i])) -813 { -814 this->error = CONF_NOT_A_NUMBER; -815 return 0; -816 } -817 } -818 if ((needs_unsigned) && (atoi(val)<0)) -819 { -820 this->error = CONF_NOT_UNSIGNED; -821 return 0; +812 this->error = CONF_VALUE_NOT_FOUND; +813 return 0; +814 } +815 for (unsigned int i = 0; i < strlen(val); i++) +816 { +817 if (!isdigit(val[i])) +818 { +819 this->error = CONF_NOT_A_NUMBER; +820 return 0; +821 } 822 } -823 return atoi(val); -824 } +823 if ((needs_unsigned) && (atoi(val)<0)) +824 { +825 this->error = CONF_NOT_UNSIGNED; +826 return 0; +827 } +828 return atoi(val); +829 } .fi .PP .SS "\fBstd::string\fP ConfigReader::ReadValue (\fBstd::string\fP tag, \fBstd::string\fP name, int index)" @@ -317,25 +317,25 @@ Retrieves a value from the config file. .PP This method retrieves a value from the config file. Where multiple copies of the tag exist in the config file, index indicates which of the values to retrieve. .PP -Definition at line 764 of file modules.cpp. +Definition at line 769 of file modules.cpp. .PP References cache, CONF_VALUE_NOT_FOUND, error, and ServerConfig::ReadConf(). .PP .nf -765 { -766 char val[MAXBUF]; -767 char t[MAXBUF]; -768 char n[MAXBUF]; -769 strlcpy(t,tag.c_str(),MAXBUF); -770 strlcpy(n,name.c_str(),MAXBUF); -771 int res = Config->ReadConf(cache,t,n,index,val); -772 if (!res) -773 { -774 this->error = CONF_VALUE_NOT_FOUND; -775 return ''; -776 } -777 return val; -778 } +770 { +771 char val[MAXBUF]; +772 char t[MAXBUF]; +773 char n[MAXBUF]; +774 strlcpy(t,tag.c_str(),MAXBUF); +775 strlcpy(n,name.c_str(),MAXBUF); +776 int res = Config->ReadConf(cache,t,n,index,val); +777 if (!res) +778 { +779 this->error = CONF_VALUE_NOT_FOUND; +780 return ''; +781 } +782 return val; +783 } .fi .PP .SS "bool ConfigReader::Verify ()" @@ -344,14 +344,14 @@ Returns true if a config file is valid. .PP This method is partially implemented and will only return false if the config file does not exist or could not be opened. .PP -Definition at line 876 of file modules.cpp. +Definition at line 881 of file modules.cpp. .PP References readerror. .PP .nf -877 { -878 return this->readerror; -879 } +882 { +883 return this->readerror; +884 } .fi .PP .SH "Member Data Documentation" @@ -362,24 +362,24 @@ The contents of the configuration file This protected member should never be acc .PP It will contain a pointer to the configuration file data with unneeded data (such as comments) stripped from it. .PP -Definition at line 1533 of file modules.h. +Definition at line 1537 of file modules.h. .PP Referenced by ConfigReader(), Enumerate(), EnumerateValues(), ReadFlag(), ReadInteger(), ReadValue(), and ~ConfigReader(). .SS "long \fBConfigReader::error\fP\fC [protected]\fP" .PP -Definition at line 1538 of file modules.h. +Definition at line 1542 of file modules.h. .PP Referenced by ConfigReader(), GetError(), ReadFlag(), ReadInteger(), and ReadValue(). .SS "std::stringstream* \fBConfigReader::errorlog\fP\fC [protected]\fP" .PP -Definition at line 1534 of file modules.h. +Definition at line 1538 of file modules.h. .PP Referenced by ConfigReader(), DumpErrors(), and ~ConfigReader(). .SS "bool \fBConfigReader::readerror\fP\fC [protected]\fP" .PP Used to store errors. .PP -Definition at line 1537 of file modules.h. +Definition at line 1541 of file modules.h. .PP Referenced by ConfigReader(), and Verify(). diff --git a/docs/man/man3/FileReader.3 b/docs/man/man3/FileReader.3 index 05fbaae25..f9688416d 100644 --- a/docs/man/man3/FileReader.3 +++ b/docs/man/man3/FileReader.3 @@ -57,7 +57,7 @@ Caches a text file into memory and can be used to retrieve lines from it. This class contains methods for read-only manipulation of a text file in memory. Either use the constructor type with one parameter to load a file into memory at construction, or use the LoadFile method to load a file. .PP -Definition at line 1614 of file modules.h. +Definition at line 1618 of file modules.h. .SH "Constructor & Destructor Documentation" .PP .SS "FileReader::FileReader ()" @@ -66,11 +66,11 @@ Default constructor. .PP This method does not load any file into memory, you must use the LoadFile method after constructing the class this way. .PP -Definition at line 889 of file modules.cpp. +Definition at line 894 of file modules.cpp. .PP .nf -890 { -891 } +895 { +896 } .fi .PP .SS "FileReader::FileReader (\fBstd::string\fP filename)" @@ -79,16 +79,16 @@ Secondary constructor. .PP This method initialises the class with a file loaded into it ready for GetLine and and other methods to be called. If the file could not be loaded, \fBFileReader::FileSize\fP returns 0. .PP -Definition at line 882 of file modules.cpp. +Definition at line 887 of file modules.cpp. .PP References fc. .PP .nf -883 { -884 file_cache c; -885 readfile(c,filename.c_str()); -886 this->fc = c; -887 } +888 { +889 file_cache c; +890 readfile(c,filename.c_str()); +891 this->fc = c; +892 } .fi .PP .SS "FileReader::~FileReader ()" @@ -97,11 +97,11 @@ Default destructor. .PP This deletes the memory allocated to the file. .PP -Definition at line 901 of file modules.cpp. +Definition at line 906 of file modules.cpp. .PP .nf -902 { -903 } +907 { +908 } .fi .PP .SH "Member Function Documentation" @@ -110,21 +110,21 @@ Definition at line 901 of file modules.cpp. .PP Returns true if the file exists This function will return false if the file could not be opened. .PP -Definition at line 905 of file modules.cpp. +Definition at line 910 of file modules.cpp. .PP References fc. .PP .nf -906 { -907 if (fc.size() == 0) -908 { -909 return(false); -910 } -911 else -912 { -913 return(true); -914 } -915 } +911 { +912 if (fc.size() == 0) +913 { +914 return(false); +915 } +916 else +917 { +918 return(true); +919 } +920 } .fi .PP .SS "int FileReader::FileSize ()" @@ -133,14 +133,14 @@ Returns the size of the file in lines. .PP This method returns the number of lines in the read file. If it is 0, no lines have been read into memory, either because the file is empty or it does not exist, or cannot be opened due to permission problems. .PP -Definition at line 924 of file modules.cpp. +Definition at line 929 of file modules.cpp. .PP References fc. .PP .nf -925 { -926 return fc.size(); -927 } +930 { +931 return fc.size(); +932 } .fi .PP .SS "\fBstd::string\fP FileReader::GetLine (int x)" @@ -149,16 +149,16 @@ Retrieve one line from the file. .PP This method retrieves one line from the text file. If an empty non-NULL string is returned, the index was out of bounds, or the line had no data on it. .PP -Definition at line 917 of file modules.cpp. +Definition at line 922 of file modules.cpp. .PP References fc. .PP .nf -918 { -919 if ((x<0) || ((unsigned)x>fc.size())) -920 return ''; -921 return fc[x]; -922 } +923 { +924 if ((x<0) || ((unsigned)x>fc.size())) +925 return ''; +926 return fc[x]; +927 } .fi .PP .SS "void FileReader::LoadFile (\fBstd::string\fP filename)" @@ -167,23 +167,23 @@ Used to load a file. .PP This method loads a file into the class ready for GetLine and and other methods to be called. If the file could not be loaded, \fBFileReader::FileSize\fP returns 0. .PP -Definition at line 893 of file modules.cpp. +Definition at line 898 of file modules.cpp. .PP References fc. .PP .nf -894 { -895 file_cache c; -896 readfile(c,filename.c_str()); -897 this->fc = c; -898 } +899 { +900 file_cache c; +901 readfile(c,filename.c_str()); +902 this->fc = c; +903 } .fi .PP .SH "Member Data Documentation" .PP .SS "\fBfile_cache\fP \fBFileReader::fc\fP\fC [private]\fP" .PP -Definition at line 1616 of file modules.h. +Definition at line 1620 of file modules.h. .PP Referenced by Exists(), FileReader(), FileSize(), GetLine(), and LoadFile(). diff --git a/docs/man/man3/ModuleFactory.3 b/docs/man/man3/ModuleFactory.3 index c1964f216..476737145 100644 --- a/docs/man/man3/ModuleFactory.3 +++ b/docs/man/man3/ModuleFactory.3 @@ -32,23 +32,23 @@ Instantiates classes inherited from \fBModule\fP This class creates a class inhe This is to allow for modules to create many different variants of \fBModule\fP, dependent on architecture, configuration, etc. In most cases, the simple class shown in the example module m_foobar.so will suffice for most modules. .PP -Definition at line 1669 of file modules.h. +Definition at line 1673 of file modules.h. .SH "Constructor & Destructor Documentation" .PP .SS "ModuleFactory::ModuleFactory ()\fC [inline]\fP" .PP -Definition at line 1672 of file modules.h. +Definition at line 1676 of file modules.h. .PP .nf -1672 { } +1676 { } .fi .PP .SS "virtual ModuleFactory::~ModuleFactory ()\fC [inline, virtual]\fP" .PP -Definition at line 1673 of file modules.h. +Definition at line 1677 of file modules.h. .PP .nf -1673 { } +1677 { } .fi .PP .SH "Member Function Documentation" diff --git a/docs/man/man3/Server.3 b/docs/man/man3/Server.3 index 5ec1f020d..0584cb751 100644 --- a/docs/man/man3/Server.3 +++ b/docs/man/man3/Server.3 @@ -24,6 +24,10 @@ Inherits \fBclassbase\fP. .br .RI "\fIDefault destructor. \fP" .ti -1c +.RI "\fBServerConfig\fP * \fBGetConfig\fP ()" +.br +.RI "\fIObtains a pointer to the server's \fBServerConfig\fP object. \fP" +.ti -1c .RI "virtual void \fBSendOpers\fP (\fBstd::string\fP s)" .br .RI "\fISends text to all opers. \fP" @@ -293,14 +297,14 @@ typedef void (handlerfunc) (char**, int, userrec*); ... void \fBhandle_kill(char .PP When the command is typed, the parameters will be placed into the parameters array (similar to argv) and the parameter count will be placed into pcnt (similar to argv). There will never be any less parameters than the 'minparams' value you specified when creating the command. The *user parameter is the class of the user which caused the command to trigger, who will always have the flag you specified in 'flags' when creating the initial command. For example to create an oper only command create the commands with flags='o'. The source parameter is used for resource tracking, and should contain the name of your module (with file extension) e.g. 'm_blarp.so'. If you place the wrong identifier here, you can cause crashes if your module is unloaded. .PP -Definition at line 414 of file modules.cpp. +Definition at line 419 of file modules.cpp. .PP References createcommand(). .PP .nf -415 { -416 createcommand(cmd,f,flags,minparams,source); -417 } +420 { +421 createcommand(cmd,f,flags,minparams,source); +422 } .fi .PP .SS "void Server::AddELine (long duration, \fBstd::string\fP source, \fBstd::string\fP reason, \fBstd::string\fP hostmask)\fC [virtual]\fP" @@ -309,14 +313,14 @@ Adds a E-line The E-line is enforced as soon as it is added. .PP The duration must be in seconds, however you can use the \fBServer::CalcDuration\fP method to convert durations into the 1w2d3h3m6s format used by /GLINE etc. The source is an arbitary string used to indicate who or what sent the data, usually this is the nickname of a person, or a server name. .PP -Definition at line 658 of file modules.cpp. +Definition at line 663 of file modules.cpp. .PP References add_eline(). .PP .nf -659 { -660 add_eline(duration, source.c_str(), reason.c_str(), hostmask.c_str()); -661 } +664 { +665 add_eline(duration, source.c_str(), reason.c_str(), hostmask.c_str()); +666 } .fi .PP .SS "bool Server::AddExtendedListMode (char modechar)\fC [virtual]\fP" @@ -335,17 +339,17 @@ This call is used to implement modes like +q and +a. The characteristics of thes .PP It is down to the module handling the mode to maintain state and determine what 'items' (e.g. users, or a banlist) have the mode set on them, and process the modes at the correct times, e.g. during access checks on channels, etc. When the extended mode is triggered the OnExtendedMode method will be triggered as above. Note that the target you are given will be a channel, if for example your mode is set 'on a user' (in for example +a) you must use Server::Find to locate the user the mode is operating on. Your mode handler may return 1 to handle the mode AND tell the core to display the mode change, e.g. '+aaa one two three' in the case of the mode for 'two', or it may return -1 to 'eat' the mode change, so the above example would become '+aa one three' after processing. .PP -Definition at line 582 of file modules.cpp. +Definition at line 587 of file modules.cpp. .PP References DoAddExtendedMode(), ModeMakeList(), and MT_CHANNEL. .PP .nf -583 { -584 bool res = DoAddExtendedMode(modechar,MT_CHANNEL,false,1,1); -585 if (res) -586 ModeMakeList(modechar); -587 return res; -588 } +588 { +589 bool res = DoAddExtendedMode(modechar,MT_CHANNEL,false,1,1); +590 if (res) +591 ModeMakeList(modechar); +592 return res; +593 } .fi .PP .SS "bool Server::AddExtendedMode (char modechar, int type, bool requires_oper, int params_when_on, int params_when_off)\fC [virtual]\fP" @@ -354,37 +358,37 @@ Adds an extended mode letter which is parsed by a module. .PP This allows modules to add extra mode letters, e.g. +x for hostcloak. the 'type' parameter is either MT_CHANNEL, MT_CLIENT, or MT_SERVER, to indicate wether the mode is a channel mode, a client mode, or a server mode. requires_oper is used with MT_CLIENT type modes only to indicate the mode can only be set or unset by an oper. If this is used for MT_CHANNEL type modes it is ignored. params_when_on is the number of modes to expect when the mode is turned on (for type MT_CHANNEL only), e.g. with mode +k, this would have a value of 1. the params_when_off value has a similar value to params_when_on, except it indicates the number of parameters to expect when the mode is disabled. Modes which act in a similar way to channel mode +l (e.g. require a parameter to enable, but not to disable) should use this parameter. The function returns false if the mode is unavailable, and will not attempt to allocate another character, as this will confuse users. This also means that as only one module can claim a specific mode character, the core does not need to keep track of which modules own which modes, which speeds up operation of the server. In this version, a mode can have at most one parameter, attempting to use more parameters will have undefined effects. .PP -Definition at line 554 of file modules.cpp. +Definition at line 559 of file modules.cpp. .PP References DEBUG, DoAddExtendedMode(), MT_CLIENT, and MT_SERVER. .PP .nf -555 { -556 if (((modechar >= 'A') && (modechar <= 'Z')) || ((modechar >= 'a') && (modechar <= 'z'))) -557 { -558 if (type == MT_SERVER) -559 { -560 log(DEBUG,'*** API ERROR *** Modes of type MT_SERVER are reserved for future expansion'); -561 return false; -562 } -563 if (((params_when_on>0) || (params_when_off>0)) && (type == MT_CLIENT)) +560 { +561 if (((modechar >= 'A') && (modechar <= 'Z')) || ((modechar >= 'a') && (modechar <= 'z'))) +562 { +563 if (type == MT_SERVER) 564 { -565 log(DEBUG,'*** API ERROR *** Parameters on MT_CLIENT modes are not supported'); +565 log(DEBUG,'*** API ERROR *** Modes of type MT_SERVER are reserved for future expansion'); 566 return false; 567 } -568 if ((params_when_on>1) || (params_when_off>1)) +568 if (((params_when_on>0) || (params_when_off>0)) && (type == MT_CLIENT)) 569 { -570 log(DEBUG,'*** API ERROR *** More than one parameter for an MT_CHANNEL mode is not yet supported'); +570 log(DEBUG,'*** API ERROR *** Parameters on MT_CLIENT modes are not supported'); 571 return false; 572 } -573 return DoAddExtendedMode(modechar,type,requires_oper,params_when_on,params_when_off); -574 } -575 else -576 { -577 log(DEBUG,'*** API ERROR *** Muppet modechar detected.'); -578 } -579 return false; -580 } +573 if ((params_when_on>1) || (params_when_off>1)) +574 { +575 log(DEBUG,'*** API ERROR *** More than one parameter for an MT_CHANNEL mode is not yet supported'); +576 return false; +577 } +578 return DoAddExtendedMode(modechar,type,requires_oper,params_when_on,params_when_off); +579 } +580 else +581 { +582 log(DEBUG,'*** API ERROR *** Muppet modechar detected.'); +583 } +584 return false; +585 } .fi .PP .SS "void Server::AddGLine (long duration, \fBstd::string\fP source, \fBstd::string\fP reason, \fBstd::string\fP hostmask)\fC [virtual]\fP" @@ -393,14 +397,14 @@ Adds a G-line The G-line is propogated to all of the servers in the mesh and enf .PP The duration must be in seconds, however you can use the \fBServer::CalcDuration\fP method to convert durations into the 1w2d3h3m6s format used by /GLINE etc. The source is an arbitary string used to indicate who or what sent the data, usually this is the nickname of a person, or a server name. .PP -Definition at line 638 of file modules.cpp. +Definition at line 643 of file modules.cpp. .PP References add_gline(). .PP .nf -639 { -640 add_gline(duration, source.c_str(), reason.c_str(), hostmask.c_str()); -641 } +644 { +645 add_gline(duration, source.c_str(), reason.c_str(), hostmask.c_str()); +646 } .fi .PP .SS "void Server::AddKLine (long duration, \fBstd::string\fP source, \fBstd::string\fP reason, \fBstd::string\fP hostmask)\fC [virtual]\fP" @@ -409,14 +413,14 @@ Adds a K-line The K-line is enforced as soon as it is added. .PP The duration must be in seconds, however you can use the \fBServer::CalcDuration\fP method to convert durations into the 1w2d3h3m6s format used by /GLINE etc. The source is an arbitary string used to indicate who or what sent the data, usually this is the nickname of a person, or a server name. .PP -Definition at line 653 of file modules.cpp. +Definition at line 658 of file modules.cpp. .PP References add_kline(). .PP .nf -654 { -655 add_kline(duration, source.c_str(), reason.c_str(), hostmask.c_str()); -656 } +659 { +660 add_kline(duration, source.c_str(), reason.c_str(), hostmask.c_str()); +661 } .fi .PP .SS "void Server::AddQLine (long duration, \fBstd::string\fP source, \fBstd::string\fP reason, \fBstd::string\fP nickname)\fC [virtual]\fP" @@ -425,14 +429,14 @@ Adds a Q-line The Q-line is propogated to all of the servers in the mesh and enf .PP The duration must be in seconds, however you can use the \fBServer::CalcDuration\fP method to convert durations into the 1w2d3h3m6s format used by /GLINE etc. The source is an arbitary string used to indicate who or what sent the data, usually this is the nickname of a person, or a server name. .PP -Definition at line 643 of file modules.cpp. +Definition at line 648 of file modules.cpp. .PP References add_qline(). .PP .nf -644 { -645 add_qline(duration, source.c_str(), reason.c_str(), nickname.c_str()); -646 } +649 { +650 add_qline(duration, source.c_str(), reason.c_str(), nickname.c_str()); +651 } .fi .PP .SS "void Server::AddSocket (\fBInspSocket\fP * sock)\fC [virtual]\fP" @@ -455,14 +459,14 @@ Adds a Z-line The Z-line is propogated to all of the servers in the mesh and enf .PP The duration must be in seconds, however you can use the \fBServer::CalcDuration\fP method to convert durations into the 1w2d3h3m6s format used by /GLINE etc. The source is an arbitary string used to indicate who or what sent the data, usually this is the nickname of a person, or a server name. .PP -Definition at line 648 of file modules.cpp. +Definition at line 653 of file modules.cpp. .PP References add_zline(). .PP .nf -649 { -650 add_zline(duration, source.c_str(), reason.c_str(), ipaddr.c_str()); -651 } +654 { +655 add_zline(duration, source.c_str(), reason.c_str(), ipaddr.c_str()); +656 } .fi .PP .SS "long Server::CalcDuration (\fBstd::string\fP duration)\fC [virtual]\fP" @@ -471,14 +475,14 @@ Calculates a duration This method will take a string containing a formatted dura .PP '1w2d') and return its value as a total number of seconds. This is the same function used internally by /GLINE etc to set the ban times. .PP -Definition at line 688 of file modules.cpp. +Definition at line 693 of file modules.cpp. .PP References duration(). .PP .nf -689 { -690 return duration(delta.c_str()); -691 } +694 { +695 return duration(delta.c_str()); +696 } .fi .PP .SS "void Server::CallCommandHandler (\fBstd::string\fP commandname, char ** parameters, int pcnt, \fBuserrec\fP * user)\fC [virtual]\fP" @@ -489,12 +493,12 @@ You can use this function to trigger other commands in the ircd, such as PRIVMSG .br ) you may use them as callback identifiers. The first parameter to this method is the name of the command handler you wish to call, e.g. PRIVMSG. This will be a command handler previously registered by the core or wih \fBAddCommand()\fP. The second parameter is an array of parameters, and the third parameter is a count of parameters in the array. If you do not pass enough parameters to meet the minimum needed by the handler, the functiom will silently ignore it. The final parameter is the user executing the command handler, used for privilage checks, etc. .PP -Definition at line 399 of file modules.cpp. +Definition at line 404 of file modules.cpp. .PP .nf -400 { -401 call_handler(commandname.c_str(),parameters,pcnt,user); -402 } +405 { +406 call_handler(commandname.c_str(),parameters,pcnt,user); +407 } .fi .PP .SS "void Server::ChangeGECOS (\fBuserrec\fP * user, \fBstd::string\fP gecos)\fC [virtual]\fP" @@ -503,14 +507,14 @@ Change GECOS (fullname) of a user. .PP You should always call this method to change a user's GECOS rather than writing directly to the fullname member of userrec, as any change applied via this method will be propogated to any linked servers. .PP -Definition at line 497 of file modules.cpp. +Definition at line 502 of file modules.cpp. .PP References ChangeName(). .PP .nf -498 { -499 ChangeName(user,gecos.c_str()); -500 } +503 { +504 ChangeName(user,gecos.c_str()); +505 } .fi .PP .SS "void Server::ChangeHost (\fBuserrec\fP * user, \fBstd::string\fP host)\fC [virtual]\fP" @@ -519,14 +523,14 @@ Change displayed hostname of a user. .PP You should always call this method to change a user's host rather than writing directly to the dhost member of userrec, as any change applied via this method will be propogated to any linked servers. .PP -Definition at line 492 of file modules.cpp. +Definition at line 497 of file modules.cpp. .PP References ChangeDisplayedHost(). .PP .nf -493 { -494 ChangeDisplayedHost(user,host.c_str()); -495 } +498 { +499 ChangeDisplayedHost(user,host.c_str()); +500 } .fi .PP .SS "void Server::ChangeUserNick (\fBuserrec\fP * user, \fBstd::string\fP nickname)\fC [virtual]\fP" @@ -535,12 +539,12 @@ Forces a user nickchange. .PP This command works similarly to SVSNICK, and can be used to implement Q-lines etc. If you specify an invalid nickname, the nick change will be dropped and the target user will receive the error numeric for it. .PP -Definition at line 384 of file modules.cpp. +Definition at line 389 of file modules.cpp. .PP .nf -385 { -386 force_nickchange(user,nickname.c_str()); -387 } +390 { +391 force_nickchange(user,nickname.c_str()); +392 } .fi .PP .SS "\fBstd::string\fP Server::ChanMode (\fBuserrec\fP * User, \fBchanrec\fP * Chan)\fC [virtual]\fP" @@ -549,14 +553,14 @@ Attempts to look up a user's privilages on a channel. .PP This function will return a string containing either @, %, +, or an empty string, representing the user's privilages upon the channel you specify. .PP -Definition at line 522 of file modules.cpp. +Definition at line 527 of file modules.cpp. .PP References cmode(). .PP .nf -523 { -524 return cmode(User,Chan); -525 } +528 { +529 return cmode(User,Chan); +530 } .fi .PP .SS "bool Server::CommonChannels (\fBuserrec\fP * u1, \fBuserrec\fP * u2)\fC [virtual]\fP" @@ -565,14 +569,14 @@ Returns true if two users share a common channel. .PP This method is used internally by the NICK and QUIT commands, and the \fBServer::SendCommon\fP method. .PP -Definition at line 470 of file modules.cpp. +Definition at line 475 of file modules.cpp. .PP References common_channels(). .PP .nf -471 { -472 return (common_channels(u1,u2) != 0); -473 } +476 { +477 return (common_channels(u1,u2) != 0); +478 } .fi .PP .SS "int Server::CountUsers (\fBchanrec\fP * c)\fC [virtual]\fP" @@ -581,103 +585,103 @@ Returns a count of the number of users on a channel. .PP This will NEVER be 0, as if the chanrec exists, it will have at least one user in the channel. .PP -Definition at line 590 of file modules.cpp. +Definition at line 595 of file modules.cpp. .PP .nf -591 { -592 return usercount(c); -593 } +596 { +597 return usercount(c); +598 } .fi .PP .SS "bool Server::DelELine (\fBstd::string\fP hostmask)\fC [virtual]\fP" .PP Deletes a local E-Line. .PP -Definition at line 683 of file modules.cpp. +Definition at line 688 of file modules.cpp. .PP References del_eline(). .PP .nf -684 { -685 return del_eline(hostmask.c_str()); -686 } +689 { +690 return del_eline(hostmask.c_str()); +691 } .fi .PP .SS "bool Server::DelGLine (\fBstd::string\fP hostmask)\fC [virtual]\fP" .PP Deletes a G-Line from all servers on the mesh. .PP -Definition at line 663 of file modules.cpp. +Definition at line 668 of file modules.cpp. .PP References del_gline(). .PP .nf -664 { -665 return del_gline(hostmask.c_str()); -666 } +669 { +670 return del_gline(hostmask.c_str()); +671 } .fi .PP .SS "bool Server::DelKLine (\fBstd::string\fP hostmask)\fC [virtual]\fP" .PP Deletes a local K-Line. .PP -Definition at line 678 of file modules.cpp. +Definition at line 683 of file modules.cpp. .PP References del_kline(). .PP .nf -679 { -680 return del_kline(hostmask.c_str()); -681 } +684 { +685 return del_kline(hostmask.c_str()); +686 } .fi .PP .SS "bool Server::DelQLine (\fBstd::string\fP nickname)\fC [virtual]\fP" .PP Deletes a Q-Line from all servers on the mesh. .PP -Definition at line 668 of file modules.cpp. +Definition at line 673 of file modules.cpp. .PP References del_qline(). .PP .nf -669 { -670 return del_qline(nickname.c_str()); -671 } +674 { +675 return del_qline(nickname.c_str()); +676 } .fi .PP .SS "void Server::DelSocket (\fBInspSocket\fP * sock)\fC [virtual]\fP" .PP Deletes a class derived from \fBInspSocket\fP from the server's socket engine. .PP -Definition at line 332 of file modules.cpp. +Definition at line 337 of file modules.cpp. .PP References module_sockets. .PP .nf -333 { -334 for (std::vector<InspSocket*>::iterator a = module_sockets.begin(); a < module_sockets.end(); a++) -335 { -336 if (*a == sock) -337 { -338 module_sockets.erase(a); -339 return; -340 } -341 } -342 } +338 { +339 for (std::vector<InspSocket*>::iterator a = module_sockets.begin(); a < module_sockets.end(); a++) +340 { +341 if (*a == sock) +342 { +343 module_sockets.erase(a); +344 return; +345 } +346 } +347 } .fi .PP .SS "bool Server::DelZLine (\fBstd::string\fP ipaddr)\fC [virtual]\fP" .PP Deletes a Z-Line from all servers on the mesh. .PP -Definition at line 673 of file modules.cpp. +Definition at line 678 of file modules.cpp. .PP References del_zline(). .PP .nf -674 { -675 return del_zline(ipaddr.c_str()); -676 } +679 { +680 return del_zline(ipaddr.c_str()); +681 } .fi .PP .SS "\fBchanrec\fP * Server::FindChannel (\fBstd::string\fP channel)\fC [virtual]\fP" @@ -686,12 +690,12 @@ Attempts to look up a channel and return a pointer to it. .PP This function will return NULL if the channel does not exist. .PP -Definition at line 517 of file modules.cpp. +Definition at line 522 of file modules.cpp. .PP .nf -518 { -519 return FindChan(channel.c_str()); -520 } +523 { +524 return FindChan(channel.c_str()); +525 } .fi .PP .SS "\fBuserrec\fP * Server::FindDescriptor (int socket)\fC [virtual]\fP" @@ -700,12 +704,12 @@ Attempts to look up a nick using the file descriptor associated with that nick. .PP This function will return NULL if the file descriptor is not associated with a valid user. .PP -Definition at line 512 of file modules.cpp. +Definition at line 517 of file modules.cpp. .PP .nf -513 { -514 return (socket < 65536 ? fd_ref_table[socket] : NULL); -515 } +518 { +519 return (socket < 65536 ? fd_ref_table[socket] : NULL); +520 } .fi .PP .SS "\fBModule\fP * Server::FindModule (\fBstd::string\fP name)\fC [virtual]\fP" @@ -714,21 +718,21 @@ This function finds a module by name. .PP You must provide the filename of the module. If the module cannot be found (is not loaded) the function will return NULL. .PP -Definition at line 722 of file modules.cpp. +Definition at line 727 of file modules.cpp. .PP References MODCOUNT, ServerConfig::module_names, and modules. .PP .nf -723 { -724 for (int i = 0; i <= MODCOUNT; i++) -725 { -726 if (Config->module_names[i] == name) -727 { -728 return modules[i]; -729 } -730 } -731 return NULL; -732 } +728 { +729 for (int i = 0; i <= MODCOUNT; i++) +730 { +731 if (Config->module_names[i] == name) +732 { +733 return modules[i]; +734 } +735 } +736 return NULL; +737 } .fi .PP .SS "\fBuserrec\fP * Server::FindNick (\fBstd::string\fP nick)\fC [virtual]\fP" @@ -737,12 +741,12 @@ Attempts to look up a nick and return a pointer to it. .PP This function will return NULL if the nick does not exist. .PP -Definition at line 507 of file modules.cpp. +Definition at line 512 of file modules.cpp. .PP .nf -508 { -509 return Find(nick); -510 } +513 { +514 return Find(nick); +515 } .fi .PP .SS "\fBAdmin\fP Server::GetAdmin ()\fC [virtual]\fP" @@ -751,48 +755,62 @@ Returns the information of the server as returned by the /ADMIN command. .PP See the \fBAdmin\fP class for further information of the return value. The members \fBAdmin::Nick\fP, \fBAdmin::Email\fP and \fBAdmin::Name\fP contain the information for the server where the module is loaded. .PP -Definition at line 547 of file modules.cpp. +Definition at line 552 of file modules.cpp. .PP .nf -548 { -549 return Admin(getadminname(),getadminemail(),getadminnick()); -550 } +553 { +554 return Admin(getadminname(),getadminemail(),getadminnick()); +555 } +.fi +.PP +.SS "\fBServerConfig\fP * Server::GetConfig ()" +.PP +Obtains a pointer to the server's \fBServerConfig\fP object. +.PP +The \fBServerConfig\fP object contains most of the configuration data of the IRC server, as read from the config file by the core. +.PP +Definition at line 332 of file modules.cpp. +.PP +.nf +333 { +334 return Config; +335 } .fi .PP .SS "\fBstd::string\fP Server::GetNetworkName ()\fC [virtual]\fP" .PP Returns the network name, global to all linked servers. .PP -Definition at line 537 of file modules.cpp. +Definition at line 542 of file modules.cpp. .PP .nf -538 { -539 return getnetworkname(); -540 } +543 { +544 return getnetworkname(); +545 } .fi .PP .SS "\fBstd::string\fP Server::GetServerDescription ()\fC [virtual]\fP" .PP Returns the server description string of the local server. .PP -Definition at line 542 of file modules.cpp. +Definition at line 547 of file modules.cpp. .PP .nf -543 { -544 return getserverdesc(); -545 } +548 { +549 return getserverdesc(); +550 } .fi .PP .SS "\fBstd::string\fP Server::GetServerName ()\fC [virtual]\fP" .PP Returns the server name of the server where the module is loaded. .PP -Definition at line 532 of file modules.cpp. +Definition at line 537 of file modules.cpp. .PP .nf -533 { -534 return getservername(); -535 } +538 { +539 return getservername(); +540 } .fi .PP .SS "\fBchanuserlist\fP Server::GetUsers (\fBchanrec\fP * chan)\fC [virtual]\fP" @@ -801,22 +819,22 @@ Fetches the userlist of a channel. .PP This function must be here and not a member of userrec or chanrec due to include constraints. .PP -Definition at line 372 of file modules.cpp. +Definition at line 377 of file modules.cpp. .PP References chanrec::GetUsers(). .PP .nf -373 { -374 chanuserlist userl; -375 userl.clear(); -376 std::vector<char*> *list = chan->GetUsers(); -377 for (std::vector<char*>::iterator i = list->begin(); i != list->end(); i++) -378 { -379 char* o = *i; -380 userl.push_back((userrec*)o); -381 } -382 return userl; -383 } +378 { +379 chanuserlist userl; +380 userl.clear(); +381 std::vector<char*> *list = chan->GetUsers(); +382 for (std::vector<char*>::iterator i = list->begin(); i != list->end(); i++) +383 { +384 char* o = *i; +385 userl.push_back((userrec*)o); +386 } +387 return userl; +388 } .fi .PP .SS "bool Server::IsNick (\fBstd::string\fP nick)\fC [virtual]\fP" @@ -825,14 +843,14 @@ Returns true if a nick is valid. .PP Nicks for unregistered connections will return false. .PP -Definition at line 502 of file modules.cpp. +Definition at line 507 of file modules.cpp. .PP References isnick(). .PP .nf -503 { -504 return (isnick(nick.c_str()) != 0); -505 } +508 { +509 return (isnick(nick.c_str()) != 0); +510 } .fi .PP .SS "bool Server::IsOnChannel (\fBuserrec\fP * User, \fBchanrec\fP * Chan)\fC [virtual]\fP" @@ -841,14 +859,14 @@ Checks if a user is on a channel. .PP This function will return true or false to indicate if user 'User' is on channel 'Chan'. .PP -Definition at line 527 of file modules.cpp. +Definition at line 532 of file modules.cpp. .PP References has_channel(). .PP .nf -528 { -529 return has_channel(User,Chan); -530 } +533 { +534 return has_channel(User,Chan); +535 } .fi .PP .SS "bool Server::IsUlined (\fBstd::string\fP server)\fC [virtual]\fP" @@ -857,60 +875,60 @@ Returns true if the servername you give is ulined. .PP ULined servers have extra privilages. They are allowed to change nicknames on remote servers, change modes of clients which are on remote servers and set modes of channels where there are no channel operators for that channel on the ulined server, amongst other things. Ulined server data is also broadcast across the mesh at all times as opposed to selectively messaged in the case of normal servers, as many ulined server types (such as services) do not support meshed links and must operate in this manner. .PP -Definition at line 394 of file modules.cpp. +Definition at line 399 of file modules.cpp. .PP References is_uline(). .PP .nf -395 { -396 return is_uline(server.c_str()); -397 } +400 { +401 return is_uline(server.c_str()); +402 } .fi .PP .SS "bool Server::IsValidMask (\fBstd::string\fP mask)\fC [virtual]\fP" .PP Returns true if a nick!ident string is correctly formatted, false if otherwise. .PP -Definition at line 693 of file modules.cpp. +Definition at line 698 of file modules.cpp. .PP .nf -694 { -695 const char* dest = mask.c_str(); -696 if (strchr(dest,'!')==0) -697 return false; -698 if (strchr(dest,'@')==0) -699 return false; -700 for (unsigned int i = 0; i < strlen(dest); i++) -701 if (dest[i] < 32) -702 return false; -703 for (unsigned int i = 0; i < strlen(dest); i++) -704 if (dest[i] > 126) -705 return false; -706 unsigned int c = 0; -707 for (unsigned int i = 0; i < strlen(dest); i++) -708 if (dest[i] == '!') -709 c++; -710 if (c>1) -711 return false; -712 c = 0; -713 for (unsigned int i = 0; i < strlen(dest); i++) -714 if (dest[i] == '@') -715 c++; -716 if (c>1) -717 return false; -718 -719 return true; -720 } +699 { +700 const char* dest = mask.c_str(); +701 if (strchr(dest,'!')==0) +702 return false; +703 if (strchr(dest,'@')==0) +704 return false; +705 for (unsigned int i = 0; i < strlen(dest); i++) +706 if (dest[i] < 32) +707 return false; +708 for (unsigned int i = 0; i < strlen(dest); i++) +709 if (dest[i] > 126) +710 return false; +711 unsigned int c = 0; +712 for (unsigned int i = 0; i < strlen(dest); i++) +713 if (dest[i] == '!') +714 c++; +715 if (c>1) +716 return false; +717 c = 0; +718 for (unsigned int i = 0; i < strlen(dest); i++) +719 if (dest[i] == '@') +720 c++; +721 if (c>1) +722 return false; +723 +724 return true; +725 } .fi .PP .SS "bool Server::IsValidModuleCommand (\fBstd::string\fP commandname, int pcnt, \fBuserrec\fP * user)\fC [virtual]\fP" .PP -Definition at line 404 of file modules.cpp. +Definition at line 409 of file modules.cpp. .PP .nf -405 { -406 return is_valid_cmd(commandname.c_str(), pcnt, user); -407 } +410 { +411 return is_valid_cmd(commandname.c_str(), pcnt, user); +412 } .fi .PP .SS "\fBchanrec\fP * Server::JoinUserToChannel (\fBuserrec\fP * user, \fBstd::string\fP cname, \fBstd::string\fP key)\fC [virtual]\fP" @@ -919,12 +937,12 @@ Forces a user to join a channel. .PP This is similar to svsjoin and can be used to implement redirection, etc. On success, the return value is a valid pointer to a chanrec* of the channel the user was joined to. On failure, the result is NULL. .PP -Definition at line 362 of file modules.cpp. +Definition at line 367 of file modules.cpp. .PP .nf -363 { -364 return add_channel(user,cname.c_str(),key.c_str(),false); -365 } +368 { +369 return add_channel(user,cname.c_str(),key.c_str(),false); +370 } .fi .PP .SS "void Server::Log (int level, \fBstd::string\fP s)\fC [virtual]\fP" @@ -933,12 +951,12 @@ Writes a log string. .PP This method writes a line of text to the log. If the level given is lower than the level given in the configuration, this command has no effect. .PP -Definition at line 409 of file modules.cpp. +Definition at line 414 of file modules.cpp. .PP .nf -410 { -411 log(level,'%s',s.c_str()); -412 } +415 { +416 log(level,'%s',s.c_str()); +417 } .fi .PP .SS "bool Server::MatchText (\fBstd::string\fP sliteral, \fBstd::string\fP spattern)\fC [virtual]\fP" @@ -947,15 +965,15 @@ Matches text against a glob pattern. .PP Uses the ircd's internal matching function to match string against a globbing pattern, e.g. *!*@*.com Returns true if the literal successfully matches the pattern, false if otherwise. .PP -Definition at line 349 of file modules.cpp. +Definition at line 354 of file modules.cpp. .PP .nf -350 { -351 char literal[MAXBUF],pattern[MAXBUF]; -352 strlcpy(literal,sliteral.c_str(),MAXBUF); -353 strlcpy(pattern,spattern.c_str(),MAXBUF); -354 return match(literal,pattern); -355 } +355 { +356 char literal[MAXBUF],pattern[MAXBUF]; +357 strlcpy(literal,sliteral.c_str(),MAXBUF); +358 strlcpy(pattern,spattern.c_str(),MAXBUF); +359 return match(literal,pattern); +360 } .fi .PP .SS "\fBchanrec\fP * Server::PartUserFromChannel (\fBuserrec\fP * user, \fBstd::string\fP cname, \fBstd::string\fP reason)\fC [virtual]\fP" @@ -964,12 +982,12 @@ Forces a user to part a channel. .PP This is similar to svspart and can be used to implement redirection, etc. Although the return value of this function is a pointer to a channel record, the returned data is undefined and should not be read or written to. This behaviour may be changed in a future version. .PP -Definition at line 367 of file modules.cpp. +Definition at line 372 of file modules.cpp. .PP .nf -368 { -369 return del_channel(user,cname.c_str(),reason.c_str(),false); -370 } +373 { +374 return del_channel(user,cname.c_str(),reason.c_str(),false); +375 } .fi .PP .SS "bool Server::PseudoToUser (\fBuserrec\fP * alive, \fBuserrec\fP * zombie, \fBstd::string\fP message)\fC [virtual]\fP" @@ -978,39 +996,39 @@ This user takes one user, and switches their file descriptor with another user, .PP The user in 'alive' is booted off the server with the given message. The user referred to by 'zombie' should have previously been locked with Server::ZombifyUser, otherwise stale sockets and file descriptor leaks can occur. After this call, the pointer to alive will be invalid, and the pointer to zombie will be equivalent in effect to the old pointer to alive. .PP -Definition at line 608 of file modules.cpp. +Definition at line 613 of file modules.cpp. .PP References userrec::chans, userrec::ClearBuffer(), connection::fd, FD_MAGIC_NUMBER, connection::host, userrec::ident, chanrec::name, userrec::nick, chanrec::setby, chanrec::topic, and chanrec::topicset. .PP .nf -609 { -610 zombie->fd = alive->fd; -611 alive->fd = FD_MAGIC_NUMBER; -612 alive->ClearBuffer(); -613 Write(zombie->fd,':%s!%s@%s NICK %s',alive->nick,alive->ident,alive->host,zombie->nick); -614 kill_link(alive,message.c_str()); -615 fd_ref_table[zombie->fd] = zombie; -616 for (unsigned int i = 0; i < zombie->chans.size(); i++) -617 { -618 if (zombie->chans[i].channel != NULL) -619 { -620 if (zombie->chans[i].channel->name) -621 { -622 chanrec* Ptr = zombie->chans[i].channel; -623 WriteFrom(zombie->fd,zombie,'JOIN %s',Ptr->name); -624 if (Ptr->topicset) -625 { -626 WriteServ(zombie->fd,'332 %s %s :%s', zombie->nick, Ptr->name, Ptr->topic); -627 WriteServ(zombie->fd,'333 %s %s %s %d', zombie->nick, Ptr->name, Ptr->setby, Ptr->topicset); -628 } -629 userlist(zombie,Ptr); -630 WriteServ(zombie->fd,'366 %s %s :End of /NAMES list.', zombie->nick, Ptr->name); -631 -632 } -633 } -634 } -635 return true; -636 } +614 { +615 zombie->fd = alive->fd; +616 alive->fd = FD_MAGIC_NUMBER; +617 alive->ClearBuffer(); +618 Write(zombie->fd,':%s!%s@%s NICK %s',alive->nick,alive->ident,alive->host,zombie->nick); +619 kill_link(alive,message.c_str()); +620 fd_ref_table[zombie->fd] = zombie; +621 for (unsigned int i = 0; i < zombie->chans.size(); i++) +622 { +623 if (zombie->chans[i].channel != NULL) +624 { +625 if (zombie->chans[i].channel->name) +626 { +627 chanrec* Ptr = zombie->chans[i].channel; +628 WriteFrom(zombie->fd,zombie,'JOIN %s',Ptr->name); +629 if (Ptr->topicset) +630 { +631 WriteServ(zombie->fd,'332 %s %s :%s', zombie->nick, Ptr->name, Ptr->topic); +632 WriteServ(zombie->fd,'333 %s %s %s %d', zombie->nick, Ptr->name, Ptr->setby, Ptr->topicset); +633 } +634 userlist(zombie,Ptr); +635 WriteServ(zombie->fd,'366 %s %s :End of /NAMES list.', zombie->nick, Ptr->name); +636 +637 } +638 } +639 } +640 return true; +641 } .fi .PP .SS "void Server::QuitUser (\fBuserrec\fP * user, \fBstd::string\fP reason)\fC [virtual]\fP" @@ -1023,12 +1041,12 @@ WARNING! .PP Once you call this function, userrec* user will immediately become INVALID. You MUST NOT write to, or read from this pointer after calling the QuitUser method UNDER ANY CIRCUMSTANCES! The best course of action after calling this method is to immediately bail from your handler. .PP -Definition at line 389 of file modules.cpp. +Definition at line 394 of file modules.cpp. .PP .nf -390 { -391 kill_link(user,reason.c_str()); -392 } +395 { +396 kill_link(user,reason.c_str()); +397 } .fi .PP .SS "void Server::RehashServer ()\fC [virtual]\fP" @@ -1050,12 +1068,12 @@ Sends a line of text down a TCP/IP socket. .PP This method writes a line of text to an established socket, cutting it to 510 characters plus a carriage return and linefeed if required. .PP -Definition at line 424 of file modules.cpp. +Definition at line 429 of file modules.cpp. .PP .nf -425 { -426 Write(Socket,'%s',s.c_str()); -427 } +430 { +431 Write(Socket,'%s',s.c_str()); +432 } .fi .PP .SS "void Server::SendChannel (\fBuserrec\fP * User, \fBchanrec\fP * Channel, \fBstd::string\fP s, bool IncludeSender)\fC [virtual]\fP" @@ -1064,19 +1082,19 @@ Sends text from a user to a channel (mulicast). .PP This method writes a line of text to a channel, with the given user's nick/ident /host combination prepended, as used in PRIVMSG etc commands (see RFC 1459). If the IncludeSender flag is set, then the text is also sent back to the user from which it originated, as seen in MODE (see RFC 1459). .PP -Definition at line 458 of file modules.cpp. +Definition at line 463 of file modules.cpp. .PP .nf -459 { -460 if (IncludeSender) -461 { -462 WriteChannel(Channel,User,'%s',s.c_str()); -463 } -464 else -465 { -466 ChanExceptSender(Channel,User,'%s',s.c_str()); -467 } -468 } +464 { +465 if (IncludeSender) +466 { +467 WriteChannel(Channel,User,'%s',s.c_str()); +468 } +469 else +470 { +471 ChanExceptSender(Channel,User,'%s',s.c_str()); +472 } +473 } .fi .PP .SS "void Server::SendChannelServerNotice (\fBstd::string\fP ServName, \fBchanrec\fP * Channel, \fBstd::string\fP text)\fC [virtual]\fP" @@ -1085,12 +1103,12 @@ Writes text to a channel, but from a server, including all. .PP This can be used to send server notices to a group of users. .PP -Definition at line 453 of file modules.cpp. +Definition at line 458 of file modules.cpp. .PP .nf -454 { -455 WriteChannelWithServ((char*)ServName.c_str(), Channel, '%s', text.c_str()); -456 } +459 { +460 WriteChannelWithServ((char*)ServName.c_str(), Channel, '%s', text.c_str()); +461 } .fi .PP .SS "void Server::SendCommon (\fBuserrec\fP * User, \fBstd::string\fP text, bool IncludeSender)\fC [virtual]\fP" @@ -1099,19 +1117,19 @@ Sends text from a user to one or more channels (mulicast). .PP This method writes a line of text to all users which share a common channel with a given user, with the user's nick/ident/host combination prepended, as used in PRIVMSG etc commands (see RFC 1459). If the IncludeSender flag is set, then the text is also sent back to the user from which it originated, as seen in NICK (see RFC 1459). Otherwise, it is only sent to the other recipients, as seen in QUIT. .PP -Definition at line 475 of file modules.cpp. +Definition at line 480 of file modules.cpp. .PP .nf -476 { -477 if (IncludeSender) -478 { -479 WriteCommon(User,'%s',text.c_str()); -480 } -481 else -482 { -483 WriteCommonExcept(User,'%s',text.c_str()); -484 } -485 } +481 { +482 if (IncludeSender) +483 { +484 WriteCommon(User,'%s',text.c_str()); +485 } +486 else +487 { +488 WriteCommonExcept(User,'%s',text.c_str()); +489 } +490 } .fi .PP .SS "void Server::SendFrom (int Socket, \fBuserrec\fP * User, \fBstd::string\fP s)\fC [virtual]\fP" @@ -1120,12 +1138,12 @@ Sends text from a user to a socket. .PP This method writes a line of text to an established socket, with the given user's nick/ident /host combination prepended, as used in PRIVSG etc commands (see RFC 1459) .PP -Definition at line 434 of file modules.cpp. +Definition at line 439 of file modules.cpp. .PP .nf -435 { -436 WriteFrom(Socket,User,'%s',s.c_str()); -437 } +440 { +441 WriteFrom(Socket,User,'%s',s.c_str()); +442 } .fi .PP .SS "void Server::SendMode (char ** parameters, int pcnt, \fBuserrec\fP * user)\fC [virtual]\fP" @@ -1148,14 +1166,14 @@ Srv->SendMode(modes,3,user); .PP The modes will originate from the server where the command was issued, however responses (e.g. numerics) will be sent to the user you provide as the third parameter. You must be sure to get the number of parameters correct in the pcnt parameter otherwise you could leave your server in an unstable state! .PP -Definition at line 419 of file modules.cpp. +Definition at line 424 of file modules.cpp. .PP References server_mode(). .PP .nf -420 { -421 server_mode(parameters,pcnt,user); -422 } +425 { +426 server_mode(parameters,pcnt,user); +427 } .fi .PP .SS "void Server::SendOpers (\fBstd::string\fP s)\fC [virtual]\fP" @@ -1164,12 +1182,12 @@ Sends text to all opers. .PP This method sends a server notice to all opers with the usermode +s. .PP -Definition at line 344 of file modules.cpp. +Definition at line 349 of file modules.cpp. .PP .nf -345 { -346 WriteOpers('%s',s.c_str()); -347 } +350 { +351 WriteOpers('%s',s.c_str()); +352 } .fi .PP .SS "void Server::SendServ (int Socket, \fBstd::string\fP s)\fC [virtual]\fP" @@ -1178,12 +1196,12 @@ Sends text from the server to a socket. .PP This method writes a line of text to an established socket, with the servername prepended as used by numerics (see RFC 1459) .PP -Definition at line 429 of file modules.cpp. +Definition at line 434 of file modules.cpp. .PP .nf -430 { -431 WriteServ(Socket,'%s',s.c_str()); -432 } +435 { +436 WriteServ(Socket,'%s',s.c_str()); +437 } .fi .PP .SS "void Server::SendTo (\fBuserrec\fP * Source, \fBuserrec\fP * Dest, \fBstd::string\fP s)\fC [virtual]\fP" @@ -1200,23 +1218,23 @@ The format will become: .PP Which is useful for numerics and server notices to single users, etc. .PP -Definition at line 439 of file modules.cpp. +Definition at line 444 of file modules.cpp. .PP References connection::fd. .PP .nf -440 { -441 if (!Source) -442 { -443 // if source is NULL, then the message originates from the local server -444 Write(Dest->fd,':%s %s',this->GetServerName().c_str(),s.c_str()); -445 } -446 else +445 { +446 if (!Source) 447 { -448 // otherwise it comes from the user specified -449 WriteTo(Source,Dest,'%s',s.c_str()); +448 // if source is NULL, then the message originates from the local server +449 Write(Dest->fd,':%s %s',this->GetServerName().c_str(),s.c_str()); 450 } -451 } +451 else +452 { +453 // otherwise it comes from the user specified +454 WriteTo(Source,Dest,'%s',s.c_str()); +455 } +456 } .fi .PP .SS "void Server::SendToModeMask (\fBstd::string\fP modes, int flags, \fBstd::string\fP text)\fC [virtual]\fP" @@ -1229,12 +1247,12 @@ Serv->SendToModeMask('xi', WM_OR, 'm00'); .PP Then the text 'm00' will be sent to all users with EITHER mode x or i. Conversely if you used WM_AND, the user must have both modes set to receive the message. .PP -Definition at line 357 of file modules.cpp. +Definition at line 362 of file modules.cpp. .PP .nf -358 { -359 WriteMode(modes.c_str(),flags,'%s',text.c_str()); -360 } +363 { +364 WriteMode(modes.c_str(),flags,'%s',text.c_str()); +365 } .fi .PP .SS "void Server::SendWallops (\fBuserrec\fP * User, \fBstd::string\fP text)\fC [virtual]\fP" @@ -1243,12 +1261,12 @@ Sends a WALLOPS message. .PP This method writes a WALLOPS message to all users with the +w flag, originating from the specified user. .PP -Definition at line 487 of file modules.cpp. +Definition at line 492 of file modules.cpp. .PP .nf -488 { -489 WriteWallOps(User,false,'%s',text.c_str()); -490 } +493 { +494 WriteWallOps(User,false,'%s',text.c_str()); +495 } .fi .PP .SS "bool Server::UserToPseudo (\fBuserrec\fP * user, \fBstd::string\fP message)\fC [virtual]\fP" @@ -1257,21 +1275,21 @@ Remove a user's connection to the irc server, but leave their client in existenc .PP When you call this function, the user's file descriptor will be replaced with the value of FD_MAGIC_NUMBER and their old file descriptor will be closed. This idle client will remain until it is restored with a valid file descriptor, or is removed from IRC by an operator After this call, the pointer to user will be invalid. .PP -Definition at line 596 of file modules.cpp. +Definition at line 601 of file modules.cpp. .PP References userrec::ClearBuffer(), SocketEngine::DelFd(), connection::fd, FD_MAGIC_NUMBER, connection::host, and userrec::ident. .PP .nf -597 { -598 unsigned int old_fd = user->fd; -599 user->fd = FD_MAGIC_NUMBER; -600 user->ClearBuffer(); -601 Write(old_fd,'ERROR :Closing link (%s@%s) [%s]',user->ident,user->host,message.c_str()); -602 SE->DelFd(old_fd); -603 shutdown(old_fd,2); -604 close(old_fd); -605 return true; -606 } +602 { +603 unsigned int old_fd = user->fd; +604 user->fd = FD_MAGIC_NUMBER; +605 user->ClearBuffer(); +606 Write(old_fd,'ERROR :Closing link (%s@%s) [%s]',user->ident,user->host,message.c_str()); +607 SE->DelFd(old_fd); +608 shutdown(old_fd,2); +609 close(old_fd); +610 return true; +611 } .fi .PP diff --git a/docs/man/man3/ServerConfig.3 b/docs/man/man3/ServerConfig.3 index 9f5733197..8a713cdc1 100644 --- a/docs/man/man3/ServerConfig.3 +++ b/docs/man/man3/ServerConfig.3 @@ -2,7 +2,9 @@ .ad l .nh .SH NAME -ServerConfig \- +ServerConfig \- This class holds the bulk of the runtime configuration for the ircd. + +.PP .SH SYNOPSIS .br .PP @@ -19,9 +21,11 @@ Inherits \fBclassbase\fP. .ti -1c .RI "void \fBClearStack\fP ()" .br +.RI "\fIClears the include stack in preperation for a \fBRead()\fP call. \fP" .ti -1c .RI "void \fBRead\fP (bool bail, \fBuserrec\fP *user)" .br +.RI "\fIRead the entire configuration into memory and initialize this class. \fP" .ti -1c .RI "bool \fBLoadConf\fP (const char *filename, std::stringstream *target, std::stringstream *errorstream)" .br @@ -47,108 +51,142 @@ Inherits \fBclassbase\fP. .ti -1c .RI "char \fBServerName\fP [MAXBUF]" .br +.RI "\fIHolds the server name of the local server as defined by the administrator. \fP" .ti -1c .RI "char \fBNetwork\fP [MAXBUF]" .br .ti -1c .RI "char \fBServerDesc\fP [MAXBUF]" .br +.RI "\fIHolds the description of the local server as defined by the administrator. \fP" .ti -1c .RI "char \fBAdminName\fP [MAXBUF]" .br +.RI "\fIHolds the admin's name, for output in the /ADMIN command. \fP" .ti -1c .RI "char \fBAdminEmail\fP [MAXBUF]" .br +.RI "\fIHolds the email address of the admin, for output in the /ADMIN command. \fP" .ti -1c .RI "char \fBAdminNick\fP [MAXBUF]" .br +.RI "\fIHolds the admin's nickname, for output in the /ADMIN command. \fP" .ti -1c .RI "char \fBdiepass\fP [MAXBUF]" .br +.RI "\fIThe admin-configured /DIE password. \fP" .ti -1c .RI "char \fBrestartpass\fP [MAXBUF]" .br +.RI "\fIThe admin-configured /RESTART password. \fP" .ti -1c .RI "char \fBmotd\fP [MAXBUF]" .br +.RI "\fIThe pathname and filename of the message of the day file, as defined by the administrator. \fP" .ti -1c .RI "char \fBrules\fP [MAXBUF]" .br +.RI "\fIThe pathname and filename of the rules file, as defined by the administrator. \fP" .ti -1c .RI "char \fBPrefixQuit\fP [MAXBUF]" .br +.RI "\fIThe quit prefix in use, or an empty string. \fP" .ti -1c .RI "char \fBDieValue\fP [MAXBUF]" .br +.RI "\fIThe last string found within a <die> tag, or an empty string. \fP" .ti -1c .RI "char \fBDNSServer\fP [MAXBUF]" .br +.RI "\fIThe \fBDNS\fP server to use for \fBDNS\fP queries. \fP" .ti -1c .RI "char \fBDisabledCommands\fP [MAXBUF]" .br +.RI "\fIThis variable contains a space-seperated list of commands which are disabled by the administrator of the server for non-opers. \fP" .ti -1c .RI "char \fBModPath\fP [1024]" .br +.RI "\fIThe full path to the modules directory. \fP" .ti -1c .RI "char \fBMyExecutable\fP [1024]" .br +.RI "\fIThe full pathname to the executable, as given in argv[0] when the program starts. \fP" .ti -1c .RI "FILE * \fBlog_file\fP" .br +.RI "\fIThe file handle of the logfile. \fP" .ti -1c .RI "bool \fBnofork\fP" .br +.RI "\fIIf this value is true, the owner of the server specified -nofork on the command line, causing the daemon to stay in the foreground. \fP" .ti -1c .RI "bool \fBunlimitcore\fP" .br +.RI "\fIIf this value is true, the owner of the server has chosen to unlimit the coredump size to as large a value as his account settings will allow. \fP" .ti -1c .RI "bool \fBAllowHalfop\fP" .br +.RI "\fIIf this value is true, halfops have been enabled in the configuration file. \fP" .ti -1c .RI "int \fBdns_timeout\fP" .br +.RI "\fIThe number of seconds the \fBDNS\fP subsystem will wait before timing out any request. \fP" .ti -1c .RI "int \fBNetBufferSize\fP" .br +.RI "\fIThe size of the read() buffer in the user handling code, used to read data into a user's recvQ. \fP" .ti -1c .RI "int \fBMaxConn\fP" .br +.RI "\fIThe value to be used for listen() backlogs as default. \fP" .ti -1c .RI "unsigned int \fBSoftLimit\fP" .br +.RI "\fIThe soft limit value assigned to the irc server. \fP" .ti -1c .RI "int \fBMaxWhoResults\fP" .br +.RI "\fIThe maximum number of /WHO results allowed in any single /WHO command. \fP" .ti -1c .RI "int \fBdebugging\fP" .br +.RI "\fITrue if the DEBUG loglevel is selected. \fP" .ti -1c .RI "int \fBLogLevel\fP" .br +.RI "\fIThe loglevel in use by the IRC server. \fP" .ti -1c .RI "int \fBDieDelay\fP" .br +.RI "\fIHow many seconds to wait before exiting the program when /DIE is correctly issued. \fP" .ti -1c .RI "char \fBaddrs\fP [MAXBUF][255]" .br +.RI "\fIA list of IP addresses the server is listening on. \fP" .ti -1c .RI "\fBfile_cache\fP \fBMOTD\fP" .br +.RI "\fIThe MOTD file, cached in a file_cache type. \fP" .ti -1c .RI "\fBfile_cache\fP \fBRULES\fP" .br +.RI "\fIThe RULES file, cached in a file_cache type. \fP" .ti -1c .RI "char \fBPID\fP [1024]" .br +.RI "\fIThe full pathname and filename of the PID file as defined in the configuration. \fP" .ti -1c .RI "std::stringstream \fBconfig_f\fP" .br +.RI "\fIThe parsed configuration file as a stringstream. \fP" .ti -1c .RI "\fBClassVector\fP \fBClasses\fP" .br +.RI "\fIThe connect classes in use by the IRC server. \fP" .ti -1c .RI "std::vector< \fBstd::string\fP > \fBmodule_names\fP" .br +.RI "\fIA list of module names (names only, no paths) which are currently loaded by the server. \fP" .in -1c .SS "Private Member Functions" @@ -156,9 +194,11 @@ Inherits \fBclassbase\fP. .ti -1c .RI "int \fBfgets_safe\fP (char *buffer, size_t maxsize, FILE *&file)" .br +.RI "\fIUsed by the config file subsystem to safely read a C-style string without dependency upon any certain style of linefeed, e.g. \fP" .ti -1c .RI "\fBstd::string\fP \fBConfProcess\fP (char *buffer, long linenumber, std::stringstream *errorstream, bool &error, \fBstd::string\fP filename)" .br +.RI "\fIThis private method processes one line of configutation, appending errors to errorstream and setting error if an error has occured. \fP" .in -1c .SS "Private Attributes" @@ -166,10 +206,15 @@ Inherits \fBclassbase\fP. .ti -1c .RI "std::vector< \fBstd::string\fP > \fBinclude_stack\fP" .br +.RI "\fIThis variable holds the names of all files included from the main one. \fP" .in -1c .SH "Detailed Description" .PP -Definition at line 34 of file inspircd_io.h. +This class holds the bulk of the runtime configuration for the ircd. + +It allows for reading new config values, accessing configuration files, and storage of the configuration data needed to run the ircd, such as the servername, connect classes, /ADMIN data, MOTDs and filenames etc. +.PP +Definition at line 39 of file inspircd_io.h. .SH "Constructor & Destructor Documentation" .PP .SS "ServerConfig::ServerConfig ()" @@ -178,9 +223,13 @@ Definition at line 34 of file inspircd_io.h. .PP .SS "void ServerConfig::ClearStack ()" .PP +Clears the include stack in preperation for a \fBRead()\fP call. +.PP Referenced by ConfigReader::ConfigReader(). .SS "\fBstd::string\fP ServerConfig::ConfProcess (char * buffer, long linenumber, std::stringstream * errorstream, bool & error, \fBstd::string\fP filename)\fC [private]\fP" .PP +This private method processes one line of configutation, appending errors to errorstream and setting error if an error has occured. +.PP .SS "int ServerConfig::ConfValue (char * tag, char * var, int index, char * result, std::stringstream * config)" .PP Referenced by userrec::HasPermission(). @@ -194,11 +243,18 @@ Referenced by ConfigReader::Enumerate(). Referenced by ConfigReader::EnumerateValues(). .SS "int ServerConfig::fgets_safe (char * buffer, size_t maxsize, FILE *& file)\fC [private]\fP" .PP +Used by the config file subsystem to safely read a C-style string without dependency upon any certain style of linefeed, e.g. +.PP +it can read both windows and UNIX style linefeeds transparently. .SS "bool ServerConfig::LoadConf (const char * filename, std::stringstream * target, std::stringstream * errorstream)" .PP Referenced by ConfigReader::ConfigReader(). .SS "void ServerConfig::Read (bool bail, \fBuserrec\fP * user)" .PP +Read the entire configuration into memory and initialize this class. +.PP +All other methods should be used only by the core. +.PP Referenced by Server::RehashServer(). .SS "int ServerConfig::ReadConf (std::stringstream * config_f, const char * tag, const char * var, int index, char * result)" .PP @@ -207,118 +263,200 @@ Referenced by ConfigReader::ReadFlag(), ConfigReader::ReadInteger(), and ConfigR .PP .SS "char \fBServerConfig::addrs\fP[MAXBUF][255]" .PP -Definition at line 70 of file inspircd_io.h. +A list of IP addresses the server is listening on. +.PP +Definition at line 216 of file inspircd_io.h. .SS "char \fBServerConfig::AdminEmail\fP[MAXBUF]" .PP -Definition at line 46 of file inspircd_io.h. +Holds the email address of the admin, for output in the /ADMIN command. +.PP +Definition at line 89 of file inspircd_io.h. .SS "char \fBServerConfig::AdminName\fP[MAXBUF]" .PP -Definition at line 45 of file inspircd_io.h. +Holds the admin's name, for output in the /ADMIN command. +.PP +Definition at line 84 of file inspircd_io.h. .SS "char \fBServerConfig::AdminNick\fP[MAXBUF]" .PP -Definition at line 47 of file inspircd_io.h. +Holds the admin's nickname, for output in the /ADMIN command. +.PP +Definition at line 94 of file inspircd_io.h. .SS "bool \fBServerConfig::AllowHalfop\fP" .PP -Definition at line 61 of file inspircd_io.h. +If this value is true, halfops have been enabled in the configuration file. +.PP +Definition at line 171 of file inspircd_io.h. .SS "\fBClassVector\fP \fBServerConfig::Classes\fP" .PP -Definition at line 75 of file inspircd_io.h. +The connect classes in use by the IRC server. +.PP +Definition at line 242 of file inspircd_io.h. .SS "std::stringstream \fBServerConfig::config_f\fP" .PP -Definition at line 74 of file inspircd_io.h. +The parsed configuration file as a stringstream. +.PP +You should pass this to any configuration methods of this class, and not access it directly. It is recommended that modules use \fBConfigReader\fP instead which provides a simpler abstraction of configuration files. +.PP +Definition at line 238 of file inspircd_io.h. .PP Referenced by userrec::HasPermission(). .SS "int \fBServerConfig::debugging\fP" .PP -Definition at line 67 of file inspircd_io.h. +True if the DEBUG loglevel is selected. +.PP +Definition at line 202 of file inspircd_io.h. .SS "int \fBServerConfig::DieDelay\fP" .PP -Definition at line 69 of file inspircd_io.h. +How many seconds to wait before exiting the program when /DIE is correctly issued. +.PP +Definition at line 211 of file inspircd_io.h. .SS "char \fBServerConfig::diepass\fP[MAXBUF]" .PP -Definition at line 48 of file inspircd_io.h. +The admin-configured /DIE password. +.PP +Definition at line 98 of file inspircd_io.h. .SS "char \fBServerConfig::DieValue\fP[MAXBUF]" .PP -Definition at line 53 of file inspircd_io.h. +The last string found within a <die> tag, or an empty string. +.PP +Definition at line 121 of file inspircd_io.h. .SS "char \fBServerConfig::DisabledCommands\fP[MAXBUF]" .PP -Definition at line 55 of file inspircd_io.h. +This variable contains a space-seperated list of commands which are disabled by the administrator of the server for non-opers. +.PP +Definition at line 131 of file inspircd_io.h. .SS "int \fBServerConfig::dns_timeout\fP" .PP -Definition at line 62 of file inspircd_io.h. +The number of seconds the \fBDNS\fP subsystem will wait before timing out any request. +.PP +Definition at line 176 of file inspircd_io.h. .SS "char \fBServerConfig::DNSServer\fP[MAXBUF]" .PP -Definition at line 54 of file inspircd_io.h. +The \fBDNS\fP server to use for \fBDNS\fP queries. +.PP +Definition at line 125 of file inspircd_io.h. .SS "std::vector<\fBstd::string\fP> \fBServerConfig::include_stack\fP\fC [private]\fP" .PP -Definition at line 37 of file inspircd_io.h. +This variable holds the names of all files included from the main one. +.PP +This is used to make sure that no files are recursively included. +.PP +Definition at line 47 of file inspircd_io.h. .SS "FILE* \fBServerConfig::log_file\fP" .PP -Definition at line 58 of file inspircd_io.h. +The file handle of the logfile. +.PP +If this value is NULL, the log file is not open, probably due to a permissions error on startup (this should not happen in normal operation!). +.PP +Definition at line 151 of file inspircd_io.h. .SS "int \fBServerConfig::LogLevel\fP" .PP -Definition at line 68 of file inspircd_io.h. +The loglevel in use by the IRC server. +.PP +Definition at line 206 of file inspircd_io.h. .SS "int \fBServerConfig::MaxConn\fP" .PP -Definition at line 64 of file inspircd_io.h. +The value to be used for listen() backlogs as default. +.PP +Definition at line 187 of file inspircd_io.h. .SS "int \fBServerConfig::MaxWhoResults\fP" .PP -Definition at line 66 of file inspircd_io.h. +The maximum number of /WHO results allowed in any single /WHO command. +.PP +Definition at line 198 of file inspircd_io.h. .SS "char \fBServerConfig::ModPath\fP[1024]" .PP -Definition at line 56 of file inspircd_io.h. +The full path to the modules directory. +.PP +This is either set at compile time, or overridden in the configuration file via the <options> tag. +.PP +Definition at line 138 of file inspircd_io.h. .SS "std::vector<\fBstd::string\fP> \fBServerConfig::module_names\fP" .PP -Definition at line 76 of file inspircd_io.h. +A list of module names (names only, no paths) which are currently loaded by the server. +.PP +Definition at line 247 of file inspircd_io.h. .PP Referenced by Server::FindModule(). .SS "\fBfile_cache\fP \fBServerConfig::MOTD\fP" .PP -Definition at line 71 of file inspircd_io.h. +The MOTD file, cached in a file_cache type. +.PP +Definition at line 220 of file inspircd_io.h. .SS "char \fBServerConfig::motd\fP[MAXBUF]" .PP -Definition at line 50 of file inspircd_io.h. +The pathname and filename of the message of the day file, as defined by the administrator. +.PP +Definition at line 107 of file inspircd_io.h. .SS "char \fBServerConfig::MyExecutable\fP[1024]" .PP -Definition at line 57 of file inspircd_io.h. +The full pathname to the executable, as given in argv[0] when the program starts. +.PP +Definition at line 143 of file inspircd_io.h. .SS "int \fBServerConfig::NetBufferSize\fP" .PP -Definition at line 63 of file inspircd_io.h. +The size of the read() buffer in the user handling code, used to read data into a user's recvQ. +.PP +Definition at line 182 of file inspircd_io.h. .SS "char \fBServerConfig::Network\fP[MAXBUF]" .PP -Definition at line 43 of file inspircd_io.h. +Definition at line 74 of file inspircd_io.h. .SS "bool \fBServerConfig::nofork\fP" .PP -Definition at line 59 of file inspircd_io.h. +If this value is true, the owner of the server specified -nofork on the command line, causing the daemon to stay in the foreground. +.PP +Definition at line 158 of file inspircd_io.h. .SS "char \fBServerConfig::PID\fP[1024]" .PP -Definition at line 73 of file inspircd_io.h. +The full pathname and filename of the PID file as defined in the configuration. +.PP +Definition at line 229 of file inspircd_io.h. .SS "char \fBServerConfig::PrefixQuit\fP[MAXBUF]" .PP -Definition at line 52 of file inspircd_io.h. +The quit prefix in use, or an empty string. +.PP +Definition at line 116 of file inspircd_io.h. .SS "char \fBServerConfig::restartpass\fP[MAXBUF]" .PP -Definition at line 49 of file inspircd_io.h. +The admin-configured /RESTART password. +.PP +Definition at line 102 of file inspircd_io.h. .SS "\fBfile_cache\fP \fBServerConfig::RULES\fP" .PP -Definition at line 72 of file inspircd_io.h. +The RULES file, cached in a file_cache type. +.PP +Definition at line 224 of file inspircd_io.h. .SS "char \fBServerConfig::rules\fP[MAXBUF]" .PP -Definition at line 51 of file inspircd_io.h. +The pathname and filename of the rules file, as defined by the administrator. +.PP +Definition at line 112 of file inspircd_io.h. .SS "char \fBServerConfig::ServerDesc\fP[MAXBUF]" .PP -Definition at line 44 of file inspircd_io.h. +Holds the description of the local server as defined by the administrator. +.PP +Definition at line 79 of file inspircd_io.h. .SS "char \fBServerConfig::ServerName\fP[MAXBUF]" .PP -Definition at line 42 of file inspircd_io.h. +Holds the server name of the local server as defined by the administrator. +.PP +Definition at line 68 of file inspircd_io.h. .PP Referenced by userrec::userrec(). .SS "unsigned int \fBServerConfig::SoftLimit\fP" .PP -Definition at line 65 of file inspircd_io.h. +The soft limit value assigned to the irc server. +.PP +The IRC server will not allow more than this number of local users. +.PP +Definition at line 193 of file inspircd_io.h. .SS "bool \fBServerConfig::unlimitcore\fP" .PP -Definition at line 60 of file inspircd_io.h. +If this value is true, the owner of the server has chosen to unlimit the coredump size to as large a value as his account settings will allow. +.PP +This is often used when debugging. +.PP +Definition at line 166 of file inspircd_io.h. .SH "Author" .PP diff --git a/docs/man/man3/channels.cpp.3 b/docs/man/man3/channels.cpp.3 index 429b0ccdd..0d5feb55c 100644 --- a/docs/man/man3/channels.cpp.3 +++ b/docs/man/man3/channels.cpp.3 @@ -135,7 +135,7 @@ Referenced by chanrec::GetModeParameter(), and chanrec::SetCustomModeParam(). .PP .SS "int \fBMODCOUNT\fP = -1" .PP -Definition at line 933 of file modules.cpp. +Definition at line 938 of file modules.cpp. .PP Referenced by Server::FindModule(). .SS "std::vector<\fBstd::string\fP> \fBmodule_names\fP" diff --git a/docs/man/man3/inspircd_io.h.3 b/docs/man/man3/inspircd_io.h.3 index b832da93e..fa150ea79 100644 --- a/docs/man/man3/inspircd_io.h.3 +++ b/docs/man/man3/inspircd_io.h.3 @@ -23,6 +23,7 @@ inspircd_io.h \- .ti -1c .RI "class \fBServerConfig\fP" .br +.RI "\fIThis class holds the bulk of the runtime configuration for the ircd. \fP" .in -1c .SS "Defines" @@ -30,6 +31,7 @@ inspircd_io.h \- .ti -1c .RI "#define \fBDEBUG\fP 10" .br +.RI "\fIFlags for use with log(). \fP" .ti -1c .RI "#define \fBVERBOSE\fP 20" .br @@ -72,6 +74,8 @@ inspircd_io.h \- .PP .SS "#define DEBUG 10" .PP +Flags for use with log(). +.PP Definition at line 28 of file inspircd_io.h. .PP Referenced by Server::AddExtendedMode(), SocketEngine::AddFd(), chanrec::AddUser(), SocketEngine::DelFd(), chanrec::DelUser(), InspSocket::InspSocket(), InspSocket::Read(), userrec::RemoveInvite(), chanrec::SetCustomMode(), chanrec::SetCustomModeParam(), InspSocket::SetState(), userrec::SetWriteError(), SocketEngine::SocketEngine(), and SocketEngine::~SocketEngine(). diff --git a/docs/man/man3/ircd_connector.3 b/docs/man/man3/ircd_connector.3 deleted file mode 100644 index 7198b4947..000000000 --- a/docs/man/man3/ircd_connector.3 +++ /dev/null @@ -1,487 +0,0 @@ -.TH "ircd_connector" 3 "30 May 2005" "InspIRCd" \" -*- nroff -*- -.ad l -.nh -.SH NAME -ircd_connector \- Each connection has one or more of these each represents ONE outbound connection to another ircd so each inbound has multiple outbounds. - -.PP -.SH SYNOPSIS -.br -.PP -\fC#include <connection.h>\fP -.PP -Inherits \fBExtensible\fP. -.PP -.SS "Public Member Functions" - -.in +1c -.ti -1c -.RI "\fBircd_connector\fP ()" -.br -.RI "\fIConstructor clears the sendq and initialises the fd to -1. \fP" -.ti -1c -.RI "bool \fBMakeOutboundConnection\fP (char *newhost, int newport)" -.br -.RI "\fICreate an outbound connection to a listening socket. \fP" -.ti -1c -.RI "std::string \fBGetServerName\fP ()" -.br -.RI "\fIReturn the servername on this established connection. \fP" -.ti -1c -.RI "void \fBSetServerName\fP (std::string serv)" -.br -.RI "\fISet the server name of this connection. \fP" -.ti -1c -.RI "int \fBGetDescriptor\fP ()" -.br -.RI "\fIGet the file descriptor associated with this connection. \fP" -.ti -1c -.RI "void \fBSetDescriptor\fP (int \fBfd\fP)" -.br -.RI "\fISet the file descriptor for this connection. \fP" -.ti -1c -.RI "int \fBGetState\fP ()" -.br -.RI "\fIGet the state flags for this connection. \fP" -.ti -1c -.RI "void \fBSetState\fP (int \fBstate\fP)" -.br -.RI "\fISet the state flags for this connection. \fP" -.ti -1c -.RI "char * \fBGetServerIP\fP ()" -.br -.RI "\fIGet the ip address (not servername) associated with this connection. \fP" -.ti -1c -.RI "std::string \fBGetDescription\fP ()" -.br -.RI "\fIGet the server description of this connection. \fP" -.ti -1c -.RI "void \fBSetDescription\fP (std::string desc)" -.br -.RI "\fISet the server description of this connection. \fP" -.ti -1c -.RI "int \fBGetServerPort\fP ()" -.br -.RI "\fIGet the port number being used for this connection If the connection is outbound this will be the remote port otherwise it will be the local port, so it can always be gautanteed as open at the address given in \fBGetServerIP()\fP. \fP" -.ti -1c -.RI "void \fBSetServerPort\fP (int p)" -.br -.RI "\fISet the port used by this connection. \fP" -.ti -1c -.RI "bool \fBSetHostAndPort\fP (char *newhost, int newport)" -.br -.RI "\fISet both the host and the port in one operation for this connection. \fP" -.ti -1c -.RI "void \fBCloseConnection\fP ()" -.br -.RI "\fIClose the connection by calling close() on its file descriptor This function call updates no other data. \fP" -.ti -1c -.RI "bool \fBAddBuffer\fP (std::string a)" -.br -.RI "\fIThis method adds text to the ircd connection's buffer. \fP" -.ti -1c -.RI "bool \fBBufferIsComplete\fP ()" -.br -.RI "\fIThis method returns true if the buffer contains at least one carriage return character, e.g. \fP" -.ti -1c -.RI "void \fBClearBuffer\fP ()" -.br -.RI "\fIThis method clears the server's buffer by setting it to an empty string. \fP" -.ti -1c -.RI "std::string \fBGetBuffer\fP ()" -.br -.RI "\fIThis method retrieves the first string from the tail end of the buffer and advances the tail end of the buffer past the returned string, in a similar manner to strtok(). \fP" -.ti -1c -.RI "void \fBSetVersionString\fP (std::string newversion)" -.br -.RI "\fIThis method sets the version string of the remote server. \fP" -.ti -1c -.RI "std::string \fBGetVersionString\fP ()" -.br -.RI "\fIThis method returns the version string of the remote server. \fP" -.ti -1c -.RI "bool \fBAddWriteBuf\fP (std::string data)" -.br -.RI "\fIAdds data to the connection's sendQ to be flushed later. \fP" -.ti -1c -.RI "bool \fBFlushWriteBuf\fP ()" -.br -.RI "\fIFlushes as much of the data from the buffer as possible, and advances the queue pointer to what is left. \fP" -.ti -1c -.RI "void \fBSetWriteError\fP (std::string error)" -.br -.RI "\fISets the error string for this connection. \fP" -.ti -1c -.RI "std::string \fBGetWriteError\fP ()" -.br -.RI "\fIGets the error string for this connection. \fP" -.ti -1c -.RI "bool \fBHasBufferedOutput\fP ()" -.br -.RI "\fIReturns true if there is data to be written that hasn't been sent yet. \fP" -.ti -1c -.RI "bool \fBCheckPing\fP ()" -.br -.RI "\fIChecks if the connection replied to its last ping, and if it did sends another and returns true, if not, returns false. \fP" -.ti -1c -.RI "void \fBResetPing\fP ()" -.br -.RI "\fIResets the ping counter. \fP" -.in -1c -.SS "Public Attributes" - -.in +1c -.ti -1c -.RI "std::string \fBircdbuffer\fP" -.br -.RI "\fIIRCD Buffer for input characters, holds as many lines as are pending - Note that the final line may not be complete and should only be read when there is a -.br - seperator. \fP" -.ti -1c -.RI "char \fBhost\fP [MAXBUF]" -.br -.RI "\fIWhen MakeOutboundConnection is called, these public members are filled with the details passed to the function, for future reference. \fP" -.ti -1c -.RI "int \fBport\fP" -.br -.RI "\fIWhen MakeOutboundConnection is called, these public members are filled with the details passed to the function, for future reference. \fP" -.ti -1c -.RI "std::vector< std::string > \fBroutes\fP" -.br -.RI "\fI\fBServer\fP names of servers that this server is linked to So for A->B->C, if this was the record for B it would contain A and C whilever both servers are connected to B. \fP" -.in -1c -.SS "Private Member Functions" - -.in +1c -.ti -1c -.RI "bool \fBSetHostAddress\fP (char *\fBhost\fP, int \fBport\fP)" -.br -.RI "\fIPRIVATE function to set the host address and port to connect to. \fP" -.in -1c -.SS "Private Attributes" - -.in +1c -.ti -1c -.RI "sockaddr_in \fBaddr\fP" -.br -.RI "\fISockaddr of the outbound ip and port. \fP" -.ti -1c -.RI "int \fBfd\fP" -.br -.RI "\fIFile descriptor of the connection. \fP" -.ti -1c -.RI "std::string \fBservername\fP" -.br -.RI "\fI\fBServer\fP name. \fP" -.ti -1c -.RI "std::string \fBdescription\fP" -.br -.RI "\fI\fBServer\fP 'GECOS'. \fP" -.ti -1c -.RI "char \fBstate\fP" -.br -.RI "\fIState. \fP" -.ti -1c -.RI "std::string \fBversion\fP" -.br -.RI "\fIThis string holds the ircd's version response. \fP" -.ti -1c -.RI "std::string \fBsendq\fP" -.br -.RI "\fISendQ of the outbound connector, does not have a limit. \fP" -.ti -1c -.RI "std::string \fBWriteError\fP" -.br -.RI "\fIWrite error of connection. \fP" -.ti -1c -.RI "time_t \fBnextping\fP" -.br -.RI "\fITime this connection was last pinged. \fP" -.ti -1c -.RI "bool \fBreplied\fP" -.br -.RI "\fIDid this connection reply to its last ping? \fP" -.in -1c -.SH "Detailed Description" -.PP -Each connection has one or more of these each represents ONE outbound connection to another ircd so each inbound has multiple outbounds. - -A listening socket that accepts server type connections is represented by one class serverrec. Class serverrec will instantiate several objects of type ircd_connector to represent each established connection, inbound or outbound. So, to determine all linked servers you must walk through all the serverrecs that the core defines, and in each one iterate through until you find connection(s) relating to the server you want information on. The core and module API provide functions for this. -.PP -Definition at line 56 of file connection.h. -.SH "Constructor & Destructor Documentation" -.PP -.SS "ircd_connector::ircd_connector ()" -.PP -Constructor clears the sendq and initialises the fd to -1. -.SH "Member Function Documentation" -.PP -.SS "bool ircd_connector::AddBuffer (std::string a)" -.PP -This method adds text to the ircd connection's buffer. \fBParameters:\fP -.RS 4 -\fIa\fP The text to add to the buffer up to a maximum size of 1MB -.RE -.PP -This buffer's maximum size is one megabyte, the method returning false if the buffer is full. -.PP -\fBReturns:\fP -.RS 4 -True on success, false if the buffer is full or the connection is down -.RE -.PP - -.SS "bool ircd_connector::AddWriteBuf (std::string data)" -.PP -Adds data to the connection's sendQ to be flushed later. \fBParameters:\fP -.RS 4 -\fIdata\fP The data to add to the write buffer -.RE -.PP -Fails if there is an error pending on the connection. -.PP -\fBReturns:\fP -.RS 4 -True on success, false if the connection is down or the buffer is full -.RE -.PP -Referenced by serverrec::SendPacket(). -.SS "bool ircd_connector::BufferIsComplete ()" -.PP -This method returns true if the buffer contains at least one carriage return character, e.g. one line can be read from the buffer successfully. -.PP -\fBReturns:\fP -.RS 4 -True if there is at least one complete line waiting to be processed -.RE -.PP - -.SS "bool ircd_connector::CheckPing ()" -.PP -Checks if the connection replied to its last ping, and if it did sends another and returns true, if not, returns false. \fBReturns:\fP -.RS 4 -True if the server is still replying to pings -.RE -.PP - -.SS "void ircd_connector::ClearBuffer ()" -.PP -This method clears the server's buffer by setting it to an empty string. -.SS "void ircd_connector::CloseConnection ()" -.PP -Close the connection by calling close() on its file descriptor This function call updates no other data. Referenced by serverrec::SendPacket(). -.SS "bool ircd_connector::FlushWriteBuf ()" -.PP -Flushes as much of the data from the buffer as possible, and advances the queue pointer to what is left. \fBReturns:\fP -.RS 4 -True if the flush succeeded, false if the connection is down -.RE -.PP -Referenced by serverrec::SendPacket(). -.SS "std::string ircd_connector::GetBuffer ()" -.PP -This method retrieves the first string from the tail end of the buffer and advances the tail end of the buffer past the returned string, in a similar manner to strtok(). \fBReturns:\fP -.RS 4 -The first line of the buffer up to a carriage return -.RE -.PP - -.SS "std::string ircd_connector::GetDescription ()" -.PP -Get the server description of this connection. \fBReturns:\fP -.RS 4 -The description (GECOS) of this connection -.RE -.PP - -.SS "int ircd_connector::GetDescriptor ()" -.PP -Get the file descriptor associated with this connection. \fBReturns:\fP -.RS 4 -The file descriptor associated with this connection -.RE -.PP - -.SS "char* ircd_connector::GetServerIP ()" -.PP -Get the ip address (not servername) associated with this connection. \fBReturns:\fP -.RS 4 -The connections IP address in dotted decimal form -.RE -.PP - -.SS "std::string ircd_connector::GetServerName ()" -.PP -Return the servername on this established connection. Referenced by serverrec::SendPacket(). -.SS "int ircd_connector::GetServerPort ()" -.PP -Get the port number being used for this connection If the connection is outbound this will be the remote port otherwise it will be the local port, so it can always be gautanteed as open at the address given in \fBGetServerIP()\fP. \fBReturns:\fP -.RS 4 -The port number of this connection -.RE -.PP - -.SS "int ircd_connector::GetState ()" -.PP -Get the state flags for this connection. \fBReturns:\fP -.RS 4 -The state flags associated with this connection -.RE -.PP -Referenced by serverrec::SendPacket(). -.SS "std::string ircd_connector::GetVersionString ()" -.PP -This method returns the version string of the remote server. If the server has no version string an empty string is returned. -.PP -\fBReturns:\fP -.RS 4 -The version text of this connection -.RE -.PP - -.SS "std::string ircd_connector::GetWriteError ()" -.PP -Gets the error string for this connection. \fBReturns:\fP -.RS 4 -The last error to occur or an empty string -.RE -.PP -Referenced by serverrec::SendPacket(). -.SS "bool ircd_connector::HasBufferedOutput ()" -.PP -Returns true if there is data to be written that hasn't been sent yet. \fBReturns:\fP -.RS 4 -True if the buffer is not empty -.RE -.PP - -.SS "bool ircd_connector::MakeOutboundConnection (char * newhost, int newport)" -.PP -Create an outbound connection to a listening socket. Referenced by serverrec::BeginLink(), and serverrec::MeshCookie(). -.SS "void ircd_connector::ResetPing ()" -.PP -Resets the ping counter. -.SS "void ircd_connector::SetDescription (std::string desc)" -.PP -Set the server description of this connection. \fBParameters:\fP -.RS 4 -\fIdesc\fP The description (GECOS) of this connection to be set -.RE -.PP - -.SS "void ircd_connector::SetDescriptor (int fd)" -.PP -Set the file descriptor for this connection. \fBParameters:\fP -.RS 4 -\fIfd\fP The file descriptor to associate with the connection -.RE -.PP -Referenced by serverrec::AddIncoming(). -.SS "bool ircd_connector::SetHostAddress (char * host, int port)\fC [private]\fP" -.PP -PRIVATE function to set the host address and port to connect to. -.SS "bool ircd_connector::SetHostAndPort (char * newhost, int newport)" -.PP -Set both the host and the port in one operation for this connection. \fBParameters:\fP -.RS 4 -\fInewhost\fP The hostname to set for this connection -.br -\fInewport\fP The port number to set for this connection -.RE -.PP -\fBReturns:\fP -.RS 4 -True on success, false on failure -.RE -.PP -Referenced by serverrec::AddIncoming(), serverrec::BeginLink(), and serverrec::MeshCookie(). -.SS "void ircd_connector::SetServerName (std::string serv)" -.PP -Set the server name of this connection. \fBParameters:\fP -.RS 4 -\fIserv\fP The server name to set -.RE -.PP -Referenced by serverrec::AddIncoming(), serverrec::BeginLink(), and serverrec::MeshCookie(). -.SS "void ircd_connector::SetServerPort (int p)" -.PP -Set the port used by this connection. \fBParameters:\fP -.RS 4 -\fIp\fP The port number to set for this connection -.RE -.PP - -.SS "void ircd_connector::SetState (int state)" -.PP -Set the state flags for this connection. \fBParameters:\fP -.RS 4 -\fIstate\fP The state flags to set for this connection -.RE -.PP -Referenced by serverrec::AddIncoming(), serverrec::BeginLink(), serverrec::MeshCookie(), and serverrec::SendPacket(). -.SS "void ircd_connector::SetVersionString (std::string newversion)" -.PP -This method sets the version string of the remote server. \fBParameters:\fP -.RS 4 -\fInewversion\fP The version string to set -.RE -.PP - -.SS "void ircd_connector::SetWriteError (std::string error)" -.PP -Sets the error string for this connection. \fBParameters:\fP -.RS 4 -\fIerror\fP The error string to set -.RE -.PP - -.SH "Member Data Documentation" -.PP -.SS "sockaddr_in \fBircd_connector::addr\fP\fC [private]\fP" -.PP -Sockaddr of the outbound ip and port. Definition at line 61 of file connection.h. -.SS "std::string \fBircd_connector::description\fP\fC [private]\fP" -.PP -\fBServer\fP 'GECOS'. Definition at line 73 of file connection.h. -.SS "int \fBircd_connector::fd\fP\fC [private]\fP" -.PP -File descriptor of the connection. Definition at line 65 of file connection.h. -.SS "char \fBircd_connector::host\fP[MAXBUF]" -.PP -When MakeOutboundConnection is called, these public members are filled with the details passed to the function, for future reference. Definition at line 117 of file connection.h. -.SS "std::string \fBircd_connector::ircdbuffer\fP" -.PP -IRCD Buffer for input characters, holds as many lines as are pending - Note that the final line may not be complete and should only be read when there is a -.br - seperator. Definition at line 110 of file connection.h. -.SS "time_t \fBircd_connector::nextping\fP\fC [private]\fP" -.PP -Time this connection was last pinged. Definition at line 98 of file connection.h. -.SS "int \fBircd_connector::port\fP" -.PP -When MakeOutboundConnection is called, these public members are filled with the details passed to the function, for future reference. Definition at line 123 of file connection.h. -.SS "bool \fBircd_connector::replied\fP\fC [private]\fP" -.PP -Did this connection reply to its last ping? Definition at line 102 of file connection.h. -.SS "std::vector<std::string> \fBircd_connector::routes\fP" -.PP -\fBServer\fP names of servers that this server is linked to So for A->B->C, if this was the record for B it would contain A and C whilever both servers are connected to B. Definition at line 129 of file connection.h. -.SS "std::string \fBircd_connector::sendq\fP\fC [private]\fP" -.PP -SendQ of the outbound connector, does not have a limit. Definition at line 90 of file connection.h. -.SS "std::string \fBircd_connector::servername\fP\fC [private]\fP" -.PP -\fBServer\fP name. Definition at line 69 of file connection.h. -.SS "char \fBircd_connector::state\fP\fC [private]\fP" -.PP -State. STATE_NOAUTH_INBOUND, STATE_NOAUTH_OUTBOUND STATE_SYNC, STATE_DISCONNECTED, STATE_CONNECTEDDefinition at line 78 of file connection.h. -.SS "std::string \fBircd_connector::version\fP\fC [private]\fP" -.PP -This string holds the ircd's version response. Definition at line 86 of file connection.h. -.SS "std::string \fBircd_connector::WriteError\fP\fC [private]\fP" -.PP -Write error of connection. Definition at line 94 of file connection.h. - -.SH "Author" -.PP -Generated automatically by Doxygen for InspIRCd from the source code. diff --git a/docs/man/man3/modules.cpp.3 b/docs/man/man3/modules.cpp.3 index 2b4dae325..b8eec9add 100644 --- a/docs/man/man3/modules.cpp.3 +++ b/docs/man/man3/modules.cpp.3 @@ -328,7 +328,7 @@ Referenced by DoAddExtendedMode(), ModeDefined(), ModeDefinedOff(), ModeDefinedO .PP .SS "int \fBMODCOUNT\fP = -1" .PP -Definition at line 933 of file modules.cpp. +Definition at line 938 of file modules.cpp. .SS "std::vector<\fBInspSocket\fP*> \fBmodule_sockets\fP" .PP Referenced by Server::AddSocket(), and Server::DelSocket(). diff --git a/docs/man/man3/modules.h.3 b/docs/man/man3/modules.h.3 index b65b4ac89..28f7e5404 100644 --- a/docs/man/man3/modules.h.3 +++ b/docs/man/man3/modules.h.3 @@ -242,22 +242,22 @@ Referenced by Module::OnAccessCheck(). Definition at line 38 of file modules.h. .SS "#define CONF_FILE_NOT_FOUND 0x000200" .PP -Definition at line 1516 of file modules.h. +Definition at line 1520 of file modules.h. .PP Referenced by ConfigReader::ConfigReader(). .SS "#define CONF_NOT_A_NUMBER 0x000010" .PP -Definition at line 1513 of file modules.h. +Definition at line 1517 of file modules.h. .PP Referenced by ConfigReader::ReadInteger(). .SS "#define CONF_NOT_UNSIGNED 0x000080" .PP -Definition at line 1514 of file modules.h. +Definition at line 1518 of file modules.h. .PP Referenced by ConfigReader::ReadInteger(). .SS "#define CONF_VALUE_NOT_FOUND 0x000100" .PP -Definition at line 1515 of file modules.h. +Definition at line 1519 of file modules.h. .PP Referenced by ConfigReader::ReadFlag(), ConfigReader::ReadInteger(), and ConfigReader::ReadValue(). .SS "#define DEBUG 10" @@ -351,7 +351,7 @@ Low level definition of a \fBFileReader\fP classes file cache area. Definition at line 65 of file modules.h. .SS "typedef DLLFactory<\fBModuleFactory\fP> \fBircd_module\fP" .PP -Definition at line 1682 of file modules.h. +Definition at line 1686 of file modules.h. .SS "typedef \fBfile_cache\fP \fBstring_list\fP" .PP Definition at line 70 of file modules.h. diff --git a/docs/man/man3/serverrec.3 b/docs/man/man3/serverrec.3 deleted file mode 100644 index 428f509df..000000000 --- a/docs/man/man3/serverrec.3 +++ /dev/null @@ -1,733 +0,0 @@ -.TH "serverrec" 3 "30 May 2005" "InspIRCd" \" -*- nroff -*- -.ad l -.nh -.SH NAME -serverrec \- A class that defines the local server or a remote server. - -.PP -.SH SYNOPSIS -.br -.PP -\fC#include <servers.h>\fP -.PP -Inherits \fBconnection\fP. -.PP -.SS "Public Member Functions" - -.in +1c -.ti -1c -.RI "\fBserverrec\fP ()" -.br -.RI "\fIConstructor. \fP" -.ti -1c -.RI "\fBserverrec\fP (char *n, long ver, bool jupe)" -.br -.RI "\fIConstructor which initialises some of the main variables. \fP" -.ti -1c -.RI "\fB~serverrec\fP ()" -.br -.RI "\fIDestructor. \fP" -.ti -1c -.RI "bool \fBCreateListener\fP (char *\fBhost\fP, int p)" -.br -.RI "\fICreate a listening socket on 'host' using port number 'p'. \fP" -.ti -1c -.RI "bool \fBBeginLink\fP (char *targethost, int \fBport\fP, char *password, char *servername, int myport)" -.br -.RI "\fIBegin an outbound link to another ircd at targethost. \fP" -.ti -1c -.RI "bool \fBMeshCookie\fP (char *targethost, int \fBport\fP, unsigned long cookie, char *servername)" -.br -.RI "\fIBegin an outbound mesh link to another ircd on a network you are already an authenticated member of. \fP" -.ti -1c -.RI "void \fBTerminateLink\fP (char *targethost)" -.br -.RI "\fITerminate a link to 'targethost' by calling the \fBircd_connector::CloseConnection\fP method. \fP" -.ti -1c -.RI "bool \fBSendPacket\fP (char *message, const char *\fBhost\fP)" -.br -.RI "\fISend a message to a server by name, if the server is unavailable directly route the packet via another server If the server still cannot be reached after attempting to route the message remotely, returns false. \fP" -.ti -1c -.RI "bool \fBRecvPacket\fP (std::deque< std::string > &messages, char *\fBhost\fP, std::deque< std::string > &sums)" -.br -.RI "\fIReturns the next available packet and returns true if data is available. \fP" -.ti -1c -.RI "\fBircd_connector\fP * \fBFindHost\fP (std::string \fBhost\fP)" -.br -.RI "\fIFind the \fBircd_connector\fP oject related to a certain servername given in 'host'. \fP" -.ti -1c -.RI "bool \fBAddIncoming\fP (int \fBfd\fP, char *targethost, int sourceport)" -.br -.RI "\fIAdd an incoming connection to the connection pool. \fP" -.ti -1c -.RI "void \fBFlushWriteBuffers\fP ()" -.br -.RI "\fIFlushes all data waiting to be written for all of this server's connections. \fP" -.in -1c -.SS "Public Attributes" - -.in +1c -.ti -1c -.RI "char \fBname\fP [MAXBUF]" -.br -.RI "\fIserver name \fP" -.ti -1c -.RI "long \fBpingtime\fP" -.br -.RI "\fIlast ping response (ms) \fP" -.ti -1c -.RI "long \fBusercount_i\fP" -.br -.RI "\fIinvisible users on server \fP" -.ti -1c -.RI "long \fBusercount\fP" -.br -.RI "\fInon-invisible users on server \fP" -.ti -1c -.RI "long \fBopercount\fP" -.br -.RI "\fIopers on server \fP" -.ti -1c -.RI "int \fBhops_away\fP" -.br -.RI "\fInumber of hops away (for quick access) \fP" -.ti -1c -.RI "long \fBversion\fP" -.br -.RI "\fIircd version \fP" -.ti -1c -.RI "bool \fBjupiter\fP" -.br -.RI "\fIis a JUPE server (faked to enforce a server ban) \fP" -.ti -1c -.RI "char \fBdescription\fP [MAXBUF]" -.br -.RI "\fIDescription of the server. \fP" -.ti -1c -.RI "char \fBnickserv\fP [NICKMAX]" -.br -.RI "\fIHolds nickserv's name on U:lined (services) servers (this is a kludge for ircservices which ASSUMES things :/). \fP" -.ti -1c -.RI "bool \fBsync_soon\fP" -.br -.ti -1c -.RI "std::vector< \fBircd_connector\fP > \fBconnectors\fP" -.br -.RI "\fIWith a serverrec, this is a list of all established server connections. \fP" -.in -1c -.SH "Detailed Description" -.PP -A class that defines the local server or a remote server. Definition at line 30 of file servers.h. -.SH "Constructor & Destructor Documentation" -.PP -.SS "serverrec::serverrec ()" -.PP -Constructor. Definition at line 46 of file servers.cpp. -.PP -References connectors, connection::fd, hops_away, jupiter, connection::lastping, name, nickserv, opercount, pingtime, connection::signon, sync_soon, TIME, usercount, usercount_i, and version. -.PP -.nf -47 { -48 strlcpy(name,'',256); -49 pingtime = 0; -50 lastping = TIME; -51 usercount_i = usercount = opercount = version = 0; -52 hops_away = 1; -53 signon = TIME; -54 jupiter = false; -55 fd = 0; -56 sync_soon = false; -57 strlcpy(nickserv,'',NICKMAX); -58 connectors.clear(); -59 } -.fi -.SS "serverrec::serverrec (char * n, long ver, bool jupe)" -.PP -Constructor which initialises some of the main variables. Definition at line 66 of file servers.cpp. -.PP -References connectors, connection::fd, hops_away, jupiter, connection::lastping, name, nickserv, opercount, connection::signon, sync_soon, TIME, usercount, usercount_i, and version. -.PP -.nf -67 { -68 strlcpy(name,n,256); -69 lastping = TIME; -70 usercount_i = usercount = opercount = 0; -71 version = ver; -72 hops_away = 1; -73 signon = TIME; -74 jupiter = jupe; -75 fd = 0; -76 sync_soon = false; -77 strlcpy(nickserv,'',NICKMAX); -78 connectors.clear(); -79 } -.fi -.SS "serverrec::~\fBserverrec\fP ()" -.PP -Destructor. Definition at line 62 of file servers.cpp. -.PP -.nf -63 { -64 } -.fi -.SH "Member Function Documentation" -.PP -.SS "bool serverrec::AddIncoming (int fd, char * targethost, int sourceport)" -.PP -Add an incoming connection to the connection pool. (reserved for core use) Definition at line 212 of file servers.cpp. -.PP -References connectors, DEBUG, ircd_connector::SetDescriptor(), ircd_connector::SetHostAndPort(), ircd_connector::SetServerName(), ircd_connector::SetState(), and STATE_NOAUTH_INBOUND. -.PP -.nf -213 { -214 ircd_connector connector; -215 -216 // targethost has been turned into an ip... -217 // we dont want this as the server name. -218 connector.SetServerName(targethost); -219 connector.SetDescriptor(newfd); -220 connector.SetState(STATE_NOAUTH_INBOUND); -221 int flags = fcntl(newfd, F_GETFL, 0); -222 fcntl(newfd, F_SETFL, flags | O_NONBLOCK); -223 int sendbuf = 32768; -224 int recvbuf = 32768; -225 setsockopt(newfd,SOL_SOCKET,SO_SNDBUF,(const void *)&sendbuf,sizeof(sendbuf)); -226 setsockopt(newfd,SOL_SOCKET,SO_RCVBUF,(const void *)&recvbuf,sizeof(sendbuf)); -227 connector.SetHostAndPort(targethost, sourceport); -228 connector.SetState(STATE_NOAUTH_INBOUND); -229 log(DEBUG,'serverrec::AddIncoming() Added connection: %s:%d',targethost,sourceport); -230 this->connectors.push_back(connector); -231 return true; -232 } -.fi -.SS "bool serverrec::BeginLink (char * targethost, int port, char * password, char * servername, int myport)" -.PP -Begin an outbound link to another ircd at targethost. Definition at line 142 of file servers.cpp. -.PP -References connectors, connection::fd, FindHost(), ircd_connector::MakeOutboundConnection(), SendPacket(), ircd_connector::SetHostAndPort(), ircd_connector::SetServerName(), ircd_connector::SetState(), STATE_DISCONNECTED, and STATE_NOAUTH_OUTBOUND. -.PP -.nf -143 { -144 char connect[MAXBUF]; -145 -146 ircd_connector connector; -147 ircd_connector *cn = this->FindHost(servername); -148 -149 -150 if (cn) -151 { -152 WriteOpers('CONNECT aborted: Server %s already exists',servername); -153 return false; -154 } -155 -156 -157 if (this->fd) -158 { -159 if (connector.MakeOutboundConnection(targethost,newport)) -160 { -161 // targethost has been turned into an ip... -162 // we dont want this as the server name. -163 connector.SetServerName(servername); -164 snprintf(connect,MAXBUF,'S %s %s %lu %s :%s',getservername().c_str(),password,(unsigned long)myport,GetRevision().c_str(),getserverdesc().c_str()); -165 connector.SetState(STATE_NOAUTH_OUTBOUND); -166 connector.SetHostAndPort(targethost, newport); -167 this->connectors.push_back(connector); -168 // this packet isn't actually sent until the socket connects -- the STATE_NOAUTH_OUTBOUND state -169 // queues outbound data until the socket is polled as writeable (e.g. the connection is established) -170 return this->SendPacket(connect, servername); -171 } -172 else -173 { -174 connector.SetState(STATE_DISCONNECTED); -175 WriteOpers('Could not create outbound connection to %s:%d',targethost,newport); -176 } -177 } -178 return false; -179 } -.fi -.SS "bool serverrec::CreateListener (char * host, int p)" -.PP -Create a listening socket on 'host' using port number 'p'. Definition at line 81 of file servers.cpp. -.PP -References connection::fd, MaxConn, and connection::port. -.PP -.nf -82 { -83 sockaddr_in host_address; -84 int flags; -85 in_addr addy; -86 int on = 0; -87 struct linger linger = { 0 }; -88 -89 this->port = p; -90 -91 fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); -92 if (fd <= 0) -93 { -94 return false; -95 } -96 -97 setsockopt(fd,SOL_SOCKET,SO_REUSEADDR,(const char*)&on,sizeof(on)); -98 linger.l_onoff = 1; -99 linger.l_linger = 1; -100 setsockopt(fd,SOL_SOCKET,SO_LINGER,(const char*)&linger,sizeof(linger)); -101 -102 // attempt to increase socket sendq and recvq as high as its possible -103 // to get them on linux. -104 int sendbuf = 32768; -105 int recvbuf = 32768; -106 setsockopt(fd,SOL_SOCKET,SO_SNDBUF,(const void *)&sendbuf,sizeof(sendbuf)); -107 setsockopt(fd,SOL_SOCKET,SO_RCVBUF,(const void *)&recvbuf,sizeof(sendbuf)); -108 -109 memset((void*)&host_address, 0, sizeof(host_address)); -110 -111 host_address.sin_family = AF_INET; -112 -113 if (!strcmp(newhost,'')) -114 { -115 host_address.sin_addr.s_addr = htonl(INADDR_ANY); -116 } -117 else -118 { -119 inet_aton(newhost,&addy); -120 host_address.sin_addr = addy; -121 } -122 -123 host_address.sin_port = htons(p); -124 -125 if (bind(fd,(sockaddr*)&host_address,sizeof(host_address))<0) -126 { -127 return false; -128 } -129 -130 // make the socket non-blocking -131 flags = fcntl(fd, F_GETFL, 0); -132 fcntl(fd, F_SETFL, flags | O_NONBLOCK); -133 -134 this->port = p; -135 -136 listen(this->fd, MaxConn); -137 -138 return true; -139 } -.fi -.SS "\fBircd_connector\fP * serverrec::FindHost (std::string host)" -.PP -Find the \fBircd_connector\fP oject related to a certain servername given in 'host'. Definition at line 242 of file servers.cpp. -.PP -References connectors. -.PP -Referenced by BeginLink(), and SendPacket(). -.PP -.nf -243 { -244 for (int i = 0; i < this->connectors.size(); i++) -245 { -246 if (this->connectors[i].GetServerName() == findhost) -247 { -248 return &this->connectors[i]; -249 } -250 } -251 return NULL; -252 } -.fi -.SS "void serverrec::FlushWriteBuffers ()" -.PP -Flushes all data waiting to be written for all of this server's connections. Definition at line 274 of file servers.cpp. -.PP -References connectors, has_been_netsplit, IsRoutable(), STATE_DISCONNECTED, STATE_NOAUTH_INBOUND, STATE_NOAUTH_OUTBOUND, and TIME. -.PP -.nf -275 { -276 char buffer[MAXBUF]; -277 for (int i = 0; i < this->connectors.size(); i++) -278 { -279 // don't try and ping a NOAUTH_OUTBOUND state, its not authed yet! -280 if ((this->connectors[i].GetState() == STATE_NOAUTH_OUTBOUND) && (TIME > this->connectors[i].age+30)) -281 { -282 // however if we reach this timer its connected timed out :) -283 WriteOpers('*** Connection to %s timed out',this->connectors[i].GetServerName().c_str()); -284 snprintf(buffer,MAXBUF,'& %s',this->connectors[i].GetServerName().c_str()); -285 NetSendToAllExcept(this->connectors[i].GetServerName().c_str(),buffer); -286 DoSplit(this->connectors[i].GetServerName().c_str()); -287 return; -288 } -289 if ((this->connectors[i].GetState() == STATE_NOAUTH_INBOUND) && (TIME > this->connectors[i].age+30)) -290 { -291 WriteOpers('*** Connection from %s timed out',this->connectors[i].GetServerName().c_str()); -292 snprintf(buffer,MAXBUF,'& %s',this->connectors[i].GetServerName().c_str()); -293 NetSendToAllExcept(this->connectors[i].GetServerName().c_str(),buffer); -294 DoSplit(this->connectors[i].GetServerName().c_str()); -295 return; -296 } -297 if (this->connectors[i].GetState() != STATE_DISCONNECTED) -298 { -299 if (!this->connectors[i].CheckPing()) -300 { -301 WriteOpers('*** Lost single connection to %s: Ping timeout',this->connectors[i].GetServerName().c_str()); -302 this->connectors[i].CloseConnection(); -303 this->connectors[i].SetState(STATE_DISCONNECTED); -304 if (!IsRoutable(this->connectors[i].GetServerName())) -305 { -306 WriteOpers('*** Server %s is no longer routable, disconnecting.',this->connectors[i].GetServerName().c_str()); -307 snprintf(buffer,MAXBUF,'& %s',this->connectors[i].GetServerName().c_str()); -308 NetSendToAllExcept(this->connectors[i].GetServerName().c_str(),buffer); -309 DoSplit(this->connectors[i].GetServerName().c_str()); -310 } -311 has_been_netsplit = true; -312 } -313 } -314 if ((this->connectors[i].GetWriteError() !='') && (this->connectors[i].GetState() != STATE_DISCONNECTED)) -315 { -316 // if we're here the write() caused an error, we cannot proceed -317 WriteOpers('*** Lost single connection to %s, link inactive and retrying: %s',this->connectors[i].GetServerName().c_str(),this->connectors[i].GetWriteError().c_str()); -318 this->connectors[i].CloseConnection(); -319 this->connectors[i].SetState(STATE_DISCONNECTED); -320 if (!IsRoutable(this->connectors[i].GetServerName())) -321 { -322 WriteOpers('*** Server %s is no longer routable, disconnecting.',this->connectors[i].GetServerName().c_str()); -323 snprintf(buffer,MAXBUF,'& %s',this->connectors[i].GetServerName().c_str()); -324 NetSendToAllExcept(this->connectors[i].GetServerName().c_str(),buffer); -325 DoSplit(this->connectors[i].GetServerName().c_str()); -326 } -327 has_been_netsplit = true; -328 } -329 if ((this->connectors[i].HasBufferedOutput()) && (this->connectors[i].GetState() != STATE_DISCONNECTED)) -330 { -331 if (!this->connectors[i].FlushWriteBuf()) -332 { -333 // if we're here the write() caused an error, we cannot proceed -334 WriteOpers('*** Lost single connection to %s, link inactive and retrying: %s',this->connectors[i].GetServerName().c_str(),this->connectors[i].GetWriteError().c_str()); -335 this->connectors[i].CloseConnection(); -336 this->connectors[i].SetState(STATE_DISCONNECTED); -337 if (!IsRoutable(this->connectors[i].GetServerName())) -338 { -339 WriteOpers('*** Server %s is no longer routable, disconnecting.',this->connectors[i].GetServerName().c_str()); -340 snprintf(buffer,MAXBUF,'& %s',this->connectors[i].GetServerName().c_str()); -341 NetSendToAllExcept(this->connectors[i].GetServerName().c_str(),buffer); -342 DoSplit(this->connectors[i].GetServerName().c_str()); -343 } -344 has_been_netsplit = true; -345 } -346 } -347 } -348 } -.fi -.SS "bool serverrec::MeshCookie (char * targethost, int port, unsigned long cookie, char * servername)" -.PP -Begin an outbound mesh link to another ircd on a network you are already an authenticated member of. Definition at line 182 of file servers.cpp. -.PP -References connectors, connection::fd, ircd_connector::MakeOutboundConnection(), SendPacket(), ircd_connector::SetHostAndPort(), ircd_connector::SetServerName(), ircd_connector::SetState(), STATE_DISCONNECTED, and STATE_NOAUTH_OUTBOUND. -.PP -.nf -183 { -184 char connect[MAXBUF]; -185 -186 ircd_connector connector; -187 -188 WriteOpers('Establishing meshed link to %s:%d',servername,newport); -189 -190 if (this->fd) -191 { -192 if (connector.MakeOutboundConnection(targethost,newport)) -193 { -194 // targethost has been turned into an ip... -195 // we dont want this as the server name. -196 connector.SetServerName(servername); -197 snprintf(connect,MAXBUF,'- %lu %s :%s',cookie,getservername().c_str(),getserverdesc().c_str()); -198 connector.SetState(STATE_NOAUTH_OUTBOUND); -199 connector.SetHostAndPort(targethost, newport); -200 this->connectors.push_back(connector); -201 return this->SendPacket(connect, servername); -202 } -203 else -204 { -205 connector.SetState(STATE_DISCONNECTED); -206 WriteOpers('Could not create outbound connection to %s:%d',targethost,newport); -207 } -208 } -209 return false; -210 } -.fi -.SS "bool serverrec::RecvPacket (std::deque< std::string > & messages, char * host, std::deque< std::string > & sums)" -.PP -Returns the next available packet and returns true if data is available. Writes the servername the data came from to 'host'. If no data is available this function returns false. This function will automatically close broken links and reroute pathways, generating split messages on the network. Definition at line 445 of file servers.cpp. -.PP -References already_have_sum(), connectors, DEBUG, has_been_netsplit, IsRoutable(), and STATE_DISCONNECTED. -.PP -.nf -446 { -447 char data[65536],buffer[MAXBUF]; -448 memset(data, 0, 65536); -449 for (int i = 0; i < this->connectors.size(); i++) -450 { -451 if (this->connectors[i].GetState() != STATE_DISCONNECTED) -452 { -453 // returns false if the packet could not be sent (e.g. target host down) -454 int rcvsize = 0; -455 -456 // check if theres any data on this socket -457 // if not, continue onwards to the next. -458 pollfd polls; -459 polls.fd = this->connectors[i].GetDescriptor(); -460 polls.events = POLLIN; -461 int ret = poll(&polls,1,1); -462 if (ret <= 0) continue; -463 -464 rcvsize = recv(this->connectors[i].GetDescriptor(),data,65000,0); -465 data[rcvsize] = '\0'; -466 if (rcvsize == 0) -467 { -468 log(DEBUG,'recv() failed for serverrec::RecvPacket(): EOF'); -469 log(DEBUG,'Disabling connector: %s',this->connectors[i].GetServerName().c_str()); -470 this->connectors[i].CloseConnection(); -471 this->connectors[i].SetState(STATE_DISCONNECTED); -472 if (!IsRoutable(this->connectors[i].GetServerName())) -473 { -474 WriteOpers('*** Server %s is no longer routable, disconnecting (EOF)',this->connectors[i].GetServerName().c_str()); -475 snprintf(buffer,MAXBUF,'& %s',this->connectors[i].GetServerName().c_str()); -476 NetSendToAllExcept(this->connectors[i].GetServerName().c_str(),buffer); -477 DoSplit(this->connectors[i].GetServerName().c_str()); -478 } -479 has_been_netsplit = true; -480 } -481 if (rcvsize == -1) -482 { -483 if (errno != EAGAIN) -484 { -485 log(DEBUG,'recv() failed for serverrec::RecvPacket(): %s',strerror(errno)); -486 log(DEBUG,'Disabling connector: %s',this->connectors[i].GetServerName().c_str()); -487 this->connectors[i].CloseConnection(); -488 this->connectors[i].SetState(STATE_DISCONNECTED); -489 if (!IsRoutable(this->connectors[i].GetServerName())) -490 { -491 WriteOpers('*** Server %s is no longer routable, disconnecting.',this->connectors[i].GetServerName().c_str()); -492 snprintf(buffer,MAXBUF,'& %s',this->connectors[i].GetServerName().c_str()); -493 NetSendToAllExcept(this->connectors[i].GetServerName().c_str(),buffer); -494 DoSplit(this->connectors[i].GetServerName().c_str()); -495 } -496 has_been_netsplit = true; -497 } -498 } -499 int pushed = 0; -500 if (rcvsize > 0) -501 { -502 if (!this->connectors[i].AddBuffer(data)) -503 { -504 WriteOpers('*** Read buffer for %s exceeds maximum, closing connection!',this->connectors[i].GetServerName().c_str()); -505 this->connectors[i].CloseConnection(); -506 this->connectors[i].SetState(STATE_DISCONNECTED); -507 if (!IsRoutable(this->connectors[i].GetServerName())) -508 { -509 WriteOpers('*** Server %s is no longer routable, disconnecting.',this->connectors[i].GetServerName().c_str()); -510 snprintf(buffer,MAXBUF,'& %s',this->connectors[i].GetServerName().c_str()); -511 NetSendToAllExcept(this->connectors[i].GetServerName().c_str(),buffer); -512 DoSplit(this->connectors[i].GetServerName().c_str()); -513 } -514 has_been_netsplit = true; -515 } -516 if (this->connectors[i].BufferIsComplete()) -517 { -518 this->connectors[i].ResetPing(); -519 while (this->connectors[i].BufferIsComplete()) -520 { -521 std::string text = this->connectors[i].GetBuffer(); -522 if (text != '') -523 { -524 if ((text[0] == ':') && (text.find(' ') != std::string::npos)) -525 { -526 std::string orig = text; -527 log(DEBUG,'Original: %s',text.c_str()); -528 std::string sum = text.substr(1,text.find(' ')-1); -529 text = text.substr(text.find(' ')+1,text.length()); -530 std::string possible_token = text.substr(1,text.find(' ')-1); -531 if (possible_token.length() > 1) -532 { -533 sums.push_back('*'); -534 text = orig; -535 log(DEBUG,'Non-mesh, non-tokenized string passed up the chain'); -536 } -537 else -538 { -539 log(DEBUG,'Packet sum: '%s'',sum.c_str()); -540 if ((already_have_sum(sum)) && (sum != '*')) -541 { -542 // we don't accept dupes -543 continue; -544 } -545 sums.push_back(sum.c_str()); -546 } -547 } -548 else sums.push_back('*'); -549 messages.push_back(text.c_str()); -550 strlcpy(recvhost,this->connectors[i].GetServerName().c_str(),160); -551 log(DEBUG,'serverrec::RecvPacket() %d:%s->%s',pushed++,recvhost,text.c_str()); -552 } -553 } -554 return true; -555 } -556 } -557 } -558 } -559 // nothing new yet -- message and host will be undefined -560 return false; -561 } -.fi -.SS "bool serverrec::SendPacket (char * message, const char * host)" -.PP -Send a message to a server by name, if the server is unavailable directly route the packet via another server If the server still cannot be reached after attempting to route the message remotely, returns false. Definition at line 350 of file servers.cpp. -.PP -References ircd_connector::AddWriteBuf(), ircd_connector::CloseConnection(), connectors, DEBUG, FindHost(), ircd_connector::FlushWriteBuf(), ircd_connector::GetServerName(), ircd_connector::GetState(), ircd_connector::GetWriteError(), ircd_connector::SetState(), and STATE_DISCONNECTED. -.PP -Referenced by BeginLink(), and MeshCookie(). -.PP -.nf -351 { -352 if ((!message) || (!sendhost)) -353 return true; -354 -355 ircd_connector* cn = this->FindHost(sendhost); -356 -357 if (!strchr(message,'\n')) -358 { -359 strlcat(message,'\n',MAXBUF); -360 } -361 -362 if (cn) -363 { -364 log(DEBUG,'main: serverrec::SendPacket() sent '%s' to %s',message,cn->GetServerName().c_str()); -365 -366 if (cn->GetState() == STATE_DISCONNECTED) -367 { -368 // fix: can only route one hop to avoid a loop -369 if (strncmp(message,'R ',2)) -370 { -371 log(DEBUG,'Not a double reroute'); -372 // this route is down, we must re-route the packet through an available point in the mesh. -373 for (int k = 0; k < this->connectors.size(); k++) -374 { -375 log(DEBUG,'Check connector %d: %s',k,this->connectors[k].GetServerName().c_str()); -376 // search for another point in the mesh which can 'reach' where we want to go -377 for (int m = 0; m < this->connectors[k].routes.size(); m++) -378 { -379 if (!strcasecmp(this->connectors[k].routes[m].c_str(),sendhost)) -380 { -381 log(DEBUG,'Found alternative route for packet: %s',this->connectors[k].GetServerName().c_str()); -382 char buffer[MAXBUF]; -383 snprintf(buffer,MAXBUF,'R %s %s',sendhost,message); -384 this->SendPacket(buffer,this->connectors[k].GetServerName().c_str()); -385 return true; -386 } -387 } -388 } -389 } -390 char buffer[MAXBUF]; -391 snprintf(buffer,MAXBUF,'& %s',sendhost); -392 WriteOpers('*** All connections to %s lost.',sendhost); -393 NetSendToAllExcept(sendhost,buffer); -394 DoSplit(sendhost); -395 return false; -396 } -397 -398 // returns false if the packet could not be sent (e.g. target host down) -399 if (!cn->AddWriteBuf(message)) -400 { -401 // if we're here, there was an error pending, and the send cannot proceed -402 log(DEBUG,'cn->AddWriteBuf() failed for serverrec::SendPacket(): %s',cn->GetWriteError().c_str()); -403 log(DEBUG,'Disabling connector: %s',cn->GetServerName().c_str()); -404 cn->CloseConnection(); -405 cn->SetState(STATE_DISCONNECTED); -406 WriteOpers('*** Lost single connection to %s, link inactive and retrying: %s',cn->GetServerName().c_str(),cn->GetWriteError().c_str()); -407 // retry the packet along a new route so either arrival OR failure are gauranteed (bugfix) -408 return this->SendPacket(message,sendhost); -409 } -410 if (!cn->FlushWriteBuf()) -411 { -412 // if we're here the write() caused an error, we cannot proceed -413 log(DEBUG,'cn->FlushWriteBuf() failed for serverrec::SendPacket(): %s',cn->GetWriteError().c_str()); -414 log(DEBUG,'Disabling connector: %s',cn->GetServerName().c_str()); -415 cn->CloseConnection(); -416 cn->SetState(STATE_DISCONNECTED); -417 WriteOpers('*** Lost single connection to %s, link inactive and retrying: %s',cn->GetServerName().c_str(),cn->GetWriteError().c_str()); -418 // retry the packet along a new route so either arrival OR failure are gauranteed -419 return this->SendPacket(message,sendhost); -420 } -421 return true; -422 } -423 } -.fi -.SS "void serverrec::TerminateLink (char * targethost)" -.PP -Terminate a link to 'targethost' by calling the \fBircd_connector::CloseConnection\fP method. Definition at line 234 of file servers.cpp. -.PP -.nf -235 { -236 // this locates the targethost in the serverrec::connectors vector of the class, -237 // and terminates it by sending it an SQUIT token and closing its descriptor. -238 // TerminateLink with a null string causes a terminate of ALL links -239 } -.fi -.SH "Member Data Documentation" -.PP -.SS "std::vector<\fBircd_connector\fP> \fBserverrec::connectors\fP" -.PP -With a serverrec, this is a list of all established server connections. Definition at line 81 of file servers.h. -.PP -Referenced by AddIncoming(), BeginLink(), FindHost(), FlushWriteBuffers(), IsRoutable(), MeshCookie(), RecvPacket(), SendPacket(), and serverrec(). -.SS "char \fBserverrec::description\fP[MAXBUF]" -.PP -Description of the server. Definition at line 61 of file servers.h. -.SS "int \fBserverrec::hops_away\fP" -.PP -number of hops away (for quick access) Definition at line 51 of file servers.h. -.PP -Referenced by serverrec(). -.SS "bool \fBserverrec::jupiter\fP" -.PP -is a JUPE server (faked to enforce a server ban) Definition at line 57 of file servers.h. -.PP -Referenced by serverrec(). -.SS "char \fBserverrec::name\fP[MAXBUF]" -.PP -server name Definition at line 36 of file servers.h. -.PP -Referenced by serverrec(). -.SS "char \fBserverrec::nickserv\fP[NICKMAX]" -.PP -Holds nickserv's name on U:lined (services) servers (this is a kludge for ircservices which ASSUMES things :/). Definition at line 65 of file servers.h. -.PP -Referenced by serverrec(). -.SS "long \fBserverrec::opercount\fP" -.PP -opers on server Definition at line 48 of file servers.h. -.PP -Referenced by serverrec(). -.SS "long \fBserverrec::pingtime\fP" -.PP -last ping response (ms) Definition at line 39 of file servers.h. -.PP -Referenced by serverrec(). -.SS "bool \fBserverrec::sync_soon\fP" -.PP -Definition at line 67 of file servers.h. -.PP -Referenced by serverrec(). -.SS "long \fBserverrec::usercount\fP" -.PP -non-invisible users on server Definition at line 45 of file servers.h. -.PP -Referenced by serverrec(). -.SS "long \fBserverrec::usercount_i\fP" -.PP -invisible users on server Definition at line 42 of file servers.h. -.PP -Referenced by serverrec(). -.SS "long \fBserverrec::version\fP" -.PP -ircd version Definition at line 54 of file servers.h. -.PP -Referenced by serverrec(). - -.SH "Author" -.PP -Generated automatically by Doxygen for InspIRCd from the source code. diff --git a/docs/man/man3/servers.cpp.3 b/docs/man/man3/servers.cpp.3 deleted file mode 100644 index ff4d1a736..000000000 --- a/docs/man/man3/servers.cpp.3 +++ /dev/null @@ -1,150 +0,0 @@ -.TH "servers.cpp" 3 "30 May 2005" "InspIRCd" \" -*- nroff -*- -.ad l -.nh -.SH NAME -servers.cpp \- -.SH SYNOPSIS -.br -.PP -\fC#include 'inspircd_config.h'\fP -.br -\fC#include 'servers.h'\fP -.br -\fC#include 'inspircd.h'\fP -.br -\fC#include <unistd.h>\fP -.br -\fC#include <fcntl.h>\fP -.br -\fC#include <poll.h>\fP -.br -\fC#include <sys/errno.h>\fP -.br -\fC#include <sys/ioctl.h>\fP -.br -\fC#include <sys/utsname.h>\fP -.br -\fC#include <vector>\fP -.br -\fC#include <string>\fP -.br -\fC#include <deque>\fP -.br -\fC#include <sstream>\fP -.br -\fC#include <map>\fP -.br -\fC#include 'inspstring.h'\fP -.br -\fC#include 'helperfuncs.h'\fP -.br -\fC#include 'connection.h'\fP -.br - -.SS "Functions" - -.in +1c -.ti -1c -.RI "bool \fBIsRoutable\fP (std::string servername)" -.br -.ti -1c -.RI "bool \fBalready_have_sum\fP (std::string sum)" -.br -.in -1c -.SS "Variables" - -.in +1c -.ti -1c -.RI "time_t \fBTIME\fP" -.br -.ti -1c -.RI "int \fBMaxConn\fP" -.br -.ti -1c -.RI "\fBserverrec\fP * \fBme\fP [32]" -.br -.ti -1c -.RI "bool \fBhas_been_netsplit\fP" -.br -.ti -1c -.RI "std::deque< std::string > \fBxsums\fP" -.br -.in -1c -.SH "Function Documentation" -.PP -.SS "bool already_have_sum (std::string sum)" -.PP -Definition at line 425 of file servers.cpp. -.PP -References xsums. -.PP -Referenced by serverrec::RecvPacket(). -.PP -.nf -426 { -427 for (int i = 0; i < xsums.size(); i++) -428 { -429 if (xsums[i] == sum) -430 { -431 return true; -432 } -433 } -434 if (xsums.size() >= 128) -435 { -436 xsums.pop_front(); -437 } -438 xsums.push_back(sum); -439 return false; -440 } -.fi -.SS "bool IsRoutable (std::string servername)" -.PP -Definition at line 256 of file servers.cpp. -.PP -References serverrec::connectors, me, and STATE_DISCONNECTED. -.PP -Referenced by serverrec::FlushWriteBuffers(), and serverrec::RecvPacket(). -.PP -.nf -257 { -258 int c = 0; -259 for (int x = 0; x < 32; x++) -260 if (me[x]) -261 { -262 for (int i = 0; i < me[x]->connectors.size(); i++) -263 { -264 if ((me[x]->connectors[i].GetServerName() == servername) && (me[x]->connectors[i].GetState() != STATE_DISCONNECTED)) -265 { -266 c++; -267 } -268 } -269 } -270 return (c != 0); -271 } -.fi -.SH "Variable Documentation" -.PP -.SS "bool \fBhas_been_netsplit\fP" -.PP -Definition at line 42 of file servers.cpp. -.PP -Referenced by serverrec::FlushWriteBuffers(), and serverrec::RecvPacket(). -.SS "int \fBMaxConn\fP" -.PP -Definition at line 38 of file servers.cpp. -.PP -Referenced by serverrec::CreateListener(). -.SS "\fBserverrec\fP* \fBme\fP[32]" -.PP -Definition at line 40 of file servers.cpp. -.SS "time_t \fBTIME\fP" -.PP -Definition at line 37 of file servers.cpp. -.SS "std::deque<std::string> \fBxsums\fP" -.PP -Definition at line 44 of file servers.cpp. -.PP -Referenced by already_have_sum(). -.SH "Author" -.PP -Generated automatically by Doxygen for InspIRCd from the source code. diff --git a/docs/man/man3/servers.h.3 b/docs/man/man3/servers.h.3 deleted file mode 100644 index 44c07711f..000000000 --- a/docs/man/man3/servers.h.3 +++ /dev/null @@ -1,46 +0,0 @@ -.TH "servers.h" 3 "30 May 2005" "InspIRCd" \" -*- nroff -*- -.ad l -.nh -.SH NAME -servers.h \- -.SH SYNOPSIS -.br -.PP -\fC#include 'inspircd_config.h'\fP -.br -\fC#include 'connection.h'\fP -.br -\fC#include <string>\fP -.br -\fC#include <map>\fP -.br - -.SS "Compounds" - -.in +1c -.ti -1c -.RI "class \fBserverrec\fP" -.br -.RI "\fIA class that defines the local server or a remote server. \fP" -.in -1c -.SS "Defines" - -.in +1c -.ti -1c -.RI "#define \fBLINK_ACTIVE\fP 1" -.br -.ti -1c -.RI "#define \fBLINK_INACTIVE\fP 0" -.br -.in -1c -.SH "Define Documentation" -.PP -.SS "#define LINK_ACTIVE 1" -.PP -Definition at line 25 of file servers.h. -.SS "#define LINK_INACTIVE 0" -.PP -Definition at line 26 of file servers.h. -.SH "Author" -.PP -Generated automatically by Doxygen for InspIRCd from the source code. |