Browse code

core: relocated some folders from root and utils to misc

- utils keeps only the applications related to kamailio c code
- the other are now in misc/tools
- utils/misc/vim moved to misc/extra/
- obsolete and scripts folders moved to misc/

Daniel-Constantin Mierla authored on 07/12/2016 11:46:38
Showing 1 changed files
1 1
deleted file mode 100755
... ...
@@ -1,111 +0,0 @@
1
-#!/usr/bin/env sh
2
-#
3
-# This is a simple script which attempts to convert kamailio modules so that
4
-# they can be used with the sip-router core. Most of the changes done by the
5
-# script deal with the changes in the database abstraction layer in the
6
-# sip-router source tree. 
7
-#
8
-# Run this script in module directory to convert it from kamailio core to
9
-# sip-router core. The root of the tree should be two levels up, otherwise
10
-# relative paths to headers (../..) would not work and the module will not
11
-# compile.
12
-# 
13
-# Some of the changes done by the script:
14
-#
15
-#  * Extra defines in the Makefile to make the module link with libsrdb1
16
-#  * Path to database headers updated to point to lib/srdb1
17
-#  * db_con_t and db_res_t renamed to db1_con_t and db1_res_t in *.[ch]
18
-#  * Value type names such as DB_INT changed to DB1_INT in *.[ch]
19
-#
20
-# NOTE: There is no guarantee that the update module would compile or even
21
-#       work. Make a backup before running the script. You have been warned!
22
-# 
23
-# Written by Jan Janak <jan@iptel.org>
24
-#
25
-
26
-if [ ! -f Makefile ] ; then
27
-	echo "ERROR: Could not find module Makefile"
28
-	echo "       Run this file in the module directory"
29
-	exit 1
30
-fi
31
-
32
-if ! egrep "Makefile\.modules" Makefile >/dev/null ; then
33
-	echo "ERROR: Doesn't look like a module..."
34
-	exit 1
35
-fi
36
-
37
-if ! egrep '^#[ \t]*include[ \t]*".*\/db\/db(_(cap|con|id|key|op|pool|query|res|row|ut|val))?\.h[ \t]*"' *.[ch] >/dev/null ; then
38
-	echo "The module does not seem to include old database headers..."
39
-	exit 0
40
-fi
41
-
42
-echo -n "Updating Makefile..."
43
-cp Makefile Makefile.backup
44
-cat Makefile.backup | gawk '
45
-BEGIN {
46
-    serlibpath_seen = 0
47
-    libs_seen = 0
48
-    defs_seen = 0
49
-}
50
-
51
-# If the define already exists then skip it, this ensures that
52
-# we do not add the same line more than once.
53
-/^[ \t]*DEFS[ \t]*\+?=.*OPENSER_MOD_INTERFACE/ {
54
-    defs_seen = 1
55
-}
56
-
57
-/^[ \t]*DEFS[ \t]*\+?=.*KAMAILIO_MOD_INTERFACE/ {
58
-    defs_seen = 1
59
-}
60
-
61
-/^[ \t]*SER_LIBS[ \t]*\+?=.*srdb1\/srdb1/ {
62
-    libs_seen = 1
63
-}
64
-
65
-/^[ \t]*SERLIBPATH[ \t]*=/ {
66
-    serlibpath_seen = 1
67
-}
68
-
69
-# Write everything just before the line including Makefile.modules,
70
-# this is most likely the last line in the Makefile
71
-/^[ \t]*include[ \t]+.*\/Makefile\.modules[ \t]*$/ {
72
-    if (serlibpath_seen == 0) print "SERLIBPATH=../../lib"
73
-    if (defs_seen == 0) print "DEFS+=-DKAMAILIO_MOD_INTERFACE"
74
-    if (libs_seen == 0) print "SER_LIBS+=$(SERLIBPATH)/srdb1/srdb1"
75
-}
76
-
77
-{ print $0 }
78
-
79
-' > Makefile
80
-echo "done."
81
-
82
-for file in *.[ch] ; do
83
-	echo -n "Updating file $file..."
84
-	cp $file $file.backup
85
-	cat $file.backup | gawk '
86
-
87
-/^#[ \t]*include[ \t]*".*\/db\/db(_(cap|con|id|key|op|pool|query|res|row|ut|val))?\.h[ \t]*"/ {
88
-    sub("/db/", "/lib/srdb1/", $0);
89
-}
90
-
91
-/(^|[^a-zA-Z0-9_])(db_(con|res)_t|struct[ \t]+db_(con|res))([^a-zA-Z0-9_]|$)/ {
92
-    gsub("struct[ \t]+db_con", "struct db1_con", $0);
93
-    gsub("struct[ \t]+db_res", "struct db1_res", $0);
94
-    gsub("db_con_t", "db1_con_t", $0);
95
-    gsub("db_res_t", "db1_res_t", $0);
96
-}
97
-
98
-/(^|[^a-zA-Z0-9_])DB_((BIG)?INT|DOUBLE|STR(ING)?|DATETIME|BLOB|BITMAP)([^a-zA-Z0-9_]|$)/ {
99
-    gsub("DB_INT", "DB1_INT", $0);
100
-    gsub("DB_BIGINT", "DB1_BIGINT", $0);
101
-    gsub("DB_DOUBLE", "DB1_DOUBLE", $0);
102
-    gsub("DB_STR", "DB1_STR", $0);
103
-    gsub("DB_DATETIME", "DB1_DATETIME", $0);
104
-    gsub("DB_BLOB", "DB1_BLOB", $0);
105
-    gsub("DB_BITMAP", "DB1_BITMAP", $0);
106
-}
107
-
108
-{ print $0 }
109
-' >$file
110
-	echo "done."
111
-done
Browse code

