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,96 +0,0 @@
1
-/*
2
- * Process Table
3
- *
4
- * Copyright (C) 2001-2003 FhG Fokus
5
- *
6
- * Permission to use, copy, modify, and distribute this software for any
7
- * purpose with or without fee is hereby granted, provided that the above
8
- * copyright notice and this permission notice appear in all copies.
9
- *
10
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
- */
18
-/** Kamailio core :: internal fork functions and process table.
19
- * @file: pt.h
20
- * @ingroup core
21
- */
22
-
23
-#ifndef _PT_H
24
-#define _PT_H
25
-
26
-#include <sys/types.h>
27
-#include <unistd.h>
28
-#include <stdlib.h>
29
-
30
-#include "globals.h"
31
-#include "timer.h"
32
-#include "socket_info.h"
33
-#include "locking.h"
34
-
35
-#define MAX_PT_DESC			128
36
-
37
-struct process_table {
38
-	int pid;
39
-#ifdef USE_TCP
40
-	int unix_sock; 	/* unix socket on which tcp main listens	*/
41
-	int idx; 		/* tcp child index, -1 for other processes 	*/
42
-#endif
43
-	char desc[MAX_PT_DESC];
44
-};
45
-
46
-extern struct process_table *pt;
47
-extern gen_lock_t* process_lock;
48
-extern int *process_count;
49
-extern int process_no;
50
-
51
-extern struct tcp_child* tcp_children;
52
-
53
-int init_pt(int proc_no);
54
-int get_max_procs(void);
55
-int register_procs(int no);
56
-int get_max_open_fds(void);
57
-int register_fds(int no);
58
-
59
-
60
-int close_extra_socks(int proc_id, int proc_no);
61
-
62
-#define get_proc_no() ((process_count)?*process_count:0)
63
-
64
-/* return processes pid */
65
-int my_pid(void);
66
-
67
-/**
68
- * Forks a new process.
69
- * @param desc - text description for the process table
70
- * @param make_sock - if to create a unix socket pair for it
71
- * @returns the pid of the new process
72
- */
73
-int fork_process(int child_id,char *desc,int make_sock);
74
-
75
-/**
76
- * Forks a new TCP process.
77
- * @param desc - text description for the process table
78
- * @param r - index in the tcp_children array
79
- * @param *reader_fd_1 - pointer to return the reader_fd[1]
80
- * @returns the pid of the new process
81
- */
82
-#ifdef USE_TCP
83
-int fork_tcp_process(int child_id,char *desc,int r,int *reader_fd_1);
84
-#endif
85
-
86
-#ifdef PKG_MALLOC
87
-void mem_dump_pkg_cb(str *gname, str *name);
88
-#endif
89
-
90
-#ifdef SHM_MEM
91
-int mem_dump_shm_fixup(void *handle, str *gname, str *name, void **val);
92
-#endif
93
-
94
-unsigned int set_fork_delay(unsigned int v);
95
-
96
-#endif
Browse code

Core Update of doxygen, removal of history, changing "ser" to "kamailio"

Olle E. Johansson authored on 03/01/2015 14:03:24
Showing 1 changed files
... ...
@@ -1,10 +1,6 @@
1 1
 /*
2
- * $Id$
3
- *
4 2
  * Process Table
5 3
  *
6
- *
7
- *
8 4
  * Copyright (C) 2001-2003 FhG Fokus
9 5
  *
10 6
  * Permission to use, copy, modify, and distribute this software for any
... ...
@@ -19,19 +15,11 @@
19 15
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
20 16
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 17
  */
22
-/*
23
- * History:
24
- * --------
25
- *  2003-04-15  added tcp_disable support (andrei)
26
- *  2006-06-14	added process table in shared mem (dragos)
27
- *  2007-07-04	added register_fds() and get_max_open_fds(() (andrei)
28
- */
29
-/** internal fork functions and process table.
18
+/** Kamailio core :: internal fork functions and process table.
30 19
  * @file: pt.h
31 20
  * @ingroup core
32 21
  */
