Browse code

core, lib, modules: updated include paths for header files

Daniel-Constantin Mierla authored on 07/12/2016 11:07:22
Showing 1 changed files
... ...
@@ -43,8 +43,8 @@
43 43
  * 
44 44
  */
45 45
 
46
-#include "../../ip_addr.h"
47
-#include "../../dprint.h"
46
+#include "../../core/ip_addr.h"
47
+#include "../../core/dprint.h"
48 48
 
49 49
 #include "ul_rpc.h"
50 50
 #include "dlist.h"
Browse code

core, lib, modules: restructured source code tree

- 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)

Daniel-Constantin Mierla authored on 07/12/2016 11:03:51
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,172 @@
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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
43
+ * 
44
+ */
45
+
46
+#include "../../ip_addr.h"
47
+#include "../../dprint.h"
48
+
49
+#include "ul_rpc.h"
50
+#include "dlist.h"
51
+#include "udomain.h"
52
+
53
+static const char* ul_rpc_dump_doc[2] = {
54
+	"Dump PCSCF contacts and associated identitites",
55
+	0
56
+};
57
+
58
+static void ul_rpc_dump(rpc_t* rpc, void* ctx) {
59
+	dlist_t* dl;
60
+	udomain_t* dom;
61
+//	time_t t;
62
+	void* th;
63
+	void* ah;
64
+	void* sh;
65
+	int max, n, i;
66
+
67
+//	t = time(0);
68
+	for (dl = root; dl; dl = dl->next) {
69
+		dom = dl->d;
70
+		if (rpc->add(ctx, "{", &th) < 0) {
71
+			rpc->fault(ctx, 500, "Internal error creating top rpc");
72
+			return;
73
+		}
74
+		if (rpc->struct_add(th, "Sd{", "Domain", &dl->name, "Size",
75
+				(int) dom->size, "AoRs", &ah) < 0) {
76
+			rpc->fault(ctx, 500, "Internal error creating inner struct");
77
+			return;
78
+		}
79
+
80
+		for (i = 0, n = 0, max = 0; i < dom->size; i++) {
81
+//			lock_ulslot(dom, i);
82
+			n += dom->table[i].n;
83
+			if (max < dom->table[i].n)
84
+				max = dom->table[i].n;
85
+//			for (c = dom->table[i].first; c; c = c->next) {
86
+//				if (rpc->struct_add(ah, "S", "AoR", &c->aor) < 0) {
87
+//					unlock_ulslot(dom, i);
88
+//					rpc->fault(ctx, 500, "Internal error creating aor struct");
89
+//					return;
90
+//				}
91
+//				if (rpc->struct_add(ah, "s", "State", reg_state_to_string(c->reg_state)) < 0) {
92
+//					unlock_ulslot(dom, i);
93
+//					rpc->fault(ctx, 500, "Internal error creating reg state struct");
94
+//					return;
95
+//				}
96
+//				if (c->expires == 0) {
97
+//					if (rpc->struct_add(ah, "s", "Expires", "permanent") < 0) {
98
+//						unlock_ulslot(dom, i);
99
+//						rpc->fault(ctx, 500, "Internal error adding expire");
100
+//						return;
101
+//					}
102
+//				} else if (c->expires == -1/*UL_EXPIRED_TIME*/) {
103
+//					if (rpc->struct_add(ah, "s", "Expires", "deleted") < 0) {
104
+//						unlock_ulslot(dom, i);
105
+//						rpc->fault(ctx, 500, "Internal error adding expire");
106
+//						return;
107
+//					}
108
+//				} else if (t > c->expires) {
109
+//					if (rpc->struct_add(ah, "s", "Expires", "expired") < 0) {
110
+//						unlock_ulslot(dom, i);
111
+//						rpc->fault(ctx, 500, "Internal error adding expire");
112
+//						return;
113
+//					}
114
+//				} else {
115
+//					if (rpc->struct_add(ah, "d", "Expires", (int) (c->expires - t)) < 0) {
116
+//						unlock_ulslot(dom, i);
117
+//						rpc->fault(ctx, 500, "Internal error adding expire");
118
+//						return;
119
+//					}
120
+//				}
121
+//
122
+//				if (rpc->struct_add(ah, "S", "Path", &c->path) < 0) {
123
+//					unlock_ulslot(dom, i);
124
+//					rpc->fault(ctx, 500, "Internal error creating path struct");
125
+//					return;
126
+//				}
127
+//
128
+//				if (rpc->struct_add(ah, "{", "Service Routes", &sr) < 0) {
129
+//					unlock_ulslot(dom, i);
130
+//					rpc->fault(ctx, 500, "Internal error creating Service Routes");
131
+//					return;
132
+//				}
133
+//
134
+//				for (j = 0; j < c->num_service_routes; j++) {
135
+//					if (rpc->struct_add(sr, "S", "Route", &c->service_routes[j]) < 0) {
136
+//						unlock_ulslot(dom, i);
137
+//						rpc->fault(ctx, 500, "Internal error creating Service Route struct");
138
+//						return;
139
+//					}
140
+//				}
141
+//
142
+//				if (rpc->struct_add(ah, "{", "Public Identities", &ih) < 0) {
143
+//					unlock_ulslot(dom, i);
144
+//					rpc->fault(ctx, 500, "Internal error creating IMPU struct");
145
+//					return;
146
+//				}
147
+//
148
+//				for (p = c->head; p; p = p->next) {
149
+//					if (rpc->struct_add(ih, "S", "IMPU", &p->public_identity) < 0) {
150
+//						unlock_ulslot(dom, i);
151
+//						rpc->fault(ctx, 500, "Internal error creating IMPU struct");
152
+//						return;
153
+//					}
154
+//				}
155
+//			}
156
+//			unlock_ulslot(dom, i);
157
+		}
158
+		if (rpc->struct_add(ah, "{", "Stats", &sh) > 0) {
159
+			rpc->fault(ctx, 500, "Internal error creating stats");
160
+		}
161
+		if (rpc->struct_add(sh, "dd", "Records", n, "Max-Slots", max) < 0) {
162
+			rpc->fault(ctx, 500, "Internal error creating stats struct");
163
+		}
164
+	}
165
+}
166
+
167
+rpc_export_t ul_rpc[] = {
168
+	{"ulpcscf.status",   ul_rpc_dump,   ul_rpc_dump_doc,   0},
169
+	{0, 0, 0, 0}
170
+};
171
+
172
+