all: OPENSER_MOD_INTERFACE replaced with KAMAILIO_MOD_INTERFACE

- OPENSER_MOD_INTERFACE still works if used in module Makefile

Daniel-Constantin Mierla authored on 18/10/2012 13:46:13
Showing 1 changed files
... ...
@@ -54,6 +54,10 @@ BEGIN {
54 54
     defs_seen = 1
55 55
 }
56 56
 
57
+/^[ \t]*DEFS[ \t]*\+?=.*KAMAILIO_MOD_INTERFACE/ {
58
+    defs_seen = 1
59
+}
60
+
57 61
 /^[ \t]*SER_LIBS[ \t]*\+?=.*srdb1\/srdb1/ {
58 62
     libs_seen = 1
59 63
 }
... ...
@@ -66,7 +70,7 @@ BEGIN {
66 70
 # this is most likely the last line in the Makefile
67 71
 /^[ \t]*include[ \t]+.*\/Makefile\.modules[ \t]*$/ {
68 72
     if (serlibpath_seen == 0) print "SERLIBPATH=../../lib"
69
-    if (defs_seen == 0) print "DEFS+=-DOPENSER_MOD_INTERFACE"
73
+    if (defs_seen == 0) print "DEFS+=-DKAMAILIO_MOD_INTERFACE"
70 74
     if (libs_seen == 0) print "SER_LIBS+=$(SERLIBPATH)/srdb1/srdb1"
71 75
 }
72 76
 
Browse code

Two small fixes in regular expressions.

The fixes include:
* db_con.h added to the regex matching header file names.
* Fixed regexp matching db_con_t and db_res_t structures (previously
did not match the two strings at the beginning of a line).

Jan Janak authored on 18/02/2009 00:09:22
Showing 1 changed files
... ...
@@ -34,7 +34,7 @@ if ! egrep "Makefile\.modules" Makefile >/dev/null ; then
34 34
 	exit 1
35 35
 fi
36 36
 
37
-if ! egrep '^#[ \t]*include[ \t]*".*\/db\/db(_(cap|id|key|op|pool|query|res|row|ut|val))?\.h[ \t]*"' *.[ch] >/dev/null ; then
37
+if ! egrep '^#[ \t]*include[ \t]*".*\/db\/db(_(cap|con|id|key|op|pool|query|res|row|ut|val))?\.h[ \t]*"' *.[ch] >/dev/null ; then
38 38
 	echo "The module does not seem to include old database headers..."
39 39
 	exit 0
40 40
 fi
... ...
@@ -80,18 +80,18 @@ for file in *.[ch] ; do
80 80
 	cp $file $file.backup
81 81
 	cat $file.backup | gawk '
82 82
 
83
-/^#[ \t]*include[ \t]*".*\/db\/db(_(cap|id|key|op|pool|query|res|row|ut|val))?\.h[ \t]*"/ {
83
+/^#[ \t]*include[ \t]*".*\/db\/db(_(cap|con|id|key|op|pool|query|res|row|ut|val))?\.h[ \t]*"/ {
84 84
     sub("/db/", "/lib/srdb1/", $0);
85 85
 }
