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
... ...
@@ -23,7 +23,7 @@
23 23
 #ifndef PUA_CBACK
24 24
 #define PUA_CBACK
25 25
 
26
-#include "../../parser/parse_fline.h"
26
+#include "../../core/parser/parse_fline.h"
27 27
 #include "../pua/hash.h"
28 28
 
29 29
 #define PUACB_MAX    		(1<<9)
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,76 @@
1
+/*
2
+ * pua module - presence user agent module
3
+ *
4
+ * Copyright (C) 2007 Voice Sistem S.R.L.
5
+ *
6
+ * This file is part of Kamailio, a free SIP server.
7
+ *
8
+ * Kamailio is free software; you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation; either version 2 of the License, or
11
+ * (at your option) any later version
12
+ *
13
+ * Kamailio is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License 
19
+ * along with this program; if not, write to the Free Software 
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ */
22
+
23
+#ifndef PUA_CBACK
24
+#define PUA_CBACK
25
+
26
+#include "../../parser/parse_fline.h"
27
+#include "../pua/hash.h"
28
+
29
+#define PUACB_MAX    		(1<<9)
30
+
31
+/* callback function prototype */
32
+typedef int (pua_cb)(ua_pres_t* hentity, struct sip_msg*);
33
+/* register callback function prototype */
34
+typedef int (*register_puacb_t)(int types, pua_cb f, void* param );
35
+
36
+
37
+struct pua_callback {
38
+	int id;                      /* id of this callback - useless */
39
+	int types;                   /* types of events that trigger the callback*/
40
+	pua_cb* callback;             /* callback function */
41
+	void* param;
42
+	struct pua_callback* next;
43
+};
44
+
45
+struct puacb_head_list {
46
+	struct pua_callback *first;
47
+	int reg_types;
48
+};
49
+
50
+
51
+extern struct puacb_head_list*  puacb_list;
52
+
53
+int init_puacb_list(void);
54
+
55
+void destroy_puacb_list(void);
56
+
57
+
58
+/* register a callback for several types of events */
59
+int register_puacb( int types, pua_cb f, void* param );
60
+
61
+/* run all transaction callbacks for an event type */
62
+static inline void run_pua_callbacks(ua_pres_t* hentity, struct sip_msg* msg)
63
+{
64
+	struct pua_callback *cbp;
65
+
66
+	for (cbp= puacb_list->first; cbp; cbp=cbp->next)  {
67
+		if(cbp->types & hentity->flag) 
68
+		{	
69
+			LM_DBG("found callback\n");
70
+			cbp->callback(hentity, msg);
71
+		}
72
+	}
73
+}
74
+
75
+/* Q: should I call the registered callback functions when the modules refreshes a request? */
76
+#endif