- /* Pointer back to the server */
- void *server;
-
- /* Filename of the configuration file */
- char *filename;
-
- /* Configuration sections */
- SilcServerConfigSectionAlg *cipher;
- SilcServerConfigSectionAlg *pkcs;
- SilcServerConfigSectionAlg *hash_func;
- SilcServerConfigSectionServerInfo *server_info;
- SilcServerConfigSectionAdminInfo *admin_info;
- SilcServerConfigSectionListenPort *listen_port;
- SilcServerConfigSectionIdentity *identity;
- SilcServerConfigSectionLogging *logging;
- SilcServerConfigSectionConnectionClass *conn_class;
- SilcServerConfigSectionClientConnection *clients;
- SilcServerConfigSectionServerConnection *servers;
- SilcServerConfigSectionServerConnection *routers;
- SilcServerConfigSectionAdminConnection *admins;
- SilcServerConfigSectionDenyConnection *denied;
- SilcServerConfigSectionRedirectClient *redirect;
- SilcServerConfigSectionMotd *motd;
-} SilcServerConfigObject;
-
-typedef SilcServerConfigObject *SilcServerConfig;
-
-/* Configuration section type enumerations. */
-typedef enum {
- SILC_CONFIG_SERVER_SECTION_TYPE_NONE = 0,
- SILC_CONFIG_SERVER_SECTION_TYPE_CIPHER,
- SILC_CONFIG_SERVER_SECTION_TYPE_PKCS,
- SILC_CONFIG_SERVER_SECTION_TYPE_HASH_FUNCTION,
- SILC_CONFIG_SERVER_SECTION_TYPE_SERVER_INFO,
- SILC_CONFIG_SERVER_SECTION_TYPE_ADMIN_INFO,
- SILC_CONFIG_SERVER_SECTION_TYPE_LISTEN_PORT,
- SILC_CONFIG_SERVER_SECTION_TYPE_IDENTITY,
- SILC_CONFIG_SERVER_SECTION_TYPE_LOGGING,
- SILC_CONFIG_SERVER_SECTION_TYPE_CONNECTION_CLASS,
- SILC_CONFIG_SERVER_SECTION_TYPE_CLIENT_CONNECTION,
- SILC_CONFIG_SERVER_SECTION_TYPE_SERVER_CONNECTION,
- SILC_CONFIG_SERVER_SECTION_TYPE_ROUTER_CONNECTION,
- SILC_CONFIG_SERVER_SECTION_TYPE_ADMIN_CONNECTION,
- SILC_CONFIG_SERVER_SECTION_TYPE_DENY_CONNECTION,
- SILC_CONFIG_SERVER_SECTION_TYPE_REDIRECT_CLIENT,
- SILC_CONFIG_SERVER_SECTION_TYPE_MOTD,
-} SilcServerConfigSectionType;
-
-/* SILC Configuration Section structure. */
-typedef struct {
- const char *section;
- SilcServerConfigSectionType type;
- unsigned int maxfields;
-} SilcServerConfigSection;
-
-/* LIst of all possible config sections in SILC server. */
-extern SilcServerConfigSection silc_server_config_sections[];
-
-/* Structure used in parsing the configuration lines. The line is read
- from a file to this structure before parsing it further. */
-typedef struct SilcServerConfigParseStruct {
- SilcBuffer line;
- unsigned int linenum;
- SilcServerConfigSection *section;
- struct SilcServerConfigParseStruct *next;
- struct SilcServerConfigParseStruct *prev;
-} *SilcServerConfigParse;
-
-/* Macros */
-
-/* Allocates list entries for configuration sections. Used by all
- config sections as this is common. */
-#define SILC_SERVER_CONFIG_LIST_ALLOC(x) \
-do { \
- if (!(x)) { \
- (x) = silc_calloc(1, sizeof(*(x))); \
- (x)->next = NULL; \
- (x)->prev = NULL; \
- } else { \
- if (!(x)->next) { \
- (x)->next = silc_calloc(1, sizeof(*(x)->next)); \
- (x)->next->next = NULL; \
- (x)->next->prev = (x); \
- (x) = (x)->next; \
- } \
- } \
-} while(0)