| 1 | ############################################################################### |
|---|
| 2 | # |
|---|
| 3 | # conf.txt: documentation on the configuration file format |
|---|
| 4 | # |
|---|
| 5 | # Copyright 2002 the Ithildin Project. |
|---|
| 6 | # See the COPYING file for more information on licensing and use. |
|---|
| 7 | # |
|---|
| 8 | # $Id$ |
|---|
| 9 | # |
|---|
| 10 | ############################################################################### |
|---|
| 11 | |
|---|
| 12 | The conf parser: |
|---|
| 13 | The format for configuration files for this daemon has been popularized by |
|---|
| 14 | bind8, and is looks somewhat like C or perl. Format specs are as follows: |
|---|
| 15 | |
|---|
| 16 | the most basic unit is a single element, which looks like this: |
|---|
| 17 | element "data"; |
|---|
| 18 | |
|---|
| 19 | The quotes are optional. Double quotes (") cause 'expansion' which |
|---|
| 20 | currently works only for backquoting (i.e. "\"foo\"" produces an entry which |
|---|
| 21 | is literally "foo"). No other quoting is supported. Data does not |
|---|
| 22 | necessarily need to be quoted, but it is both safer and more readable to |
|---|
| 23 | quote. All 'statements' must end in a semicolon (;) to be valid. |
|---|
| 24 | |
|---|
| 25 | the other supported unit is a list, which looks like this: |
|---|
| 26 | list { |
|---|
| 27 | element1 "an element"; |
|---|
| 28 | element2 "another element"; |
|---|
| 29 | }; |
|---|
| 30 | |
|---|
| 31 | lists are groups for elements. additionally, lists may contain sub-lists |
|---|
| 32 | (this is recursive, there may be any depth of sub-lists desired.). Lists |
|---|
| 33 | are always delimited by curly brackets ({}). Lists must end in a semicolon |
|---|
| 34 | (;) to be valid. |
|---|
| 35 | |
|---|
| 36 | Additionally, other files may be included using a C-style include directive |
|---|
| 37 | such as this: |
|---|
| 38 | $INCLUDE "otherfile" |
|---|
| 39 | Other functionality using $... directives may be added later. Do not use |
|---|
| 40 | anything but the '$INCLUDE' directive. |
|---|
| 41 | |
|---|
| 42 | To be processed an include directive must be the first non-whitespace data |
|---|
| 43 | on a line. the file may either be quoted or unquoqted. C-style triangle |
|---|
| 44 | braces (<>) are not supported. |
|---|
| 45 | |
|---|
| 46 | Comments may be either C++ // style comments or C /* */ style comments. // |
|---|
| 47 | comments last until the end of the line. /* */ comments encapsulate all data |
|---|
| 48 | between the /* and */. additional /* markers inside a C style comment are |
|---|
| 49 | ignored. The # character may also be used as a comment character. |
|---|
| 50 | |
|---|
| 51 | For an example of a configuration file, see the file 'example.conf' in this |
|---|
| 52 | directory. |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | Accessing configuration data within the code: |
|---|
| 56 | Upon startup the global configuration file (typically |
|---|
| 57 | /usr/local/etc/ithildin/ircd.conf) is read in. The global tree is placed in |
|---|
| 58 | a pointer to a conf_list structure (see conf.h) called config_head. |
|---|
| 59 | Sub-lists can be searched for using the conf_find_list function, similarly |
|---|
| 60 | individual entries can be searched for using conf_find_entry. Recursion may |
|---|
| 61 | be specified to make searches more likely to return the correct result. |
|---|