33 22
 
34
-
35 23
 #ifndef _PT_H
36 24
 #define _PT_H
37 25
 
Browse code

core: Added void to declarations of functions with empty argument list

In C language, a declaration in the form int f(); is equivalent to int f(...);, thus being able to accept an indefinit number of parameters. With the -Wstrict-prototypes GCC options, these declarations are reported as "function declaration isn’t a prototype".
On some cases, this may trick the compiler into generating unoptimized code (like preparing to handle variadic argument list).
In all cases having a declaration int f() and a definition inf f(int) is missleading, even if standard compliant.
This is still Work in Progress. (maybe adding the -Wstrict-prototypes option to default is desireable)

Marius Zbihlei authored on 02/04/2012 14:19:17
Showing 1 changed files
... ...
@@ -63,9 +63,9 @@ extern int process_no;
63 63
 extern struct tcp_child* tcp_children;
64 64
 
65 65
 int init_pt(int proc_no);
66
-int get_max_procs();
66
+int get_max_procs(void);
67 67
 int register_procs(int no);
68
-int get_max_open_fds();
68
+int get_max_open_fds(void);
69 69
 int register_fds(int no);
70 70
 
71 71
 
... ...
@@ -74,7 +74,7 @@ int close_extra_socks(int proc_id, int proc_no);
74 74
 #define get_proc_no() ((process_count)?*process_count:0)
75 75
 
76 76
 /* return processes pid */
77
-int my_pid();
77
+int my_pid(void);
78 78
 
79 79
 /**
80 80
  * Forks a new process.
Browse code

core: new cfg parameter fork_delay

- number of usecs to wait before forking a process
- default is 0, don't wait
- useful in case there are some throttling policies for the system
running the sip server (e.g., number of new db connections per second)
-- you can introduce delays so that worker processes are not forked at
once

Daniel-Constantin Mierla authored on 06/01/2012 11:06:02
Showing 1 changed files
... ...
@@ -103,4 +103,6 @@ void mem_dump_pkg_cb(str *gname, str *name);
103 103
 int mem_dump_shm_fixup(void *handle, str *gname, str *name, void **val);
104 104
 #endif
105 105
 
106
+unsigned int set_fork_delay(unsigned int v);
107
+
106 108
 #endif
Browse code

core: fix two more 'no real prototype' warnings, fix one wrong caller in timer mod

Henning Westerholt authored on 29/06/2011 20:30:39
Showing 1 changed files
... ...
@@ -62,7 +62,7 @@ extern int process_no;
62 62
 
63 63
 extern struct tcp_child* tcp_children;
64 64
 
65
-int init_pt();
65
+int init_pt(int proc_no);
66 66
 int get_max_procs();
67 67
 int register_procs(int no);
68 68
 int get_max_open_fds();
Browse code

core: daemon status/pipe fixes & interface changes

- moved most of the daemon status stuff to daemonize.[ch].
- nicer interface (e.g. daemon_status_send(code))
- send/read only 1 byte which will be used as exit code
- send an error status on error (fixes
"Main process exited before writing to pipe" error message)
- disabled the timeout. Not needed (now a status is sent always
and even an unlikely process crash before sending it is detected via
the read() failure) and very hard to find a good value (some
setups start very slow).
- close the pipe "send" fd in processes not needing it
- attempt to send back status only if dont_daemonize is not set
(not only if dont_fork==0, it is possible to have forking
enabled, but daemonize disabled: ser -DD)
- BSDed daemonize.[ch] and pt.[ch]

Andrei Pelinescu-Onciul authored on 19/08/2010 18:03:54
Showing 1 changed files
... ...
@@ -7,26 +7,17 @@
7 7
  *
8 8
  * Copyright (C) 2001-2003 FhG Fokus
9 9
  *
10
- * This file is part of ser, a free SIP server.
10
+ * Permission to use, copy, modify, and distribute this software for any
11
+ * purpose with or without fee is hereby granted, provided that the above
12
+ * copyright notice and this permission notice appear in all copies.
11 13
  *
12
- * ser is free software; you can redistribute it and/or modify
13
- * it under the terms of the GNU General Public License as published by
14
- * the Free Software Foundation; either version 2 of the License, or
15
- * (at your option) any later version
16
- *
17
- * For a license to use the ser software under conditions
18
- * other than those described here, or to purchase support for this
19
- * software, please contact iptel.org by e-mail at the following addresses:
20
- *    info@iptel.org
21
- *
22
- * ser is distributed in the hope that it will be useful,
23
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25
- * GNU General Public License for more details.
26
- *
27
- * You should have received a copy of the GNU General Public License 
28
- * along with this program; if not, write to the Free Software 
29
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
14
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
15
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
17
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
20
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
30 21
  */
