permissions/hash.h
Go to the documentation of this file.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 "../../mi/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 unsigned int ip_addr;
00112 unsigned int port;
00113 struct addr_list *next;
00114 };
00115
00116
00117
00118
00119
00120 struct addr_list** new_addr_hash_table(void);
00121
00122
00123
00124
00125
00126 void free_addr_hash_table(struct addr_list** table);
00127
00128
00129
00130
00131
00132 void destroy_addr_hash_table(struct addr_list** table);
00133
00134
00135
00136
00137
00138 int addr_hash_table_insert(struct addr_list** hash_table, unsigned int grp,
00139 unsigned int ip_addr, unsigned int port);
00140
00141
00142
00143
00144
00145
00146 int match_addr_hash_table(struct addr_list** table, unsigned int grp,
00147 unsigned int ip_addr, unsigned int port);
00148
00149
00150
00151
00152
00153
00154
00155 int find_group_in_addr_hash_table(struct addr_list** table,
00156 unsigned int ip_addr, unsigned int port);
00157
00158
00159
00160
00161
00162 void addr_hash_table_print(struct addr_list** hash_table, FILE* reply_file);
00163 int addr_hash_table_mi_print(struct addr_list** hash_table,
00164 struct mi_node* rpl);
00165
00166
00167
00168
00169
00170 void empty_addr_hash_table(struct addr_list** hash_table);
00171
00172
00173 #define PERM_MAX_SUBNETS 128
00174
00175
00176
00177
00178
00179 struct subnet {
00180 unsigned int grp;
00181 unsigned int subnet;
00182 unsigned int port;
00183 unsigned int mask;
00184 };
00185
00186
00187
00188
00189
00190 struct subnet* new_subnet_table(void);
00191
00192
00193
00194
00195
00196
00197 int match_subnet_table(struct subnet* table, unsigned int group,
00198 unsigned int ip_addr, unsigned int port);
00199
00200
00201
00202
00203
00204
00205
00206 int find_group_in_subnet_table(struct subnet* table,
00207 unsigned int ip_addr, unsigned int port);
00208
00209
00210
00211
00212 void empty_subnet_table(struct subnet *table);
00213
00214
00215
00216
00217
00218 void free_subnet_table(struct subnet* table);
00219
00220
00221
00222
00223
00224
00225 int subnet_table_insert(struct subnet* table, unsigned int grp,
00226 unsigned int subnet, unsigned int mask,
00227 unsigned int port);
00228
00229
00230
00231
00232
00233 void subnet_table_print(struct subnet* table, FILE* reply_file);
00234 int subnet_table_mi_print(struct subnet* table, struct mi_node* rpl);
00235
00236
00237 #endif