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
deleted file mode 100644
... ...
@@ -1,76 +0,0 @@
1
-/**
2
- *
3
- * Copyright (C) 2009 SIP-Router.org
4
- *
5
- * This file is part of Kamailio, a free SIP server.
6
- *
7
- * Permission to use, copy, modify, and distribute this software for any
8
- * purpose with or without fee is hereby granted, provided that the above
9
- * copyright notice and this permission notice appear in all copies.
10
- *
11
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
- */
19
-
20
-#ifndef _SR_EVENTS_H_
21
-#define _SR_EVENTS_H_
22
-
23
-#include "parser/msg_parser.h"
24
-
25
-#define SREV_NET_DATA_IN		1
26
-#define SREV_NET_DATA_OUT		2
27
-#define SREV_CORE_STATS			3
28
-#define SREV_CFG_RUN_ACTION		4
29
-#define SREV_PKG_UPDATE_STATS	5
30
-#define SREV_RCV_NOSIP			6
31
-#define SREV_NET_DGRAM_IN		7
32
-#define SREV_TCP_HTTP_100C		8
33
-#define SREV_TCP_MSRP_FRAME		9
34
-#define SREV_TCP_WS_FRAME_IN		10
35
-#define SREV_TCP_WS_FRAME_OUT		11
36
-#define SREV_STUN_IN			12
37
-#define SREV_TCP_CLOSED			13
38
-#define SREV_NET_DATA_RECV		14
39
-#define SREV_NET_DATA_SEND		15
40
-
41
-#define SREV_CB_LIST_SIZE	3
42
-
43
-typedef int (*sr_event_cb_f)(void *data);
44
-
45
-typedef struct sr_event_cb {
46
-	sr_event_cb_f net_data_in[SREV_CB_LIST_SIZE];
47
-	sr_event_cb_f net_data_out[SREV_CB_LIST_SIZE];
48
-	sr_event_cb_f core_stats;
49
-	sr_event_cb_f run_action;
50
-	sr_event_cb_f pkg_update_stats;
51
-	sr_event_cb_f net_dgram_in;
52
-	sr_event_cb_f tcp_http_100c;
53
-	sr_event_cb_f tcp_msrp_frame;
54
-	sr_event_cb_f tcp_ws_frame_in;
55
-	sr_event_cb_f tcp_ws_frame_out;
56
-	sr_event_cb_f stun_in;
57
-	sr_event_cb_f rcv_nosip;
58
-	sr_event_cb_f tcp_closed;
59
-	sr_event_cb_f net_data_recv;
60
-	sr_event_cb_f net_data_send;
61
-} sr_event_cb_t;
62
-
63
-void sr_event_cb_init(void);
64
-int sr_event_register_cb(int type, sr_event_cb_f f);
65
-int sr_event_exec(int type, void *data);
66
-int sr_event_enabled(int type);
67
-
68
-
69
-/* shortcut types for core event routes */
70
-/* initial parsing error in message receive function */
71
-#define SR_CORE_ERT_RECEIVE_PARSE_ERROR		1
72
-
73
-void sr_core_ert_init(void);
74
-void sr_core_ert_run(sip_msg_t *msg, int e);
75
-
76
-#endif
Browse code

core: new event SREV_NET_DATA_RECV

- to be executed if a sip message has been received

Daniel-Constantin Mierla authored on 11/01/2016 21:21:37
Showing 1 changed files
... ...
@@ -35,7 +35,8 @@
35 35
 #define SREV_TCP_WS_FRAME_OUT		11
36 36
 #define SREV_STUN_IN			12
37 37
 #define SREV_TCP_CLOSED			13
38
-#define SREV_NET_DATA_SEND		14
38
+#define SREV_NET_DATA_RECV		14
39
+#define SREV_NET_DATA_SEND		15
39 40
 
40 41
 #define SREV_CB_LIST_SIZE	3
41 42
 
... ...
@@ -55,6 +56,7 @@ typedef struct sr_event_cb {
55 56
 	sr_event_cb_f stun_in;
56 57
 	sr_event_cb_f rcv_nosip;
57 58
 	sr_event_cb_f tcp_closed;
59
+	sr_event_cb_f net_data_recv;
58 60
 	sr_event_cb_f net_data_send;
59 61
 } sr_event_cb_t;
60 62
 
Browse code