31 22
 /*
32 23
  * History:
... ...
@@ -35,6 +26,10 @@
35 26
  *  2006-06-14	added process table in shared mem (dragos)
36 27
  *  2007-07-04	added register_fds() and get_max_open_fds(() (andrei)
37 28
  */
29
+/** internal fork functions and process table.
30
+ * @file: pt.h
31
+ * @ingroup core
32
+ */
38 33
 
39 34
 
40 35
 #ifndef _PT_H
Browse code

The fixup function prototypes of the config variables have been extended with the group name. All the fixup functions have been updated.

Miklos Tirpak authored on 13/03/2009 13:59:28
Showing 1 changed files
... ...
@@ -101,11 +101,11 @@ int fork_tcp_process(int child_id,char *desc,int r,int *reader_fd_1);
101 101
 #endif
102 102
 
103 103
 #ifdef PKG_MALLOC
104
-void mem_dump_pkg_cb(str *name);
104
+void mem_dump_pkg_cb(str *gname, str *name);
105 105
 #endif
106 106
 
107 107
 #ifdef SHM_MEM
108
-int mem_dump_shm_fixup(void *handle, str *name, void **val);
108
+int mem_dump_shm_fixup(void *handle, str *gname, str *name, void **val);
109 109
 #endif
110 110
 
111 111
 #endif
Browse code

Two configuration variables are introduced that can help troubleshooting memory leaks: mem_dump_pkg, and mem_dump_shm Useage:

sercmd cfg.set_now_int mem_dump_pkg <pid_number>
Dumps the pkg memory status of the given processs

sercmd cfg.set_now_int mem_dump_shm 1
Dumps the shm memory status

Miklos Tirpak authored on 04/04/2008 08:40:53
Showing 1 changed files
... ...
@@ -100,4 +100,12 @@ int fork_process(int child_id,char *desc,int make_sock);
100 100
 int fork_tcp_process(int child_id,char *desc,int r,int *reader_fd_1);
101 101
 #endif
102 102
 
103
+#ifdef PKG_MALLOC
104
+void mem_dump_pkg_cb(str *name);
105
+#endif
106
+
107
+#ifdef SHM_MEM
108
+int mem_dump_shm_fixup(void *handle, str *name, void **val);
109
+#endif
110
+
103 111
 #endif
Browse code

- close all the unneeded fds in child processes (=> significantly less fds used)

Andrei Pelinescu-Onciul authored on 05/12/2007 20:26:58
Showing 1 changed files
... ...
@@ -73,6 +73,11 @@ int register_procs(int no);
73 73
 int get_max_open_fds();
74 74
 int register_fds(int no);
75 75
 
76
+
77
+int close_extra_socks(int proc_id, int proc_no);
78
+
79
+#define get_proc_no() ((process_count)?*process_count:0)
80
+
76 81
 /* return processes pid */
77 82
 int my_pid();
