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,166 +0,0 @@
1
-/*
2
- *
3
- * Copyright (C) 2001-2003 FhG Fokus
4
- *
5
- * This file is part of Kamailio, a free SIP server.
6
- *
7
- * Kamailio is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; either version 2 of the License, or
10
- * (at your option) any later version
11
- *
12
- * Kamailio is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License 
18
- * along with this program; if not, write to the Free Software 
19
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20
- */
21
-
22
-
23
-#ifndef stats_h
24
-#define stats_h
25
-
26
-#include <ctype.h>
27
-#include <sys/mman.h>
28
-#include <fcntl.h>
29
-#include <sys/time.h>
30
-#include <time.h>
31
-#include <sys/utsname.h>
32
-#include <stdio.h>
33
-#include <stdlib.h>
34
-#include <errno.h>
35
-
36
-
37
-#define _update_request( method, dir )			\
38
-	do{ if (stat_file!=NULL) switch( method ) {	\
39
-          	case METHOD_INVITE: stats->dir##_requests_inv++; break;	\
40
-          	case METHOD_ACK: stats->dir##_requests_ack++; break;		\
41
-          	case METHOD_CANCEL: stats->dir##_requests_cnc++; break;	\
42
-          	case METHOD_BYE: stats->dir##_requests_bye++; break;		\
43
-		case METHOD_INFO: stats->dir##_requests_info++; break;		\
44
-          	case METHOD_OTHER: stats->dir##_requests_other++; break;	\
45
-		default: LM_ERR("unknown method in rq stats (%s)\n", #dir);	\
46
-		}	\
47
-	}while(0)
48
-
49
-
50
-/*
51
-#define update_received_request( method ) _update_request( method, received )
52
-#define update_sent_request( method ) _update_request( method, sent )
53
-
54
-#define update_received_response( statusclass ) \
55
-									_update_response( statusclass, received )
56
-#define update_sent_response( statusclass ) \
57
-									_update_response( statusclass, sent )
58
-#define update_received_drops	{  stats->received_drops++; }
59
-#define update_fail_on_send	{  stats->failed_on_send++; }
60
-*/
61
-
62
-#define         _statusline(class, dir )\
63
-						case class: stats->dir##_responses_##class++; break;
64
-
65
-/* FIXME: Don't have case for _other (see received_responses_other) */
66
-#define _update_response( statusclass, dir )		\
67
-        do{ if (stat_file!=NULL)                          \
68
-                switch( statusclass ) {                 \
69
-                        _statusline(1, dir)                   \
70
-                        _statusline(2, dir)                   \
71
-                        _statusline(3, dir)                   \
72
-                        _statusline(4, dir)                   \
73
-                        _statusline(5, dir)                   \
74
-                        _statusline(6, dir)                   \
75
-                        default: LM_INFO("unusual status code received in stats (%s)\n", #dir); \
76
-                }       \
77
-        }while(0)
78
-
79
-#ifdef STATS
80
-#	define STATS_RX_REQUEST(method) _update_request(method, received)
81
-#	define STATS_TX_REQUEST(method) _update_request(method, sent )
82
-#	define STATS_RX_RESPONSE(class) _update_response( class, received )
83
-#	define STATS_TX_RESPONSE(class) _update_response( class, sent )
84
-#	define STATS_RX_DROPS {  stats->received_drops++; }
85
-#	define STATS_TX_DROPS {  stats->failed_on_send++; }
86
-#else
87
-#	define STATS_RX_REQUEST(method)
88
-#	define STATS_TX_REQUEST(method)
89
-#	define STATS_RX_RESPONSE(class) 
90
-#	define STATS_TX_RESPONSE(class) 
91
-#	define STATS_RX_DROPS 
92
-#	define STATS_TX_DROPS 
93
-#endif
94
-
95
-#ifdef STATS
96
-
97
-
98
-struct stats_s {
99
-
100
-	unsigned int	process_index;
101
-	pid_t		pid;
102
-	time_t		start_time;
103
-
104
-	unsigned long 
105
-
106
-	/* received packets */
107
-
108
-	received_requests_inv, 		/* received_requests */
109
-	received_requests_ack,
110
-	received_requests_cnc,
111
-	received_requests_bye,
112
-	received_requests_other,
113
-
114
-	received_responses_1, 		/* received_responses */
115
-	received_responses_2,
116
-	received_responses_3,
117
-	received_responses_4,
118
-	received_responses_5,
119
-	received_responses_6,
120
-	received_responses_other,
121
-
122
-	received_drops,	/* all messages we received and did not process
123
-					   successfully; reasons include SIP sanity checks 
124
-					   (missing Vias, neither request nor response, 
125
-					   failed parsing), ser errors (malloc, action
126
-					   failure)
127
-					*/
128
-
129
-	/* sent */
130
-
131
-	/* sent_requests */
132
-	sent_requests_inv,
133
-	sent_requests_ack,
134
-	sent_requests_cnc,
135
-	sent_requests_bye,
136
-	sent_requests_other,
137
-
138
-	/* sent responses */
139
-	sent_responses_1,
140
-	sent_responses_2,
141
-	sent_responses_3,
142
-	sent_responses_4,
143
-	sent_responses_5,
144
-	sent_responses_6,
145
-	/* FIXME: Don't want sent_responses_other?? */
146
-
147
-	processed_requests,
148
-	processed_responses,
149
-	acc_req_time,
150
-	acc_res_time,
151
-
152
-	failed_on_send;			
153
-};
154
-
155
-extern struct stats_s *stats;
156
-extern char *stat_file;
157
-
158
-int init_stats( int nr_of_processes );
159
-void setstats( int child_index );
160
-int dump_all_statistic();
161
-int dump_statistic(FILE *fp, struct stats_s *istats, int printheader);
162
-/* Registers handlers with SNMP module */
163
-int stats_register(); 
164
-
165
-#endif
166
-#endif
Browse code

core: Modify doxygen, remove history, remove SVN IDs, change "ser" and "sip-router" to "KAMAILIO"

Olle E. Johansson authored on 16/01/2015 16:38:46
Showing 1 changed files
... ...
@@ -1,22 +1,15 @@
1 1
 /*
2
- * $Id$
3
- *
4 2
  *
5 3
  * Copyright (C) 2001-2003 FhG Fokus
6 4
  *
7
- * This file is part of ser, a free SIP server.
5
+ * This file is part of Kamailio, a free SIP server.
8 6
  *
9
- * ser is free software; you can redistribute it and/or modify
7
+ * Kamailio is free software; you can redistribute it and/or modify
10 8
  * it under the terms of the GNU General Public License as published by
11 9
  * the Free Software Foundation; either version 2 of the License, or
12 10
  * (at your option) any later version
13 11
  *
14
- * For a license to use the ser software under conditions
15
- * other than those described here, or to purchase support for this
16
- * software, please contact iptel.org by e-mail at the following addresses:
17
- *    info@iptel.org
18
- *
19
- * ser is distributed in the hope that it will be useful,
12
+ * Kamailio is distributed in the hope that it will be useful,
20 13
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 14
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 15
  * GNU General Public License for more details.
Browse code

stats.h: logging: convert LOG to LM_*

Ovidiu Sas authored on 03/10/2014 19:19:35
Showing 1 changed files
... ...
@@ -49,8 +49,7 @@
49 49
           	case METHOD_BYE: stats->dir##_requests_bye++; break;		\
50 50
 		case METHOD_INFO: stats->dir##_requests_info++; break;		\
51 51
           	case METHOD_OTHER: stats->dir##_requests_other++; break;	\
52
-          	default: LOG(L_ERR, "ERROR: unknown method in rq stats (%s)\n", \
53
-							#dir);	\
52
+		default: LM_ERR("unknown method in rq stats (%s)\n", #dir);	\
54 53
 		}	\
55 54
 	}while(0)
56 55
 
... ...
@@ -80,8 +79,7 @@
80 79
                         _statusline(4, dir)                   \
81 80
                         _statusline(5, dir)                   \
82 81
                         _statusline(6, dir)                   \
83
-                        default: LOG(L_INFO, "ERROR: unusual status code"\
84
-										 " received in stats (%s)\n", #dir); \
82
+                        default: LM_INFO("unusual status code received in stats (%s)\n", #dir); \
85 83
                 }       \
86 84
         }while(0)
87 85
 
Browse code

all: updated FSF address in GPL text

Anthony Messina authored on 04/07/2014 09:36:37 • Daniel-Constantin Mierla committed on 04/07/2014 09:37:36
Showing 1 changed files
... ...
@@ -23,7 +23,7 @@
23 23
  *
24 24
  * You should have received a copy of the GNU General Public License 
25 25
  * along with this program; if not, write to the Free Software 
26
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
27 27
  */
28 28
 
29 29
 
Browse code

core: fix some #includes to be posix compliant

sys/poll.h and sys/fcntl.h are GNUisms and might not exist on
strictly posix compliant systems. This fixes to use the posix
specified standard locations of these headers.

E.g musl c-library will give warnings on using these non-standard
glibc 'internal' headers.

Timo Teräs authored on 21/04/2014 07:57:11
Showing 1 changed files
... ...
@@ -32,7 +32,7 @@
32 32
 
33 33
 #include <ctype.h>
34 34
 #include <sys/mman.h>
35
-#include <sys/fcntl.h>
35
+#include <fcntl.h>
36 36
 #include <sys/time.h>
37 37
 #include <time.h>
38 38
 #include <sys/utsname.h>
Browse code

- Maxim's INFO support patch (I forgot to apply it the first time)

Andrei Pelinescu-Onciul authored on 23/05/2005 09:20:57
Showing 1 changed files
... ...
@@ -47,6 +47,7 @@
47 47
           	case METHOD_ACK: stats->dir##_requests_ack++; break;		\
48 48
           	case METHOD_CANCEL: stats->dir##_requests_cnc++; break;	\
49 49
           	case METHOD_BYE: stats->dir##_requests_bye++; break;		\
50
+		case METHOD_INFO: stats->dir##_requests_info++; break;		\
50 51
           	case METHOD_OTHER: stats->dir##_requests_other++; break;	\
51 52
           	default: LOG(L_ERR, "ERROR: unknown method in rq stats (%s)\n", \
52 53
 							#dir);	\
Browse code

- Spelling checked - READMEs updated

Jan Janak authored on 24/08/2004 08:45:09
Showing 1 changed files
... ...
@@ -2,7 +2,7 @@
2 2
  * $Id$
3 3
  *
4 4
  *
5
- * Copyright (C) 2001-2003 Fhg Fokus
5
+ * Copyright (C) 2001-2003 FhG Fokus
6 6
  *
7 7
  * This file is part of ser, a free SIP server.
8 8
  *
Browse code

- cosmetic changes (lines too long a.s.o)

Andrei Pelinescu-Onciul authored on 20/09/2002 09:29:07
Showing 1 changed files
... ...
@@ -42,32 +42,36 @@
42 42
 
43 43
 
44 44
 #define _update_request( method, dir )			\
45
-	{ if (stat_file!=NULL) switch( method ) {	\
45
+	do{ if (stat_file!=NULL) switch( method ) {	\
46 46
           	case METHOD_INVITE: stats->dir##_requests_inv++; break;	\
47 47
           	case METHOD_ACK: stats->dir##_requests_ack++; break;		\
48 48
           	case METHOD_CANCEL: stats->dir##_requests_cnc++; break;	\
49 49
           	case METHOD_BYE: stats->dir##_requests_bye++; break;		\
50 50
           	case METHOD_OTHER: stats->dir##_requests_other++; break;	\
51
-          	default: LOG(L_ERR, "ERROR: unknown method in rq stats (%s)\n", #dir);	\
51
+          	default: LOG(L_ERR, "ERROR: unknown method in rq stats (%s)\n", \
52
+							#dir);	\
52 53
 		}	\
53
-        }
54
+	}while(0)
54 55
 
55 56
 
56 57
 /*
57 58
 #define update_received_request( method ) _update_request( method, received )
58 59
 #define update_sent_request( method ) _update_request( method, sent )
59 60
 
60
-#define update_received_response( statusclass ) _update_response( statusclass, received )
61
-#define update_sent_response( statusclass ) _update_response( statusclass, sent )
61
+#define update_received_response( statusclass ) \
62
+									_update_response( statusclass, received )
63
+#define update_sent_response( statusclass ) \
64
+									_update_response( statusclass, sent )
62 65
 #define update_received_drops	{  stats->received_drops++; }
63 66
 #define update_fail_on_send	{  stats->failed_on_send++; }
64 67
 */
65 68
 
66
-#define         _statusline(class, dir )       case class: stats->dir##_responses_##class++; break;
69
+#define         _statusline(class, dir )\
70
+						case class: stats->dir##_responses_##class++; break;
67 71
 
68 72
 /* FIXME: Don't have case for _other (see received_responses_other) */
69 73
 #define _update_response( statusclass, dir )		\
70
-        { if (stat_file!=NULL)                          \
74
+        do{ if (stat_file!=NULL)                          \
71 75
                 switch( statusclass ) {                 \
72 76
                         _statusline(1, dir)                   \
73 77
                         _statusline(2, dir)                   \
... ...
@@ -75,9 +79,10 @@
75 79
                         _statusline(4, dir)                   \
76 80
                         _statusline(5, dir)                   \
77 81
                         _statusline(6, dir)                   \
78
-                        default: LOG(L_INFO, "ERROR: unusual status code received in stats (%s)\n", #dir);    \
82
+                        default: LOG(L_INFO, "ERROR: unusual status code"\
83
+										 " received in stats (%s)\n", #dir); \
79 84
                 }       \
80
-        }
85
+        }while(0)
81 86
 
82 87
 #ifdef STATS
83 88
 #	define STATS_RX_REQUEST(method) _update_request(method, received)
Browse code

GPLization banner introduced to *.[hc] files

Jiri Kuthan authored on 19/09/2002 12:23:52
Showing 1 changed files
... ...
@@ -1,8 +1,32 @@
1 1
 /*
2 2
  * $Id$
3 3
  *
4
+ *
5
+ * Copyright (C) 2001-2003 Fhg Fokus
6
+ *
7
+ * This file is part of ser, a free SIP server.
8
+ *
9
+ * ser is free software; you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation; either version 2 of the License, or
12
+ * (at your option) any later version
13
+ *
14
+ * For a license to use the ser software under conditions
15
+ * other than those described here, or to purchase support for this
16
+ * software, please contact iptel.org by e-mail at the following addresses:
17
+ *    info@iptel.org
18
+ *
19
+ * ser is distributed in the hope that it will be useful,
20
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
+ * GNU General Public License for more details.
23
+ *
24
+ * You should have received a copy of the GNU General Public License 
25
+ * along with this program; if not, write to the Free Software 
26
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
4 27
  */
5 28
 
29
+
6 30
 #ifndef stats_h
7 31
 #define stats_h
8 32
 
Browse code

CVS substitutes introduced

Jiri Kuthan authored on 19/09/2002 11:51:26
Showing 1 changed files
... ...
@@ -1,3 +1,8 @@
1
+/*
2
+ * $Id$
3
+ *
4
+ */
5
+
1 6
 #ifndef stats_h
2 7
 #define stats_h
3 8
 
Browse code

- New stats code

ric authored on 28/08/2002 18:59:38
Showing 1 changed files
... ...
@@ -36,6 +36,7 @@
36 36
 
37 37
 #define         _statusline(class, dir )       case class: stats->dir##_responses_##class++; break;
38 38
 
39
+/* FIXME: Don't have case for _other (see received_responses_other) */
39 40
 #define _update_response( statusclass, dir )		\
40 41
         { if (stat_file!=NULL)                          \
41 42
                 switch( statusclass ) {                 \
... ...
@@ -84,7 +85,7 @@ struct stats_s {
84 85
 	received_requests_bye,
85 86
 	received_requests_other,
86 87
 
87
-	received_responses_1, 		/* received_requests */
88
+	received_responses_1, 		/* received_responses */
88 89
 	received_responses_2,
89 90
 	received_responses_3,
90 91
 	received_responses_4,
... ...
@@ -92,7 +93,7 @@ struct stats_s {
92 93
 	received_responses_6,
93 94
 	received_responses_other,
94 95
 
95
-	received_drops, 		/* all messages we received and did not process
96
+	received_drops,	/* all messages we received and did not process
96 97
 					   successfully; reasons include SIP sanity checks 
97 98
 					   (missing Vias, neither request nor response, 
98 99
 					   failed parsing), ser errors (malloc, action
... ...
@@ -115,6 +116,7 @@ struct stats_s {
115 116
 	sent_responses_4,
116 117
 	sent_responses_5,
117 118
 	sent_responses_6,
119
+	/* FIXME: Don't want sent_responses_other?? */
118 120
 
119 121
 	processed_requests,
120 122
 	processed_responses,
... ...
@@ -122,18 +124,17 @@ struct stats_s {
122 124
 	acc_res_time,
123 125
 
124 126
 	failed_on_send;			
125
-			  
126 127
 };
127 128
 
128
-
129 129
 extern struct stats_s *stats;
130
+extern char *stat_file;
130 131
 
132
+int init_stats( int nr_of_processes );
131 133
 void setstats( int child_index );
132
-void dump_statistic( FILE *fp, struct stats_s *istats );
133 134
 int dump_all_statistic();
134
-int init_stats( int nr_of_processes );
135
-
136
-
135
+int dump_statistic(FILE *fp, struct stats_s *istats, int printheader);
136
+/* Registers handlers with SNMP module */
137
+int stats_register(); 
137 138
 
138 139
 #endif
139 140
 #endif
Browse code

bug fixes, latency stats

Jiri Kuthan authored on 07/01/2002 17:52:26
Showing 1 changed files
... ...
@@ -116,6 +116,11 @@ struct stats_s {
116 116
 	sent_responses_5,
117 117
 	sent_responses_6,
118 118
 
119
+	processed_requests,
120
+	processed_responses,
121
+	acc_req_time,
122
+	acc_res_time,
123
+
119 124
 	failed_on_send;			
120 125
 			  
121 126
 };
Browse code

performance and bug fixes

Jiri Kuthan authored on 07/01/2002 04:39:49
Showing 1 changed files
... ...
@@ -12,6 +12,58 @@
12 12
 #include <errno.h>
13 13
 
14 14
 
15
+#define _update_request( method, dir )			\
16
+	{ if (stat_file!=NULL) switch( method ) {	\
17
+          	case METHOD_INVITE: stats->dir##_requests_inv++; break;	\
18
+          	case METHOD_ACK: stats->dir##_requests_ack++; break;		\
19
+          	case METHOD_CANCEL: stats->dir##_requests_cnc++; break;	\
20
+          	case METHOD_BYE: stats->dir##_requests_bye++; break;		\
21
+          	case METHOD_OTHER: stats->dir##_requests_other++; break;	\
22
+          	default: LOG(L_ERR, "ERROR: unknown method in rq stats (%s)\n", #dir);	\
23
+		}	\
24
+        }
25
+
26
+
27
+/*
28
+#define update_received_request( method ) _update_request( method, received )
29
+#define update_sent_request( method ) _update_request( method, sent )
30
+
31
+#define update_received_response( statusclass ) _update_response( statusclass, received )
32
+#define update_sent_response( statusclass ) _update_response( statusclass, sent )
33
+#define update_received_drops	{  stats->received_drops++; }
34
+#define update_fail_on_send	{  stats->failed_on_send++; }
35
+*/
36
+
37
+#define         _statusline(class, dir )       case class: stats->dir##_responses_##class++; break;
38
+
39
+#define _update_response( statusclass, dir )		\
40
+        { if (stat_file!=NULL)                          \
41
+                switch( statusclass ) {                 \
42
+                        _statusline(1, dir)                   \
43
+                        _statusline(2, dir)                   \
44
+                        _statusline(3, dir)                   \
45
+                        _statusline(4, dir)                   \
46
+                        _statusline(5, dir)                   \
47
+                        _statusline(6, dir)                   \
48
+                        default: LOG(L_INFO, "ERROR: unusual status code received in stats (%s)\n", #dir);    \
49
+                }       \
50
+        }
51
+
52
+#ifdef STATS
53
+#	define STATS_RX_REQUEST(method) _update_request(method, received)
54
+#	define STATS_TX_REQUEST(method) _update_request(method, sent )
55
+#	define STATS_RX_RESPONSE(class) _update_response( class, received )
56
+#	define STATS_TX_RESPONSE(class) _update_response( class, sent )
57
+#	define STATS_RX_DROPS {  stats->received_drops++; }
58
+#	define STATS_TX_DROPS {  stats->failed_on_send++; }
59
+#else
60
+#	define STATS_RX_REQUEST(method)
61
+#	define STATS_TX_REQUEST(method)
62
+#	define STATS_RX_RESPONSE(class) 
63
+#	define STATS_TX_RESPONSE(class) 
64
+#	define STATS_RX_DROPS 
65
+#	define STATS_TX_DROPS 
66
+#endif
15 67
 
16 68
 #ifdef STATS
17 69
 
... ...
@@ -76,44 +128,6 @@ void dump_statistic( FILE *fp, struct stats_s *istats );
76 128
 int dump_all_statistic();
77 129
 int init_stats( int nr_of_processes );
78 130
 
79
-#define _update_request( method, dir )			\
80
-	{ if (stat_file!=NULL) switch( method ) {	\
81
-          	case METHOD_INVITE: stats->dir##_requests_inv++; break;	\
82
-          	case METHOD_ACK: stats->dir##_requests_ack++; break;		\
83
-          	case METHOD_CANCEL: stats->dir##_requests_cnc++; break;	\
84
-          	case METHOD_BYE: stats->dir##_requests_bye++; break;		\
85
-          	case METHOD_OTHER: stats->dir##_requests_other++; break;	\
86
-          	default: LOG(L_ERR, "ERROR: unknown method in rq stats (%s)\n", #dir);	\
87
-		}	\
88
-        }
89
-
90
-#define update_received_request( method ) _update_request( method, received )
91
-#define update_sent_request( method ) _update_request( method, sent )
92
-
93
-#define         _statusline(class, dir )       case class: stats->dir##_responses_##class++; break;
94
-/*
95
-#define		statusline( class )	_statusline( class, received )
96
-#define		statusline2( class )	_statusline( class, sent )
97
-*/
98
-
99
-#define _update_response( statusclass, dir )		\
100
-        { if (stat_file!=NULL)                          \
101
-                switch( statusclass ) {                 \
102
-                        _statusline(1, dir)                   \
103
-                        _statusline(2, dir)                   \
104
-                        _statusline(3, dir)                   \
105
-                        _statusline(4, dir)                   \
106
-                        _statusline(5, dir)                   \
107
-                        _statusline(6, dir)                   \
108
-                        default: LOG(L_INFO, "ERROR: unusual status code received in stats (%s)\n", #dir);    \
109
-                }       \
110
-        }
111
-
112
-#define update_received_response( statusclass ) _update_response( statusclass, received )
113
-#define update_sent_response( statusclass ) _update_response( statusclass, sent )
114
-
115
-#define update_received_drops	{  stats->received_drops++; }
116
-#define update_fail_on_send	{  stats->failed_on_send++; }
117 131
 
118 132
 
119 133
 #endif
Browse code

port numbers different now for remote and local

Jiri Kuthan authored on 20/11/2001 06:26:49
Showing 1 changed files
... ...
@@ -1,22 +1,120 @@
1 1
 #ifndef stats_h
2 2
 #define stats_h
3 3
 
4
+#include <ctype.h>
5
+#include <sys/mman.h>
6
+#include <sys/fcntl.h>
7
+#include <sys/time.h>
8
+#include <time.h>
9
+#include <sys/utsname.h>
10
+#include <stdio.h>
11
+#include <stdlib.h>
12
+#include <errno.h>
13
+
14
+
15
+
4 16
 #ifdef STATS
5 17
 
18
+
6 19
 struct stats_s {
7 20
 
8
-	/* total/valid, received/sent, request/response */
9
-	unsigned long 	ok_rx_rq,
10
-			ok_rx_rs,
11
-			ok_tx_rq,
12
-			ok_tx_rs,
13
-			total_rx,
14
-			total_tx;
21
+	unsigned int	process_index;
22
+	pid_t		pid;
23
+	time_t		start_time;
24
+
25
+	unsigned long 
26
+
27
+	/* received packets */
28
+
29
+	received_requests_inv, 		/* received_requests */
30
+	received_requests_ack,
31
+	received_requests_cnc,
32
+	received_requests_bye,
33
+	received_requests_other,
34
+
35
+	received_responses_1, 		/* received_requests */
36
+	received_responses_2,
37
+	received_responses_3,
38
+	received_responses_4,
39
+	received_responses_5,
40
+	received_responses_6,
41
+	received_responses_other,
42
+
43
+	received_drops, 		/* all messages we received and did not process
44
+					   successfully; reasons include SIP sanity checks 
45
+					   (missing Vias, neither request nor response, 
46
+					   failed parsing), ser errors (malloc, action
47
+					   failure)
48
+					*/
49
+
50
+	/* sent */
51
+
52
+	/* sent_requests */
53
+	sent_requests_inv,
54
+	sent_requests_ack,
55
+	sent_requests_cnc,
56
+	sent_requests_bye,
57
+	sent_requests_other,
58
+
59
+	/* sent responses */
60
+	sent_responses_1,
61
+	sent_responses_2,
62
+	sent_responses_3,
63
+	sent_responses_4,
64
+	sent_responses_5,
65
+	sent_responses_6,
66
+
67
+	failed_on_send;			
68
+			  
15 69
 };
16 70
 
17 71
 
18
-extern struct stats_s stats;
72
+extern struct stats_s *stats;
19 73
 
20
-#endif
74
+void setstats( int child_index );
75
+void dump_statistic( FILE *fp, struct stats_s *istats );
76
+int dump_all_statistic();
77
+int init_stats( int nr_of_processes );
78
+
79
+#define _update_request( method, dir )			\
80
+	{ if (stat_file!=NULL) switch( method ) {	\
81
+          	case METHOD_INVITE: stats->dir##_requests_inv++; break;	\
82
+          	case METHOD_ACK: stats->dir##_requests_ack++; break;		\
83
+          	case METHOD_CANCEL: stats->dir##_requests_cnc++; break;	\
84
+          	case METHOD_BYE: stats->dir##_requests_bye++; break;		\
85
+          	case METHOD_OTHER: stats->dir##_requests_other++; break;	\
86
+          	default: LOG(L_ERR, "ERROR: unknown method in rq stats (%s)\n", #dir);	\
87
+		}	\
88
+        }
89
+
90
+#define update_received_request( method ) _update_request( method, received )
91
+#define update_sent_request( method ) _update_request( method, sent )
92
+
93
+#define         _statusline(class, dir )       case class: stats->dir##_responses_##class++; break;
94
+/*
95
+#define		statusline( class )	_statusline( class, received )
96
+#define		statusline2( class )	_statusline( class, sent )
97
+*/
21 98
 
99
+#define _update_response( statusclass, dir )		\
100
+        { if (stat_file!=NULL)                          \
101
+                switch( statusclass ) {                 \
102
+                        _statusline(1, dir)                   \
103
+                        _statusline(2, dir)                   \
104
+                        _statusline(3, dir)                   \
105
+                        _statusline(4, dir)                   \
106
+                        _statusline(5, dir)                   \
107
+                        _statusline(6, dir)                   \
108
+                        default: LOG(L_INFO, "ERROR: unusual status code received in stats (%s)\n", #dir);    \
109
+                }       \
110
+        }
111
+
112
+#define update_received_response( statusclass ) _update_response( statusclass, received )
113
+#define update_sent_response( statusclass ) _update_response( statusclass, sent )
114
+
115
+#define update_received_drops	{  stats->received_drops++; }
116
+#define update_fail_on_send	{  stats->failed_on_send++; }
117
+
118
+
119
+#endif
22 120
 #endif
Browse code

tested and ifdef-ed the Stats hack; to be done:L put it in shmem

Jiri Kuthan authored on 07/11/2001 19:52:42
Showing 1 changed files
... ...
@@ -1,6 +1,8 @@
1 1
 #ifndef stats_h
2 2
 #define stats_h
3 3
 
4
+#ifdef STATS
5
+
4 6
 struct stats_s {
5 7
 
6 8
 	/* total/valid, received/sent, request/response */
... ...
@@ -16,3 +18,5 @@ struct stats_s {
16 18
 extern struct stats_s stats;
17 19
 
18 20
 #endif
21
+
22
+#endif
Browse code

nasty stats added

Jiri Kuthan authored on 07/11/2001 18:41:08
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,18 @@
1
+#ifndef stats_h
2
+#define stats_h
3
+
4
+struct stats_s {
5
+
6
+	/* total/valid, received/sent, request/response */
7
+	unsigned long 	ok_rx_rq,
8
+			ok_rx_rs,
9
+			ok_tx_rq,
10
+			ok_tx_rs,
11
+			total_rx,
12
+			total_tx;
13
+};
14
+
15
+
16
+extern struct stats_s stats;
17
+
18
+#endif