core: new event SREV_NET_DATA_SEND

- to be executed if message was sent to the network

Daniel-Constantin Mierla authored on 11/01/2016 11:39:59
Showing 1 changed files
... ...
@@ -35,6 +35,7 @@
35 35
 #define SREV_TCP_WS_FRAME_OUT		11
36 36
 #define SREV_STUN_IN			12
37 37
 #define SREV_TCP_CLOSED			13
38
+#define SREV_NET_DATA_SEND		14
38 39
 
39 40
 #define SREV_CB_LIST_SIZE	3
40 41
 
... ...
@@ -54,6 +55,7 @@ typedef struct sr_event_cb {
54 55
 	sr_event_cb_f stun_in;
55 56
 	sr_event_cb_f rcv_nosip;
56 57
 	sr_event_cb_f tcp_closed;
58
+	sr_event_cb_f net_data_send;
57 59
 } sr_event_cb_t;
58 60
 
59 61
 void sr_event_cb_init(void);
Browse code

core: added event callback field for tcp closed connection

Armen Babikyan authored on 04/01/2016 22:04:37 • Daniel-Constantin Mierla committed on 04/01/2016 22:04:37
Showing 1 changed files
... ...
@@ -34,6 +34,7 @@
34 34
 #define SREV_TCP_WS_FRAME_IN		10
35 35
 #define SREV_TCP_WS_FRAME_OUT		11
36 36
 #define SREV_STUN_IN			12
37
+#define SREV_TCP_CLOSED			13
37 38
 
38 39
 #define SREV_CB_LIST_SIZE	3
39 40
 
... ...
@@ -52,6 +53,7 @@ typedef struct sr_event_cb {
52 53
 	sr_event_cb_f tcp_ws_frame_out;
53 54
 	sr_event_cb_f stun_in;
54 55
 	sr_event_cb_f rcv_nosip;
56
+	sr_event_cb_f tcp_closed;
55 57
 } sr_event_cb_t;
56 58
 
57 59
 void sr_event_cb_init(void);
Browse code

kex: removed unused callbacks

Removed the two SREV_MODULE_PKG_STATS and SREV_MODULE_SHM_STATS callbacks
that were never used.

Stefan Mititelu authored on 02/11/2015 15:30:30
Showing 1 changed files
... ...
@@ -34,8 +34,6 @@
34 34
 #define SREV_TCP_WS_FRAME_IN		10
35 35
 #define SREV_TCP_WS_FRAME_OUT		11
36 36
 #define SREV_STUN_IN			12
37
-#define SREV_MODULE_PKG_STATS   13
38
-#define SREV_MODULE_SHM_STATS   14
39 37
 
40 38
 #define SREV_CB_LIST_SIZE	3
41 39
 
... ...
@@ -54,8 +52,6 @@ typedef struct sr_event_cb {
54 52
 	sr_event_cb_f tcp_ws_frame_out;
55 53
 	sr_event_cb_f stun_in;
56 54
 	sr_event_cb_f rcv_nosip;
57
-	sr_event_cb_f mod_update_pkg_stats;
58
-	sr_event_cb_f mod_update_shm_stats;
59 55
 } sr_event_cb_t;
60 56
 
61 57
 void sr_event_cb_init(void);
Browse code

core: added events for per module pkg/shm summary

- used by kex for per module memory stats

Stefan Mititelu authored on 02/11/2015 12:38:40 • Daniel-Constantin Mierla committed on 02/11/2015 12:38:40
Showing 1 changed files
... ...
@@ -34,6 +34,8 @@
34 34
 #define SREV_TCP_WS_FRAME_IN		10
35 35
 #define SREV_TCP_WS_FRAME_OUT		11
36 36
 #define SREV_STUN_IN			12
37
+#define SREV_MODULE_PKG_STATS   13
38
+#define SREV_MODULE_SHM_STATS   14
37 39
 
38 40
 #define SREV_CB_LIST_SIZE	3
39 41
 
... ...
@@ -52,6 +54,8 @@ typedef struct sr_event_cb {
52 54
 	sr_event_cb_f tcp_ws_frame_out;
53 55
 	sr_event_cb_f stun_in;
54 56
 	sr_event_cb_f rcv_nosip;
57
+	sr_event_cb_f mod_update_pkg_stats;
58
+	sr_event_cb_f mod_update_shm_stats;
55 59
 } sr_event_cb_t;