78 83
 
Browse code

- added missing register_fds & get_max_open_fds() declarations

Andrei Pelinescu-Onciul authored on 07/07/2007 00:33:02
Showing 1 changed files
... ...
@@ -33,6 +33,7 @@
33 33
  * --------
34 34
  *  2003-04-15  added tcp_disable support (andrei)
35 35
  *  2006-06-14	added process table in shared mem (dragos)
36
+ *  2007-07-04	added register_fds() and get_max_open_fds(() (andrei)
36 37
  */
37 38
 
38 39
 
... ...
@@ -69,6 +70,8 @@ extern struct tcp_child* tcp_children;
69 70
 int init_pt();
70 71
 int get_max_procs();
71 72
 int register_procs(int no);
73
+int get_max_open_fds();
74
+int register_fds(int no);
72 75
 
73 76
 /* return processes pid */
74 77
 int my_pid();
Browse code

- added ser profiling patch from Hendrik Scholz <hendrik.scholz@freenet-ag.de>, adapted to the new fork functions (for more info see http://lists.iptel.org/pipermail/serdev/2006-July/007627.html)

Andrei Pelinescu-Onciul authored on 20/09/2006 10:28:42
Showing 1 changed files
... ...
@@ -66,12 +66,12 @@ extern int process_no;
66 66
 
67 67
 extern struct tcp_child* tcp_children;
68 68
 
69
-inline int init_pt();
69
+int init_pt();
70 70
 int get_max_procs();
71 71
 int register_procs(int no);
72 72
 
73 73
 /* return processes pid */
74
-inline int my_pid();
74
+int my_pid();
75 75
 
76 76
 /**
77 77
  * Forks a new process.
... ...
@@ -79,7 +79,7 @@ inline int my_pid();
79 79
  * @param make_sock - if to create a unix socket pair for it
80 80
  * @returns the pid of the new process
81 81
  */
82
-inline int fork_process(int child_id,char *desc,int make_sock);
82
+int fork_process(int child_id,char *desc,int make_sock);
83 83
 
84 84
 /**
85 85
  * Forks a new TCP process.
... ...
@@ -89,7 +89,7 @@ inline int fork_process(int child_id,char *desc,int make_sock);
89 89
  * @returns the pid of the new process
90 90
  */
91 91
 #ifdef USE_TCP
92
-inline int fork_tcp_process(int child_id,char *desc,int r,int *reader_fd_1);
92
+int fork_tcp_process(int child_id,char *desc,int r,int *reader_fd_1);
93 93
 #endif
94 94
 
95 95
 #endif
Browse code

- allow compilation without USE_TCP option

Hendrik Scholz authored on 20/09/2006 09:22:48
Showing 1 changed files
... ...
@@ -88,6 +88,8 @@ inline int fork_process(int child_id,char *desc,int make_sock);
88 88
  * @param *reader_fd_1 - pointer to return the reader_fd[1]
89 89
  * @returns the pid of the new process
90 90
  */
91
+#ifdef USE_TCP
91 92
 inline int fork_tcp_process(int child_id,char *desc,int r,int *reader_fd_1);
93
+#endif
92 94
 
93 95
 #endif
Browse code

- applied patch from Dragos Vingarzan <vingarzan@fokus.fraunhofer.de> which moves all the forking part into 2 functions in pt.c (fork_process and fork_tcp_process). - added PROC_NOCHLDINIT rank value for Dragos's fork_process (if this value is used as child_id/rank_value the mod_child functions will not be called) - added register_procs(processes_no), used from mod_init when a module knows that it will fork some children (replaces the old process_count++ / the patch's estimated_process_count++) - added get_max_procs(): returns the maximum (estimated) number of processes

Andrei Pelinescu-Onciul authored on 19/09/2006 16:13:27
Showing 1 changed files
... ...
@@ -32,6 +32,7 @@
32 32
  * History:
33 33
  * --------
34 34
  *  2003-04-15  added tcp_disable support (andrei)
35
+ *  2006-06-14	added process table in shared mem (dragos)
35 36
  */
36 37
 
37 38
 
... ...
@@ -40,33 +41,53 @@
40 41
 
41 42
 #include <sys/types.h>
42 43
 #include <unistd.h>
44
+#include <stdlib.h>
43 45
 
44 46
 #include "globals.h"
45 47
 #include "timer.h"
46 48
 #include "socket_info.h"
49
+#include "locking.h"
47 50
 
48
-#define MAX_PT_DESC	128
51
+#define MAX_PT_DESC			128
49 52
 
50 53
 struct process_table {
51 54
 	int pid;
52 55
 #ifdef USE_TCP
53
-	int unix_sock; /* unix socket on which tcp main listens */
54
-	int idx; /* tcp child index, -1 for other processes */
56
+	int unix_sock; 	/* unix socket on which tcp main listens	*/
57
+	int idx; 		/* tcp child index, -1 for other processes 	*/
55 58
 #endif
56 59
 	char desc[MAX_PT_DESC];
57 60
 };
58 61
 
59 62
 extern struct process_table *pt;
63
+extern gen_lock_t* process_lock;
64
+extern int *process_count;
60 65
 extern int process_no;
61
-extern int process_count;
62
-extern int last_process;
63 66
 
67
+extern struct tcp_child* tcp_children;
68
+
69
+inline int init_pt();
70
+int get_max_procs();
71
+int register_procs(int no);
64 72
 
65 73
 /* return processes pid */
66
-inline static int my_pid()
67
-{
68
-	return pt ? pt[process_no].pid : getpid();
69
-}
74
+inline int my_pid();
75
+
76
+/**
77
+ * Forks a new process.
78
+ * @param desc - text description for the process table
79
+ * @param make_sock - if to create a unix socket pair for it
80
+ * @returns the pid of the new process
81
+ */
82
+inline int fork_process(int child_id,char *desc,int make_sock);
70 83
 
84
+/**
85
+ * Forks a new TCP process.
86
+ * @param desc - text description for the process table
87
+ * @param r - index in the tcp_children array
88
+ * @param *reader_fd_1 - pointer to return the reader_fd[1]
89
+ * @returns the pid of the new process
90
+ */
91
+inline int fork_tcp_process(int child_id,char *desc,int r,int *reader_fd_1);
71 92
 
72 93
 #endif
Browse code

- Modules can properly register processes in SER process table - process_count function has been replaced by process_count variable - modules can increase the value of process_count in mod_init, this will be used to allocate process table that will be big enough - modules can create processes in child_init with rank PROC_MAIN - the index into process table is in last_process, this is where information about the new process should be recorded - do not forget to reset is_main in the new process otherwise it will not be terminated properly - modules should increate last_process before fork - the new child should set process_no = last_process

Jan Janak authored on 13/12/2005 12:10:15
Showing 1 changed files
... ...
@@ -58,34 +58,8 @@ struct process_table {
58 58
 
59 59
 extern struct process_table *pt;
60 60
 extern int process_no;
61
-
62
-/* get number of process started by main with
63
-   given configuration
64
-*/
65
-inline static int process_count()
66
-{
67
-	int udp_listeners;
68
-	struct socket_info* si;
69
-	
70
-	for (si=udp_listen, udp_listeners=0; si; si=si->next, udp_listeners++);
71
-    return 
72
-		/* receivers and attendant */
73
-		(dont_fork ? 1 : children_no*udp_listeners + 1)
74
-		/* timer process */
75
-		+ 1 /* always, we need it in most cases, and we can't tell here
76
-			   & now if we don't need it */
77
-#ifdef USE_SLOW_TIMER
78
-		+ 1 /* slow timer process */
79
-#endif
80
-		/* fifo server */
81
-		+((fifo==NULL || strlen(fifo)==0) ? 0 : 1 )
82
-		/* unixsock server*/
83
-		+(unixsock_name?unixsock_children:0)
84
-#ifdef USE_TCP
85
-		+((!tcp_disable)?( 1/* tcp main */ + tcp_children_no ):0) 
86
-#endif
87
-		;
88
-}
61
+extern int process_count;
62
+extern int last_process;
89 63
 
90 64
 
91 65
 /* return processes pid */
Browse code

New timer interface: - allows adding timers dynamically - supports one shot and periodic timers - precise - allows timeouts < 0.5 s (depends on the config., by default min. timeout = 62.5 ms) - based on a 3 level hierarchical timing wheel - very fast - low overhead for timer functions (most of the time, the excetion is timer_del which take can take quite a long time in special situations) - supports "slow" timers (compile option, by default on), "slow" timer = a timer handler which is declared as possible taking a long timer to execute. - backward compatible: old timer functions are preserverd => no changes needed for the existing code (although migration to the new interface is recommended) For more information read doc/timers.txt. tm timer update will follow shortly (this week).

Andrei Pelinescu-Onciul authored on 05/12/2005 18:29:30
Showing 1 changed files
... ...
@@ -74,6 +74,9 @@ inline static int process_count()
74 74
 		/* timer process */
75 75
 		+ 1 /* always, we need it in most cases, and we can't tell here
76 76
 			   & now if we don't need it */
77
+#ifdef USE_SLOW_TIMER
78
+		+ 1 /* slow timer process */
79
+#endif
77 80
 		/* fifo server */
78 81
 		+((fifo==NULL || strlen(fifo)==0) ? 0 : 1 )
79 82
 		/* unixsock server*/
Browse code

- process_count was wrong when tcp was disabled

Andrei Pelinescu-Onciul authored on 26/11/2004 16:27:22
Showing 1 changed files
... ...
@@ -72,18 +72,15 @@ inline static int process_count()
72 72
 		/* receivers and attendant */
73 73
 		(dont_fork ? 1 : children_no*udp_listeners + 1)
74 74
 		/* timer process */
75
-		+ (timer_list ? 1 : 0 )
75
+		+ 1 /* always, we need it in most cases, and we can't tell here
76
+			   & now if we don't need it */
76 77
 		/* fifo server */
77 78
 		+((fifo==NULL || strlen(fifo)==0) ? 0 : 1 )
78 79
 		/* unixsock server*/
79 80
 		+(unixsock_name?unixsock_children:0)
80 81
 #ifdef USE_TCP
81
-		+((!tcp_disable)?( 1/* tcp main */ + tcp_children_no + 
82
-							(timer_list ? 0: 1)):0) /* add the timer proc.
83
-													  if not already taken
84
-													  into account */
82
+		+((!tcp_disable)?( 1/* tcp main */ + tcp_children_no ):0) 
85 83
 #endif
86
-		
87 84
 		;
88 85
 }
89 86
 
Browse code

- Spelling checked - READMEs updated

Jan Janak authored on 24/08/2004 08:45:09
Showing 1 changed files
... ...
@@ -5,7 +5,7 @@
5 5
  *
6 6
  *
7 7
  *
8
- * Copyright (C) 2001-2003 Fhg Fokus
8
+ * Copyright (C) 2001-2003 FhG Fokus
9 9
  *
10 10
  * This file is part of ser, a free SIP server.
11 11
  *
... ...
@@ -88,7 +88,7 @@ inline static int process_count()
88 88
 }
