0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-07-01 16:28:19 +02:00
construct/include/ircd
2017-09-24 18:16:38 -07:00
..
ctx ircd::ctx: Updates; add ctx::view; add preliminary ctx::fault; various reorg. 2017-09-24 18:16:38 -07:00
db ircd::db: Better cursor comparison. 2017-09-24 18:16:37 -07:00
js ircd::js: Upgrade SpiderMonkey to esr52 from esr45. 2017-08-23 15:25:22 -06:00
json ircd::json: Various fixes/cleanup/conversions. 2017-09-24 18:16:38 -07:00
m ircd::json: Simplify grammar / various cleanup. 2017-09-24 18:16:35 -07:00
.gitignore What is the Matrix? Control. 2017-03-10 17:51:18 -08:00
allocator.h ircd::allocator: Add node allocator / reorg fixed/dynamic. 2017-09-24 18:16:33 -07:00
buffer.h ircd::buffer: Add member iterator concept. 2017-09-24 18:16:36 -07:00
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 ircd::ctx: Updates; add ctx::view; add preliminary ctx::fault; various reorg. 2017-09-24 18:16:38 -07:00
date.h ircd: Add date.h header for date and time utilities. 2017-09-08 03:47:51 -07:00
db.h ircd::db: Rename txn to iov. 2017-09-24 18:16:37 -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 ircd::json: Complete serialize/stringify for object/object::member. 2017-09-24 18:16:37 -07:00
lexical.h ircd: Add surrounds() lexical util. 2017-09-24 18:16:36 -07:00
life_guard.h Update various documentation and comments. 2017-09-24 18:16:33 -07:00
listen.h ircd: Employ namespace scope extensions from c++1z/gnu++14. 2017-09-08 03:47:46 -07:00
localee.h ircd: Employ namespace scope extensions from c++1z/gnu++14. 2017-09-08 03:47:46 -07:00
logger.h Update various documentation and comments. 2017-09-24 18:16:33 -07:00
m.h ircd::m modules: Matrix reinterface checkpoint. 2017-09-08 03:47:53 -07:00
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 ircd: Employ namespace scope extensions from c++1z/gnu++14. 2017-09-08 03:47:46 -07:00
parse.h ircd::http: Proper exception when parse buffer is too small. 2017-09-08 03:47:51 -07:00
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::resource: Cleanup JSON iov related; Add exception handlers. 2017-09-24 18:16:36 -07:00
rfc1459.h ircd: Add lex_cast wrapper interface; various cleanup. 2017-03-14 15:03:15 -07:00
rfc1459_gen.h ircd: Add lex_cast wrapper interface; various cleanup. 2017-03-14 15:03:15 -07:00
rfc1459_parse.h ircd: Minor cleanup. 2017-03-30 16:04:20 -07:00
socket.h ircd::ctx: Updates; add ctx::view; add preliminary ctx::fault; various reorg. 2017-09-24 18:16:38 -07:00
spirit.h ircd: Add aggregate spirit header (without pch at this time). 2017-03-16 13:35:37 -07:00
stdinc.h Update various documentation and comments. 2017-09-24 18:16:33 -07:00
string_view.h ircd: vector_view<> typdef'ing. 2017-09-24 18:16:36 -07:00
timer.h ircd: Employ namespace scope extensions from c++1z/gnu++14. 2017-09-08 03:47:46 -07:00
util.h ircd::util: Iterator pair. 2017-09-24 18:16:36 -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.