Browse code

pdb: new protocol between pdb_server and kama pdb module

Modified the communication protocol between the pdb clent <-> server such
that the server will give more feedback on scenarios like "pdb_id not found" or
"request number contains letters". New msg types or reply codes can be easily
added. Curent version of the protocol is 1 (0x01).
Also backwards compatibility is maintained when the first received byte is
different than the known versions (now, just 0x01).
Updated the http link for the get_carrier_germany script. Created a new perl
script to get german carrier id.
Updated doku (utils/pdbt/docs/network_protocol.txt).

added the perls script

Stefan Mititelu authored on 04/06/2015 08:34:19
Showing 1 changed files
... ...
@@ -55,10 +55,10 @@ void destroy_log(void) {
55 55
 
56 56
 
57 57
 
58
-void log_stdout(char * format, va_list ap)
58
+void log_stderr(char * format, va_list ap)
59 59
 {
60
-	vfprintf(stdout, format, ap);
61
-	fflush(stdout);
60
+	vfprintf(stderr, format, ap);
61
+	fflush(stderr);
62 62
 }
63 63
 
64 64
 
... ...
@@ -70,7 +70,7 @@ void pdb_log(int priority, char * format, ...) {
70 70
 	if (priority<=log_level) {
71 71
 		va_start(ap, format);
72 72
 		if (use_syslog) vsyslog(priority, format, ap);
73
-		else log_stdout(format, ap);
73
+		else log_stderr(format, ap);
74 74
 		va_end(ap);
75 75
 	}
76 76
 }
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
... ...
@@ -15,7 +15,7 @@
15 15
  *
16 16
  * You should have received a copy of the GNU General Public License 
17 17
  * along with this program; if not, write to the Free Software 
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19 19
  */
20 20
 
21 21
 #include "log.h"
Browse code

pdb: add daemon 'pdb_server' and optimising data compiler 'pdbt'

- add number portability database daemon and optimizing data compiler
- add debian packaging scripts for tool and daemon as well
- TODO:
- add documentation (run binaries with '-h' for now to get help)
- fix this redundant declaration of trie (dt* files) and logging (log*).
There exists already an implementation that uses the sr core parts for
this, but we import the proven implementation for now.
- add data helper scripts as well, they need some cleanup first
- initial implementation was done from Hardy Kahl @ 1&1 Internet Ag
- further bug fixes from Timo Reimann, timo dot reimann at 1und1 dot de

Henning Westerholt authored on 10/09/2009 16:35:05
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,76 @@
1
+/*
2
+ * Copyright (C) 2009 1&1 Internet AG
3
+ *
4
+ * This file is part of sip-router, a free SIP server.
5
+ *
6
+ * sip-router is free software; you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation; either version 2 of the License, or
9
+ * (at your option) any later version
10
+ *
11
+ * sip-router is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License 
17
+ * along with this program; if not, write to the Free Software 
18
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
+ */
20
+
21
+#include "log.h"
22
+#include <stdio.h>
23
+#include <stdarg.h>
24
+
25
+
26
+
27
+
28
+static int use_syslog = 0;
29
+static int log_level = LOG_WARNING;
30
+
31
+
32
+
33
+
34
+void init_log(char *_prgname, int _use_syslog) {
35
+	use_syslog = _use_syslog;
36
+	if (use_syslog) {
37
+		openlog(_prgname, LOG_PID, LOG_DAEMON);
38
+	}
39
+}
40
+
41
+
42
+
43
+
44
+void set_log_level(int level) {
45
+	log_level = level;
46
+}
47
+
48
+
49
+
50
+
51
+void destroy_log(void) {
52
+	if (use_syslog) closelog();
53
+}
54
+
55
+
56
+
57
+
58
+void log_stdout(char * format, va_list ap)
59
+{
60
+	vfprintf(stdout, format, ap);
61
+	fflush(stdout);
62
+}
63
+
64
+
65
+
66
+
67
+void pdb_log(int priority, char * format, ...) {
68
+	va_list ap;
69
+
70
+	if (priority<=log_level) {
71
+		va_start(ap, format);
72
+		if (use_syslog) vsyslog(priority, format, ap);
73
+		else log_stdout(format, ap);
74
+		va_end(ap);
75
+	}
76
+}