89 89
 
90 90
 
91
-/* retun processes's pid */
91
+/* return processes pid */
92 92
 inline static int my_pid()
93 93
 {
94 94
 	return pt ? pt[process_no].pid : getpid();
Browse code

- updated process_count() to refelect the unixsock_server - changed version number to reflect the same thing

Andrei Pelinescu-Onciul authored on 03/03/2004 08:30:27
Showing 1 changed files
... ...
@@ -75,6 +75,8 @@ inline static int process_count()
75 75
 		+ (timer_list ? 1 : 0 )
76 76
 		/* fifo server */
77 77
 		+((fifo==NULL || strlen(fifo)==0) ? 0 : 1 )
78
+		/* unixsock server*/
79
+		+(unixsock_name?unixsock_children:0)
78 80
 #ifdef USE_TCP
79 81
 		+((!tcp_disable)?( 1/* tcp main */ + tcp_children_no + 
80 82
 							(timer_list ? 0: 1)):0) /* add the timer proc.
Browse code

- sock_lists completely re-organized

Andrei Pelinescu-Onciul authored on 24/10/2003 20:23:58
Showing 1 changed files
... ...
@@ -43,6 +43,7 @@
43 43
 
44 44
 #include "globals.h"
45 45
 #include "timer.h"
46
+#include "socket_info.h"
46 47
 
47 48
 #define MAX_PT_DESC	128
48 49
 
... ...
@@ -63,9 +64,13 @@ extern int process_no;
63 64
 */
64 65
 inline static int process_count()
65 66
 {
67
+	int udp_listeners;
68
+	struct socket_info* si;
69
+	
70
+	for (si=udp_listen, udp_listeners=0; si; si=si->next, udp_listeners++);
66 71
     return 
67 72
 		/* receivers and attendant */
68
-		(dont_fork ? 1 : children_no*sock_no + 1)
73
+		(dont_fork ? 1 : children_no*udp_listeners + 1)
69 74
 		/* timer process */
70 75
 		+ (timer_list ? 1 : 0 )
71 76
 		/* fifo server */
Browse code

- fixed process_count() (forgot to add some() when I added tcp_disable)

Andrei Pelinescu-Onciul authored on 18/04/2003 13:58:15
Showing 1 changed files
... ...
@@ -71,8 +71,8 @@ inline static int process_count()
71 71
 		/* fifo server */
72 72
 		+((fifo==NULL || strlen(fifo)==0) ? 0 : 1 )
73 73
 #ifdef USE_TCP
74
-		+ (!tcp_disable)?( 1/* tcp main */ + tcp_children_no + 
75
-							(timer_list ? 0: 1)):0 /* add the timer proc.
74
+		+((!tcp_disable)?( 1/* tcp main */ + tcp_children_no + 
75
+							(timer_list ? 0: 1)):0) /* add the timer proc.
76 76
 													  if not already taken
77 77
 													  into account */
