- new folder src/ to hold the source code for main project applications
- main.c is in src/
- all core files are subfolder are in src/core/
- modules are in src/modules/
- libs are in src/lib/
- application Makefiles are in src/
- application binary is built in src/ (src/kamailio)
1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,222 +0,0 @@ |
1 |
-/* |
|
2 |
- * Copyright (C) 2001-2003 FhG Fokus |
|
3 |
- * |
|
4 |
- * This file is part of Kamailio, a free SIP server. |
|
5 |
- * |
|
6 |
- * Kamailio is free software; you can redistribute it and/or modify |
|
7 |
- * it under the terms of the GNU General Public License as published by |
|
8 |
- * the Free Software Foundation; either version 2 of the License, or |
|
9 |
- * (at your option) any later version |
|
10 |
- * |
|
11 |
- * Kamailio is distributed in the hope that it will be useful, |
|
12 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
- * GNU General Public License for more details. |
|
15 |
- * |
|
16 |
- * You should have received a copy of the GNU General Public License |
|
17 |
- * along with this program; if not, write to the Free Software |
|
18 |
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
19 |
- * |
|
20 |
- */ |
|
21 |
- |
|
22 |
-#ifndef _SER_USR_AVP_H_ |
|
23 |
-#define _SER_USR_AVP_H_ |
|
24 |
- |
|
25 |
-#include <sys/types.h> |
|
26 |
-#include <regex.h> |
|
27 |
- |
|
28 |
- |
|
29 |
-/* |
|
30 |
- * LIST with the allocated flags, their meaning and owner |
|
31 |
- * flag no. owner description |
|
32 |
- * ------------------------------------------------------- |
|
33 |
- * 0 avp_core avp has a string name |
|
34 |
- * 1 avp_core avp has a string value |
|
35 |
- * 2 avp_core regex search in progress |
|
36 |
- * 3 avpops module avp was loaded from DB |
|
37 |
- * 4 lcr module contact avp qvalue change |
|
38 |
- * 5 core avp is in user list |
|
39 |
- * 6 core avp is in domain list |
|
40 |
- * 7 core avp is in global list |
|
41 |
- * 8 core avp is in the from avp list |
|
42 |
- * 9 core avp is in the to avp list |
|
43 |
- * 10 core avp name with positive index |
|
44 |
- * 11 core avp name with negative index |
|
45 |
- */ |
|
46 |
- |
|
47 |
-#include "str.h" |
|
48 |
- |
|
49 |
- |
|
50 |
-#define AVP_UID "uid" /* Unique user identifier */ |
|
51 |
-#define AVP_DID "did" /* Unique domain identifier */ |
|
52 |
-#define AVP_REALM "digest_realm" /* Digest realm */ |
|
53 |
-#define AVP_FR_TIMER "fr_timer" /* Value of final response timer */ |
|
54 |
-#define AVP_FR_INV_TIMER "fr_inv_timer" /* Value of final response invite timer */ |
|
55 |
-#define AVP_RPID "rpid" /* Remote-Party-ID */ |
|
56 |
-#define AVP_GFLAGS "gflags" /* global flags */ |
|
57 |
- |
|
58 |
-struct str_int_data { |
|
59 |
- str name; |
|
60 |
- int val; |
|
61 |
-}; |
|
62 |
- |
|
63 |
-struct str_str_data { |
|
64 |
- str name; |
|
65 |
- str val; |
|
66 |
-}; |
|
67 |
- |
|
68 |
-typedef union { |
|
69 |
- int n; |
|
70 |
- str s; |
|
71 |
- regex_t* re; |
|
72 |
-} int_str; |
|
73 |
- |
|
74 |
-#define avp_id_t unsigned short |
|
75 |
-#define avp_flags_t unsigned int |
|
76 |
-#define avp_name_t int_str |
|
77 |
-#define avp_value_t int_str |
|
78 |
-#define avp_index_t unsigned short |
|
79 |
- |
|
80 |
-union usr_avp_data{ |
|
81 |
- void *p; /* forces alignment */ |
|
82 |
- long l; |
|
83 |
- char data[sizeof(void*)]; /* used to access other types, var length */ |
|
84 |
-}; |
|
85 |
- |
|
86 |
-typedef struct usr_avp { |
|
87 |
- avp_id_t id; |
|
88 |
- /* Flags that are kept for the AVP lifetime */ |
|
89 |
- avp_flags_t flags; |
|
90 |
- struct usr_avp *next; |
|
91 |
- union usr_avp_data d; /* var length */ |
|
92 |
-} avp_t; |
|
93 |
- |
|
94 |
-typedef avp_t* avp_list_t; |
|
95 |
- |
|
96 |
-/* AVP identification */ |
|
97 |
-typedef struct avp_ident { |
|
98 |
- avp_flags_t flags; |
|
99 |
- avp_name_t name; |
|
100 |
- avp_index_t index; |
|
101 |
-} avp_ident_t; |
|
102 |
- |
|
103 |
-/* |
|
104 |
- * AVP search state |
|
105 |
- */ |
|
106 |
-typedef struct search_state { |
|
107 |
- avp_flags_t flags; /* Type of search and additional flags */ |
|
108 |
- avp_id_t id; |
|
109 |
- avp_name_t name; |
|
110 |
- avp_t* avp; /* Current AVP */ |
|
111 |
-// regex_t* search_re; /* Compiled regular expression */ |
|
112 |
-} avp_search_state_t; |
|
113 |
- |
|
114 |
-/* avp aliases structs*/ |
|
115 |
-typedef struct avp_spec { |
|
116 |
- avp_flags_t type; |
|
117 |
- avp_name_t name; |
|
118 |
- avp_index_t index; |
|
119 |
-} avp_spec_t; |
|
120 |
- |
|
121 |
-/* AVP types */ |
|
122 |
-#define AVP_NAME_STR (1<<0) |
|
123 |
-#define AVP_VAL_STR (1<<1) |
|
124 |
-#define AVP_NAME_RE (1<<2) |
|
125 |
- |
|
126 |
-/* AVP classes */ |
|
127 |
-#define AVP_CLASS_URI (1<<4) |
|
128 |
-#define AVP_CLASS_USER (1<<5) |
|
129 |
-#define AVP_CLASS_DOMAIN (1<<6) |
|
130 |
-#define AVP_CLASS_GLOBAL (1<<7) |
|
131 |
- |
|
132 |
-/* AVP track (either from or to) */ |
|
133 |
-#define AVP_TRACK_FROM (1<<8) |
|
134 |
-#define AVP_TRACK_TO (1<<9) |
|
135 |
-#define AVP_TRACK_ALL (AVP_TRACK_FROM|AVP_TRACK_TO) |
|
136 |
- |
|
137 |
-#define AVP_CLASS_ALL (AVP_CLASS_URI|AVP_CLASS_USER|AVP_CLASS_DOMAIN|AVP_CLASS_GLOBAL) |
|
138 |
- |
|
139 |
-/* AVP name index */ |
|
140 |
-#define AVP_INDEX_FORWARD (1<<10) |
|
141 |
-#define AVP_INDEX_BACKWARD (1<<11) |
|
142 |
-#define AVP_INDEX_ALL (AVP_INDEX_FORWARD | AVP_INDEX_BACKWARD) |
|
143 |
- |
|
144 |
-/* AVP DB flag used by avpops module - defined in avpops |
|
145 |
- * - kept here for reference */ |
|
146 |
-// #define AVP_IS_IN_DB (1<<12) |
|
147 |
- |
|
148 |
-#define AVP_CUSTOM_FLAGS 13 |
|
149 |
- |
|
150 |
-#define GALIAS_CHAR_MARKER '$' |
|
151 |
- |
|
152 |
-#define AVP_NAME_VALUE_MASK 0x0007 |
|
153 |
-#define AVP_CORE_MASK 0x00ff |
|
154 |
-#define AVP_SCRIPT_MASK 0xff00 |
|
155 |
-#define avp_core_flags(f) ((f)&0x00ff) |
|
156 |
-#define avp_script_flags(f) (((f)<<8)&0xff00) |
|
157 |
-#define avp_get_script_flags(f) (((f)&0xff00)>>8) |
|
158 |
- |
|
159 |
-#define is_avp_str_name(a) ((a)->flags&AVP_NAME_STR) |
|
160 |
-#define is_avp_str_val(a) ((a)->flags&AVP_VAL_STR) |
|
161 |
- |
|
162 |
- |
|
163 |
-#define AVP_IS_ASSIGNABLE(ident) ( ((ident).flags & AVP_NAME_RE) == 0 && (((ident).flags & AVP_NAME) == 0 || (((ident)->flags & AVP_NAME) && (ident).name.s.len)) ) |
|
164 |
-/* Initialize memory structures */ |
|
165 |
-int init_avps(void); |
|
166 |
- |
|
167 |
-/* add avp to the list of avps */ |
|
168 |
-int add_avp(avp_flags_t flags, avp_name_t name, avp_value_t val); |
|
169 |
-int add_avp_before(avp_t *avp, avp_flags_t flags, avp_name_t name, avp_value_t val); |
|
170 |
-int add_avp_list(avp_list_t* list, avp_flags_t flags, avp_name_t name, avp_value_t val); |
|
171 |
- |
|
172 |
-/* Delete avps with given type and name */ |
|
173 |
-void delete_avp(avp_flags_t flags, avp_name_t name); |
|
174 |
- |
|
175 |
-int destroy_avps(avp_flags_t flags, avp_name_t name, int all); |
|
176 |
- |
|
177 |
-/* search functions */ |
|
178 |
-avp_t *search_first_avp( avp_flags_t flags, avp_name_t name, |
|
179 |
- avp_value_t *val, struct search_state* state); |
|
180 |
-avp_t *search_avp_by_index( avp_flags_t flags, avp_name_t name, |
|
181 |
- avp_value_t *val, avp_index_t index); |
|
182 |
- |
|
183 |
-avp_t *search_avp (avp_ident_t ident, avp_value_t* val, struct search_state* state); |
|
184 |
-avp_t *search_next_avp(struct search_state* state, avp_value_t *val); |
|
185 |
- |
|
186 |
-/* Reset one avp list */ |
|
187 |
-int reset_avp_list(int flags); |
|
188 |
- |
|
189 |
-/* free functions */ |
|
190 |
-void reset_avps(void); |
|
191 |
- |
|
192 |
-void destroy_avp(avp_t *avp); |
|
193 |
-void destroy_avp_list(avp_list_t *list ); |
|
194 |
-void destroy_avp_list_unsafe(avp_list_t *list ); |
|
195 |
- |
|
196 |
-/* get func */ |
|
197 |
-void get_avp_val(avp_t *avp, avp_value_t *val ); |
|
198 |
-str* get_avp_name(avp_t *avp); |
|
199 |
- |
|
200 |
-avp_list_t get_avp_list(avp_flags_t flags); |
|
201 |
-avp_list_t* set_avp_list(avp_flags_t flags, avp_list_t* list); |
|
202 |
- |
|
203 |
- |
|
204 |
-/* global alias functions (manipulation and parsing)*/ |
|
205 |
-int add_avp_galias_str(char *alias_definition); |
|
206 |
-int lookup_avp_galias(str *alias, int *type, int_str *avp_name); |
|
207 |
-int add_avp_galias(str *alias, int type, int_str avp_name); |
|
208 |
-int parse_avp_ident( str *name, avp_ident_t* attr); |
|
209 |
-int parse_avp_name( str *name, int *type, int_str *avp_name, int *index); |
|
210 |
-int parse_avp_spec( str *name, int *type, int_str *avp_name, int *index); |
|
211 |
-int km_parse_avp_spec( str *name, int *type, int_str *avp_name); |
|
212 |
-void free_avp_name( avp_flags_t *type, int_str *avp_name); |
|
213 |
-/* Free an ident obtained with parse_avp_ident() */ |
|
214 |
-void free_avp_ident(avp_ident_t* attr); |
|
215 |
- |
|
216 |
-/* AVP flags functions */ |
|
217 |
-#define MAX_AVPFLAG ((unsigned int)( sizeof(avp_flags_t) * CHAR_BIT - 1 - AVP_CUSTOM_FLAGS)) |
|
218 |
- |
|
219 |
-avp_flags_t register_avpflag(char* name); |
|
220 |
-avp_flags_t get_avpflag_no(char* name); |
|
221 |
- |
|
222 |
-#endif |
... | ... |
@@ -1,21 +1,14 @@ |
1 | 1 |
/* |
2 |
- * $Id$ |
|
3 |
- * |
|
4 | 2 |
* Copyright (C) 2001-2003 FhG Fokus |
5 | 3 |
* |
6 |
- * This file is part of ser, a free SIP server. |
|
4 |
+ * This file is part of Kamailio, a free SIP server. |
|
7 | 5 |
* |
8 |
- * ser is free software; you can redistribute it and/or modify |
|
6 |
+ * Kamailio is free software; you can redistribute it and/or modify |
|
9 | 7 |
* it under the terms of the GNU General Public License as published by |
10 | 8 |
* the Free Software Foundation; either version 2 of the License, or |
11 | 9 |
* (at your option) any later version |
12 | 10 |
* |
13 |
- * For a license to use the ser software under conditions |
|
14 |
- * other than those described here, or to purchase support for this |
|
15 |
- * software, please contact iptel.org by e-mail at the following addresses: |
|
16 |
- * info@iptel.org |
|
17 |
- * |
|
18 |
- * ser is distributed in the hope that it will be useful, |
|
11 |
+ * Kamailio is distributed in the hope that it will be useful, |
|
19 | 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 | 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21 | 14 |
* GNU General Public License for more details. |
... | ... |
@@ -24,11 +17,6 @@ |
24 | 17 |
* along with this program; if not, write to the Free Software |
25 | 18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
26 | 19 |
* |
27 |
- * History: |
|
28 |
- * --------- |
|
29 |
- * 2004-07-21 created (bogdan) |
|
30 |
- * 2004-11-14 global aliases support added |
|
31 |
- * 2005-02-14 list with FLAGS USAGE added (bogdan) |
|
32 | 20 |
*/ |
33 | 21 |
|
34 | 22 |
#ifndef _SER_USR_AVP_H_ |
... | ... |
@@ -22,7 +22,7 @@ |
22 | 22 |
* |
23 | 23 |
* You should have received a copy of the GNU General Public License |
24 | 24 |
* along with this program; if not, write to the Free Software |
25 |
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
25 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
26 | 26 |
* |
27 | 27 |
* History: |
28 | 28 |
* --------- |
... | ... |
@@ -115,13 +115,13 @@ typedef struct avp_ident { |
115 | 115 |
/* |
116 | 116 |
* AVP search state |
117 | 117 |
*/ |
118 |
-struct search_state { |
|
118 |
+typedef struct search_state { |
|
119 | 119 |
avp_flags_t flags; /* Type of search and additional flags */ |
120 | 120 |
avp_id_t id; |
121 | 121 |
avp_name_t name; |
122 | 122 |
avp_t* avp; /* Current AVP */ |
123 | 123 |
// regex_t* search_re; /* Compiled regular expression */ |
124 |
-}; |
|
124 |
+} avp_search_state_t; |
|
125 | 125 |
|
126 | 126 |
/* avp aliases structs*/ |
127 | 127 |
typedef struct avp_spec { |
- k avpops uses a flag to mark whether a loaded avp from db has changed,
in order to decide if worth to update db
- the value was overlapping with flags defined in sr core
- reported by Juha Heinanen
... | ... |
@@ -153,7 +153,11 @@ typedef struct avp_spec { |
153 | 153 |
#define AVP_INDEX_BACKWARD (1<<11) |
154 | 154 |
#define AVP_INDEX_ALL (AVP_INDEX_FORWARD | AVP_INDEX_BACKWARD) |
155 | 155 |
|
156 |
-#define AVP_CUSTOM_FLAGS 12 |
|
156 |
+/* AVP DB flag used by avpops module - defined in avpops |
|
157 |
+ * - kept here for reference */ |
|
158 |
+// #define AVP_IS_IN_DB (1<<12) |
|
159 |
+ |
|
160 |
+#define AVP_CUSTOM_FLAGS 13 |
|
157 | 161 |
|
158 | 162 |
#define GALIAS_CHAR_MARKER '$' |
159 | 163 |
|
- K compatible avp spec parser
... | ... |
@@ -216,6 +216,7 @@ int add_avp_galias(str *alias, int type, int_str avp_name); |
216 | 216 |
int parse_avp_ident( str *name, avp_ident_t* attr); |
217 | 217 |
int parse_avp_name( str *name, int *type, int_str *avp_name, int *index); |
218 | 218 |
int parse_avp_spec( str *name, int *type, int_str *avp_name, int *index); |
219 |
+int km_parse_avp_spec( str *name, int *type, int_str *avp_name); |
|
219 | 220 |
void free_avp_name( avp_flags_t *type, int_str *avp_name); |
220 | 221 |
/* Free an ident obtained with parse_avp_ident() */ |
221 | 222 |
void free_avp_ident(avp_ident_t* attr); |
New macros:
* AVP_NAME_VALUE_MASK
* AVP_CORE_MASK
* AVP_SCRIPT_MASK
* avp_core_flags
* avp_script_flags
* avp_get_script_flags
* is_avp_str_name
* is_avp_str_val
... | ... |
@@ -157,6 +157,17 @@ typedef struct avp_spec { |
157 | 157 |
|
158 | 158 |
#define GALIAS_CHAR_MARKER '$' |
159 | 159 |
|
160 |
+#define AVP_NAME_VALUE_MASK 0x0007 |
|
161 |
+#define AVP_CORE_MASK 0x00ff |
|
162 |
+#define AVP_SCRIPT_MASK 0xff00 |
|
163 |
+#define avp_core_flags(f) ((f)&0x00ff) |
|
164 |
+#define avp_script_flags(f) (((f)<<8)&0xff00) |
|
165 |
+#define avp_get_script_flags(f) (((f)&0xff00)>>8) |
|
166 |
+ |
|
167 |
+#define is_avp_str_name(a) ((a)->flags&AVP_NAME_STR) |
|
168 |
+#define is_avp_str_val(a) ((a)->flags&AVP_VAL_STR) |
|
169 |
+ |
|
170 |
+ |
|
160 | 171 |
#define AVP_IS_ASSIGNABLE(ident) ( ((ident).flags & AVP_NAME_RE) == 0 && (((ident).flags & AVP_NAME) == 0 || (((ident)->flags & AVP_NAME) && (ident).name.s.len)) ) |
161 | 172 |
/* Initialize memory structures */ |
162 | 173 |
int init_avps(void); |
The last parameter of the function controls if the function destroys
all avps with given name or just one. Returns the number of avps
destroyed.
... | ... |
@@ -169,6 +169,8 @@ int add_avp_list(avp_list_t* list, avp_flags_t flags, avp_name_t name, avp_value |
169 | 169 |
/* Delete avps with given type and name */ |
170 | 170 |
void delete_avp(avp_flags_t flags, avp_name_t name); |
171 | 171 |
|
172 |
+int destroy_avps(avp_flags_t flags, avp_name_t name, int all); |
|
173 |
+ |
|
172 | 174 |
/* search functions */ |
173 | 175 |
avp_t *search_first_avp( avp_flags_t flags, avp_name_t name, |
174 | 176 |
avp_value_t *val, struct search_state* state); |
* ser_core_cvs:
tcp: fix compilation problem on solaris (FIONREAD)
core: fix bad level name in new LOG()
t_check_status() checks also the blind UACs if t_pick_branch()
Documenting t_lookup_cancel() script function.
Removing set_t() from t_lookup_cancel() function, and introducing
updated udp_mtu handling code - fixes SER-433
documenting t_is_expired() function
t_is_expired() script function is introduced.
* logging API updated (see doc/logging-api.txt for details)
- AS support disabled by default.
When building the route set of ACKs for local UACs, only the reply is now
In case the AVP is a regexp, an allocation is required to build an AVP
Currently, SER matches E2E ACKs only if there is an equality between From HF
The calculate_routeset_length() produces an invalid result in the case
'memapp' and 'append_mem_block' are now both only used in source
"Route :" prefix (and separator) is used some more time across the
script: udp_mtu fallback script config & commands
core: forward: tcp fallback for big udp packets
Conflicts:
action.c
cfg.y
cfg_core.c
cfg_core.h
dprint.h - updated to the new logging api from ser, while
keeping the kamailio compatibility macros and
CRIT().
usr_avp.h
... | ... |
@@ -203,7 +203,10 @@ int add_avp_galias(str *alias, int type, int_str avp_name); |
203 | 203 |
int parse_avp_ident( str *name, avp_ident_t* attr); |
204 | 204 |
int parse_avp_name( str *name, int *type, int_str *avp_name, int *index); |
205 | 205 |
int parse_avp_spec( str *name, int *type, int_str *avp_name, int *index); |
206 |
+/* TODO: is there any client for this function? */ |
|
206 | 207 |
void free_avp_name( int *type, int_str *avp_name); |
208 |
+/* Free an ident obtained with parse_avp_ident() */ |
|
209 |
+void free_avp_ident(avp_ident_t* attr); |
|
207 | 210 |
|
208 | 211 |
/* AVP flags functions */ |
209 | 212 |
#define MAX_AVPFLAG ((unsigned int)( sizeof(avp_flags_t) * CHAR_BIT - 1 - AVP_CUSTOM_FLAGS)) |
* commit 'origin/andrei/fixups':
avp: comments fix
fixups: added kamailio compatible fixups
fixups: support for PVE & PVS in get_*_fparam()
fixups: fix param function using a param type mask
fixups: generic fixups work now on kamailio pvars
select: comments for parse_select()
avp: minor fixes & comments
sr_module: identing and whitespace
- type punning warning fixed (both for =-Wstrict-aliasing and
-Wstrict-aliasing=2)
- replaced usr_avp->data with a union (more sane, looks better)
... | ... |
@@ -89,12 +89,18 @@ typedef union { |
89 | 89 |
#define avp_value_t int_str |
90 | 90 |
#define avp_index_t unsigned short |
91 | 91 |
|
92 |
+union usr_avp_data{ |
|
93 |
+ void *p; /* forces alignment */ |
|
94 |
+ long l; |
|
95 |
+ char data[sizeof(void*)]; /* used to access other types, var length */ |
|
96 |
+}; |
|
97 |
+ |
|
92 | 98 |
typedef struct usr_avp { |
93 | 99 |
avp_id_t id; |
94 |
- /* Flags that are kept for the AVP lifetime */ |
|
100 |
+ /* Flags that are kept for the AVP lifetime */ |
|
95 | 101 |
avp_flags_t flags; |
96 | 102 |
struct usr_avp *next; |
97 |
- void *data; |
|
103 |
+ union usr_avp_data d; /* var length */ |
|
98 | 104 |
} avp_t; |
99 | 105 |
|
100 | 106 |
typedef avp_t* avp_list_t; |
- free_avp_name() for a regexp avp did not use regfree(...)
- changed free_avp_name() prototype to use avp_flags_t for the type
- added comments for parse_avp_ident()
... | ... |
@@ -197,7 +197,7 @@ int add_avp_galias(str *alias, int type, int_str avp_name); |
197 | 197 |
int parse_avp_ident( str *name, avp_ident_t* attr); |
198 | 198 |
int parse_avp_name( str *name, int *type, int_str *avp_name, int *index); |
199 | 199 |
int parse_avp_spec( str *name, int *type, int_str *avp_name, int *index); |
200 |
-void free_avp_name( int *type, int_str *avp_name); |
|
200 |
+void free_avp_name( avp_flags_t *type, int_str *avp_name); |
|
201 | 201 |
|
202 | 202 |
/* AVP flags functions */ |
203 | 203 |
#define MAX_AVPFLAG ((unsigned int)( sizeof(avp_flags_t) * CHAR_BIT - 1 - AVP_CUSTOM_FLAGS)) |
... | ... |
@@ -66,7 +66,6 @@ |
66 | 66 |
#define AVP_FR_INV_TIMER "fr_inv_timer" /* Value of final response invite timer */ |
67 | 67 |
#define AVP_RPID "rpid" /* Remote-Party-ID */ |
68 | 68 |
#define AVP_GFLAGS "gflags" /* global flags */ |
69 |
-#define AVP_FLAGS "flags" /* message flags */ |
|
70 | 69 |
|
71 | 70 |
struct str_int_data { |
72 | 71 |
str name; |
... | ... |
@@ -173,6 +172,8 @@ avp_t *search_avp_by_index( avp_flags_t flags, avp_name_t name, |
173 | 172 |
avp_t *search_avp (avp_ident_t ident, avp_value_t* val, struct search_state* state); |
174 | 173 |
avp_t *search_next_avp(struct search_state* state, avp_value_t *val); |
175 | 174 |
|
175 |
+/* Reset one avp list */ |
|
176 |
+int reset_avp_list(int flags); |
|
176 | 177 |
|
177 | 178 |
/* free functions */ |
178 | 179 |
void reset_avps(void); |
... | ... |
@@ -131,6 +131,7 @@ typedef struct avp_spec { |
131 | 131 |
#define AVP_NAME_RE (1<<2) |
132 | 132 |
|
133 | 133 |
/* AVP classes */ |
134 |
+#define AVP_CLASS_URI (1<<4) |
|
134 | 135 |
#define AVP_CLASS_USER (1<<5) |
135 | 136 |
#define AVP_CLASS_DOMAIN (1<<6) |
136 | 137 |
#define AVP_CLASS_GLOBAL (1<<7) |
... | ... |
@@ -140,7 +141,7 @@ typedef struct avp_spec { |
140 | 141 |
#define AVP_TRACK_TO (1<<9) |
141 | 142 |
#define AVP_TRACK_ALL (AVP_TRACK_FROM|AVP_TRACK_TO) |
142 | 143 |
|
143 |
-#define AVP_CLASS_ALL (AVP_CLASS_USER|AVP_CLASS_DOMAIN|AVP_CLASS_GLOBAL) |
|
144 |
+#define AVP_CLASS_ALL (AVP_CLASS_URI|AVP_CLASS_USER|AVP_CLASS_DOMAIN|AVP_CLASS_GLOBAL) |
|
144 | 145 |
|
145 | 146 |
/* AVP name index */ |
146 | 147 |
#define AVP_INDEX_FORWARD (1<<10) |
Every AVP may by flaged from script via setavpflag(avpid, flag) (it's similar like message flags setflags,resetflags,isflagset). AVP flags must be declared using avpflags statement. Flags may be tested via isavpflagset(avpid, flag). Both the setting and testing may also be processed in a module. It's currently used in the "rr" module for dialog_cookies. Such module should register flag using register_avpflag(flag_id).
Example:
avpflags myflag, dialog_cookie;
$a = 123;
setavpflag($a, "myflag");
if (isavpflagset($a, "myflag")) {
....
$dlg_foo = "foo";
$dlg_bar = "bar";
setavpflag("$f./^dlg_", "dialog_cookie");
... | ... |
@@ -147,10 +147,11 @@ typedef struct avp_spec { |
147 | 147 |
#define AVP_INDEX_BACKWARD (1<<11) |
148 | 148 |
#define AVP_INDEX_ALL (AVP_INDEX_FORWARD | AVP_INDEX_BACKWARD) |
149 | 149 |
|
150 |
-#define AVP_FLAG_DIALOG (1<<12) |
|
150 |
+#define AVP_CUSTOM_FLAGS 12 |
|
151 | 151 |
|
152 | 152 |
#define GALIAS_CHAR_MARKER '$' |
153 | 153 |
|
154 |
+#define AVP_IS_ASSIGNABLE(ident) ( ((ident).flags & AVP_NAME_RE) == 0 && (((ident).flags & AVP_NAME) == 0 || (((ident)->flags & AVP_NAME) && (ident).name.s.len)) ) |
|
154 | 155 |
/* Initialize memory structures */ |
155 | 156 |
int init_avps(void); |
156 | 157 |
|
... | ... |
@@ -196,4 +197,10 @@ int parse_avp_name( str *name, int *type, int_str *avp_name, int *index); |
196 | 197 |
int parse_avp_spec( str *name, int *type, int_str *avp_name, int *index); |
197 | 198 |
void free_avp_name( int *type, int_str *avp_name); |
198 | 199 |
|
200 |
+/* AVP flags functions */ |
|
201 |
+#define MAX_AVPFLAG ((unsigned int)( sizeof(avp_flags_t) * CHAR_BIT - 1 - AVP_CUSTOM_FLAGS)) |
|
202 |
+ |
|
203 |
+avp_flags_t register_avpflag(char* name); |
|
204 |
+avp_flags_t get_avpflag_no(char* name); |
|
205 |
+ |
|
199 | 206 |
#endif |
... | ... |
@@ -20,8 +20,8 @@ |
20 | 20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21 | 21 |
* GNU General Public License for more details. |
22 | 22 |
* |
23 |
- * You should have received a copy of the GNU General Public License |
|
24 |
- * along with this program; if not, write to the Free Software |
|
23 |
+ * You should have received a copy of the GNU General Public License |
|
24 |
+ * along with this program; if not, write to the Free Software |
|
25 | 25 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
26 | 26 |
* |
27 | 27 |
* History: |
... | ... |
@@ -147,6 +147,8 @@ typedef struct avp_spec { |
147 | 147 |
#define AVP_INDEX_BACKWARD (1<<11) |
148 | 148 |
#define AVP_INDEX_ALL (AVP_INDEX_FORWARD | AVP_INDEX_BACKWARD) |
149 | 149 |
|
150 |
+#define AVP_FLAG_DIALOG (1<<12) |
|
151 |
+ |
|
150 | 152 |
#define GALIAS_CHAR_MARKER '$' |
151 | 153 |
|
152 | 154 |
/* Initialize memory structures */ |
Rest of the source code needs to be updated to new types usage before we
would be able to smoothly change internal structure without breaking
anything else. (e.g. flags unsigned short -> unsigned long)
... | ... |
@@ -84,34 +84,45 @@ typedef union { |
84 | 84 |
regex_t* re; |
85 | 85 |
} int_str; |
86 | 86 |
|
87 |
+#define avp_id_t unsigned short |
|
88 |
+#define avp_flags_t unsigned short |
|
89 |
+#define avp_name_t int_str |
|
90 |
+#define avp_value_t int_str |
|
91 |
+#define avp_index_t unsigned short |
|
87 | 92 |
|
88 | 93 |
typedef struct usr_avp { |
89 |
- unsigned short id; |
|
94 |
+ avp_id_t id; |
|
90 | 95 |
/* Flags that are kept for the AVP lifetime */ |
91 |
- unsigned short flags; |
|
96 |
+ avp_flags_t flags; |
|
92 | 97 |
struct usr_avp *next; |
93 | 98 |
void *data; |
94 | 99 |
} avp_t; |
95 | 100 |
|
96 | 101 |
typedef avp_t* avp_list_t; |
97 | 102 |
|
103 |
+/* AVP identification */ |
|
104 |
+typedef struct avp_ident { |
|
105 |
+ avp_flags_t flags; |
|
106 |
+ avp_name_t name; |
|
107 |
+ avp_index_t index; |
|
108 |
+} avp_ident_t; |
|
98 | 109 |
|
99 | 110 |
/* |
100 | 111 |
* AVP search state |
101 | 112 |
*/ |
102 | 113 |
struct search_state { |
103 |
- unsigned short flags; /* Type of search and additional flags */ |
|
104 |
- unsigned short id; |
|
105 |
- int_str name; |
|
114 |
+ avp_flags_t flags; /* Type of search and additional flags */ |
|
115 |
+ avp_id_t id; |
|
116 |
+ avp_name_t name; |
|
106 | 117 |
avp_t* avp; /* Current AVP */ |
107 |
- regex_t* search_re; /* Compiled regular expression */ |
|
118 |
+// regex_t* search_re; /* Compiled regular expression */ |
|
108 | 119 |
}; |
109 | 120 |
|
110 | 121 |
/* avp aliases structs*/ |
111 | 122 |
typedef struct avp_spec { |
112 |
- int type; |
|
113 |
- int_str name; |
|
114 |
- int index; |
|
123 |
+ avp_flags_t type; |
|
124 |
+ avp_name_t name; |
|
125 |
+ avp_index_t index; |
|
115 | 126 |
} avp_spec_t; |
116 | 127 |
|
117 | 128 |
/* AVP types */ |
... | ... |
@@ -142,20 +153,23 @@ typedef struct avp_spec { |
142 | 153 |
int init_avps(void); |
143 | 154 |
|
144 | 155 |
/* add avp to the list of avps */ |
145 |
-int add_avp(unsigned short flags, int_str name, int_str val); |
|
146 |
-int add_avp_before(avp_t *avp, unsigned short flags, int_str name, int_str val); |
|
147 |
-int add_avp_list(avp_list_t* list, unsigned short flags, int_str name, int_str val); |
|
156 |
+int add_avp(avp_flags_t flags, avp_name_t name, avp_value_t val); |
|
157 |
+int add_avp_before(avp_t *avp, avp_flags_t flags, avp_name_t name, avp_value_t val); |
|
158 |
+int add_avp_list(avp_list_t* list, avp_flags_t flags, avp_name_t name, avp_value_t val); |
|
148 | 159 |
|
149 | 160 |
/* Delete avps with given type and name */ |
150 |
-void delete_avp(unsigned short flags, int_str name); |
|
161 |
+void delete_avp(avp_flags_t flags, avp_name_t name); |
|
151 | 162 |
|
152 | 163 |
/* search functions */ |
153 |
-avp_t *search_first_avp( unsigned short flags, int_str name, |
|
154 |
- int_str *val, struct search_state* state); |
|
155 |
-avp_t *search_next_avp(struct search_state* state, int_str *val); |
|
164 |
+avp_t *search_first_avp( avp_flags_t flags, avp_name_t name, |
|
165 |
+ avp_value_t *val, struct search_state* state); |
|
166 |
+avp_t *search_avp_by_index( avp_flags_t flags, avp_name_t name, |
|
167 |
+ avp_value_t *val, avp_index_t index); |
|
168 |
+ |
|
169 |
+avp_t *search_avp (avp_ident_t ident, avp_value_t* val, struct search_state* state); |
|
170 |
+avp_t *search_next_avp(struct search_state* state, avp_value_t *val); |
|
171 |
+ |
|
156 | 172 |
|
157 |
-avp_t *search_avp_by_index( unsigned short flags, int_str name, |
|
158 |
- int_str *val, unsigned short index); |
|
159 | 173 |
/* free functions */ |
160 | 174 |
void reset_avps(void); |
161 | 175 |
|
... | ... |
@@ -164,17 +178,18 @@ void destroy_avp_list(avp_list_t *list ); |
164 | 178 |
void destroy_avp_list_unsafe(avp_list_t *list ); |
165 | 179 |
|
166 | 180 |
/* get func */ |
167 |
-void get_avp_val(avp_t *avp, int_str *val ); |
|
181 |
+void get_avp_val(avp_t *avp, avp_value_t *val ); |
|
168 | 182 |
str* get_avp_name(avp_t *avp); |
169 | 183 |
|
170 |
-avp_list_t get_avp_list(unsigned short flags); |
|
171 |
-avp_list_t* set_avp_list(unsigned short flags, avp_list_t* list); |
|
184 |
+avp_list_t get_avp_list(avp_flags_t flags); |
|
185 |
+avp_list_t* set_avp_list(avp_flags_t flags, avp_list_t* list); |
|
172 | 186 |
|
173 | 187 |
|
174 | 188 |
/* global alias functions (manipulation and parsing)*/ |
175 | 189 |
int add_avp_galias_str(char *alias_definition); |
176 | 190 |
int lookup_avp_galias(str *alias, int *type, int_str *avp_name); |
177 | 191 |
int add_avp_galias(str *alias, int type, int_str avp_name); |
192 |
+int parse_avp_ident( str *name, avp_ident_t* attr); |
|
178 | 193 |
int parse_avp_name( str *name, int *type, int_str *avp_name, int *index); |
179 | 194 |
int parse_avp_spec( str *name, int *type, int_str *avp_name, int *index); |
180 | 195 |
void free_avp_name( int *type, int_str *avp_name); |
$prefix.name - it MUST be only one AVP with that name to match binary
operators or on the right side of assignment
$prefix.name[] - allowed on both sides of assignment
on left side means - enable more AVPS with the same name
on the right side - all AVPs with the name are added (correctly ordered)
$prefix.name[index] - allowed on right side of assignment and as binary
operand, corresponds to value of index-th AVP in the list (if such exists)
1 means the AVP, which was added FIRST to the list (this unfortunatelly
means, that the AVP name is scanned through the whole list)
-1 means the AVP, which was added LAST to the list
prefix is one of following
f - FROM USER
t - TO USER
fd- FROM DOMAIN
td- TO DOMAIN
g - GLOBAL
and if ommited, the default FROM USER is used
=new function parse_avp_name, needs to be enhanced (does not accept
whitespace as the script parser does)
=new function search_avp_by_index, usable even for variant without the
brackets (then it checks the name exclusivity)
=xlog module uses new avp parse and search_by_index function
format string is %avp_syntax, e.g. %$MyAVP[1]
=avp module merged functions from another branch, not updated to new AVP
syntax fully
=script parser updated to new syntax
... | ... |
@@ -52,7 +52,8 @@ |
52 | 52 |
* 7 core avp is in global list |
53 | 53 |
* 8 core avp is in the from avp list |
54 | 54 |
* 9 core avp is in the to avp list |
55 |
- * |
|
55 |
+ * 10 core avp name with positive index |
|
56 |
+ * 11 core avp name with negative index |
|
56 | 57 |
*/ |
57 | 58 |
|
58 | 59 |
#include "str.h" |
... | ... |
@@ -65,6 +66,7 @@ |
65 | 66 |
#define AVP_FR_INV_TIMER "fr_inv_timer" /* Value of final response invite timer */ |
66 | 67 |
#define AVP_RPID "rpid" /* Remote-Party-ID */ |
67 | 68 |
#define AVP_GFLAGS "gflags" /* global flags */ |
69 |
+#define AVP_FLAGS "flags" /* message flags */ |
|
68 | 70 |
|
69 | 71 |
struct str_int_data { |
70 | 72 |
str name; |
... | ... |
@@ -109,6 +111,7 @@ struct search_state { |
109 | 111 |
typedef struct avp_spec { |
110 | 112 |
int type; |
111 | 113 |
int_str name; |
114 |
+ int index; |
|
112 | 115 |
} avp_spec_t; |
113 | 116 |
|
114 | 117 |
/* AVP types */ |
... | ... |
@@ -128,6 +131,11 @@ typedef struct avp_spec { |
128 | 131 |
|
129 | 132 |
#define AVP_CLASS_ALL (AVP_CLASS_USER|AVP_CLASS_DOMAIN|AVP_CLASS_GLOBAL) |
130 | 133 |
|
134 |
+/* AVP name index */ |
|
135 |
+#define AVP_INDEX_FORWARD (1<<10) |
|
136 |
+#define AVP_INDEX_BACKWARD (1<<11) |
|
137 |
+#define AVP_INDEX_ALL (AVP_INDEX_FORWARD | AVP_INDEX_BACKWARD) |
|
138 |
+ |
|
131 | 139 |
#define GALIAS_CHAR_MARKER '$' |
132 | 140 |
|
133 | 141 |
/* Initialize memory structures */ |
... | ... |
@@ -135,6 +143,7 @@ int init_avps(void); |
135 | 143 |
|
136 | 144 |
/* add avp to the list of avps */ |
137 | 145 |
int add_avp(unsigned short flags, int_str name, int_str val); |
146 |
+int add_avp_before(avp_t *avp, unsigned short flags, int_str name, int_str val); |
|
138 | 147 |
int add_avp_list(avp_list_t* list, unsigned short flags, int_str name, int_str val); |
139 | 148 |
|
140 | 149 |
/* Delete avps with given type and name */ |
... | ... |
@@ -145,6 +154,8 @@ avp_t *search_first_avp( unsigned short flags, int_str name, |
145 | 154 |
int_str *val, struct search_state* state); |
146 | 155 |
avp_t *search_next_avp(struct search_state* state, int_str *val); |
147 | 156 |
|
157 |
+avp_t *search_avp_by_index( unsigned short flags, int_str name, |
|
158 |
+ int_str *val, unsigned short index); |
|
148 | 159 |
/* free functions */ |
149 | 160 |
void reset_avps(void); |
150 | 161 |
|
... | ... |
@@ -164,7 +175,8 @@ avp_list_t* set_avp_list(unsigned short flags, avp_list_t* list); |
164 | 175 |
int add_avp_galias_str(char *alias_definition); |
165 | 176 |
int lookup_avp_galias(str *alias, int *type, int_str *avp_name); |
166 | 177 |
int add_avp_galias(str *alias, int type, int_str avp_name); |
167 |
-int parse_avp_name( str *name, int *type, int_str *avp_name); |
|
168 |
-int parse_avp_spec( str *name, int *type, int_str *avp_name); |
|
178 |
+int parse_avp_name( str *name, int *type, int_str *avp_name, int *index); |
|
179 |
+int parse_avp_spec( str *name, int *type, int_str *avp_name, int *index); |
|
180 |
+void free_avp_name( int *type, int_str *avp_name); |
|
169 | 181 |
|
170 | 182 |
#endif |
... | ... |
@@ -138,7 +138,7 @@ int add_avp(unsigned short flags, int_str name, int_str val); |
138 | 138 |
int add_avp_list(avp_list_t* list, unsigned short flags, int_str name, int_str val); |
139 | 139 |
|
140 | 140 |
/* Delete avps with given type and name */ |
141 |
-int delete_avp(unsigned short flags, int_str name); |
|
141 |
+void delete_avp(unsigned short flags, int_str name); |
|
142 | 142 |
|
143 | 143 |
/* search functions */ |
144 | 144 |
avp_t *search_first_avp( unsigned short flags, int_str name, |
... | ... |
@@ -106,10 +106,10 @@ struct search_state { |
106 | 106 |
}; |
107 | 107 |
|
108 | 108 |
/* avp aliases structs*/ |
109 |
-struct avp_spec { |
|
109 |
+typedef struct avp_spec { |
|
110 | 110 |
int type; |
111 | 111 |
int_str name; |
112 |
-}; |
|
112 |
+} avp_spec_t; |
|
113 | 113 |
|
114 | 114 |
/* AVP types */ |
115 | 115 |
#define AVP_NAME_STR (1<<0) |
... | ... |
@@ -157,7 +157,7 @@ void get_avp_val(avp_t *avp, int_str *val ); |
157 | 157 |
str* get_avp_name(avp_t *avp); |
158 | 158 |
|
159 | 159 |
avp_list_t get_avp_list(unsigned short flags); |
160 |
-avp_list_t set_avp_list(unsigned short flags, avp_list_t* list); |
|
160 |
+avp_list_t* set_avp_list(unsigned short flags, avp_list_t* list); |
|
161 | 161 |
|
162 | 162 |
|
163 | 163 |
/* global alias functions (manipulation and parsing)*/ |
... | ... |
@@ -31,8 +31,8 @@ |
31 | 31 |
* 2005-02-14 list with FLAGS USAGE added (bogdan) |
32 | 32 |
*/ |
33 | 33 |
|
34 |
-#ifndef _SER_URS_AVP_H_ |
|
35 |
-#define _SER_URS_AVP_H_ |
|
34 |
+#ifndef _SER_USR_AVP_H_ |
|
35 |
+#define _SER_USR_AVP_H_ |
|
36 | 36 |
|
37 | 37 |
#include <sys/types.h> |
38 | 38 |
#include <regex.h> |
... | ... |
@@ -50,6 +50,8 @@ |
50 | 50 |
* 5 core avp is in user list |
51 | 51 |
* 6 core avp is in domain list |
52 | 52 |
* 7 core avp is in global list |
53 |
+ * 8 core avp is in the from avp list |
|
54 |
+ * 9 core avp is in the to avp list |
|
53 | 55 |
* |
54 | 56 |
*/ |
55 | 57 |
|
... | ... |
@@ -62,8 +64,7 @@ |
62 | 64 |
#define AVP_FR_TIMER "fr_timer" /* Value of final response timer */ |
63 | 65 |
#define AVP_FR_INV_TIMER "fr_inv_timer" /* Value of final response invite timer */ |
64 | 66 |
#define AVP_RPID "rpid" /* Remote-Party-ID */ |
65 |
-#define AVP_GFLAGS "gflags" /* global flags */ |
|
66 |
- |
|
67 |
+#define AVP_GFLAGS "gflags" /* global flags */ |
|
67 | 68 |
|
68 | 69 |
struct str_int_data { |
69 | 70 |
str name; |
... | ... |
@@ -77,7 +78,7 @@ struct str_str_data { |
77 | 78 |
|
78 | 79 |
typedef union { |
79 | 80 |
int n; |
80 |
- str *s; |
|
81 |
+ str s; |
|
81 | 82 |
regex_t* re; |
82 | 83 |
} int_str; |
83 | 84 |
|
... | ... |
@@ -90,6 +91,8 @@ typedef struct usr_avp { |
90 | 91 |
void *data; |
91 | 92 |
} avp_t; |
92 | 93 |
|
94 |
+typedef avp_t* avp_list_t; |
|
95 |
+ |
|
93 | 96 |
|
94 | 97 |
/* |
95 | 98 |
* AVP search state |
... | ... |
@@ -102,31 +105,40 @@ struct search_state { |
102 | 105 |
regex_t* search_re; /* Compiled regular expression */ |
103 | 106 |
}; |
104 | 107 |
|
108 |
+/* avp aliases structs*/ |
|
109 |
+struct avp_spec { |
|
110 |
+ int type; |
|
111 |
+ int_str name; |
|
112 |
+}; |
|
105 | 113 |
|
114 |
+/* AVP types */ |
|
106 | 115 |
#define AVP_NAME_STR (1<<0) |
107 | 116 |
#define AVP_VAL_STR (1<<1) |
108 | 117 |
#define AVP_NAME_RE (1<<2) |
109 |
-#define AVP_USER (1<<5) |
|
110 |
-#define AVP_DOMAIN (1<<6) |
|
111 |
-#define AVP_GLOBAL (1<<7) |
|
112 | 118 |
|
113 |
-#define ALL_AVP_CLASSES (AVP_USER|AVP_DOMAIN|AVP_GLOBAL) |
|
119 |
+/* AVP classes */ |
|
120 |
+#define AVP_CLASS_USER (1<<5) |
|
121 |
+#define AVP_CLASS_DOMAIN (1<<6) |
|
122 |
+#define AVP_CLASS_GLOBAL (1<<7) |
|
114 | 123 |
|
115 |
-/* True for user avps */ |
|
116 |
-#define IS_USER_AVP(flags) ((flags) & AVP_USER) |
|
124 |
+/* AVP track (either from or to) */ |
|
125 |
+#define AVP_TRACK_FROM (1<<8) |
|
126 |
+#define AVP_TRACK_TO (1<<9) |
|
127 |
+#define AVP_TRACK_ALL (AVP_TRACK_FROM|AVP_TRACK_TO) |
|
117 | 128 |
|
118 |
-/* True for domain avps */ |
|
119 |
-#define IS_DOMAIN_AVP(flags) ((flags) & AVP_DOMAIN) |
|
120 |
- |
|
121 |
-/* true for global avps */ |
|
122 |
-#define IS_GLOBAL_AVP(flags) ((flags) & AVP_GLOBAL) |
|
129 |
+#define AVP_CLASS_ALL (AVP_CLASS_USER|AVP_CLASS_DOMAIN|AVP_CLASS_GLOBAL) |
|
123 | 130 |
|
124 | 131 |
#define GALIAS_CHAR_MARKER '$' |
125 | 132 |
|
126 |
-/* add functions */ |
|
133 |
+/* Initialize memory structures */ |
|
134 |
+int init_avps(void); |
|
135 |
+ |
|
136 |
+/* add avp to the list of avps */ |
|
127 | 137 |
int add_avp(unsigned short flags, int_str name, int_str val); |
138 |
+int add_avp_list(avp_list_t* list, unsigned short flags, int_str name, int_str val); |
|
128 | 139 |
|
129 |
-int add_avp_list(avp_t** list, unsigned short flags, int_str name, int_str val); |
|
140 |
+/* Delete avps with given type and name */ |
|
141 |
+int delete_avp(unsigned short flags, int_str name); |
|
130 | 142 |
|
131 | 143 |
/* search functions */ |
132 | 144 |
avp_t *search_first_avp( unsigned short flags, int_str name, |
... | ... |
@@ -134,24 +146,18 @@ avp_t *search_first_avp( unsigned short flags, int_str name, |
134 | 146 |
avp_t *search_next_avp(struct search_state* state, int_str *val); |
135 | 147 |
|
136 | 148 |
/* free functions */ |
137 |
-void reset_user_avps(void); |
|
138 |
-void reset_domain_avps(void); |
|
149 |
+void reset_avps(void); |
|
139 | 150 |
|
140 | 151 |
void destroy_avp(avp_t *avp); |
141 |
-void destroy_avp_list(avp_t **list ); |
|
142 |
-void destroy_avp_list_unsafe(avp_t **list ); |
|
152 |
+void destroy_avp_list(avp_list_t *list ); |
|
153 |
+void destroy_avp_list_unsafe(avp_list_t *list ); |
|
143 | 154 |
|
144 | 155 |
/* get func */ |
145 | 156 |
void get_avp_val(avp_t *avp, int_str *val ); |
146 | 157 |
str* get_avp_name(avp_t *avp); |
147 | 158 |
|
148 |
-avp_t** get_user_avp_list(void); /* Return current list of user avps */ |
|
149 |
-avp_t** get_domain_avp_list(void); /* Return current list of domain avps */ |
|
150 |
-avp_t** get_global_avp_list(void); /* Return current list of global avps */ |
|
151 |
- |
|
152 |
-avp_t** set_user_avp_list(avp_t **list); /* Set current list of user avps to list */ |
|
153 |
-avp_t** set_domain_avp_list(avp_t **list); /* Set current list of domain avps to list */ |
|
154 |
-avp_t** set_global_avp_list(avp_t **list); /* Set current list of global avps to list */ |
|
159 |
+avp_list_t get_avp_list(unsigned short flags); |
|
160 |
+avp_list_t set_avp_list(unsigned short flags, avp_list_t* list); |
|
155 | 161 |
|
156 | 162 |
|
157 | 163 |
/* global alias functions (manipulation and parsing)*/ |
... | ... |
@@ -62,6 +62,7 @@ |
62 | 62 |
#define AVP_FR_TIMER "fr_timer" /* Value of final response timer */ |
63 | 63 |
#define AVP_FR_INV_TIMER "fr_inv_timer" /* Value of final response invite timer */ |
64 | 64 |
#define AVP_RPID "rpid" /* Remote-Party-ID */ |
65 |
+#define AVP_GFLAGS "gflags" /* global flags */ |
|
65 | 66 |
|
66 | 67 |
|
67 | 68 |
struct str_int_data { |
... | ... |
@@ -56,6 +56,14 @@ |
56 | 56 |
#include "str.h" |
57 | 57 |
|
58 | 58 |
|
59 |
+#define AVP_UID "uid" /* Unique user identifier */ |
|
60 |
+#define AVP_DID "did" /* Unique domain identifier */ |
|
61 |
+#define AVP_REALM "digest_realm" /* Digest realm */ |
|
62 |
+#define AVP_FR_TIMER "fr_timer" /* Value of final response timer */ |
|
63 |
+#define AVP_FR_INV_TIMER "fr_inv_timer" /* Value of final response invite timer */ |
|
64 |
+#define AVP_RPID "rpid" /* Remote-Party-ID */ |
|
65 |
+ |
|
66 |
+ |
|
59 | 67 |
struct str_int_data { |
60 | 68 |
str name; |
61 | 69 |
int val; |
... | ... |
@@ -117,6 +125,8 @@ struct search_state { |
117 | 125 |
/* add functions */ |
118 | 126 |
int add_avp(unsigned short flags, int_str name, int_str val); |
119 | 127 |
|
128 |
+int add_avp_list(avp_t** list, unsigned short flags, int_str name, int_str val); |
|
129 |
+ |
|
120 | 130 |
/* search functions */ |
121 | 131 |
avp_t *search_first_avp( unsigned short flags, int_str name, |
122 | 132 |
int_str *val, struct search_state* state); |
... | ... |
@@ -124,6 +134,7 @@ avp_t *search_next_avp(struct search_state* state, int_str *val); |
124 | 134 |
|
125 | 135 |
/* free functions */ |
126 | 136 |
void reset_user_avps(void); |
137 |
+void reset_domain_avps(void); |
|
127 | 138 |
|
128 | 139 |
void destroy_avp(avp_t *avp); |
129 | 140 |
void destroy_avp_list(avp_t **list ); |
... | ... |
@@ -44,13 +44,18 @@ |
44 | 44 |
* ------------------------------------------------------- |
45 | 45 |
* 0 avp_core avp has a string name |
46 | 46 |
* 1 avp_core avp has a string value |
47 |
+ * 2 avp_core regex search in progress |
|
47 | 48 |
* 3 avpops module avp was loaded from DB |
48 | 49 |
* 4 lcr module contact avp qvalue change |
50 |
+ * 5 core avp is in user list |
|
51 |
+ * 6 core avp is in domain list |
|
52 |
+ * 7 core avp is in global list |
|
49 | 53 |
* |
50 | 54 |
*/ |
51 | 55 |
|
52 | 56 |
#include "str.h" |
53 | 57 |
|
58 |
+ |
|
54 | 59 |
struct str_int_data { |
55 | 60 |
str name; |
56 | 61 |
int val; |
... | ... |
@@ -68,42 +73,74 @@ typedef union { |
68 | 73 |
} int_str; |
69 | 74 |
|
70 | 75 |
|
71 |
-struct usr_avp { |
|
76 |
+typedef struct usr_avp { |
|
72 | 77 |
unsigned short id; |
73 | 78 |
/* Flags that are kept for the AVP lifetime */ |
74 | 79 |
unsigned short flags; |
75 |
- /* Type of search in progress */ |
|
76 |
- unsigned short search_type; |
|
77 | 80 |
struct usr_avp *next; |
78 | 81 |
void *data; |
82 |
+} avp_t; |
|
83 |
+ |
|
84 |
+ |
|
85 |
+/* |
|
86 |
+ * AVP search state |
|
87 |
+ */ |
|
88 |
+struct search_state { |
|
89 |
+ unsigned short flags; /* Type of search and additional flags */ |
|
90 |
+ unsigned short id; |
|
91 |
+ int_str name; |
|
92 |
+ avp_t* avp; /* Current AVP */ |
|