0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-17 15:30:52 +01:00
construct/include/ircd
2017-09-24 18:16:43 -07:00
..
ctx ircd: Rename ircd::scope to ircd::unwind. 2017-09-24 18:16:41 -07:00
db ircd::db: Cleanup comparator related. 2017-09-24 18:16:43 -07:00
js ircd: Rename ircd::scope to ircd::unwind. 2017-09-24 18:16:41 -07:00
json ircd: Update notes. 2017-09-24 18:16:42 -07:00
m ircd:Ⓜ️ Fix subobject linkage. 2017-09-24 18:16:43 -07:00
.gitignore What is the Matrix? Control. 2017-03-10 17:51:18 -08:00
allocator.h ircd::allocator: Fix namespacing. 2017-09-24 18:16:40 -07:00
asio.h ircd: Make asio header; comments; add special continuation for yielding to asio. 2017-09-24 18:16:39 -07:00
buffer.h ircd::buffer: Minor cleanup. 2017-09-24 18:16:43 -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: Make asio header; comments; add special continuation for yielding to asio. 2017-09-24 18:16:39 -07:00
date.h ircd: Update date utils. 2017-09-24 18:16:38 -07:00
db.h ircd::db: Refactor opts to not store ilists; cleanup index/column relationship; cleanup where. 2017-09-24 18:16:41 -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
hash.h ircd::crh: Support SHA256. 2017-09-24 18:16:42 -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: Cleanup vintage string suite. 2017-09-24 18:16:43 -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 ircd: Move ircd::mods::demangle() to ircd::demangle(). 2017-09-24 18:16:39 -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: Improve resource request body template. 2017-09-24 18:16:40 -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: Make asio header; comments; add special continuation for yielding to asio. 2017-09-24 18:16:39 -07:00
spirit.h ircd: Make asio header; comments; add special continuation for yielding to asio. 2017-09-24 18:16:39 -07:00
stdinc.h ircd: Split off hash.h from util.h; reorder stdinc headers. 2017-09-24 18:16:41 -07:00
string_view.h ircd: Update notes. 2017-09-24 18:16:42 -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: Move these macros up the file out of obscurity. 2017-09-24 18:16:41 -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.