78 78
 #endif
Browse code

- added disable tcp support (-T or disable_tcp=yes in the cfg) - the number of tcp "worker" processes is now setable (-N or tcp_children=NN) - replaced get_out_socket w/ get_send_socket in tm/uac.c & fixed some proto stuff (proto was not set properly when called w/ PROTO_NONE) - updated man pages & INSTALL

Andrei Pelinescu-Onciul authored on 15/04/2003 20:39:37
Showing 1 changed files
... ...
@@ -28,6 +28,11 @@
28 28
  * along with this program; if not, write to the Free Software 
29 29
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
30 30
  */
31
+/*
32
+ * History:
33
+ * --------
34
+ *  2003-04-15  added tcp_disable support (andrei)
35
+ */
31 36
 
32 37
 
33 38
 #ifndef _PT_H
... ...
@@ -66,9 +71,10 @@ inline static int process_count()
66 71
 		/* fifo server */
67 72
 		+((fifo==NULL || strlen(fifo)==0) ? 0 : 1 )
68 73
 #ifdef USE_TCP
69
-		+ 1/* tcp main */ + tcp_children_no + 
70
-		(timer_list ? 0: 1) /* add the timer proc. if not already taken
71
-							   into account */
74
+		+ (!tcp_disable)?( 1/* tcp main */ + tcp_children_no + 
75
+							(timer_list ? 0: 1)):0 /* add the timer proc.
76
+													  if not already taken
77
+													  into account */
72 78
 #endif
