0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-27 01:02:46 +01:00
construct/include/ircd
2017-09-24 18:16:35 -07:00
..
ctx Update various documentation and comments. 2017-09-24 18:16:33 -07:00
db ircd::db: Include a difference_type for distance. 2017-09-24 18:16:35 -07:00
js
json ircd::json: Use ircd::iov for json::iov. 2017-09-24 18:16:34 -07:00
m ircd::json: Improve value semantics and various fixes. 2017-09-24 18:16:34 -07:00
.gitignore
allocator.h
buffer.h
client.h ircd: Simplify this service stack for now. 2017-09-24 18:16:34 -07:00
color.h Update various documentation and comments. 2017-09-24 18:16:33 -07:00
ctx.h Update various documentation and comments. 2017-09-24 18:16:33 -07:00
date.h
db.h ircd::db: Move items out of delta.h 2017-09-24 18:16:35 -07:00
exception.h Update various documentation and comments. 2017-09-24 18:16:33 -07:00
fmt.h Update various documentation and comments. 2017-09-24 18:16:33 -07:00
fs.h Update various documentation and comments. 2017-09-24 18:16:33 -07:00
http.h Update various documentation and comments. 2017-09-24 18:16:33 -07:00
info.h Update various documentation and comments. 2017-09-24 18:16:33 -07:00
iov.h ircd::iov: Support default construction and nullification. 2017-09-24 18:16:34 -07:00
ircd.h Update various documentation and comments. 2017-09-24 18:16:33 -07:00
js.h Update various documentation and comments. 2017-09-24 18:16:33 -07:00
json.h Update various documentation and comments. 2017-09-24 18:16:33 -07:00
lexical.h ircd: Add string_view strlcat(). 2017-09-24 18:16:34 -07:00
life_guard.h Update various documentation and comments. 2017-09-24 18:16:33 -07:00
listen.h
localee.h
logger.h Update various documentation and comments. 2017-09-24 18:16:33 -07:00
m.h
Makefile.am configure.ac/Makefile: Add debug conditionals. 2017-09-24 18:16:34 -07:00
mapi.h Update various documentation and comments. 2017-09-24 18:16:33 -07:00
mods.h Update various documentation and comments. 2017-09-24 18:16:33 -07:00
params.h
parse.h
rand.h Update various documentation and comments. 2017-09-24 18:16:33 -07:00
README.md Update various documentation and comments. 2017-09-24 18:16:33 -07:00
resource.h ircd: Remove the tokens container. 2017-09-24 18:16:34 -07:00
rfc1459.h
rfc1459_gen.h
rfc1459_parse.h
socket.h
spirit.h
stdinc.h Update various documentation and comments. 2017-09-24 18:16:33 -07:00
string_view.h Update various documentation and comments. 2017-09-24 18:16:33 -07:00
timer.h
util.h Update various documentation and comments. 2017-09-24 18:16:33 -07:00

IRCd Library

The purpose of libircd is to facilitate the execution of a server which handles requests from end-users. The library hosts a set of pluggable modules which introduce the actual application features (or the "business logic") of the server. These additional modules are found in the modules/ directory; see the section for Developing a module for more information. This library can be embedded by developers creating their own server or those who simply want to use the routines it provides; see the section for Using libircd.

Using libircd

libircd can be embedded in your application. This allows you to customize and extend the functionality of the server and have control over its execution, or, simply use library routines provided by the library without any daemonization. The prototypical embedding of libircd is charybdis found in the charybdis/ directory.

Keeping with the spirit of simplicity of the original architecture, libircd continues to be a "singleton" object which uses globals and keeps actual server state. In other words, only one IRC daemon can exist within a process's address space at any time. This is actually a profitable design decision for making IRCd easier to understand for contributors. The original version of this library was created at the dawn of the era of dynamic shared objects and began as an abstraction of code from the server executable. This was done so that additional feature modules could be created while all sharing the same maps of routines.

The library is based around the boost::asio::io_service event loop. It is nominally single threaded and serializes operations on a single asio strand. In other words, most code is executed on the thread where you call ios.run(); this is referred to as the "main thread." If ios.run() is called on multiple threads no concurrency will occur. IRCd occasionally uses global and static variables; the expectation is that these will not be contended outside of the main thread. The library may spawn additional threads, mostly from 3rd party libraries and only under daemonization. We don't like this, and try to prevent it, but it may happen under certain circumstances. These are all dealt with internally and shouldn't affect the users of the library.

Developing a module

libircd facilitates the development of dynamic shared modules which implement specific application logic used in the server.

Hacking on libircd

Style

Misc
  • When using a switch over an enum type, put what would be the default case after/outside of the switch unless the situation specifically calls for one. We use -Wswitch so changes to the enum will provide a good warning to update any switch.

  • Prototypes should name their argument variables to make them easier to understand, except if such a name is redundant because the type carries enough information to make it obvious. In other words, if you have a prototype like foo(const std::string &message) you should name message because std::string is common and what the string is for is otherwise opaque. OTOH, if you have foo(const options &, const std::string &message) one should skip the name for options & as it just adds redundant text to the prototype.