56 60
 
57 61
 void sr_event_cb_init(void);
Browse code

core : Update include files - delete IDs, update doxygen, delete history

Olle E. Johansson authored on 03/01/2015 10:55:48
Showing 1 changed files
... ...
@@ -1,9 +1,8 @@
1 1
 /**
2
- * $Id$
3 2
  *
4 3
  * Copyright (C) 2009 SIP-Router.org
5 4
  *
6
- * This file is part of Extensible SIP Router, a free SIP server.
5
+ * This file is part of Kamailio, a free SIP server.
7 6
  *
8 7
  * Permission to use, copy, modify, and distribute this software for any
9 8
  * purpose with or without fee is hereby granted, provided that the above
Browse code

core: allow up to three callback functions for net_data_in and net_data_out

- they are added normal for net_data_in and reverse for net_data_out,
allowing nested execution (e.g., first module registering the two
callbacks with have the first net_data_in and the last net_data_out)
- allow topoh module can be used with other functionalities needed the same
callbacks

Daniel-Constantin Mierla authored on 05/09/2014 14:11:51
Showing 1 changed files
... ...
@@ -36,12 +36,13 @@
36 36
 #define SREV_TCP_WS_FRAME_OUT		11
37 37
 #define SREV_STUN_IN			12
38 38
 
39
+#define SREV_CB_LIST_SIZE	3
39 40
 
40 41
 typedef int (*sr_event_cb_f)(void *data);
41 42
 
42 43
 typedef struct sr_event_cb {
43
-	sr_event_cb_f net_data_in;
44
-	sr_event_cb_f net_data_out;
44
+	sr_event_cb_f net_data_in[SREV_CB_LIST_SIZE];
45
+	sr_event_cb_f net_data_out[SREV_CB_LIST_SIZE];
45 46
 	sr_event_cb_f core_stats;
46 47
 	sr_event_cb_f run_action;
47 48
 	sr_event_cb_f pkg_update_stats;
Browse code

core: new core event executed when a non sip packet is received

- event type SREV_RCV_NOSIP

Daniel-Constantin Mierla authored on 18/07/2014 14:01:29
Showing 1 changed files
... ...
@@ -28,7 +28,7 @@
28 28
 #define SREV_CORE_STATS			3
29 29
 #define SREV_CFG_RUN_ACTION		4
30 30
 #define SREV_PKG_UPDATE_STATS	5
31
-/*		6 - not used anymore */
31
+#define SREV_RCV_NOSIP			6
32 32
 #define SREV_NET_DGRAM_IN		7
33 33
 #define SREV_TCP_HTTP_100C		8
34 34
 #define SREV_TCP_MSRP_FRAME		9
... ...
@@ -51,6 +51,7 @@ typedef struct sr_event_cb {
51 51
 	sr_event_cb_f tcp_ws_frame_in;
52 52
 	sr_event_cb_f tcp_ws_frame_out;
53 53
 	sr_event_cb_f stun_in;
54
+	sr_event_cb_f rcv_nosip;
54 55
 } sr_event_cb_t;
55 56
 
56 57
 void sr_event_cb_init(void);
Browse code

core: repaced the two pkg update event callbacks with one

- simplified usage as can be executed at the end of memory operations
(malloc, free, realloc)

Daniel-Constantin Mierla authored on 03/05/2014 18:02:47
Showing 1 changed files
... ...
@@ -27,8 +27,8 @@
27 27
 #define SREV_NET_DATA_OUT		2
28 28
 #define SREV_CORE_STATS			3
29 29
 #define SREV_CFG_RUN_ACTION		4
30
-#define SREV_PKG_SET_USED		5
31
-#define SREV_PKG_SET_REAL_USED		6
30
+#define SREV_PKG_UPDATE_STATS	5
31
+/*		6 - not used anymore */
32 32
 #define SREV_NET_DGRAM_IN		7
33 33
 #define SREV_TCP_HTTP_100C		8
34 34
 #define SREV_TCP_MSRP_FRAME		9