73 79
 		
74 80
 		;
Browse code

- increased ROUTE_MAX_REC_LEV to 100 - added new route commad: send_tcp(address, port) - tcp global vars (added new members to pt a.s.o) - tcp_send(buf, len, server, 0) will try to find an existing open tcp connection to "server"; if none found a new one will be opened (ser will also start listening on it for sip messages) - first udp to tcp & tcp to tcp send (not forward, I still have to solve some tricky via stuff)

Andrei Pelinescu-Onciul authored on 11/12/2002 21:30:44
Showing 1 changed files
... ...
@@ -43,6 +43,10 @@
43 43
 
44 44
 struct process_table {
45 45
 	int pid;
46
+#ifdef USE_TCP
47
+	int unix_sock; /* unix socket on which tcp main listens */
48
+	int idx; /* tcp child index, -1 for other processes */
49
+#endif
46 50
 	char desc[MAX_PT_DESC];
47 51
 };
48 52
 
Browse code

- even more tcp receive bs - sip msg.buff & orig are no longer 0 terminated (to avoid an extra copy in the tcp case)

Andrei Pelinescu-Onciul authored on 10/12/2002 19:41:44
Showing 1 changed files
... ...
@@ -60,7 +60,14 @@ inline static int process_count()
60 60
 		/* timer process */
