Merge branch 'jennifer/march2016-patches'
[trust_router.git] / include / tr_config.h
index 48c4ce7..8a04415 100644 (file)
@@ -38,6 +38,7 @@
 #include <stdio.h>
 #include <dirent.h>
 #include <jansson.h>
+#include <syslog.h>
 
 #include <tr.h>
 #include <tr_rp.h>
 #include <tr_comm.h>
 
 #define TR_DEFAULT_MAX_TREE_DEPTH 12
+#define TR_DEFAULT_TR_PORT 12308
+#define TR_DEFAULT_TIDS_PORT 12309
+#define TR_DEFAULT_LOG_THRESHOLD LOG_INFO
+#define TR_DEFAULT_CONSOLE_THRESHOLD LOG_NOTICE
 
 typedef enum tr_cfg_rc {
   TR_CFG_SUCCESS = 0,  /* No error */
@@ -56,24 +61,37 @@ typedef enum tr_cfg_rc {
 
 typedef struct tr_cfg_internal {
   unsigned int max_tree_depth;
+  unsigned int tids_port;
+  const char *hostname;
+  int log_threshold;
+  int console_threshold;
 } TR_CFG_INTERNAL;
 
 typedef struct tr_cfg {
-  TR_CFG_INTERNAL *internal;   /* internal trust router config */
-  TR_IDP_REALM *idp_realms;    /* locally associated IDP Realms */
-  TR_RP_CLIENT *rp_clients;    /* locally associated RP Clients */
-  TR_COMM *comms;              /* locally-known communities */
+  TR_CFG_INTERNAL *internal;           /* internal trust router config */
+  TR_IDP_REALM *idp_realms;            /* locally associated IDP Realms */
+  TR_RP_CLIENT *rp_clients;            /* locally associated RP Clients */
+  TR_COMM *comms;                      /* locally-known communities */
+  TR_AAA_SERVER *default_servers;      /* default server list */
   /* TBD -- Global Filters */
   /* TBD -- Trust Router Peers */
   /* TBD -- Trust Links */
 } TR_CFG;
 
-int tr_find_config_files (struct dirent ***cfg_files);
-json_t *tr_read_config (int n, struct dirent **cfgfiles);
-TR_CFG_RC tr_parse_config (TR_INSTANCE *tr, json_t *jcfg);
+int tr_find_config_files (const char *config_dir, struct dirent ***cfg_files);
+void tr_free_config_file_list(int n, struct dirent ***cfg_files);
+TR_CFG_RC tr_parse_config (TR_INSTANCE *tr, const char *config_dir, int n, struct dirent **cfg_files);
 TR_CFG_RC tr_apply_new_config (TR_INSTANCE *tr);
+TR_CFG_RC tr_cfg_validate (TR_CFG *trc);
 void tr_cfg_free(TR_CFG *cfg);
-void tr_print_config(FILE *stream, TR_CFG *cfg);
 
-TR_RP_CLIENT *tr_cfg_find_rp (TR_INSTANCE *tr, TR_NAME *rp_gss, TR_CFG_RC *rc);
+void tr_print_config(TR_CFG *cfg);
+void tr_print_comms(TR_COMM *comm_list);
+void tr_print_comm_idps(TR_IDP_REALM *idp_list);
+void tr_print_comm_rps(TR_RP_REALM *rp_list);
+
+TR_IDP_REALM *tr_cfg_find_idp (TR_CFG *tr_cfg, TR_NAME *idp_id, TR_CFG_RC *rc);
+TR_RP_CLIENT *tr_cfg_find_rp (TR_CFG *tr_cfg, TR_NAME *rp_gss, TR_CFG_RC *rc);
+TR_RP_CLIENT *tr_rp_client_lookup(TR_INSTANCE *tr, TR_NAME *gss_name);
+
 #endif