86 86
 
87
-/[^a-zA-Z0-9_](db_(con|res)_t|struct[ \t]+db_(con|res))[^a-zA-Z0-9_]/ {
87
+/(^|[^a-zA-Z0-9_])(db_(con|res)_t|struct[ \t]+db_(con|res))([^a-zA-Z0-9_]|$)/ {
88 88
     gsub("struct[ \t]+db_con", "struct db1_con", $0);
89 89
     gsub("struct[ \t]+db_res", "struct db1_res", $0);
90 90
     gsub("db_con_t", "db1_con_t", $0);
91 91
     gsub("db_res_t", "db1_res_t", $0);
92 92
 }
93 93
 
94
-/[^a-zA-Z0-9_]DB_((BIG)?INT|DOUBLE|STR(ING)?|DATETIME|BLOB|BITMAP)[^a-zA-Z0-9_]/ {
94
+/(^|[^a-zA-Z0-9_])DB_((BIG)?INT|DOUBLE|STR(ING)?|DATETIME|BLOB|BITMAP)([^a-zA-Z0-9_]|$)/ {
95 95
     gsub("DB_INT", "DB1_INT", $0);
96 96
     gsub("DB_BIGINT", "DB1_BIGINT", $0);
97 97
     gsub("DB_DOUBLE", "DB1_DOUBLE", $0);
Browse code

Kamailio to sip-router module conversion script.

This is a simple script which attempts to convert modules that use kamalio
core to sip-router core.

Signed-off-by: Jan Janak <jan@iptel.org>

Jan Janak authored on 17/02/2009 18:13:11
Showing 1 changed files
1 1
new file mode 100755
... ...
@@ -0,0 +1,107 @@
1
+#!/usr/bin/env sh
2
+#
3
+# This is a simple script which attempts to convert kamailio modules so that
4
+# they can be used with the sip-router core. Most of the changes done by the
5
+# script deal with the changes in the database abstraction layer in the
6
+# sip-router source tree. 
7
+#
8
+# Run this script in module directory to convert it from kamailio core to
9
+# sip-router core. The root of the tree should be two levels up, otherwise
10
+# relative paths to headers (../..) would not work and the module will not
11
+# compile.
12
+# 
13
+# Some of the changes done by the script:
14
+#
15
+#  * Extra defines in the Makefile to make the module link with libsrdb1
16
+#  * Path to database headers updated to point to lib/srdb1
17
+#  * db_con_t and db_res_t renamed to db1_con_t and db1_res_t in *.[ch]
18
+#  * Value type names such as DB_INT changed to DB1_INT in *.[ch]
19
+#
20
+# NOTE: There is no guarantee that the update module would compile or even
21
+#       work. Make a backup before running the script. You have been warned!
22
+# 
23
+# Written by Jan Janak <jan@iptel.org>
24
+#
25
+
26
+if [ ! -f Makefile ] ; then
27
+	echo "ERROR: Could not find module Makefile"
28
+	echo "       Run this file in the module directory"
29
+	exit 1
30
+fi
31
+
32
+if ! egrep "Makefile\.modules" Makefile >/dev/null ; then
33
+	echo "ERROR: Doesn't look like a module..."
34
+	exit 1
35
+fi
36
+
37
+if ! egrep '^#[ \t]*include[ \t]*".*\/db\/db(_(cap|id|key|op|pool|query|res|row|ut|val))?\.h[ \t]*"' *.[ch] >/dev/null ; then
38
+	echo "The module does not seem to include old database headers..."
39
+	exit 0
40
+fi
41
+
42
+echo -n "Updating Makefile..."
43
+cp Makefile Makefile.backup
44
+cat Makefile.backup | gawk '
45
+BEGIN {
46
+    serlibpath_seen = 0
47
+    libs_seen = 0
48
+    defs_seen = 0
49
+}
50
+
51
+# If the define already exists then skip it, this ensures that
52
+# we do not add the same line more than once.
53
+/^[ \t]*DEFS[ \t]*\+?=.*OPENSER_MOD_INTERFACE/ {
54
+    defs_seen = 1
55
+}
56
+
57
+/^[ \t]*SER_LIBS[ \t]*\+?=.*srdb1\/srdb1/ {
58
+    libs_seen = 1
59
+}
60
+
61
+/^[ \t]*SERLIBPATH[ \t]*=/ {
62
+    serlibpath_seen = 1
63
+}
64
+
65
+# Write everything just before the line including Makefile.modules,
66
+# this is most likely the last line in the Makefile
67
+/^[ \t]*include[ \t]+.*\/Makefile\.modules[ \t]*$/ {
68
+    if (serlibpath_seen == 0) print "SERLIBPATH=../../lib"
69
+    if (defs_seen == 0) print "DEFS+=-DOPENSER_MOD_INTERFACE"
70
+    if (libs_seen == 0) print "SER_LIBS+=$(SERLIBPATH)/srdb1/srdb1"
71
+}
72
+
73
+{ print $0 }
74
+
75
+' > Makefile
76
+echo "done."
77
+
78
+for file in *.[ch] ; do
79
+	echo -n "Updating file $file..."
80
+	cp $file $file.backup
81
+	cat $file.backup | gawk '
82
+
83
+/^#[ \t]*include[ \t]*".*\/db\/db(_(cap|id|key|op|pool|query|res|row|ut|val))?\.h[ \t]*"/ {
84
+    sub("/db/", "/lib/srdb1/", $0);
85
+}
86
+
87
+/[^a-zA-Z0-9_](db_(con|res)_t|struct[ \t]+db_(con|res))[^a-zA-Z0-9_]/ {
88
+    gsub("struct[ \t]+db_con", "struct db1_con", $0);
89
+    gsub("struct[ \t]+db_res", "struct db1_res", $0);
90
+    gsub("db_con_t", "db1_con_t", $0);
91
+    gsub("db_res_t", "db1_res_t", $0);
92
+}
93
+
94
+/[^a-zA-Z0-9_]DB_((BIG)?INT|DOUBLE|STR(ING)?|DATETIME|BLOB|BITMAP)[^a-zA-Z0-9_]/ {
95
+    gsub("DB_INT", "DB1_INT", $0);
96
+    gsub("DB_BIGINT", "DB1_BIGINT", $0);
97
+    gsub("DB_DOUBLE", "DB1_DOUBLE", $0);
98
+    gsub("DB_STR", "DB1_STR", $0);
99
+    gsub("DB_DATETIME", "DB1_DATETIME", $0);
100
+    gsub("DB_BLOB", "DB1_BLOB", $0);
101
+    gsub("DB_BITMAP", "DB1_BITMAP", $0);
102
+}
103
+
104
+{ print $0 }
105
+' >$file
106
+	echo "done."
107
+done