61 61
 		+ (timer_list ? 1 : 0 )
62 62
 		/* fifo server */
63
-		+((fifo==NULL || strlen(fifo)==0) ? 0 : 1 );
63
+		+((fifo==NULL || strlen(fifo)==0) ? 0 : 1 )
64
+#ifdef USE_TCP
65
+		+ 1/* tcp main */ + tcp_children_no + 
66
+		(timer_list ? 0: 1) /* add the timer proc. if not already taken
67
+							   into account */
68
+#endif
69
+		
70
+		;
64 71
 }
65 72
 
66 73
 
Browse code

missing #define added

Jiri Kuthan authored on 25/09/2002 19:17:41
Showing 1 changed files
... ...
@@ -31,6 +31,7 @@
31 31
 
32 32
 
33 33
 #ifndef _PT_H
34
+#define _PT_H
34 35
 
35 36
 #include <sys/types.h>
36 37
 #include <unistd.h>
Browse code

GPLization banner introduced to *.[hc] files

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

process table introduced; rest of code aligned with proces_no bug_fix

Jiri Kuthan authored on 18/09/2002 07:49:31
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,49 @@
1
+/*
2
+ * $Id$
3
+ *
4
+ * Process Table
5
+ *
6
+ *
7
+ */
8
+
9
+#ifndef _PT_H
10
+
11
+#include <sys/types.h>
12
+#include <unistd.h>
13
+
14
+#include "globals.h"
15
+#include "timer.h"
16
+
17
+#define MAX_PT_DESC	128
18
+
19
+struct process_table {
20
+	int pid;
21
+	char desc[MAX_PT_DESC];
22
+};
23
+
24
+extern struct process_table *pt;
25
+extern int process_no;
26
+
27
+/* get number of process started by main with
28
+   given configuration
29
+*/
30
+inline static int process_count()
31
+{
32
+    return 
33
+		/* receivers and attendant */
34
+		(dont_fork ? 1 : children_no*sock_no + 1)
35
+		/* timer process */
36
+		+ (timer_list ? 1 : 0 )
37
+		/* fifo server */
38
+		+((fifo==NULL || strlen(fifo)==0) ? 0 : 1 );
39
+}
40
+
41
+
42
+/* retun processes's pid */
43
+inline static int my_pid()
44
+{
45
+	return pt ? pt[process_no].pid : getpid();
46
+}
47
+
48
+
49
+#endif