2 * Copyright (c) 2012, JANET(UK)
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of JANET(UK) nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
25 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31 * OF THE POSSIBILITY OF SUCH DAMAGE.
48 #define TR_DEFAULT_MAX_TREE_DEPTH 12
49 #define TR_DEFAULT_TR_PORT 12308
50 #define TR_DEFAULT_TIDS_PORT 12309
51 #define TR_DEFAULT_TRPS_PORT 12310
52 #define TR_DEFAULT_LOG_THRESHOLD LOG_INFO
53 #define TR_DEFAULT_CONSOLE_THRESHOLD LOG_NOTICE
55 typedef enum tr_cfg_rc {
56 TR_CFG_SUCCESS = 0, /* No error */
57 TR_CFG_ERROR, /* General processing error */
58 TR_CFG_BAD_PARAMS, /* Bad parameters passed to tr_config function */
59 TR_CFG_NOPARSE, /* Parsing error */
60 TR_CFG_NOMEM, /* Memory allocation error */
63 typedef struct tr_cfg_internal {
64 unsigned int max_tree_depth;
65 unsigned int tids_port;
66 unsigned int trps_port;
69 int console_threshold;
70 unsigned int cfg_poll_interval;
71 unsigned int cfg_settle_count;
72 unsigned int route_sweep_interval;
75 typedef struct tr_cfg {
76 TR_CFG_INTERNAL *internal; /* internal trust router config */
77 TR_IDP_REALM *idp_realms; /* locally associated IDP Realms */
78 TR_RP_CLIENT *rp_clients; /* locally associated RP Clients */
79 TR_COMM *comms; /* locally-known communities */
80 TR_AAA_SERVER *default_servers; /* default server list */
81 /* TBD -- Global Filters */
82 /* TBD -- Trust Router Peers */
83 /* TBD -- Trust Links */
86 typedef struct tr_cfg_mgr {
91 int tr_find_config_files (const char *config_dir, struct dirent ***cfg_files);
92 void tr_free_config_file_list(int n, struct dirent ***cfg_files);
93 TR_CFG_RC tr_parse_config (TR_CFG_MGR *cfg_mgr, const char *config_dir, int n, struct dirent **cfg_files);
94 TR_CFG_RC tr_apply_new_config (TR_CFG_MGR *cfg_mgr);
95 TR_CFG_RC tr_cfg_validate (TR_CFG *trc);
96 TR_CFG *tr_cfg_new(TALLOC_CTX *mem_ctx);
97 TR_CFG_MGR *tr_cfg_mgr_new(TALLOC_CTX *mem_ctx);
98 void tr_cfg_free(TR_CFG *cfg);
99 void tr_cfg_mgr_free(TR_CFG_MGR *cfg);
100 void tr_print_config(FILE *stream, TR_CFG *cfg);
102 TR_IDP_REALM *tr_cfg_find_idp (TR_CFG *cfg, TR_NAME *idp_id, TR_CFG_RC *rc);
103 TR_RP_CLIENT *tr_cfg_find_rp (TR_CFG *cfg, TR_NAME *rp_gss, TR_CFG_RC *rc);