... ...
@@ -44,8 +44,7 @@ typedef struct sr_event_cb {
44 44
 	sr_event_cb_f net_data_out;
45 45
 	sr_event_cb_f core_stats;
46 46
 	sr_event_cb_f run_action;
47
-	sr_event_cb_f pkg_set_used;
48
-	sr_event_cb_f pkg_set_real_used;
47
+	sr_event_cb_f pkg_update_stats;
49 48
 	sr_event_cb_f net_dgram_in;
50 49
 	sr_event_cb_f tcp_http_100c;
51 50
 	sr_event_cb_f tcp_msrp_frame;
Browse code

core: execute event_route[core:receive-parse-error] block on error of initial sip message parsing

- note that the SIP message is broken in this case, but it gets access
to source and local socket addresses (ip, port, proto, af) as well as
the whole message buffer and its size

Daniel-Constantin Mierla authored on 22/08/2013 11:01:55
Showing 1 changed files
... ...
@@ -59,4 +59,12 @@ int sr_event_register_cb(int type, sr_event_cb_f f);
59 59
 int sr_event_exec(int type, void *data);
60 60
 int sr_event_enabled(int type);
61 61
 
62
+
63
+/* shortcut types for core event routes */
64
+/* initial parsing error in message receive function */
65
+#define SR_CORE_ERT_RECEIVE_PARSE_ERROR		1
66
+
67
+void sr_core_ert_init(void);
68
+void sr_core_ert_run(sip_msg_t *msg, int e);
69
+
62 70
 #endif
Browse code

core: removed STUN from core

- Added hooks so that STUN messages can be passed to a module
- Removed STUN configuration file parameters

Peter Dunkley authored on 29/03/2013 21:47:57
Showing 1 changed files
... ...
@@ -28,12 +28,13 @@
28 28
 #define SREV_CORE_STATS			3
29 29
 #define SREV_CFG_RUN_ACTION		4
30 30
 #define SREV_PKG_SET_USED		5
31
-#define SREV_PKG_SET_REAL_USED	6
31
+#define SREV_PKG_SET_REAL_USED		6
32 32
 #define SREV_NET_DGRAM_IN		7
33 33
 #define SREV_TCP_HTTP_100C		8
34 34
 #define SREV_TCP_MSRP_FRAME		9
35 35
 #define SREV_TCP_WS_FRAME_IN		10
36 36
 #define SREV_TCP_WS_FRAME_OUT		11
37
+#define SREV_STUN_IN			12
37 38
 
38 39
 
39 40
 typedef int (*sr_event_cb_f)(void *data);
... ...
@@ -50,6 +51,7 @@ typedef struct sr_event_cb {
50 51
 	sr_event_cb_f tcp_msrp_frame;
51 52
 	sr_event_cb_f tcp_ws_frame_in;
52 53
 	sr_event_cb_f tcp_ws_frame_out;
54
+	sr_event_cb_f stun_in;
53 55
 } sr_event_cb_t;
54 56
 
55 57
 void sr_event_cb_init(void);
Browse code

core: added events and data-structures so that Kamailio core can transmit through the WebSocket module

Peter Dunkley authored on 23/06/2012 18:10:03
Showing 1 changed files
... ...
@@ -32,7 +32,8 @@
32 32
 #define SREV_NET_DGRAM_IN		7
33 33
 #define SREV_TCP_HTTP_100C		8
34 34
 #define SREV_TCP_MSRP_FRAME		9
35
-#define SREV_TCP_WS_FRAME		10
35
+#define SREV_TCP_WS_FRAME_IN		10
36
+#define SREV_TCP_WS_FRAME_OUT		11
36 37
 
37 38
 
38 39
 typedef int (*sr_event_cb_f)(void *data);
... ...
@@ -47,7 +48,8 @@ typedef struct sr_event_cb {
47 48
 	sr_event_cb_f net_dgram_in;
48 49
 	sr_event_cb_f tcp_http_100c;
49 50
 	sr_event_cb_f tcp_msrp_frame;
50
-	sr_event_cb_f tcp_ws_frame;
51
+	sr_event_cb_f tcp_ws_frame_in;
52
+	sr_event_cb_f tcp_ws_frame_out;
51 53
 } sr_event_cb_t;
52 54
 
53 55
 void sr_event_cb_init(void);
Browse code

core: Added WS support/events to Kamailio core

Peter Dunkley authored on 16/06/2012 16:06:33
Showing 1 changed files
... ...
@@ -32,6 +32,7 @@
32 32
 #define SREV_NET_DGRAM_IN		7
33 33
 #define SREV_TCP_HTTP_100C		8
34 34
 #define SREV_TCP_MSRP_FRAME		9
35
+#define SREV_TCP_WS_FRAME		10
35 36
 
36 37
 
37 38
 typedef int (*sr_event_cb_f)(void *data);
... ...
@@ -46,6 +47,7 @@ typedef struct sr_event_cb {
46 47
 	sr_event_cb_f net_dgram_in;
47 48
 	sr_event_cb_f tcp_http_100c;
48 49
 	sr_event_cb_f tcp_msrp_frame;
50
+	sr_event_cb_f tcp_ws_frame;
49 51
 } sr_event_cb_t;
50 52
 
51 53
 void sr_event_cb_init(void);
Browse code

core: two more events for handling http and msrp

- one to be called for http/1.1 end of headers for checking on '100
Continue' request
- one to be called when a msrp message is received

Daniel-Constantin Mierla authored on 13/01/2012 11:46:20
Showing 1 changed files
... ...
@@ -30,6 +30,9 @@
30 30
 #define SREV_PKG_SET_USED		5
31 31
 #define SREV_PKG_SET_REAL_USED	6
32 32
 #define SREV_NET_DGRAM_IN		7
33
+#define SREV_TCP_HTTP_100C		8
34
+#define SREV_TCP_MSRP_FRAME		9
35
+
33 36
 
34 37
 typedef int (*sr_event_cb_f)(void *data);
35 38
 
... ...
@@ -41,6 +44,8 @@ typedef struct sr_event_cb {
41 44
 	sr_event_cb_f pkg_set_used;
42 45
 	sr_event_cb_f pkg_set_real_used;
43 46
 	sr_event_cb_f net_dgram_in;
47
+	sr_event_cb_f tcp_http_100c;
48
+	sr_event_cb_f tcp_msrp_frame;
44 49
 } sr_event_cb_t;
45 50
 
46 51
 void sr_event_cb_init(void);
Browse code

core: new core event for received datagrams

- event type defined as SREV_NET_DGRAM_IN
- allow modules to get a callback when a udp datagram is received
- offers the possibility to handle different content sent via datagram,
such as HEP from Homer project, without invading the core with new
code

Daniel-Constantin Mierla authored on 14/08/2011 20:59:53
Showing 1 changed files
... ...
@@ -29,6 +29,7 @@
29 29
 #define SREV_CFG_RUN_ACTION		4
30 30
 #define SREV_PKG_SET_USED		5
31 31
 #define SREV_PKG_SET_REAL_USED	6
32
+#define SREV_NET_DGRAM_IN		7
32 33
 
33 34
 typedef int (*sr_event_cb_f)(void *data);
34 35
 
... ...
@@ -39,6 +40,7 @@ typedef struct sr_event_cb {
39 40
 	sr_event_cb_f run_action;
40 41
 	sr_event_cb_f pkg_set_used;
41 42
 	sr_event_cb_f pkg_set_real_used;
43
+	sr_event_cb_f net_dgram_in;
42 44
 } sr_event_cb_t;
43 45
 
44 46
 void sr_event_cb_init(void);
Browse code

core: added core events for pkg operations

- ability to track pkg used and real_used metrics

Daniel-Constantin Mierla authored on 20/12/2010 08:39:40
Showing 1 changed files
... ...
@@ -23,10 +23,12 @@
23 23
 
24 24
 #include "parser/msg_parser.h"
25 25
 
26
-#define SREV_NET_DATA_IN	1
27
-#define SREV_NET_DATA_OUT	2
28
-#define SREV_CORE_STATS		3
29
-#define SREV_CFG_RUN_ACTION 4
26
+#define SREV_NET_DATA_IN		1
27
+#define SREV_NET_DATA_OUT		2
28
+#define SREV_CORE_STATS			3
29
+#define SREV_CFG_RUN_ACTION		4
30
+#define SREV_PKG_SET_USED		5
31
+#define SREV_PKG_SET_REAL_USED	6
30 32
 
31 33
 typedef int (*sr_event_cb_f)(void *data);
32 34
 
... ...
@@ -35,6 +37,8 @@ typedef struct sr_event_cb {
35 37
 	sr_event_cb_f net_data_out;
36 38
 	sr_event_cb_f core_stats;
37 39
 	sr_event_cb_f run_action;
40
+	sr_event_cb_f pkg_set_used;
41
+	sr_event_cb_f pkg_set_real_used;
38 42
 } sr_event_cb_t;
39 43
 
40 44
 void sr_event_cb_init(void);
Browse code

core: events: new function to test event enabled

- sr_event_enabled(type) returns true if a callback has been registered
for respective event type

Daniel-Constantin Mierla authored on 04/02/2010 11:26:30
Showing 1 changed files
... ...
@@ -40,5 +40,6 @@ typedef struct sr_event_cb {
40 40
 void sr_event_cb_init(void);
41 41
 int sr_event_register_cb(int type, sr_event_cb_f f);
42 42
 int sr_event_exec(int type, void *data);
43
+int sr_event_enabled(int type);
43 44
 
44 45
 #endif
Browse code

core: new core event: SREV_CFG_RUN_ACTION

- it is fired for each action executed from configuration file
- parameters are current acction and sip message given as a void* array
of two elements

Daniel-Constantin Mierla authored on 03/02/2010 23:05:41
Showing 1 changed files
... ...
@@ -26,6 +26,7 @@
26 26
 #define SREV_NET_DATA_IN	1
27 27
 #define SREV_NET_DATA_OUT	2
28 28
 #define SREV_CORE_STATS		3
29
+#define SREV_CFG_RUN_ACTION 4
29 30
 
30 31
 typedef int (*sr_event_cb_f)(void *data);
31 32
 
... ...
@@ -33,6 +34,7 @@ typedef struct sr_event_cb {
33 34
 	sr_event_cb_f net_data_in;
34 35
 	sr_event_cb_f net_data_out;
35 36
 	sr_event_cb_f core_stats;
37
+	sr_event_cb_f run_action;
36 38
 } sr_event_cb_t;
37 39
 
38 40
 void sr_event_cb_init(void);
Browse code

core: added new event SREV_CORE_STATS

- to be used by Kamailio core statistics not included in stock SR core
(cherry picked from commit 47c89177ce276cdf8f6a2d06fdd3359ba283fe4c)

Daniel-Constantin Mierla authored on 13/10/2009 18:47:35 • Andrei Pelinescu-Onciul committed on 01/02/2010 15:51:13
Showing 1 changed files
... ...
@@ -25,12 +25,14 @@
25 25
 
26 26
 #define SREV_NET_DATA_IN	1
27 27
 #define SREV_NET_DATA_OUT	2
28
+#define SREV_CORE_STATS		3
28 29
 
29 30
 typedef int (*sr_event_cb_f)(void *data);
30 31
 
31 32
 typedef struct sr_event_cb {
32 33
 	sr_event_cb_f net_data_in;
33 34
 	sr_event_cb_f net_data_out;
35
+	sr_event_cb_f core_stats;
34 36
 } sr_event_cb_t;
35 37
 
36 38
 void sr_event_cb_init(void);
Browse code

core: new sr events system

- designed to have small footprint in core
- the goal is to execute a event manager function during core processing
- event managers can be implemented in modules or elsewhere
- two event types added: SREV_NET_DATA_IN and SREV_NET_DATA_OUT (see the
other commit)

Daniel-Constantin Mierla authored on 04/08/2009 14:47:10
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,40 @@
1
+/**
2
+ * $Id$
3
+ *
4
+ * Copyright (C) 2009 SIP-Router.org
5
+ *
6
+ * This file is part of Extensible SIP Router, a free SIP server.
7
+ *
8
+ * Permission to use, copy, modify, and distribute this software for any
9
+ * purpose with or without fee is hereby granted, provided that the above
10
+ * copyright notice and this permission notice appear in all copies.
11
+ *
12
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
+ */
20
+
21
+#ifndef _SR_EVENTS_H_
22
+#define _SR_EVENTS_H_
23
+
24
+#include "parser/msg_parser.h"
25
+
26
+#define SREV_NET_DATA_IN	1
27
+#define SREV_NET_DATA_OUT	2
28
+
29
+typedef int (*sr_event_cb_f)(void *data);
30
+
31
+typedef struct sr_event_cb {
32
+	sr_event_cb_f net_data_in;
33
+	sr_event_cb_f net_data_out;
34
+} sr_event_cb_t;
35
+
36
+void sr_event_cb_init(void);
37
+int sr_event_register_cb(int type, sr_event_cb_f f);
38
+int sr_event_exec(int type, void *data);
39
+
40
+#endif