InspIRCd  4.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
ServerConfig Class Reference

#include <configreader.h>

Classes

class  ServerPaths
 

Public Types

enum  BannedUserTreatment { BUT_NORMAL , BUT_RESTRICT_SILENT , BUT_RESTRICT_NOTIFY }
 
typedef std::vector< std::shared_ptr< ConnectClass > > ClassVector
 
typedef insp::flat_map< std::string, std::shared_ptr< OperInfo > > OperIndex
 
typedef std::multimap< std::string, std::shared_ptr< ConfigTag >, irc::insensitive_swoTagMap
 
typedef insp::iterator_range< TagMap::const_iterator > TagList
 

Public Member Functions

std::shared_ptr< ConfigTagConfValue (const std::string &tag, std::shared_ptr< ConfigTag > def=nullptr)
 
TagList ConfTags (const std::string &tag, std::optional< TagList > def=std::nullopt)
 
 ServerConfig ()
 
const std::string & GetSID () const
 
const std::string & GetServerName () const
 
const std::string & GetServerDesc () const
 
void Read ()
 
void Apply (ServerConfig *old, const std::string &useruid)
 

Static Public Member Functions

static std::string Escape (const std::string &str)
 

Public Attributes

std::shared_ptr< ConfigTagEmptyTag
 
std::stringstream errstr
 
bool valid
 
bool WildcardIPv6
 
TagMap config_data
 
ConfigFileCache Files
 
ServerLimits Limits
 
ServerPaths Paths
 
CommandLineConf cmdline
 
unsigned char c_ipv4_range
 
unsigned char c_ipv6_range
 
std::string ServerName
 
std::string XLineMessage
 
std::string Network
 
std::string ServerDesc
 
BannedUserTreatment RestrictBannedUsers
 
unsigned long NetBufferSize
 
int MaxConn
 
bool CCOnConnect
 
unsigned long SoftLimit
 
unsigned long MaxTargets
 
time_t TimeSkipWarn
 
bool HideBans
 
bool RawLog = false
 
std::string HideServer
 
ClassVector Classes
 
std::string DefaultModes
 
std::string CustomVersion
 
bool SyntaxHints
 
std::string CaseMapping
 
bool FullHostInTopic
 
OperIndex oper_blocks
 
OperIndex OperTypes
 
std::string sid
 
bool NoSnoticeStack = false
 

Detailed Description

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.

Member Typedef Documentation

◆ ClassVector

typedef std::vector<std::shared_ptr<ConnectClass> > ServerConfig::ClassVector

Holds a complete list of all connect blocks

◆ OperIndex

typedef insp::flat_map<std::string, std::shared_ptr<OperInfo> > ServerConfig::OperIndex

Index of valid oper blocks and types

◆ TagList

typedef insp::iterator_range<TagMap::const_iterator> ServerConfig::TagList

Holds iterators to a subsection of the server config map.

◆ TagMap

typedef std::multimap<std::string, std::shared_ptr<ConfigTag>, irc::insensitive_swo> ServerConfig::TagMap

Holds the server config.

Member Enumeration Documentation

◆ BannedUserTreatment

How to treat a user in a channel who is banned.

Enumerator
BUT_NORMAL 

Don't treat a banned user any different to normal.

BUT_RESTRICT_SILENT 

Restrict the actions of a banned user.

BUT_RESTRICT_NOTIFY 

Restrict the actions of a banned user and notify them of their treatment.

Constructor & Destructor Documentation

◆ ServerConfig()

ServerConfig::ServerConfig ( )

Construct a new ServerConfig

Member Function Documentation

◆ Apply()

void ServerConfig::Apply ( ServerConfig old,
const std::string &  useruid 
)

Apply configuration changes from the old configuration.

◆ ConfTags()

ServerConfig::TagList ServerConfig::ConfTags ( const std::string &  tag,
std::optional< TagList def = std::nullopt 
)

Get a list of configuration tags by name.

Parameters
tagThe name of the tags to get.
defThe value to return if the tag doesn't exist.
Returns
Either a list of tags from the config or an empty TagList.

◆ ConfValue()

std::shared_ptr< ConfigTag > ServerConfig::ConfValue ( const std::string &  tag,
std::shared_ptr< ConfigTag def = nullptr 
)

Get a configuration tag by name. If one or more tags are present then the first is returned.

Parameters
tagThe name of the tag to get.
defThe value to return if the tag doesn't exist.
Returns
Either a tag from the config or EmptyTag.

◆ Escape()

std::string ServerConfig::Escape ( const std::string &  str)
static

Escapes a value for storage in a configuration key.

Parameters
strThe string to escape.

◆ GetServerDesc()

const std::string& ServerConfig::GetServerDesc ( ) const
inline

Retrieves the server description which should be shown to users.

◆ GetServerName()

const std::string& ServerConfig::GetServerName ( ) const
inline

