1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,19 @@ |
1 |
+# $Id$ |
|
2 |
+# |
|
3 |
+# Usrloc_pcscf module Makefile |
|
4 |
+# |
|
5 |
+# |
|
6 |
+# WARNING: do not run this directly, it should be run by the master Makefile |
|
7 |
+ |
|
8 |
+include ../../Makefile.defs |
|
9 |
+auto_gen= |
|
10 |
+NAME=usrloc_pcscf.so |
|
11 |
+ |
|
12 |
+DEFS+=-DOPENSER_MOD_INTERFACE |
|
13 |
+ |
|
14 |
+SERLIBPATH=../../lib |
|
15 |
+SER_LIBS+=$(SERLIBPATH)/kmi/kmi |
|
16 |
+SER_LIBS+=$(SERLIBPATH)/srdb1/srdb1 |
|
17 |
+SER_LIBS+=$(SERLIBPATH)/kcore/kcore |
|
18 |
+#SER_LIBS+=$(SERLIBPATH)/srutils/srutils |
|
19 |
+include ../../Makefile.modules |
0 | 20 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,44 @@ |
1 |
+/* |
|
2 |
+ * $Id$ |
|
3 |
+ * |
|
4 |
+ * Copyright (C) 2012 Smile Communications, jason.penton@smilecoms.com |
|
5 |
+ * Copyright (C) 2012 Smile Communications, richard.good@smilecoms.com |
|
6 |
+ * |
|
7 |
+ * The initial version of this code was written by Dragos Vingarzan |
|
8 |
+ * (dragos(dot)vingarzan(at)fokus(dot)fraunhofer(dot)de and the |
|
9 |
+ * Fruanhofer Institute. It was and still is maintained in a separate |
|
10 |
+ * branch of the original SER. We are therefore migrating it to |
|
11 |
+ * Kamailio/SR and look forward to maintaining it from here on out. |
|
12 |
+ * 2011/2012 Smile Communications, Pty. Ltd. |
|
13 |
+ * ported/maintained/improved by |
|
14 |
+ * Jason Penton (jason(dot)penton(at)smilecoms.com and |
|
15 |
+ * Richard Good (richard(dot)good(at)smilecoms.com) as part of an |
|
16 |
+ * effort to add full IMS support to Kamailio/SR using a new and |
|
17 |
+ * improved architecture |
|
18 |
+ * |
|
19 |
+ * NB: Alot of this code was originally part of OpenIMSCore, |
|
20 |
+ * FhG Fokus. |
|
21 |
+ * Copyright (C) 2004-2006 FhG Fokus |
|
22 |
+ * Thanks for great work! This is an effort to |
|
23 |
+ * break apart the various CSCF functions into logically separate |
|
24 |
+ * components. We hope this will drive wider use. We also feel |
|
25 |
+ * that in this way the architecture is more complete and thereby easier |
|
26 |
+ * to manage in the Kamailio/SR environment |
|
27 |
+ * |
|
28 |
+ * This file is part of Kamailio, a free SIP server. |
|
29 |
+ * |
|
30 |
+ * Kamailio is free software; you can redistribute it and/or modify |
|
31 |
+ * it under the terms of the GNU General Public License as published by |
|
32 |
+ * the Free Software Foundation; either version 2 of the License, or |
|
33 |
+ * (at your option) any later version |
|
34 |
+ * |
|
35 |
+ * Kamailio is distributed in the hope that it will be useful, |
|
36 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
37 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
38 |
+ * GNU General Public License for more details. |
|
39 |
+ * |
|
40 |
+ * You should have received a copy of the GNU General Public License |
|
41 |
+ * along with this program; if not, write to the Free Software |
|
42 |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
43 |
+ * |
|
44 |
+ */ |
|
0 | 45 |
\ No newline at end of file |
1 | 46 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,346 @@ |
1 |
+/* |
|
2 |
+ * $Id$ |
|
3 |
+ * |
|
4 |
+ * Copyright (C) 2012 Smile Communications, jason.penton@smilecoms.com |
|
5 |
+ * Copyright (C) 2012 Smile Communications, richard.good@smilecoms.com |
|
6 |
+ * |
|
7 |
+ * The initial version of this code was written by Dragos Vingarzan |
|
8 |
+ * (dragos(dot)vingarzan(at)fokus(dot)fraunhofer(dot)de and the |
|
9 |
+ * Fruanhofer Institute. It was and still is maintained in a separate |
|
10 |
+ * branch of the original SER. We are therefore migrating it to |
|
11 |
+ * Kamailio/SR and look forward to maintaining it from here on out. |
|
12 |
+ * 2011/2012 Smile Communications, Pty. Ltd. |
|
13 |
+ * ported/maintained/improved by |
|
14 |
+ * Jason Penton (jason(dot)penton(at)smilecoms.com and |
|
15 |
+ * Richard Good (richard(dot)good(at)smilecoms.com) as part of an |
|
16 |
+ * effort to add full IMS support to Kamailio/SR using a new and |
|
17 |
+ * improved architecture |
|
18 |
+ * |
|
19 |
+ * NB: Alot of this code was originally part of OpenIMSCore, |
|
20 |
+ * FhG Fokus. |
|
21 |
+ * Copyright (C) 2004-2006 FhG Fokus |
|
22 |
+ * Thanks for great work! This is an effort to |
|
23 |
+ * break apart the various CSCF functions into logically separate |
|
24 |
+ * components. We hope this will drive wider use. We also feel |
|
25 |
+ * that in this way the architecture is more complete and thereby easier |
|
26 |
+ * to manage in the Kamailio/SR environment |
|
27 |
+ * |
|
28 |
+ * This file is part of Kamailio, a free SIP server. |
|
29 |
+ * |
|
30 |
+ * Kamailio is free software; you can redistribute it and/or modify |
|
31 |
+ * it under the terms of the GNU General Public License as published by |
|
32 |
+ * the Free Software Foundation; either version 2 of the License, or |
|
33 |
+ * (at your option) any later version |
|
34 |
+ * |
|
35 |
+ * Kamailio is distributed in the hope that it will be useful, |
|
36 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
37 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
38 |
+ * GNU General Public License for more details. |
|
39 |
+ * |
|
40 |
+ * You should have received a copy of the GNU General Public License |
|
41 |
+ * along with this program; if not, write to the Free Software |
|
42 |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
43 |
+ * |
|
44 |
+ */ |
|
45 |
+ |
|
46 |
+#include "dlist.h" |
|
47 |
+#include <stdlib.h> /* abort */ |
|
48 |
+#include <string.h> /* strlen, memcmp */ |
|
49 |
+#include <stdio.h> /* printf */ |
|
50 |
+#include "../../ut.h" |
|
51 |
+#include "../../lib/srdb1/db_ut.h" |
|
52 |
+#include "../../mem/shm_mem.h" |
|
53 |
+#include "../../dprint.h" |
|
54 |
+#include "../../ip_addr.h" |
|
55 |
+#include "../../socket_info.h" |
|
56 |
+#include "udomain.h" /* new_udomain, free_udomain */ |
|
57 |
+#include "usrloc.h" |
|
58 |
+#include "utime.h" |
|
59 |
+#include "ul_mod.h" |
|
60 |
+#include "pcontact.h" |
|
61 |
+ |
|
62 |
+dlist_t* root = 0; |
|
63 |
+ |
|
64 |
+static inline int find_dlist(str* _n, dlist_t** _d) |
|
65 |
+{ |
|
66 |
+ dlist_t* ptr; |
|
67 |
+ |
|
68 |
+ ptr = root; |
|
69 |
+ while(ptr) { |
|
70 |
+ if ((_n->len == ptr->name.len) && |
|
71 |
+ !memcmp(_n->s, ptr->name.s, _n->len)) { |
|
72 |
+ *_d = ptr; |
|
73 |
+ return 0; |
|
74 |
+ } |
|
75 |
+ |
|
76 |
+ ptr = ptr->next; |
|
77 |
+ } |
|
78 |
+ |
|
79 |
+ return 1; |
|
80 |
+} |
|
81 |
+ |
|
82 |
+static inline int get_all_mem_ucontacts(void *buf, int len, unsigned int flags, |
|
83 |
+ unsigned int part_idx, unsigned int part_max) |
|
84 |
+{ |
|
85 |
+ dlist_t *p; |
|
86 |
+ pcontact_t *c; |
|
87 |
+ void *cp; |
|
88 |
+ int shortage; |
|
89 |
+ int needed; |
|
90 |
+ int i = 0; |
|
91 |
+ cp = buf; |
|
92 |
+ shortage = 0; |
|
93 |
+ unsigned int received_len = 0; |
|
94 |
+ char received_s[60]; // IPv6-Address (39) + "sip:" (4) + ":" (1) + Port (5); 60 should be plenty. |
|
95 |
+ /* Reserve space for terminating 0000 */ |
|
96 |
+ len -= sizeof(int); |
|
97 |
+ |
|
98 |
+ for (p = root; p != NULL; p = p->next) { |
|
99 |
+ |
|
100 |
+ for(i=0; i<p->d->size; i++) { |
|
101 |
+ |
|
102 |
+ if ( (i % part_max) != part_idx ) |
|
103 |
+ continue; |
|
104 |
+ |
|
105 |
+ lock_ulslot(p->d, i); |
|
106 |
+ if(p->d->table[i].n<=0) |
|
107 |
+ { |
|
108 |
+ unlock_ulslot(p->d, i); |
|
109 |
+ continue; |
|
110 |
+ } |
|
111 |
+ for (c = p->d->table[i].first; c != NULL; c = c->next) { |
|
112 |
+ if (c->received_host.s) { |
|
113 |
+ received_len = snprintf(received_s, sizeof(received_s), "sip:%.*s:%x", c->received_host.len, |
|
114 |
+ c->received_host.s, c->received_port) - 1; |
|
115 |
+ |
|
116 |
+ needed = (int)(sizeof(received_len) |
|
117 |
+ + received_len + sizeof(c->sock) |
|
118 |
+ + sizeof(unsigned int) + sizeof(c->path.len) |
|
119 |
+ + c->path.len); |
|
120 |
+ if (len >= needed) { |
|
121 |
+ cp = (char*)cp + received_len; |
|
122 |
+ cp = (char*)cp + sizeof(received_len); |
|
123 |
+ |
|
124 |
+ memcpy(cp, received_s, received_len); |
|
125 |
+ cp = (char*)cp + received_len; |
|
126 |
+ |
|
127 |
+ memcpy(cp, &c->sock, sizeof(c->sock)); |
|
128 |
+ cp = (char*)cp + sizeof(c->sock); |
|
129 |
+ |
|
130 |
+ memset(cp, 0, sizeof(unsigned int)); |
|
131 |
+ cp = (char*)cp + sizeof(unsigned int); |
|
132 |
+ |
|
133 |
+ memcpy(cp, &c->path.len, sizeof(c->path.len)); |
|
134 |
+ cp = (char*)cp + sizeof(c->path.len); |
|
135 |
+ memcpy(cp, c->path.s, c->path.len); |
|
136 |
+ cp = (char*)cp + c->path.len; |
|
137 |
+ len -= needed; |
|
138 |
+ } else { |
|
139 |
+ shortage += needed; |
|
140 |
+ } |
|
141 |
+ } |
|
142 |
+ } |
|
143 |
+ unlock_ulslot(p->d, i); |
|
144 |
+ } |
|
145 |
+ } |
|
146 |
+ /* len < 0 is possible, if size of the buffer < sizeof(c->c.len) */ |
|
147 |
+ if (len >= 0) |
|
148 |
+ memset(cp, 0, sizeof(int)); |
|
149 |
+ |
|
150 |
+ /* Shouldn't happen */ |
|
151 |
+ if (shortage > 0 && len > shortage) { |
|
152 |
+ abort(); |
|
153 |
+ } |
|
154 |
+ |
|
155 |
+ shortage -= len; |
|
156 |
+ |
|
157 |
+ return shortage > 0 ? shortage : 0; |
|
158 |
+} |
|
159 |
+ |
|
160 |
+int get_all_ucontacts(void *buf, int len, unsigned int flags, |
|
161 |
+ unsigned int part_idx, unsigned int part_max) |
|
162 |
+{ |
|
163 |
+ return get_all_mem_ucontacts( buf, len, flags, part_idx, part_max); |
|
164 |
+} |
|
165 |
+ |
|
166 |
+static inline int new_dlist(str* _n, dlist_t** _d) |
|
167 |
+{ |
|
168 |
+ dlist_t* ptr; |
|
169 |
+ |
|
170 |
+ /* Domains are created before ser forks, |
|
171 |
+ * so we can create them using pkg_malloc |
|
172 |
+ */ |
|
173 |
+ ptr = (dlist_t*)shm_malloc(sizeof(dlist_t)); |
|
174 |
+ if (ptr == 0) { |
|
175 |
+ LM_ERR("no more share memory\n"); |
|
176 |
+ return -1; |
|
177 |
+ } |
|
178 |
+ memset(ptr, 0, sizeof(dlist_t)); |
|
179 |
+ |
|
180 |
+ /* copy domain name as null terminated string */ |
|
181 |
+ ptr->name.s = (char*)shm_malloc(_n->len+1); |
|
182 |
+ if (ptr->name.s == 0) { |
|
183 |
+ LM_ERR("no more memory left\n"); |
|
184 |
+ shm_free(ptr); |
|
185 |
+ return -2; |
|
186 |
+ } |
|
187 |
+ |
|
188 |
+ memcpy(ptr->name.s, _n->s, _n->len); |
|
189 |
+ ptr->name.len = _n->len; |
|
190 |
+ ptr->name.s[ptr->name.len] = 0; |
|
191 |
+ |
|
192 |
+ if (new_udomain(&(ptr->name), ul_hash_size, &(ptr->d)) < 0) { |
|
193 |
+ LM_ERR("creating domain structure failed\n"); |
|
194 |
+ shm_free(ptr->name.s); |
|
195 |
+ shm_free(ptr); |
|
196 |
+ return -3; |
|
197 |
+ } |
|
198 |
+ |
|
199 |
+ *_d = ptr; |
|
200 |
+ return 0; |
|
201 |
+} |
|
202 |
+ |
|
203 |
+int get_udomain(const char* _n, udomain_t** _d) |
|
204 |
+{ |
|
205 |
+ dlist_t* d; |
|
206 |
+ str s; |
|
207 |
+ |
|
208 |
+ s.s = (char*)_n; |
|
209 |
+ s.len = strlen(_n); |
|
210 |
+ |
|
211 |
+ if (find_dlist(&s, &d) == 0) { |
|
212 |
+ *_d = d->d; |
|
213 |
+ return 0; |
|
214 |
+ } |
|
215 |
+ *_d = NULL; |
|
216 |
+ return -1; |
|
217 |
+} |
|
218 |
+ |
|
219 |
+int register_udomain(const char* _n, udomain_t** _d) |
|
220 |
+{ |
|
221 |
+ dlist_t* d; |
|
222 |
+ str s; |
|
223 |
+ |
|
224 |
+ s.s = (char*)_n; |
|
225 |
+ s.len = strlen(_n); |
|
226 |
+ |
|
227 |
+ if (find_dlist(&s, &d) == 0) { |
|
228 |
+ *_d = d->d; |
|
229 |
+ return 0; |
|
230 |
+ } |
|
231 |
+ |
|
232 |
+ if (new_dlist(&s, &d) < 0) { |
|
233 |
+ LM_ERR("failed to create new domain\n"); |
|
234 |
+ return -1; |
|
235 |
+ } |
|
236 |
+ |
|
237 |
+ d->next = root; |
|
238 |
+ root = d; |
|
239 |
+ |
|
240 |
+ *_d = d->d; |
|
241 |
+ return 0; |
|
242 |
+} |
|
243 |
+ |
|
244 |
+void free_all_udomains(void) |
|
245 |
+{ |
|
246 |
+ dlist_t* ptr; |
|
247 |
+ |
|
248 |
+ while(root) { |
|
249 |
+ ptr = root; |
|
250 |
+ root = root->next; |
|
251 |
+ |
|
252 |
+ free_udomain(ptr->d); |
|
253 |
+ shm_free(ptr->name.s); |
|
254 |
+ shm_free(ptr); |
|
255 |
+ } |
|
256 |
+} |
|
257 |
+ |
|
258 |
+void print_all_udomains(FILE* _f) |
|
259 |
+{ |
|
260 |
+ dlist_t* ptr; |
|
261 |
+ |
|
262 |
+ ptr = root; |
|
263 |
+ |
|
264 |
+ fprintf(_f, "===Domain list===\n"); |
|
265 |
+ while(ptr) { |
|
266 |
+ print_udomain(_f, ptr->d); |
|
267 |
+ ptr = ptr->next; |
|
268 |
+ } |
|
269 |
+ fprintf(_f, "===/Domain list===\n"); |
|
270 |
+} |
|
271 |
+ |
|
272 |
+int synchronize_all_udomains(void) |
|
273 |
+{ |
|
274 |
+ int res = 0; |
|
275 |
+ dlist_t* ptr; |
|
276 |
+ |
|
277 |
+ get_act_time(); /* Get and save actual time */ |
|
278 |
+ |
|
279 |
+ for( ptr=root ; ptr ; ptr=ptr->next) |
|
280 |
+ mem_timer_udomain(ptr->d); |
|
281 |
+ |
|
282 |
+ return res; |
|
283 |
+} |
|
284 |
+ |
|
285 |
+int find_domain(str* _d, udomain_t** _p) |
|
286 |
+{ |
|
287 |
+ dlist_t* d; |
|
288 |
+ |
|
289 |
+ if (find_dlist(_d, &d) == 0) { |
|
290 |
+ *_p = d->d; |
|
291 |
+ return 0; |
|
292 |
+ } |
|
293 |
+ |
|
294 |
+ return 1; |
|
295 |
+} |
|
296 |
+ |
|
297 |
+unsigned long get_number_of_contacts(void) |
|
298 |
+{ |
|
299 |
+ long numberOfUsers = 0; |
|
300 |
+ |
|
301 |
+ dlist_t* current_dlist; |
|
302 |
+ |
|
303 |
+ current_dlist = root; |
|
304 |
+ |
|
305 |
+ while (current_dlist) |
|
306 |
+ { |
|
307 |
+ numberOfUsers += get_stat_val(current_dlist->d->contacts); |
|
308 |
+ current_dlist = current_dlist->next; |
|
309 |
+ } |
|
310 |
+ |
|
311 |
+ return numberOfUsers; |
|
312 |
+} |
|
313 |
+ |
|
314 |
+unsigned long get_number_of_expired(void) |
|
315 |
+{ |
|
316 |
+ long numberOfExpired = 0; |
|
317 |
+ |
|
318 |
+ dlist_t* current_dlist; |
|
319 |
+ |
|
320 |
+ current_dlist = root; |
|
321 |
+ |
|
322 |
+ while (current_dlist) |
|
323 |
+ { |
|
324 |
+ numberOfExpired += get_stat_val(current_dlist->d->expired); |
|
325 |
+ current_dlist = current_dlist->next; |
|
326 |
+ } |
|
327 |
+ |
|
328 |
+ return numberOfExpired; |
|
329 |
+} |
|
330 |
+ |
|
331 |
+unsigned long get_number_of_impu(void) |
|
332 |
+{ |
|
333 |
+ long numberOfExpired = 0; |
|
334 |
+ |
|
335 |
+ dlist_t* current_dlist; |
|
336 |
+ |
|
337 |
+ current_dlist = root; |
|
338 |
+ |
|
339 |
+ while (current_dlist) |
|
340 |
+ { |
|
341 |
+ numberOfExpired += get_stat_val(current_dlist->d->expired); |
|
342 |
+ current_dlist = current_dlist->next; |
|
343 |
+ } |
|
344 |
+ |
|
345 |
+ return numberOfExpired; |
|
346 |
+} |
0 | 347 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,82 @@ |
1 |
+/* |
|
2 |
+ * $Id$ |
|
3 |
+ * |
|
4 |
+ * Copyright (C) 2012 Smile Communications, jason.penton@smilecoms.com |
|
5 |
+ * Copyright (C) 2012 Smile Communications, richard.good@smilecoms.com |
|
6 |
+ * |
|
7 |
+ * The initial version of this code was written by Dragos Vingarzan |
|
8 |
+ * (dragos(dot)vingarzan(at)fokus(dot)fraunhofer(dot)de and the |
|
9 |
+ * Fruanhofer Institute. It was and still is maintained in a separate |
|
10 |
+ * branch of the original SER. We are therefore migrating it to |
|
11 |
+ * Kamailio/SR and look forward to maintaining it from here on out. |
|
12 |
+ * 2011/2012 Smile Communications, Pty. Ltd. |
|
13 |
+ * ported/maintained/improved by |
|
14 |
+ * Jason Penton (jason(dot)penton(at)smilecoms.com and |
|
15 |
+ * Richard Good (richard(dot)good(at)smilecoms.com) as part of an |
|
16 |
+ * effort to add full IMS support to Kamailio/SR using a new and |
|
17 |
+ * improved architecture |
|
18 |
+ * |
|
19 |
+ * NB: Alot of this code was originally part of OpenIMSCore, |
|
20 |
+ * FhG Fokus. |
|
21 |
+ * Copyright (C) 2004-2006 FhG Fokus |
|
22 |
+ * Thanks for great work! This is an effort to |
|
23 |
+ * break apart the various CSCF functions into logically separate |
|
24 |
+ * components. We hope this will drive wider use. We also feel |
|
25 |
+ * that in this way the architecture is more complete and thereby easier |
|
26 |
+ * to manage in the Kamailio/SR environment |
|
27 |
+ * |
|
28 |
+ * This file is part of Kamailio, a free SIP server. |
|
29 |
+ * |
|
30 |
+ * Kamailio is free software; you can redistribute it and/or modify |
|
31 |
+ * it under the terms of the GNU General Public License as published by |
|
32 |
+ * the Free Software Foundation; either version 2 of the License, or |
|
33 |
+ * (at your option) any later version |
|
34 |
+ * |
|
35 |
+ * Kamailio is distributed in the hope that it will be useful, |
|
36 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
37 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
38 |
+ * GNU General Public License for more details. |
|
39 |
+ * |
|
40 |
+ * You should have received a copy of the GNU General Public License |
|
41 |
+ * along with this program; if not, write to the Free Software |
|
42 |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
43 |
+ * |
|
44 |
+ */ |
|
45 |
+ |
|
46 |
+#ifndef DLIST_H |
|
47 |
+#define DLIST_H |
|
48 |
+ |
|
49 |
+#include <stdio.h> |
|
50 |
+#include "../../str.h" |
|
51 |
+#include "usrloc.h" |
|
52 |
+#include "udomain.h" |
|
53 |
+ |
|
54 |
+/*! |
|
55 |
+ * List of all domains registered with usrloc |
|
56 |
+ */ |
|
57 |
+typedef struct dlist { |
|
58 |
+ str name; /*!< Name of the domain (null terminated) */ |
|
59 |
+ udomain_t* d; /*!< Payload */ |
|
60 |
+ struct dlist* next; /*!< Next element in the list */ |
|
61 |
+} dlist_t; |
|
62 |
+ |
|
63 |
+/*! \brief Global list of all registered domains */ |
|
64 |
+extern dlist_t* root; |
|
65 |
+ |
|
66 |
+int register_udomain(const char* _n, udomain_t** _d); |
|
67 |
+void free_all_udomains(void); |
|
68 |
+void print_all_udomains(FILE* _f); |
|
69 |
+int synchronize_all_udomains(void); |
|
70 |
+int get_all_ucontacts(void *buf, int len, unsigned int flags, |
|
71 |
+ unsigned int part_idx, unsigned int part_max); |
|
72 |
+int get_udomain(const char* _n, udomain_t** _d); |
|
73 |
+unsigned long get_number_of_users(void); |
|
74 |
+int find_domain(str* _d, udomain_t** _p); |
|
75 |
+ |
|
76 |
+/* stat retrieval functions */ |
|
77 |
+unsigned long get_number_of_contacts(void); |
|
78 |
+unsigned long get_number_of_expired(void); |
|
79 |
+unsigned long get_number_of_impu(void); |
|
80 |
+ |
|
81 |
+ |
|
82 |
+#endif |
0 | 5 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,72 @@ |
1 |
+/** Full Diameter Peer configuration. */ |
|
2 |
+typedef struct { |
|
3 |
+ str fqdn; /**< own FQDN */ |
|
4 |
+ str realm; /**< own Realm */ |
|
5 |
+ str identity; /**< own diameter URI */ |
|
6 |
+ int vendor_id; /**< own vendorid */ |
|
7 |
+ str product_name; /**< own product name */ |
|
8 |
+ int accept_unknown_peers; /**< if to accept connections from peers that are not configured initially */ |
|
9 |
+ int drop_unknown_peers; /**< if to drop the peers that are not initially configured on disconnected; |
|
10 |
+ usually, you want to do this, unless you want your list of peers to |
|
11 |
+ grow and you want to try and connect back to everybody that connected |
|
12 |
+ to you before */ |
|
13 |
+ int tc; /**< Tc timer duration (30 seconds should be) */ |
|
14 |
+ int workers; /**< Number of worker-processes to fork */ |
|
15 |
+ int queue_length; /**< Length of the message queue; when it is filled, the server part will |
|
16 |
+ block until workers will finish work on at least one item in the queue */ |
|
17 |
+ int connect_timeout; /**< Connect timeout for outbound connections */ |
|
18 |
+ int transaction_timeout; /**< Transaction timeout duration */ |
|
19 |
+ |
|
20 |
+ int sessions_hash_size; /**< Size of the sessions hash table */ |
|
21 |
+ int default_auth_session_timeout; /** The default Authorization Session Timeout to use if none other indicated */ |
|
22 |
+ int max_auth_session_timeout; /** The max Authorization Session Timeout limit */ |
|
23 |
+ |
|
24 |
+ peer_config *peers; /**< list of peers */ |
|
25 |
+ int peers_cnt; /**< size of the list of peers */ |
|
26 |
+ |
|
27 |
+ acceptor_config *acceptors; /**< list of acceptors */ |
|
28 |
+ int acceptors_cnt; /**< size of the list of acceptors */ |
|
29 |
+ |
|
30 |
+ app_config *applications; /**< list of supporter applications */ |
|
31 |
+ int applications_cnt; /**< size of list of supported applications*/ |
|
32 |
+ |
|
33 |
+ int *supported_vendors; /**< list of supported vendor ids */ |
|
34 |
+ int supported_vendors_cnt; /**< size of list of supported vendor ids */ |
|
35 |
+ |
|
36 |
+ routing_table *r_table; /**< realm routing table */ |
|
37 |
+} dp_config; |
|
38 |
+ |
|
39 |
+/** |
|
40 |
+ * Exported functions. This is the API available for use from other SER modules. |
|
41 |
+ * If you require more, please add them here. |
|
42 |
+ * <p> |
|
43 |
+ * - load_cdp() - find and load the CDiameterPeer function bindings |
|
44 |
+ * <p> |
|
45 |
+ * - AAACreateRequest() - create a diameter request #AAAMessage |
|
46 |
+ * - AAACreateResponse() - create a diameter response #AAAMessage |
|
47 |
+ * - AAAFreeMessage() - free up the memory used in a Diameter message |
|
48 |
+ * <p> |
|
49 |
+ * - AAASendMessage() - asynchronously send a message |
|
50 |
+ * - AAASendMessageToPeer() - asynchronously send a message to a forced peer |
|
51 |
+ * - AAASendRecvMessage() - synchronously send a message and get the response |
|
52 |
+ * - AAASendRecvMessageToPeer() - synchronously send a message and get the response to a forced peer |
|
53 |
+ * <p> |
|
54 |
+ * - AAACreateSession() - create a diameter #AAASessionId |
|
55 |
+ * - AAADropSession() - drop a diameter #AAASessionId |
|
56 |
+ * <p> |
|
57 |
+ * - AAACreateTransaction() - create a diameter #AAATransaction |
|
58 |
+ * - AAADropTransaction() - drop a diameter #AAATransaction |
|
59 |
+ * <p> |
|
60 |
+ * - AAACreateAVP() - create an #AAA_AVP |
|
61 |
+ * - AAAAddAVPToMessage() - add an #AAA_AVP to a #AAAMessage |
|
62 |
+ * - AAAFindMatchingAVP() - find an #AAA_AVP inside a #AAAMessage |
|
63 |
+ * - AAAGetNextAVP() - get the next #AAA_AVP from the #AAAMessage |
|
64 |
+ * - AAAFreeAVP() - free the memory taken by the #AAA_AVP |
|
65 |
+ * - AAAGroupAVPS() - group a #AAA_AVP_LIST of #AAA_AVP into a grouped #AAA_AVP |
|
66 |
+ * - AAAUngroupAVPS() - ungroup a grouped #AAA_AVP into a #AAA_AVP_LIST of #AAA_AVP |
|
67 |
+ * - AAAFindMatchingAVPList() - find an #AAA_AVP inside a #AAA_AVP_LIST |
|
68 |
+ * - AAAFreeAVPList() - free the memory taken by the all members of #AAA_AVP_LIST |
|
69 |
+ * <p> |
|
70 |
+ * - AAAAddRequestHandler() - add a #AAARequestHandler_f callback to request being received |
|
71 |
+ * - AAAAddResponseHandler() - add a #AAAResponseHandler_f callback to responses being received |
|
72 |
+ */ |
0 | 73 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,61 @@ |
1 |
+<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" |
|
3 |
+"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ |
|
4 |
+<!-- Include general documentation entities --> |
|
5 |
+<!ENTITY % docentities SYSTEM "../../../docbook/entities.xml"> |
|
6 |
+%docentities; |
|
7 |
+]> |
|
8 |
+<book> |
|
9 |
+ <bookinfo> |
|
10 |
+ <title>cdp Module</title> |
|
11 |
+ |
|
12 |
+ <productname class="trade">&kamailioname;</productname> |
|
13 |
+ |
|
14 |
+ <authorgroup> |
|
15 |
+ <author> |
|
16 |
+ <firstname>Jason Penton</firstname> |
|
17 |
+ |
|
18 |
+ <surname/> |
|
19 |
+ |
|
20 |
+ <affiliation> |
|
21 |
+ <orgname>Smile Communications</orgname> |
|
22 |
+ </affiliation> |
|
23 |
+ |
|
24 |
+ <address> |
|
25 |
+ <email>jason.penton@smilecoms.com</email> |
|
26 |
+ </address> |
|
27 |
+ </author> |
|
28 |
+ |
|
29 |
+ <editor> |
|
30 |
+ <firstname>Richard</firstname> |
|
31 |
+ |
|
32 |
+ <surname>Good</surname> |
|
33 |
+ |
|
34 |
+ <affiliation> |
|
35 |
+ <orgname>Smile Communications</orgname> |
|
36 |
+ </affiliation> |
|
37 |
+ |
|
38 |
+ <address> |
|
39 |
+ <email>richard.good@smilecoms.com</email> |
|
40 |
+ </address> |
|
41 |
+ </editor> |
|
42 |
+ </authorgroup> |
|
43 |
+ |
|
44 |
+ <copyright> |
|
45 |
+ <year>2012</year> |
|
46 |
+ |
|
47 |
+ <holder>Smile Communications</holder> |
|
48 |
+ </copyright> |
|
49 |
+ </bookinfo> |
|
50 |
+ |
|
51 |
+ <toc/> |
|
52 |
+ |
|
53 |
+ <xi:include href="usrloc_pcscf_admin.xml" |
|
54 |
+ xmlns:xi="http://www.w3.org/2001/XInclude"/> |
|
55 |
+ |
|
56 |
+ <xi:include href="usrloc_pcscf_devel.xml" |
|
57 |
+ xmlns:xi="http://www.w3.org/2001/XInclude"/> |
|
58 |
+ |
|
59 |
+ <xi:include href="usrloc_pcscf_faq.xml" |
|
60 |
+ xmlns:xi="http://www.w3.org/2001/XInclude"/> |
|
61 |
+</book> |
0 | 62 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,153 @@ |
1 |
+<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" |
|
3 |
+"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ |
|
4 |
+<!-- Include general documentation entities --> |
|
5 |
+<!ENTITY % docentities SYSTEM "../../../docbook/entities.xml"> |
|
6 |
+%docentities; |
|
7 |
+]> |
|
8 |
+<!-- Module User's Guide --> |
|
9 |
+<chapter> |
|
10 |
+ <title>&adminguide;</title> |
|
11 |
+ |
|
12 |
+ <section> |
|
13 |
+ <title>Overview</title> |
|
14 |
+ |
|
15 |
+ <para>This module serves as a storage engine for PCSCF contacts, much like |
|
16 |
+ the standard Kamailio module, usrloc, is a storage engine for standard SIP |
|
17 |
+ contacts. The concept of a contact in IMS, PCSCF specifically, is very |
|
18 |
+ different to that of std. SIP and as a result we have built this new |
|
19 |
+ module. Alot of the design has been borrowed from the std. usrloc module. |
|
20 |
+ For example. An IMS contact, in PCSCF, needs things like:</para> |
|
21 |
+ |
|
22 |
+ <para><itemizedlist> |
|
23 |
+ <listitem> |
|
24 |
+ <para>Diameter Rx session for signalling bearer status. i.e. this is |
|
25 |
+ effectively QoS from the network to make sure the signalling link |
|
26 |
+ can be 'trusted'</para> |
|
27 |
+ </listitem> |
|
28 |
+ |
|
29 |
+ <listitem> |
|
30 |
+ <para>IPSEC Security Assocation for secure signalling between UE and |
|
31 |
+ PCSCF (first point of contact)</para> |
|
32 |
+ </listitem> |
|
33 |
+ |
|
34 |
+ <listitem> |
|
35 |
+ <para>IMPU, each contact can have a number of associated public |
|
36 |
+ identities (IMPU).</para> |
|
37 |
+ </listitem> |
|
38 |
+ </itemizedlist></para> |
|
39 |
+ </section> |
|
40 |
+ |
|
41 |
+ <section> |
|
42 |
+ <title>Dependencies</title> |
|
43 |
+ |
|
44 |
+ <section> |
|
45 |
+ <title>&kamailio; Modules</title> |
|
46 |
+ |
|
47 |
+ <para>The following modules must be loaded before this module: |
|
48 |
+ <itemizedlist> |
|
49 |
+ <listitem> |
|
50 |
+ <para><emphasis>None</emphasis>.</para> |
|
51 |
+ </listitem> |
|
52 |
+ </itemizedlist></para> |
|
53 |
+ </section> |
|
54 |
+ |
|
55 |
+ <section> |
|
56 |
+ <title>External Libraries or Applications</title> |
|
57 |
+ |
|
58 |
+ <para>The following libraries or applications must be installed before |
|
59 |
+ running &kamailio; with this module loaded: <itemizedlist> |
|
60 |
+ <listitem> |
|
61 |
+ <para><emphasis>None</emphasis>.</para> |
|
62 |
+ </listitem> |
|
63 |
+ </itemizedlist></para> |
|
64 |
+ </section> |
|
65 |
+ </section> |
|
66 |
+ |
|
67 |
+ <section> |
|
68 |
+ <title>Parameters</title> |
|
69 |
+ |
|
70 |
+ <section> |
|
71 |
+ <title>hash_size (int)</title> |
|
72 |
+ |
|
73 |
+ <para>The number of entries of the hash table used by to store the |
|
74 |
+ contact records is 2^hash_size. For hash_size=4, the number of entries |
|
75 |
+ of the hash table is 16. </para> |
|
76 |
+ |
|
77 |
+ <para><emphasis> Default value is 9. </emphasis></para> |
|
78 |
+ |
|
79 |
+ <example> |
|
80 |
+ <title>Set <varname>hash_size</varname> parameter</title> |
|
81 |
+ |
|
82 |
+ <programlisting format="linespecific">... |
|
83 |
+modparam("usrloc_pcscf", "hash_size", 10) |
|
84 |
+... |
|
85 |
+</programlisting> |
|
86 |
+ </example> |
|
87 |
+ </section> |
|
88 |
+ |
|
89 |
+ <section> |
|
90 |
+ <title>timer_interval (int)</title> |
|
91 |
+ |
|
92 |
+ <para>Number of seconds between two timer runs. The module uses timer to |
|
93 |
+ delete expired contacts. </para> |
|
94 |
+ |
|
95 |
+ <para><emphasis> Default value is 60. </emphasis></para> |
|
96 |
+ |
|
97 |
+ <example> |
|
98 |
+ <title>Set timer_interval parameter</title> |
|
99 |
+ |
|
100 |
+ <programlisting format="linespecific">... |
|
101 |
+modparam("usrloc_pcscf", "timer_interval", 30) |
|
102 |
+... |
|
103 |
+</programlisting> |
|
104 |
+ </example> |
|
105 |
+ </section> |
|
106 |
+ </section> |
|
107 |
+ |
|
108 |
+ <section> |
|
109 |
+ <title>Functions</title> |
|
110 |
+ |
|
111 |
+ <section> |
|
112 |
+ <para>There are no exported functions that could be used in scripts. |
|
113 |
+ </para> |
|
114 |
+ </section> |
|
115 |
+ </section> |
|
116 |
+ |
|
117 |
+ <section> |
|
118 |
+ <title>RPC Commands</title> |
|
119 |
+ |
|
120 |
+ <para>exported RPC commands.</para> |
|
121 |
+ |
|
122 |
+ <section> |
|
123 |
+ <title>ulpcscf.status</title> |
|
124 |
+ |
|
125 |
+ <para>Status of pcscf_usrloc, AORs, max slots, etc.</para> |
|
126 |
+ </section> |
|
127 |
+ </section> |
|
128 |
+ |
|
129 |
+ <section> |
|
130 |
+ <title>Statistics</title> |
|
131 |
+ |
|
132 |
+ <para>Exported statistics are listed in the next sections. </para> |
|
133 |
+ |
|
134 |
+ <section> |
|
135 |
+ <title>registered contacts</title> |
|
136 |
+ |
|
137 |
+ <para>Number of AOR contacts in registered state - cannot be |
|
138 |
+ reset.</para> |
|
139 |
+ </section> |
|
140 |
+ |
|
141 |
+ <section> |
|
142 |
+ <title>impus</title> |
|
143 |
+ |
|
144 |
+ <para>Number of IMPUs - cannot be reset.</para> |
|
145 |
+ </section> |
|
146 |
+ |
|
147 |
+ <section> |
|
148 |
+ <title>expired contacts</title> |
|
149 |
+ |
|
150 |
+ <para>Number of expired contacts - can be reset.</para> |
|
151 |
+ </section> |
|
152 |
+ </section> |
|
153 |
+</chapter> |
0 | 154 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,682 @@ |
1 |
+<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" |
|
3 |
+"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ |
|
4 |
+<!-- Include general documentation entities --> |
|
5 |
+<!ENTITY % docentities SYSTEM "../../../docbook/entities.xml"> |
|
6 |
+%docentities; |
|
7 |
+]> |
|
8 |
+<!-- Module Developer's Guide --> |
|
9 |
+<chapter> |
|
10 |
+ <title>&develguide;</title> |
|
11 |
+ |
|
12 |
+ <section> |
|
13 |
+ <title>Available Functions</title> |
|
14 |
+ |
|
15 |
+ <section> |
|
16 |
+ <title><function moreinfo="none">load_cdp(struct cdp_binds |
|
17 |
+ *cdpb)</function></title> |
|
18 |
+ |
|
19 |
+ <para>Find and load the CDiameterPeer function bindings</para> |
|
20 |
+ |
|
21 |
+ <para>Meaning of the parameters is as follows:</para> |
|
22 |
+ |
|
23 |
+ <itemizedlist> |
|
24 |
+ <listitem> |
|
25 |
+ <para><emphasis>struct cdp_binds *cdpb</emphasis> - structure |
|
26 |
+ holding function pointers</para> |
|
27 |
+ </listitem> |
|
28 |
+ </itemizedlist> |
|
29 |
+ </section> |
|
30 |
+ |
|
31 |
+ <section> |
|
32 |
+ <title><function moreinfo="none">AAACreateRequest(AAAApplicationId |
|
33 |
+ app_id, AAACommandCode command_code, AAAMsgFlag flags, AAASession |
|
34 |
+ *session)</function></title> |
|
35 |
+ |
|
36 |
+ <para>Create a Diameter request</para> |
|
37 |
+ |
|
38 |
+ <para>Meaning of the parameters is as follows:</para> |
|
39 |
+ |
|
40 |
+ <itemizedlist> |
|
41 |
+ <listitem> |
|
42 |
+ <para><emphasis>AAAApplicationId app_id</emphasis> - structure |
|
43 |
+ holding function pointers</para> |
|
44 |
+ </listitem> |
|
45 |
+ |
|
46 |
+ <listitem> |
|
47 |
+ <para>AAACommandCode command_code - command code for the |
|
48 |
+ message</para> |
|
49 |
+ </listitem> |
|
50 |
+ |
|
51 |
+ <listitem> |
|
52 |
+ <para>AAAMsgFlag flags - flags to be set</para> |
|
53 |
+ </listitem> |
|
54 |
+ |
|
55 |
+ <listitem> |
|
56 |
+ <para>AAASession *session - session id to be set</para> |
|
57 |
+ </listitem> |
|
58 |
+ </itemizedlist> |
|
59 |
+ </section> |
|
60 |
+ |
|
61 |
+ <section> |
|
62 |
+ <title><function moreinfo="none">AAACreateResponse(AAAMessage |
|
63 |
+ *request)</function></title> |
|
64 |
+ |
|
65 |
+ <para>Create a Diameter response to a give request</para> |
|
66 |
+ |
|
67 |
+ <para>Meaning of the parameters is as follows:</para> |
|
68 |
+ |
|
69 |
+ <itemizedlist> |
|
70 |
+ <listitem> |
|
71 |
+ <para><emphasis>AAAMessage *request</emphasis> - request that this |
|
72 |
+ response is for</para> |
|
73 |
+ </listitem> |
|
74 |
+ </itemizedlist> |
|
75 |
+ </section> |
|
76 |
+ |
|
77 |
+ <section> |
|
78 |
+ <title><function moreinfo="none">AAAReturnCode AAAFreeMessage(AAAMessage |
|
79 |
+ **msg)</function></title> |
|
80 |
+ |
|
81 |
+ <para>Free up memory used by Diameter message</para> |
|
82 |
+ |
|
83 |
+ <para>Meaning of the parameters is as follows:</para> |
|
84 |
+ |
|
85 |
+ <itemizedlist> |
|
86 |
+ <listitem> |
|
87 |
+ <para><emphasis>AAAMessage **msg</emphasis> - pointer to the pointer |
|
88 |
+ containing the message</para> |
|
89 |
+ </listitem> |
|
90 |
+ </itemizedlist> |
|
91 |
+ </section> |
|
92 |
+ |
|
93 |
+ <section> |
|
94 |
+ <title><function moreinfo="none">AAAReturnCode AAASendMessage(AAAMessage |
|
95 |
+ *message, AAATransactionCallback_f *callback_f, void |
|
96 |
+ *callback_param)</function></title> |
|
97 |
+ |
|
98 |
+ <para>Send Diameter message asynchronously</para> |
|
99 |
+ |
|
100 |
+ <para>Meaning of the parameters is as follows:</para> |
|
101 |
+ |
|
102 |
+ <itemizedlist> |
|
103 |
+ <listitem> |
|
104 |
+ <para><emphasis>AAAMessage *message</emphasis> - request message to |
|
105 |
+ be sent</para> |
|
106 |
+ </listitem> |
|
107 |
+ |
|
108 |
+ <listitem> |
|
109 |
+ <para>AAATransactionCallback_f *callback_f - When the response is |
|
110 |
+ received, the callback_f(callback_param,...) is called</para> |
|
111 |
+ </listitem> |
|
112 |
+ |
|
113 |
+ <listitem> |
|
114 |
+ <para>void *callback_param - generic param for callback</para> |
|
115 |
+ </listitem> |
|
116 |
+ </itemizedlist> |
|
117 |
+ </section> |
|
118 |
+ |
|
119 |
+ <section> |
|
120 |
+ <title><function moreinfo="none">AAAReturnCode |
|
121 |
+ AAASendMessageToPeer(AAAMessage *message, str *peer_id, |
|
122 |
+ AAATransactionCallback_f *callback_f, void |
|
123 |
+ *callback_param)</function></title> |
|
124 |
+ |
|
125 |
+ <para>Send Diameter message to specific peer asynchronously</para> |
|
126 |
+ |
|
127 |
+ <para>Meaning of the parameters is as follows:</para> |
|
128 |
+ |
|
129 |
+ <itemizedlist> |
|
130 |
+ <listitem> |
|
131 |
+ <para>AAAMessage *message - request message to send</para> |
|
132 |
+ </listitem> |
|
133 |
+ |
|
134 |
+ <listitem> |
|
135 |
+ <para>str *peer_id - FQDN of peer to send to</para> |
|
136 |
+ </listitem> |
|
137 |
+ |
|
138 |
+ <listitem> |
|
139 |
+ <para>AAATransactionCallback_f *callback_f - When the response is |
|
140 |
+ received, the callback_f(callback_param,...) is called</para> |
|
141 |
+ </listitem> |
|
142 |
+ |
|
143 |
+ <listitem> |
|
144 |
+ <para>void *callback_param - generic param for callback</para> |
|
145 |
+ </listitem> |
|
146 |
+ </itemizedlist> |
|
147 |
+ </section> |
|
148 |
+ |
|
149 |
+ <section> |
|
150 |
+ <title><function moreinfo="none">AAAMessage* |
|
151 |
+ AAASendRecvMessage(AAAMessage *message)</function></title> |
|
152 |
+ |
|
153 |
+ <para>Send Diameter message synchronously. This blocks until a response |
|
154 |
+ is received or a transactional time-out happens.</para> |
|
155 |
+ |
|
156 |
+ <para>Meaning of the parameters is as follows:</para> |
|
157 |
+ |
|
158 |
+ <itemizedlist> |
|
159 |
+ <listitem> |
|
160 |
+ <para>AAAMessage *message - request message to be sent</para> |
|
161 |
+ </listitem> |
|
162 |
+ </itemizedlist> |
|
163 |
+ </section> |
|
164 |
+ |
|
165 |
+ <section> |
|
166 |
+ <title><function moreinfo="none">AAAMessage* |
|
167 |
+ AAASendRecvMessageToPeer(AAAMessage *message, str |
|
168 |
+ *peer_id)</function></title> |
|
169 |
+ |
|
170 |
+ <para>Send Diameter message to specific peer synchronously. This blocks |
|
171 |
+ until a response is received or a transactional time-out happens.</para> |
|
172 |
+ |
|
173 |
+ <para>Meaning of the parameters is as follows:</para> |
|
174 |
+ |
|
175 |
+ <itemizedlist> |
|
176 |
+ <listitem> |
|
177 |
+ <para><emphasis>AAAMessage *message</emphasis> - request message to |
|
178 |
+ send</para> |
|
179 |
+ </listitem> |
|
180 |
+ |
|
181 |
+ <listitem> |
|
182 |
+ <para>str *peer_id - FQDN of peer to send to.</para> |
|
183 |
+ </listitem> |
|
184 |
+ </itemizedlist> |
|
185 |
+ </section> |
|
186 |
+ |
|
187 |
+ <section> |
|
188 |
+ <title><function moreinfo="none">AAASession* AAACreateSession(void |
|
189 |
+ *generic_data)</function></title> |
|
190 |
+ |
|
191 |
+ <para>Create a generic Diameter session</para> |
|
192 |
+ |
|
193 |
+ <para>Meaning of the parameters is as follows:</para> |
|
194 |
+ |
|
195 |
+ <itemizedlist> |
|
196 |
+ <listitem> |
|
197 |
+ <para>void *generic_data - data to be save to session, useful for |
|
198 |
+ attaching app specific data to the session</para> |
|
199 |
+ </listitem> |
|
200 |
+ </itemizedlist> |
|
201 |
+ </section> |
|
202 |
+ |
|
203 |
+ <section> |
|
204 |
+ <title><function moreinfo="none">AAASession* AAAMakeSession(int |
|
205 |
+ app_id,int type,str session_id)</function></title> |
|
206 |
+ |
|
207 |
+ <para>Create a Diameter session using already known params</para> |
|
208 |
+ |
|
209 |
+ <para>Meaning of the parameters is as follows:</para> |
|
210 |
+ |
|
211 |
+ <itemizedlist> |
|
212 |
+ <listitem> |
|
213 |
+ <para>int app_id - app id to use</para> |
|
214 |
+ </listitem> |
|
215 |
+ |
|
216 |
+ <listitem> |
|
217 |
+ <para>int type - type of session</para> |
|
218 |
+ </listitem> |
|
219 |
+ |
|
220 |
+ <listitem> |
|
221 |
+ <para>str session_id - session ID</para> |
|
222 |
+ </listitem> |
|
223 |
+ </itemizedlist> |
|
224 |
+ </section> |
|
225 |
+ |
|
226 |
+ <section> |
|
227 |
+ <title><function moreinfo="none">AAASession* AAAGetSession(str |
|
228 |
+ id)</function></title> |
|
229 |
+ |
|
230 |
+ <para>Retrieve a Diameter session. Returns with a lock on |
|
231 |
+ AAASession->hash - Unlock when done working with result</para> |
|
232 |
+ |
|
233 |
+ <para>Meaning of the parameters is as follows:</para> |
|
234 |
+ |
|
235 |
+ <itemizedlist> |
|
236 |
+ <listitem> |
|
237 |
+ <para>str id - Diameter session ID to search for</para> |
|
238 |
+ </listitem> |
|
239 |
+ </itemizedlist> |
|
240 |
+ </section> |
|
241 |
+ |
|
242 |
+ <section> |
|
243 |
+ <title><function moreinfo="none">AAADropSession(AAASession |
|
244 |
+ *s)</function></title> |
|
245 |
+ |
|
246 |
+ <para>Drop a Diameter session - deallocating all memory</para> |
|
247 |
+ |
|
248 |
+ <para>Meaning of the parameters is as follows:</para> |
|
249 |
+ |
|
250 |
+ <itemizedlist> |
|
251 |
+ <listitem> |
|
252 |
+ <para>AAASession *s - session to drop</para> |
|
253 |
+ </listitem> |
|
254 |
+ </itemizedlist> |
|
255 |
+ </section> |
|
256 |
+ |
|
257 |
+ <section> |
|
258 |
+ <title><function moreinfo="none">AAASessionLock(unsigned int |
|
259 |
+ hash)</function></title> |
|
260 |
+ |
|
261 |
+ <para>Lock a Diameter session (hash table row)</para> |
|
262 |
+ |
|
263 |
+ <para>Meaning of the parameters is as follows:</para> |
|
264 |
+ |
|
265 |
+ <itemizedlist> |
|
266 |
+ <listitem> |
|
267 |
+ <para><emphasis>unsigned int hash - hash to lock</emphasis></para> |
|
268 |
+ </listitem> |
|
269 |
+ </itemizedlist> |
|
270 |
+ </section> |
|
271 |
+ |
|
272 |
+ <section> |
|
273 |
+ <title><function moreinfo="none">AAASessionUnLock(unsigned int |
|
274 |
+ hash)</function></title> |
|
275 |
+ |
|
276 |
+ <para>Unlock a Diameter session (hash table row)</para> |
|
277 |
+ |
|
278 |
+ <para>Meaning of the parameters is as follows:</para> |
|
279 |
+ |
|
280 |
+ <itemizedlist> |
|
281 |
+ <listitem> |
|
282 |
+ <para>unsigned int hash - hash to unlock</para> |
|
283 |
+ </listitem> |
|
284 |
+ </itemizedlist> |
|
285 |
+ </section> |
|
286 |
+ |
|
287 |
+ <section> |
|
288 |
+ <title><function moreinfo="none">AAASession* |
|
289 |
+ AAACreateClientAuthSession(int is_statefull,AAASessionCallback_f |
|
290 |
+ *cb,void *generic_data)</function></title> |
|
291 |
+ |
|
292 |
+ <para>Creates an Authorisation session for the Client. It generate a new |
|
293 |
+ ID and adds to the list of CDP sessions. Returns with a lock on |
|
294 |
+ AAASession->hash</para> |
|
295 |
+ |
|
296 |
+ <para>Meaning of the parameters is as follows:</para> |
|
297 |
+ |
|
298 |
+ <itemizedlist> |
|
299 |
+ <listitem> |
|
300 |
+ <para><emphasis>int is_statefull - is session stateful or |
|
301 |
+ not</emphasis></para> |
|
302 |
+ </listitem> |
|
303 |
+ |
|
304 |
+ <listitem> |
|
305 |
+ <para>AAASessionCallback_f *cb - callback function on session state |
|
306 |
+ change</para> |
|
307 |
+ </listitem> |
|
308 |
+ |
|
309 |
+ <listitem> |
|
310 |
+ <para>void *generic_data - generic callback data</para> |
|
311 |
+ </listitem> |
|
312 |
+ </itemizedlist> |
|
313 |
+ </section> |
|
314 |
+ |
|
315 |
+ <section> |
|
316 |
+ <title><function moreinfo="none">AAASession* |
|
317 |
+ AAACreateServerAuthSession(AAMessage *msg,int |
|
318 |
+ is_statefull,AAASessionCallback_f *cb,void |
|
319 |
+ *generic_data)</function></title> |
|
320 |
+ |
|
321 |
+ <para>Create authorisation session for the Server. Generates a new ID |
|
322 |
+ and add to CDP list of sessions. Returns with a lock on |
|
323 |
+ AAASession->hash.</para> |
|
324 |
+ |
|
325 |
+ <para>Meaning of the parameters is as follows:</para> |
|
326 |
+ |
|
327 |
+ <itemizedlist> |
|
328 |
+ <listitem> |
|
329 |
+ <para>AAMessage *msg - request message from which to create server |
|
330 |
+ session</para> |
|
331 |
+ </listitem> |
|
332 |
+ |
|
333 |
+ <listitem> |
|
334 |
+ <para>int is_statefull - is session stateful or not</para> |
|
335 |
+ </listitem> |
|
336 |
+ |
|
337 |
+ <listitem> |
|
338 |
+ <para>AAASessionCallback_f *cb - callback function on session state |
|
339 |
+ change</para> |
|
340 |
+ </listitem> |
|
341 |
+ |
|
342 |
+ <listitem> |
|
343 |
+ <para>void *generic_data - generic callback data</para> |
|
344 |
+ </listitem> |
|
345 |
+ </itemizedlist> |
|
346 |
+ </section> |
|
347 |
+ |
|
348 |
+ <section> |
|
349 |
+ <title><function moreinfo="none">AAASession* AAAGetAuthSession(str |
|
350 |
+ id)</function></title> |
|
351 |
+ |
|
352 |
+ <para>Look for an authorisation session. Returns with lock on |
|
353 |
+ AAASession->hash</para> |
|
354 |
+ |
|
355 |
+ <para>Meaning of the parameters is as follows:</para> |
|
356 |
+ |
|
357 |
+ <itemizedlist> |
|
358 |
+ <listitem> |
|
359 |
+ <para>str id - ID of Auth session to search for</para> |
|
360 |
+ </listitem> |
|
361 |
+ </itemizedlist> |
|
362 |
+ </section> |
|
363 |
+ |
|
364 |
+ <section> |
|
365 |
+ <title><function moreinfo="none">AAADropAuthSession(AAASession |
|
366 |
+ *s)</function></title> |
|
367 |
+ |
|
368 |
+ <para>Deallocates the memory taken by a Authorisation session</para> |
|
369 |
+ |
|
370 |
+ <para>Meaning of the parameters is as follows:</para> |
|
371 |
+ |
|
372 |
+ <itemizedlist> |
|
373 |
+ <listitem> |
|
374 |
+ <para><emphasis>AAASession *s</emphasis> - Session to drop and |
|
375 |
+ deallocate memory for</para> |
|
376 |
+ </listitem> |
|
377 |
+ </itemizedlist> |
|
378 |
+ </section> |
|
379 |
+ |
|
380 |
+ <section> |
|
381 |
+ <title><function moreinfo="none">AAATerminateAuthSession(AAASession |
|
382 |
+ *s)</function></title> |
|
383 |
+ |
|
384 |
+ <para>Sends a service terminated event to the session</para> |
|
385 |
+ |
|
386 |
+ <para>Meaning of the parameters is as follows:</para> |
|
387 |
+ |
|
388 |
+ <itemizedlist> |
|
389 |
+ <listitem> |
|
390 |
+ <para><emphasis>AAASession *s</emphasis> - authhorisation session to |
|
391 |
+ terminate</para> |
|
392 |
+ </listitem> |
|
393 |
+ </itemizedlist> |
|
394 |
+ </section> |
|
395 |
+ |
|
396 |
+ <section> |
|
397 |
+ <title><function moreinfo="none">AAATransaction* |
|
398 |
+ AAACreateTransaction(AAAApplicationId app_id,AAACommandCode |
|
399 |
+ cmd_code)</function></title> |
|
400 |
+ |
|
401 |
+ <para>Create a AAATransaction for the given request</para> |
|
402 |
+ |
|
403 |
+ <para>Meaning of the parameters is as follows:</para> |
|
404 |
+ |
|
405 |
+ <itemizedlist> |
|
406 |
+ <listitem> |
|
407 |
+ <para>AAAApplicationId app_id - ID of the request's |
|
408 |
+ application</para> |
|
409 |
+ </listitem> |
|
410 |
+ |
|
411 |
+ <listitem> |
|
412 |
+ <para>AAACommandCode cmd_code - request's code</para> |
|
413 |
+ </listitem> |
|
414 |
+ </itemizedlist> |
|
415 |
+ </section> |
|
416 |
+ |
|
417 |
+ <section> |
|
418 |
+ <title><function moreinfo="none">int AAADropTransaction(AAATransaction |
|
419 |
+ *trans)</function></title> |
|
420 |
+ |
|
421 |
+ <para>Deallocates the memory taken by AAA transaction</para> |
|
422 |
+ |
|
423 |
+ <para>Meaning of the parameters is as follows:</para> |
|
424 |
+ |
|
425 |
+ <itemizedlist> |
|
426 |
+ <listitem> |
|
427 |
+ <para>AAATransaction *trans - transaction to free</para> |
|
428 |
+ </listitem> |
|
429 |
+ </itemizedlist> |
|
430 |
+ </section> |
|
431 |
+ |
|
432 |
+ <section> |
|
433 |
+ <title><function moreinfo="none">AAA_AVP* AAACreateAVP(AAA_AVPCode code, |
|
434 |
+ AAA_AVPFlag flags, AAAVendorId vendorId, char *data, size_t length, |
|
435 |
+ AVPDataStatus data_status)</function></title> |
|
436 |
+ |
|
437 |
+ <para>Create new AVP and return pointer to it</para> |
|
438 |
+ |
|
439 |
+ <para>Meaning of the parameters is as follows:</para> |
|
440 |
+ |
|
441 |
+ <itemizedlist> |
|
442 |
+ <listitem> |
|
443 |
+ <para><emphasis>AAA_AVPCode code</emphasis> - code for new |
|
444 |
+ AVP</para> |
|
445 |
+ </listitem> |
|
446 |
+ |
|
447 |
+ <listitem> |
|
448 |
+ <para>AAA_AVPFlag flags - flags to set</para> |
|
449 |
+ </listitem> |
|
450 |
+ |
|
451 |
+ <listitem> |
|
452 |
+ <para>AAAVendorId vendorId - vendor ID for AVP</para> |
|
453 |
+ </listitem> |
|
454 |
+ |
|
455 |
+ <listitem> |
|
456 |
+ <para>char *data - generic payload data</para> |
|
457 |
+ </listitem> |
|
458 |
+ |
|
459 |
+ <listitem> |
|
460 |
+ <para>size_t length - length of payload data</para> |
|
461 |
+ </listitem> |
|
462 |
+ |
|
463 |
+ <listitem> |
|
464 |
+ <para>AVPDataStatus data_status - what to do with the payload, |
|
465 |
+ duplicate, free with message, etc</para> |
|
466 |
+ </listitem> |
|
467 |
+ </itemizedlist> |
|
468 |
+ </section> |
|
469 |
+ |
|
470 |
+ <section> |
|
471 |
+ <title><function moreinfo="none">AAAReturnCode |
|
472 |
+ AAAAddAVPToMessage(AAAMessage *msg, AAA_AVP *avp, AAA_AVP |
|
473 |
+ *position)</function></title> |
|
474 |
+ |
|
475 |
+ <para>Find and load the CDiameterPeer function bindings</para> |
|
476 |
+ |
|
477 |
+ <para>Meaning of the parameters is as follows:</para> |
|
478 |
+ |
|
479 |
+ <itemizedlist> |
|
480 |
+ <listitem> |
|
481 |
+ <para><emphasis>AAAMessage *msg</emphasis> - the message to add |
|
482 |
+ to</para> |
|
483 |
+ </listitem> |
|
484 |
+ |
|
485 |
+ <listitem> |
|
486 |
+ <para>AAA_AVP *avp - the AVP to add</para> |
|
487 |
+ </listitem> |
|
488 |
+ |
|
489 |
+ <listitem> |
|
490 |
+ <para>AAA_AVP *position - AVP to add after. if NULL, we add at |
|
491 |
+ beginning</para> |
|
492 |
+ </listitem> |
|
493 |
+ </itemizedlist> |
|
494 |
+ </section> |
|
495 |
+ |
|
496 |
+ <section> |
|
497 |
+ <title><function moreinfo="none">AAA_AVP* AAAFindMatchingAVP(AAAMessage |
|
498 |
+ *msg, AAA_AVP *startAvp, AAA_AVPCode avpCode, AAAVendorId vendorId, |
|
499 |
+ AAASearchType searchType)</function></title> |
|
500 |
+ |
|
501 |
+ <para>Find and load the CDiameterPeer function bindings</para> |
|
502 |
+ |
|
503 |
+ <para>Meaning of the parameters is as follows:</para> |
|
504 |
+ |
|
505 |
+ <itemizedlist> |
|
506 |
+ <listitem> |
|
507 |
+ <para>AAAMessage *msg - the message to search in</para> |
|
508 |
+ </listitem> |
|
509 |
+ |
|
510 |
+ <listitem> |
|
511 |
+ <para>AAA_AVP *startAvp - at which AVP to start the search. usefull |
|
512 |
+ for looking for more of the same name</para> |
|
513 |
+ </listitem> |
|
514 |
+ |
|
515 |
+ <listitem> |
|
516 |
+ <para>AAA_AVPCode avpCode - AVP code to match</para> |
|
517 |
+ </listitem> |
|
518 |
+ |
|
519 |
+ <listitem> |
|
520 |
+ <para>AAAVendorId vendorId - AVP vendor ID to match</para> |
|
521 |
+ </listitem> |
|
522 |
+ |
|
523 |
+ <listitem> |
|
524 |
+ <para>AAASearchType searchType - look forward or backward</para> |
|
525 |
+ </listitem> |
|
526 |
+ </itemizedlist> |
|
527 |
+ </section> |
|
528 |
+ |
|
529 |
+ <section> |
|
530 |
+ <title><function moreinfo="none">AAA_AVP * AAAGetNextAVP(AAA_AVP |
|
531 |
+ *avp)</function></title> |
|
532 |
+ |
|
533 |
+ <para>Find and load the CDiameterPeer function bindings</para> |
|
534 |
+ |
|
535 |
+ <para>Meaning of the parameters is as follows:</para> |
|
536 |
+ |
|
537 |
+ <itemizedlist> |
|
538 |
+ <listitem> |
|
539 |
+ <para>AAA_AVP *avp - reference AVP</para> |
|
540 |
+ </listitem> |
|
541 |
+ </itemizedlist> |
|
542 |
+ </section> |
|
543 |
+ |
|
544 |
+ <section> |
|
545 |
+ <title><function moreinfo="none">AAAReturnCode AAAFreeAVP(AAA_AVP |
|
546 |
+ **avp)</function></title> |
|
547 |
+ |
|
548 |
+ <para>Find and load the CDiameterPeer function bindings</para> |
|
549 |
+ |
|
550 |
+ <para>Meaning of the parameters is as follows:</para> |
|
551 |
+ |
|
552 |
+ <itemizedlist> |
|
553 |
+ <listitem> |
|
554 |
+ <para>AAA_AVP **avp - pointer memory to be freed</para> |
|
555 |
+ </listitem> |
|
556 |
+ </itemizedlist> |
|
557 |
+ </section> |
|
558 |
+ |
|
559 |
+ <section> |
|
560 |
+ <title><function moreinfo="none">str AAAGroupAVPS(AAA_AVP_LIST |
|
561 |
+ avps)</function></title> |
|
562 |
+ |
|
563 |
+ <para>Groups a list of AVPS into a data buffer</para> |
|
564 |
+ |
|
565 |
+ <para>Meaning of the parameters is as follows:</para> |
|
566 |
+ |
|
567 |
+ <itemizedlist> |
|
568 |
+ <listitem> |
|
569 |
+ <para>AAA_AVP_LIST avps - list of AVPS to group</para> |
|
570 |
+ </listitem> |
|
571 |
+ </itemizedlist> |
|
572 |
+ </section> |
|
573 |
+ |
|
574 |
+ <section> |
|
575 |
+ <title><function moreinfo="none">AAA_AVP_LIST AAAUnGroupAVPS(str |
|
576 |
+ buf)</function></title> |
|
577 |
+ |
|
578 |
+ <para>Ungroup a data buffer into a list of AVPs</para> |
|
579 |
+ |
|
580 |
+ <para>Meaning of the parameters is as follows:</para> |
|
581 |
+ |
|
582 |
+ <itemizedlist> |
|
583 |
+ <listitem> |
|
584 |
+ <para>str buf - payload to ungroup list from</para> |
|
585 |
+ </listitem> |
|
586 |
+ </itemizedlist> |
|
587 |
+ </section> |
|
588 |
+ |
|
589 |
+ <section> |
|
590 |
+ <title><function moreinfo="none">AAA_AVP* |
|
591 |
+ AAAFindMatchingAVPList(AAA_AVP_LIST avpList, AAA_AVP *startAvp, |
|
592 |
+ AAA_AVPCode avpCode, AAAVendorId vendorId, AAASearchType |
|
593 |
+ searchType)</function></title> |
|
594 |
+ |
|
595 |
+ <para>Find an AVP in an AVP list</para> |
|
596 |
+ |
|
597 |
+ <para>Meaning of the parameters is as follows:</para> |
|
598 |
+ |
|
599 |
+ <itemizedlist> |
|
600 |
+ <listitem> |
|
601 |
+ <para>AAA_AVP_LIST avpList - AVP list to search</para> |
|
602 |
+ </listitem> |
|