00001 00054 #ifndef __CONFIG_H_ 00055 #define __CONFIG_H_ 00056 00057 #include "utils.h" 00058 00060 typedef struct{ 00061 str fqdn; 00062 str realm; 00063 int port; 00064 } peer_config; 00065 00066 00068 typedef struct{ 00069 int port; 00070 str bind; 00071 } acceptor_config; 00072 00073 typedef enum { 00074 DP_AUTHORIZATION, 00075 DP_ACCOUNTING 00076 } app_type; 00077 00079 typedef struct { 00080 int id; 00081 int vendor; 00082 app_type type; 00083 } app_config; 00084 00086 typedef struct _routing_entry { 00087 str fqdn; 00088 int metric; 00089 struct _routing_entry *next; 00090 } routing_entry; 00091 00093 typedef struct _routing_realm { 00094 str realm; 00095 routing_entry *routes; 00096 struct _routing_realm *next; 00097 } routing_realm; 00098 00100 typedef struct { 00101 routing_realm *realms; 00102 routing_entry *routes; 00103 } routing_table; 00104 00106 typedef struct { 00107 str fqdn; 00108 str realm; 00109 str identity; 00110 int vendor_id; 00111 str product_name; 00112 int accept_unknown_peers; 00113 int drop_unknown_peers; 00117 int tc; 00118 int workers; 00119 int queue_length; 00122 peer_config *peers; 00123 int peers_cnt; 00125 acceptor_config *acceptors; 00126 int acceptors_cnt; 00128 app_config *applications; 00129 int applications_cnt; 00131 routing_table *r_table; 00132 } dp_config; 00133 00134 00135 dp_config *new_dp_config(); 00136 routing_realm *new_routing_realm(); 00137 routing_entry *new_routing_entry(); 00138 void free_dp_config(dp_config *x); 00139 void free_routing_realm(routing_realm *rr); 00140 void free_routing_entry(routing_entry *re); 00141 inline void log_dp_config(int level,dp_config *x); 00142 00143 dp_config* parse_dp_config(char* filename); 00144 00145 #endif /*__CONFIG_H_*/
1.5.2