#define SERVERCONFIG_H
/* Holds information of configured algorithms */
-typedef struct SilcConfigServerSectionAlgStruct {
+typedef struct SilcServerConfigSectionAlgStruct {
char *alg_name;
char *sim_name;
unsigned int block_len;
unsigned int key_len;
- struct SilcConfigServerSectionAlgStruct *next;
- struct SilcConfigServerSectionAlgStruct *prev;
+ struct SilcServerConfigSectionAlgStruct *next;
+ struct SilcServerConfigSectionAlgStruct *prev;
#define SILC_CONFIG_SERVER_MODNAME "builtin"
-} SilcConfigServerSectionAlg;
+} SilcServerConfigSectionAlg;
/* Holds server information from config file */
typedef struct {
char *server_ip;
char *location;
unsigned short port;
-} SilcConfigServerSectionServerInfo;
+} SilcServerConfigSectionServerInfo;
/* Holds server's administrative information from config file */
typedef struct {
char *server_type;
char *admin_name;
char *admin_email;
-} SilcConfigServerSectionAdminInfo;
+} SilcServerConfigSectionAdminInfo;
/* Holds all the ports the server is listenning on */
-typedef struct SilcConfigServerSectionListenPortStruct {
+typedef struct SilcServerConfigSectionListenPortStruct {
char *host;
char *remote_ip;
unsigned short port;
- struct SilcConfigServerSectionListenPortStruct *next;
- struct SilcConfigServerSectionListenPortStruct *prev;
-} SilcConfigServerSectionListenPort;
+ struct SilcServerConfigSectionListenPortStruct *next;
+ struct SilcServerConfigSectionListenPortStruct *prev;
+} SilcServerConfigSectionListenPort;
/* Holds server's execution identity, or the user and group which
to change from root when server starts */
typedef struct {
char *user;
char *group;
-} SilcConfigServerSectionIdentity;
+} SilcServerConfigSectionIdentity;
/* Holds all the configured log files. */
-typedef struct SilcConfigServerSectionLoggingStruct {
+typedef struct SilcServerConfigSectionLoggingStruct {
char *logtype;
char *filename;
unsigned int maxsize;
- struct SilcConfigServerSectionLoggingStruct *next;
- struct SilcConfigServerSectionLoggingStruct *prev;
+ struct SilcServerConfigSectionLoggingStruct *next;
+ struct SilcServerConfigSectionLoggingStruct *prev;
/* Allowed <Logging> section types */
#define SILC_CONFIG_SERVER_LF_INFO "infologfile"
#define SILC_CONFIG_SERVER_LF_WARNING "warninglogfile"
#define SILC_CONFIG_SERVER_LF_ERROR "errorlogfile"
#define SILC_CONFIG_SERVER_LF_FATAL "fatalogfile"
-} SilcConfigServerSectionLogging;
+} SilcServerConfigSectionLogging;
/* Holds all configured connection classes */
-typedef struct SilcConfigServerSectionConnectionClassStruct {
+typedef struct SilcServerConfigSectionConnectionClassStruct {
unsigned int class;
unsigned int ping_freq;
unsigned int connect_freq;
unsigned int max_links;
- struct SilcConfigServerSectionConnectionClassStruct *next;
- struct SilcConfigServerSectionConnectionClassStruct *prev;
-} SilcConfigServerSectionConnectionClass;
+ struct SilcServerConfigSectionConnectionClassStruct *next;
+ struct SilcServerConfigSectionConnectionClassStruct *prev;
+} SilcServerConfigSectionConnectionClass;
#define SILC_CONFIG_SERVER_AUTH_METH_PASSWD "passwd"
#define SILC_CONFIG_SERVER_AUTH_METH_PUBKEY "pubkey"
/* Holds all client authentication data from config file */
-typedef struct SilcConfigServerSectionClientConnectionStruct {
+typedef struct SilcServerConfigSectionClientConnectionStruct {
char *host;
int auth_meth;
char *auth_data;
unsigned short port;
unsigned int class;
- struct SilcConfigServerSectionClientConnectionStruct *next;
- struct SilcConfigServerSectionClientConnectionStruct *prev;
-} SilcConfigServerSectionClientConnection;
+ struct SilcServerConfigSectionClientConnectionStruct *next;
+ struct SilcServerConfigSectionClientConnectionStruct *prev;
+} SilcServerConfigSectionClientConnection;
/* Hols all server's administrators authentication data from config file */
-typedef struct SilcConfigServerSectionAdminConnectionStruct {
+typedef struct SilcServerConfigSectionAdminConnectionStruct {
char *host;
int auth_meth;
char *auth_data;
char *nickname;
unsigned int class;
- struct SilcConfigServerSectionAdminConnectionStruct *next;
- struct SilcConfigServerSectionAdminConnectionStruct *prev;
-} SilcConfigServerSectionAdminConnection;
+ struct SilcServerConfigSectionAdminConnectionStruct *next;
+ struct SilcServerConfigSectionAdminConnectionStruct *prev;
+} SilcServerConfigSectionAdminConnection;
/* Holds all configured server/router connections from config file */
-typedef struct SilcConfigServerSectionServerConnectionStruct {
+typedef struct SilcServerConfigSectionServerConnectionStruct {
char *host;
int auth_meth;
char *auth_data;
char *version;
unsigned int class;
int initiator;
- struct SilcConfigServerSectionServerConnectionStruct *next;
- struct SilcConfigServerSectionServerConnectionStruct *prev;
-} SilcConfigServerSectionServerConnection;
+ struct SilcServerConfigSectionServerConnectionStruct *next;
+ struct SilcServerConfigSectionServerConnectionStruct *prev;
+} SilcServerConfigSectionServerConnection;
/* Holds all configured denied connections from config file */
typedef struct {
char *time;
char *comment;
unsigned short port;
-} SilcConfigServerSectionDenyConnection;
+} SilcServerConfigSectionDenyConnection;
/* Holds all client redirections from config file */
typedef struct {
char *host;
unsigned short port;
-} SilcConfigServerSectionRedirectClient;
+} SilcServerConfigSectionRedirectClient;
/* Holds motd file */
typedef struct {
char *motd_file;
-} SilcConfigServerSectionMotd;
+} SilcServerConfigSectionMotd;
/*
SILC Server Config object.
char *filename;
/* Configuration sections */
- SilcConfigServerSectionAlg *cipher;
- SilcConfigServerSectionAlg *pkcs;
- SilcConfigServerSectionAlg *hash_func;
- SilcConfigServerSectionServerInfo *server_info;
- SilcConfigServerSectionAdminInfo *admin_info;
- SilcConfigServerSectionListenPort *listen_port;
- SilcConfigServerSectionIdentity *identity;
- SilcConfigServerSectionLogging *logging;
- SilcConfigServerSectionConnectionClass *conn_class;
- SilcConfigServerSectionClientConnection *clients;
- SilcConfigServerSectionServerConnection *servers;
- SilcConfigServerSectionServerConnection *routers;
- SilcConfigServerSectionAdminConnection *admins;
- SilcConfigServerSectionDenyConnection *denied;
- SilcConfigServerSectionRedirectClient *redirect;
- SilcConfigServerSectionMotd *motd;
-} SilcConfigServerObject;
-
-typedef SilcConfigServerObject *SilcConfigServer;
+ 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_DENY_CONNECTION,
SILC_CONFIG_SERVER_SECTION_TYPE_REDIRECT_CLIENT,
SILC_CONFIG_SERVER_SECTION_TYPE_MOTD,
-} SilcConfigServerSectionType;
+} SilcServerConfigSectionType;
/* SILC Configuration Section structure. */
typedef struct {
const char *section;
- SilcConfigServerSectionType type;
+ SilcServerConfigSectionType type;
unsigned int maxfields;
-} SilcConfigServerSection;
+} SilcServerConfigSection;
/* LIst of all possible config sections in SILC server. */
-extern SilcConfigServerSection silc_config_server_sections[];
+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 SilcConfigServerParseStruct {
+typedef struct SilcServerConfigParseStruct {
SilcBuffer line;
unsigned int linenum;
- SilcConfigServerSection *section;
- struct SilcConfigServerParseStruct *next;
- struct SilcConfigServerParseStruct *prev;
-} *SilcConfigServerParse;
+ SilcServerConfigSection *section;
+ struct SilcServerConfigParseStruct *next;
+ struct SilcServerConfigParseStruct *prev;
+} *SilcServerConfigParse;
/* Macros */
} while(0)
/* Prototypes */
-SilcConfigServer silc_config_server_alloc(char *filename);
-void silc_config_server_free(SilcConfigServer config);
-int silc_config_server_parse(SilcConfigServer config, SilcBuffer buffer,
- SilcConfigServerParse *return_config);
-int silc_config_server_parse_lines(SilcConfigServer config,
- SilcConfigServerParse parse_config);
-int silc_config_server_check_sections(unsigned int checkmask);
-void silc_config_server_setlogfiles(SilcConfigServer config);
-void silc_config_server_register_ciphers(SilcConfigServer config);
-void silc_config_server_register_pkcs(SilcConfigServer config);
-void silc_config_server_register_hashfuncs(SilcConfigServer config);
-SilcConfigServerSectionClientConnection *
-silc_config_server_find_client_conn(SilcConfigServer config,
+SilcServerConfig silc_server_config_alloc(char *filename);
+void silc_server_config_free(SilcServerConfig config);
+int silc_server_config_parse(SilcServerConfig config, SilcBuffer buffer,
+ SilcServerConfigParse *return_config);
+int silc_server_config_parse_lines(SilcServerConfig config,
+ SilcServerConfigParse parse_config);
+int silc_server_config_check_sections(unsigned int checkmask);
+void silc_server_config_setlogfiles(SilcServerConfig config);
+void silc_server_config_register_ciphers(SilcServerConfig config);
+void silc_server_config_register_pkcs(SilcServerConfig config);
+void silc_server_config_register_hashfuncs(SilcServerConfig config);
+SilcServerConfigSectionClientConnection *
+silc_server_config_find_client_conn(SilcServerConfig config,
char *host, int port);
-SilcConfigServerSectionServerConnection *
-silc_config_server_find_server_conn(SilcConfigServer config,
+SilcServerConfigSectionServerConnection *
+silc_server_config_find_server_conn(SilcServerConfig config,
char *host, int port);
-SilcConfigServerSectionServerConnection *
-silc_config_server_find_router_conn(SilcConfigServer config,
+SilcServerConfigSectionServerConnection *
+silc_server_config_find_router_conn(SilcServerConfig config,
char *host, int port);
-void silc_config_server_print();
+void silc_server_config_print();
#endif