Retrieves the server name which should be shown to users.

◆ GetSID()

const std::string& ServerConfig::GetSID ( ) const
inline

Get server ID as string with required leading zeroes

◆ Read()

void ServerConfig::Read ( )

Read the entire configuration into memory and initialize this class. All other methods should be used only by the core.

Member Data Documentation

◆ c_ipv4_range

unsigned char ServerConfig::c_ipv4_range

Clones CIDR range for ipv4 (0-32) Defaults to 32 (checks clones on all IPs separately)

◆ c_ipv6_range

unsigned char ServerConfig::c_ipv6_range

Clones CIDR range for ipv6 (0-128) Defaults to 128 (checks on all IPs separately)

◆ CaseMapping

std::string ServerConfig::CaseMapping

The name of the casemapping method used by this server.

◆ CCOnConnect

bool ServerConfig::CCOnConnect

If we should check for clones during CheckClass() in AddUser() Setting this to false allows to not trigger on maxclones for users that may belong to another class after DNS-lookup is complete. It does, however, make the server spend more time on users we may potentially not want.

◆ Classes

ClassVector ServerConfig::Classes

The connect classes in use by the IRC server.

◆ cmdline

CommandLineConf ServerConfig::cmdline

Configuration parsed from the command line.

◆ config_data

TagMap ServerConfig::config_data

This holds all the information in the config file, it's indexed by tag name to a vector of key/values.

◆ CustomVersion

std::string ServerConfig::CustomVersion

Custom version string, which if defined can replace the system info in VERSION.

◆ DefaultModes

std::string ServerConfig::DefaultModes

Default channel modes

◆ EmptyTag

std::shared_ptr<ConfigTag> ServerConfig::EmptyTag

An empty configuration tag.

◆ errstr

std::stringstream ServerConfig::errstr

Error stream, contains error output from any failed configuration parsing.

◆ Files

ConfigFileCache ServerConfig::Files

This holds all extra files that have been read in the configuration (for example, MOTD and RULES files are stored here)

◆ FullHostInTopic

bool ServerConfig::FullHostInTopic

If set to true, the full [email protected] will be shown in the TOPIC command for who set the topic last. If false, only the nick is shown.

◆ HideBans

bool ServerConfig::HideBans

True if we're going to hide ban reasons for non-opers (e.g. G-lines, K-lines, Z-lines)

◆ HideServer

std::string ServerConfig::HideServer

Set to a non-empty string to obfuscate server names.

◆ Limits

ServerLimits ServerConfig::Limits

Length limits, see definition of ServerLimits class

◆ MaxConn

int ServerConfig::MaxConn

The value to be used for listen() backlogs as default. As listen() expects a backlog to be int sized, so this must be.

◆ MaxTargets

unsigned long ServerConfig::MaxTargets

Maximum number of targets for a multi target command such as PRIVMSG or KICK

◆ NetBufferSize

unsigned long ServerConfig::NetBufferSize

The size of the read() buffer in the user handling code, used to read data into a user's recvQ.

◆ NoSnoticeStack

bool ServerConfig::NoSnoticeStack = false

If this value is true, snotices will not stack when repeats are sent

◆ oper_blocks

OperIndex ServerConfig::oper_blocks

Oper blocks keyed by their name

◆ OperTypes

OperIndex ServerConfig::OperTypes

Oper types keyed by their name

◆ Paths

ServerPaths ServerConfig::Paths

Locations of various types of file (config, module, etc).

◆ RawLog

bool ServerConfig::RawLog = false

True if raw I/O is being logged

◆ RestrictBannedUsers

BannedUserTreatment ServerConfig::RestrictBannedUsers

How to treat a user in a channel who is banned.

◆ ServerDesc

std::string ServerConfig::ServerDesc

Holds the description of the local server as defined by the administrator.

◆ ServerName

std::string ServerConfig::ServerName

Holds the server name of the local server as defined by the administrator.

◆ sid

std::string ServerConfig::sid

Unique server ID. NOTE: 000...999 are usable for InspIRCd servers. This makes code simpler. 0AA, 1BB etc with letters are reserved for services use.

◆ SoftLimit

unsigned long ServerConfig::SoftLimit

The soft limit value assigned to the irc server. The IRC server will not allow more than this number of local users.

◆ SyntaxHints

bool ServerConfig::SyntaxHints

If set to true, provide syntax hints for unknown commands

◆ TimeSkipWarn

time_t ServerConfig::TimeSkipWarn

The number of seconds that the server clock can skip by before server operators are warned.

◆ valid

bool ServerConfig::valid

True if this configuration is valid enough to run with

◆ WildcardIPv6

bool ServerConfig::WildcardIPv6

Bind to IPv6 by default

◆ XLineMessage

std::string ServerConfig::XLineMessage

Notice to give to users when they are banned by an XLine


The documentation for this class was generated from the following files: