00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _PERM_HASH_H_
00026 #define _PERM_HASH_H_
00027
00028 #include <stdio.h>
00029 #include "../../parser/msg_parser.h"
00030 #include "../../str.h"
00031 #include "../../usr_avp.h"
00032 #include "../../lib/kmi/mi.h"
00033
00034 #define PERM_HASH_SIZE 128
00035
00036
00037
00038
00039 struct trusted_list {
00040 str src_ip;
00041 int proto;
00042 char *pattern;
00043 str tag;
00044 struct trusted_list *next;
00045 };
00046
00047
00048
00049
00050
00051 int init_tag_avp(str *tag_avp_param);
00052
00053
00054
00055
00056
00057 void get_tag_avp(int_str *tag_avp_p, int *tag_avp_type_p);
00058
00059
00060
00061
00062
00063 struct trusted_list** new_hash_table(void);
00064
00065
00066
00067
00068
00069 void free_hash_table(struct trusted_list** table);
00070
00071
00072
00073
00074
00075 void destroy_hash_table(struct trusted_list** table);
00076
00077
00078
00079
00080
00081
00082 int hash_table_insert(struct trusted_list** hash_table, char* src_ip,
00083 char* proto, char* pattern, char* tag);
00084
00085
00086
00087
00088
00089
00090 int match_hash_table(struct trusted_list** table, struct sip_msg* msg,
00091 char *scr_ip, int proto);
00092
00093
00094
00095
00096
00097 void hash_table_print(struct trusted_list** hash_table, FILE* reply_file);
00098 int hash_table_mi_print(struct trusted_list **hash_table, struct mi_node* rpl);
00099
00100
00101
00102
00103 void empty_hash_table(struct trusted_list** hash_table);
00104
00105
00106
00107
00108
00109 struct addr_list {
00110 unsigned int grp;
00111 ip_addr_t addr;
00112 unsigned int port;
00113 str tag;
00114 struct addr_list *next;
00115 };
00116
00117
00118
00119
00120
00121 struct addr_list** new_addr_hash_table(void);
00122
00123
00124
00125
00126
00127 void free_addr_hash_table(struct addr_list** table);
00128
00129
00130
00131
00132
00133 void destroy_addr_hash_table(struct addr_list** table);
00134
00135
00136
00137
00138
00139 int addr_hash_table_insert(struct addr_list** hash_table, unsigned int grp,
00140 ip_addr_t *addr, unsigned int port, char *tagv);
00141
00142
00143
00144
00145
00146
00147 int match_addr_hash_table(struct addr_list** table, unsigned int grp,
00148 ip_addr_t *addr, unsigned int port);
00149
00150
00151
00152
00153
00154
00155
00156 int find_group_in_addr_hash_table(struct addr_list** table,
00157 ip_addr_t *addr, unsigned int port);
00158
00159
00160
00161
00162
00163 void addr_hash_table_print(struct addr_list** hash_table, FILE* reply_file);
00164 int addr_hash_table_mi_print(struct addr_list** hash_table,
00165 struct mi_node* rpl);
00166
00167
00168
00169
00170
00171 void empty_addr_hash_table(struct addr_list** hash_table);
00172
00173
00174 #define PERM_MAX_SUBNETS 128
00175
00176
00177
00178
00179
00180 struct subnet {
00181 unsigned int grp;
00182 ip_addr_t subnet;
00183 unsigned int port;
00184 unsigned int mask;
00185 str tag;
00186 };
00187
00188
00189
00190
00191
00192 struct subnet* new_subnet_table(void);
00193
00194
00195
00196
00197
00198
00199 int match_subnet_table(struct subnet* table, unsigned int group,
00200 ip_addr_t *addr, unsigned int port);
00201
00202
00203
00204
00205
00206
00207
00208 int find_group_in_subnet_table(struct subnet* table,
00209 ip_addr_t *addr, unsigned int port);
00210
00211
00212
00213
00214 void empty_subnet_table(struct subnet *table);
00215
00216
00217
00218
00219
00220 void free_subnet_table(struct subnet* table);
00221
00222
00223
00224
00225
00226
00227 int subnet_table_insert(struct subnet* table, unsigned int grp,
00228 ip_addr_t *subnet, unsigned int mask,
00229 unsigned int port, char *tagv);
00230
00231
00232
00233
00234
00235 void subnet_table_print(struct subnet* table, FILE* reply_file);
00236 int subnet_table_mi_print(struct subnet* table, struct mi_node* rpl);
00237
00238
00239 #endif