Renaming userblacklist to userblocklist
... | ... |
@@ -30,7 +30,7 @@ mod_list_db=acc alias_db auth_db avpops cfg_db db_text db_flatstore \ |
30 | 30 |
db_cluster dialog dispatcher domain drouting group \ |
31 | 31 |
htable imc matrix mohqueue msilo mtree p_usrloc pdt permissions \ |
32 | 32 |
pipelimit prefix_route registrar sipcapture siptrace speeddial \ |
33 |
- sqlops uac uri_db userblacklist usrloc secfilter |
|
33 |
+ sqlops uac uri_db userblocklist usrloc secfilter |
|
34 | 34 |
|
35 | 35 |
|
36 | 36 |
# - common modules depending on database, using UID db schema |
37 | 37 |
similarity index 72% |
38 | 38 |
rename from src/lib/srdb1/schema/globalblacklist.xml |
39 | 39 |
rename to src/lib/srdb1/schema/globalblocklist.xml |
... | ... |
@@ -7,16 +7,16 @@ |
7 | 7 |
|
8 | 8 |
]> |
9 | 9 |
|
10 |
-<table id="globalblacklist" xmlns:db="http://docbook.org/ns/docbook"> |
|
11 |
- <name>globalblacklist</name> |
|
10 |
+<table id="globalblocklist" xmlns:db="http://docbook.org/ns/docbook"> |
|
11 |
+ <name>globalblocklist</name> |
|
12 | 12 |
<version>1</version> |
13 | 13 |
<type db="mysql">&MYSQL_TABLE_TYPE;</type> |
14 | 14 |
<description> |
15 |
- <db:para>This table is used by the userblacklist module for the global |
|
16 |
- blacklists. More information is available at: |
|
15 |
+ <db:para>This table is used by the userblocklist module for the global |
|
16 |
+ blocklists. More information is available at: |
|
17 | 17 |
<itemizedlist> |
18 | 18 |
<listitem> |
19 |
- <ulink url="&KAMAILIO_MOD_DOC;userblacklist.html">&KAMAILIO_MOD_DOC;userblacklist.html</ulink>. |
|
19 |
+ <ulink url="&KAMAILIO_MOD_DOC;userblocklist.html">&KAMAILIO_MOD_DOC;userblocklist.html</ulink>. |
|
20 | 20 |
</listitem> |
21 | 21 |
</itemizedlist> |
22 | 22 |
</db:para> |
... | ... |
@@ -37,15 +37,15 @@ |
37 | 37 |
<type>string</type> |
38 | 38 |
<size>&user_len;</size> |
39 | 39 |
<default/> |
40 |
- <description>The prefix that is matched for the blacklist.</description> |
|
40 |
+ <description>The prefix that is matched for the blocklist.</description> |
|
41 | 41 |
</column> |
42 | 42 |
|
43 | 43 |
<column> |
44 |
- <name>whitelist</name> |
|
44 |
+ <name>allowlist</name> |
|
45 | 45 |
<type>char</type> |
46 | 46 |
<size>1</size> |
47 | 47 |
<default>0</default> |
48 |
- <description>Specify if this a blacklist (0) or a whitelist (1) entry.</description> |
|
48 |
+ <description>Specify if this a blocklist (0) or a allowlist (1) entry.</description> |
|
49 | 49 |
</column> |
50 | 50 |
|
51 | 51 |
<column> |
... | ... |
@@ -58,7 +58,7 @@ |
58 | 58 |
</column> |
59 | 59 |
|
60 | 60 |
<index> |
61 |
- <name>globalblacklist_idx</name> |
|
61 |
+ <name>globalblocklist_idx</name> |
|
62 | 62 |
<colref linkend="prefix"/> |
63 | 63 |
</index> |
64 | 64 |
</table> |
65 | 65 |
similarity index 79% |
66 | 66 |
rename from src/lib/srdb1/schema/kamailio-userblacklist.xml |
67 | 67 |
rename to src/lib/srdb1/schema/kamailio-userblocklist.xml |
... | ... |
@@ -9,6 +9,6 @@ |
9 | 9 |
|
10 | 10 |
<database xmlns:xi="http://www.w3.org/2001/XInclude"> |
11 | 11 |
<name>USERBLACKLIST Module</name> |
12 |
- <xi:include href="userblacklist.xml"/> |
|
13 |
- <xi:include href="globalblacklist.xml"/> |
|
12 |
+ <xi:include href="userblocklist.xml"/> |
|
13 |
+ <xi:include href="globalblocklist.xml"/> |
|
14 | 14 |
</database> |
15 | 15 |
similarity index 70% |
16 | 16 |
rename from src/lib/srdb1/schema/userblacklist.xml |
17 | 17 |
rename to src/lib/srdb1/schema/userblocklist.xml |
... | ... |
@@ -7,17 +7,17 @@ |
7 | 7 |
|
8 | 8 |
]> |
9 | 9 |
|
10 |
-<table id="userblacklist" xmlns:db="http://docbook.org/ns/docbook"> |
|
11 |
- <name>userblacklist</name> |
|
10 |
+<table id="userblocklist" xmlns:db="http://docbook.org/ns/docbook"> |
|
11 |
+ <name>userblocklist</name> |
|
12 | 12 |
<version>1</version> |
13 | 13 |
<type db="mysql">&MYSQL_TABLE_TYPE;</type> |
14 | 14 |
<description> |
15 | 15 |
<db:para> |
16 |
- This table is used by the userblacklist module for the user specific |
|
17 |
- blacklists. More information is available at: |
|
16 |
+ This table is used by the userblocklist module for the user specific |
|
17 |
+ blocklists. More information is available at: |
|
18 | 18 |
<itemizedlist> |
19 | 19 |
<listitem> |
20 |
- <ulink url="&KAMAILIO_MOD_DOC;userblacklist.html">&KAMAILIO_MOD_DOC;userblacklist.html</ulink>. |
|
20 |
+ <ulink url="&KAMAILIO_MOD_DOC;userblocklist.html">&KAMAILIO_MOD_DOC;userblocklist.html</ulink>. |
|
21 | 21 |
</listitem> |
22 | 22 |
</itemizedlist> |
23 | 23 |
</db:para> |
... | ... |
@@ -38,7 +38,7 @@ |
38 | 38 |
<type>string</type> |
39 | 39 |
<size>&user_len;</size> |
40 | 40 |
<default/> |
41 |
- <description>The user that is used for the blacklist lookup.</description> |
|
41 |
+ <description>The user that is used for the blocklist lookup.</description> |
|
42 | 42 |
</column> |
43 | 43 |
|
44 | 44 |
<column id="domain"> |
... | ... |
@@ -46,7 +46,7 @@ |
46 | 46 |
<type>string</type> |
47 | 47 |
<size>&domain_len;</size> |
48 | 48 |
<default/> |
49 |
- <description>The domain that is used for the blacklist lookup.</description> |
|
49 |
+ <description>The domain that is used for the blocklist lookup.</description> |
|
50 | 50 |
</column> |
51 | 51 |
|
52 | 52 |
<column id="prefix"> |
... | ... |
@@ -54,19 +54,19 @@ |
54 | 54 |
<type>string</type> |
55 | 55 |
<size>&user_len;</size> |
56 | 56 |
<default/> |
57 |
- <description>The prefix that is matched for the blacklist.</description> |
|
57 |
+ <description>The prefix that is matched for the blocklist.</description> |
|
58 | 58 |
</column> |
59 | 59 |
|
60 | 60 |
<column> |
61 |
- <name>whitelist</name> |
|
61 |
+ <name>allowlist</name> |
|
62 | 62 |
<type>char</type> |
63 | 63 |
<size>1</size> |
64 | 64 |
<default>0</default> |
65 |
- <description>Specify if this a blacklist (0) or a whitelist (1) entry.</description> |
|
65 |
+ <description>Specify if this a blocklist (0) or a allowlist (1) entry.</description> |
|
66 | 66 |
</column> |
67 | 67 |
|
68 | 68 |
<index> |
69 |
- <name>userblacklist_idx</name> |
|
69 |
+ <name>userblocklist_idx</name> |
|
70 | 70 |
<colref linkend="username"/> |
71 | 71 |
<colref linkend="domain"/> |
72 | 72 |
<colref linkend="prefix"/> |
73 | 73 |
deleted file mode 100644 |
... | ... |
@@ -1,116 +0,0 @@ |
1 |
-/*! |
|
2 |
- * \file |
|
3 |
- * \ingroup db |
|
4 |
- * \brief Database support for modules. |
|
5 |
- * |
|
6 |
- * Database support functions for modules. |
|
7 |
- * |
|
8 |
- * @cond |
|
9 |
- * WARNING: |
|
10 |
- * This file was autogenerated from the XML source file |
|
11 |
- * ../../modules/userblacklist/kamailio-userblacklist.xml. |
|
12 |
- * It can be regenerated by running 'make modules' in the db/schema |
|
13 |
- * directory of the source code. You need to have xsltproc and |
|
14 |
- * docbook-xsl stylesheets installed. |
|
15 |
- * ALL CHANGES DONE HERE WILL BE LOST IF THE FILE IS REGENERATED |
|
16 |
- * @endcond |
|
17 |
- */ |
|
18 |
- |
|
19 |
-#include "db_userblacklist.h" |
|
20 |
- |
|
21 |
-/* database variables */ |
|
22 |
-/* TODO assign read-write or read-only URI, introduce a parameter in XML */ |
|
23 |
- |
|
24 |
-//extern str userblacklist_db_url; |
|
25 |
-db1_con_t * userblacklist_dbh = NULL; |
|
26 |
-db_func_t userblacklist_dbf; |
|
27 |
- |
|
28 |
-str userblacklist_table = str_init("userblacklist"); |
|
29 |
- |
|
30 |
-/* column names */ |
|
31 |
-str userblacklist_id_col = str_init("id"); |
|
32 |
-str userblacklist_username_col = str_init("username"); |
|
33 |
-str userblacklist_domain_col = str_init("domain"); |
|
34 |
-str userblacklist_prefix_col = str_init("prefix"); |
|
35 |
-str userblacklist_whitelist_col = str_init("whitelist"); |
|
36 |
- |
|
37 |
-/* table version */ |
|
38 |
-const unsigned int userblacklist_version = 1; |
|
39 |
- |
|
40 |
-str globalblacklist_table = str_init("globalblacklist"); |
|
41 |
- |
|
42 |
-/* column names */ |
|
43 |
-str globalblacklist_id_col = str_init("id"); |
|
44 |
-str globalblacklist_prefix_col = str_init("prefix"); |
|
45 |
-str globalblacklist_whitelist_col = str_init("whitelist"); |
|
46 |
-str globalblacklist_description_col = str_init("description"); |
|
47 |
- |
|
48 |
-/* table version */ |
|
49 |
-const unsigned int globalblacklist_version = 1; |
|
50 |
- |
|
51 |
- |
|
52 |
-/* |
|
53 |
- * Closes the DB connection. |
|
54 |
- */ |
|
55 |
-void userblacklist_db_close(void) { |
|
56 |
- if (userblacklist_dbh) { |
|
57 |
- userblacklist_dbf.close(userblacklist_dbh); |
|
58 |
- userblacklist_dbh = NULL; |
|
59 |
- } |
|
60 |
-} |
|
61 |
- |
|
62 |
- |
|
63 |
-/*! |
|
64 |
- * Initialises the DB API, check the table version and closes the connection. |
|
65 |
- * This should be called from the mod_init function. |
|
66 |
- * |
|
67 |
- * \return 0 means ok, -1 means an error occurred. |
|
68 |
- */ |
|
69 |
-int userblacklist_db_init(void) { |
|
70 |
- if (!userblacklist_db_url.s || !userblacklist_db_url.len) { |
|
71 |
- LM_ERR("you have to set the db_url module parameter.\n"); |
|
72 |
- return -1; |
|
73 |
- } |
|
74 |
- if (db_bind_mod(&userblacklist_db_url, &userblacklist_dbf) < 0) { |
|
75 |
- LM_ERR("can't bind database module.\n"); |
|
76 |
- return -1; |
|
77 |
- } |
|
78 |
- if ((userblacklist_dbh = userblacklist_dbf.init(&userblacklist_db_url)) == NULL) { |
|
79 |
- LM_ERR("can't connect to database.\n"); |
|
80 |
- return -1; |
|
81 |
- } |
|
82 |
- if (db_check_table_version(&userblacklist_dbf, userblacklist_dbh, |
|
83 |
- &userblacklist_table, userblacklist_version) < 0) { |
|
84 |
- DB_TABLE_VERSION_ERROR(userblacklist_table); |
|
85 |
- userblacklist_db_close(); |
|
86 |
- return -1; |
|
87 |
- } |
|
88 |
- if (db_check_table_version(&userblacklist_dbf, userblacklist_dbh, |
|
89 |
- &globalblacklist_table, globalblacklist_version) < 0) { |
|
90 |
- DB_TABLE_VERSION_ERROR(globalblacklist_table); |
|
91 |
- userblacklist_db_close(); |
|
92 |
- return -1; |
|
93 |
- } |
|
94 |
- userblacklist_db_close(); |
|
95 |
- return 0; |
|
96 |
-} |
|
97 |
- |
|
98 |
- |
|
99 |
-/*! |
|
100 |
- * Initialize the DB connection without checking the table version and DB URL. |
|
101 |
- * This should be called from child_init. An already existing database |
|
102 |
- * connection will be closed, and a new one created. |
|
103 |
- * |
|
104 |
- * \return 0 means ok, -1 means an error occurred. |
|
105 |
- */ |
|
106 |
-int userblacklist_db_open(void) { |
|
107 |
- if (userblacklist_dbh) { |
|
108 |
- userblacklist_dbf.close(userblacklist_dbh); |
|
109 |
- } |
|
110 |
- if ((userblacklist_dbh = userblacklist_dbf.init(&userblacklist_db_url)) == NULL) { |
|
111 |
- LM_ERR("can't connect to database.\n"); |
|
112 |
- return -1; |
|
113 |
- } |
|
114 |
- return 0; |
|
115 |
-} |
|
116 |
- |
117 | 0 |
deleted file mode 100644 |
... | ... |
@@ -1,100 +0,0 @@ |
1 |
-/*! |
|
2 |
- * \file |
|
3 |
- * \ingroup db |
|
4 |
- * \brief Database support for modules. |
|
5 |
- * |
|
6 |
- * Database support functions for modules. |
|
7 |
- * |
|
8 |
- * @cond |
|
9 |
- * WARNING: |
|
10 |
- * This file was autogenerated from the XML source file |
|
11 |
- * ../../modules/userblacklist/kamailio-userblacklist.xml. |
|
12 |
- * It can be regenerated by running 'make modules' in the db/schema |
|
13 |
- * directory of the source code. You need to have xsltproc and |
|
14 |
- * docbook-xsl stylesheets installed. |
|
15 |
- * ALL CHANGES DONE HERE WILL BE LOST IF THE FILE IS REGENERATED |
|
16 |
- * @endcond |
|
17 |
- */ |
|
18 |
- |
|
19 |
-#ifndef db_userblacklist_h |
|
20 |
-#define db_userblacklist_h |
|
21 |
- |
|
22 |
- |
|
23 |
-/* necessary includes */ |
|
24 |
-#include "../../lib/srdb1/db.h" |
|
25 |
-#include "../../core/str.h" |
|
26 |
-#include "../../core/ut.h" |
|
27 |
- |
|
28 |
-#include <string.h> |
|
29 |
- |
|
30 |
- |
|
31 |
-/* database variables */ |
|
32 |
- |
|
33 |
-extern str userblacklist_db_url; |
|
34 |
-extern db1_con_t * userblacklist_dbh; |
|
35 |
-extern db_func_t userblacklist_dbf; |
|
36 |
- |
|
37 |
-#define userblacklist_DB_URL { "db_url", PARAM_STR, &userblacklist_db_url }, |
|
38 |
- |
|
39 |
-#define userblacklist_DB_TABLE { "userblacklist_table", PARAM_STR, &userblacklist_table }, |
|
40 |
- |
|
41 |
-extern str userblacklist_table; |
|
42 |
- |
|
43 |
-/* column names */ |
|
44 |
-extern str userblacklist_id_col; |
|
45 |
-extern str userblacklist_username_col; |
|
46 |
-extern str userblacklist_domain_col; |
|
47 |
-extern str userblacklist_prefix_col; |
|
48 |
-extern str userblacklist_whitelist_col; |
|
49 |
-#define userblacklist_DB_COLS \ |
|
50 |
-{ "userblacklist_id_col", PARAM_STR, &userblacklist_id_col }, \ |
|
51 |
-{ "userblacklist_username_col", PARAM_STR, &userblacklist_username_col }, \ |
|
52 |
-{ "userblacklist_domain_col", PARAM_STR, &userblacklist_domain_col }, \ |
|
53 |
-{ "userblacklist_prefix_col", PARAM_STR, &userblacklist_prefix_col }, \ |
|
54 |
-{ "userblacklist_whitelist_col", PARAM_STR, &userblacklist_whitelist_col }, \ |
|
55 |
- |
|
56 |
-/* table version */ |
|
57 |
-extern const unsigned int userblacklist_version; |
|
58 |
- |
|
59 |
-#define globalblacklist_DB_TABLE { "globalblacklist_table", PARAM_STR, &globalblacklist_table }, |
|
60 |
- |
|
61 |
-extern str globalblacklist_table; |
|
62 |
- |
|
63 |
-/* column names */ |
|
64 |
-extern str globalblacklist_id_col; |
|
65 |
-extern str globalblacklist_prefix_col; |
|
66 |
-extern str globalblacklist_whitelist_col; |
|
67 |
-extern str globalblacklist_description_col; |
|
68 |
-#define globalblacklist_DB_COLS \ |
|
69 |
-{ "globalblacklist_id_col", PARAM_STR, &globalblacklist_id_col }, \ |
|
70 |
-{ "globalblacklist_prefix_col", PARAM_STR, &globalblacklist_prefix_col }, \ |
|
71 |
-{ "globalblacklist_whitelist_col", PARAM_STR, &globalblacklist_whitelist_col }, \ |
|
72 |
-{ "globalblacklist_description_col", PARAM_STR, &globalblacklist_description_col }, \ |
|
73 |
- |
|
74 |
-/* table version */ |
|
75 |
-extern const unsigned int globalblacklist_version; |
|
76 |
- |
|
77 |
- |
|
78 |
-/* |
|
79 |
- * Closes the DB connection. |
|
80 |
- */ |
|
81 |
-void userblacklist_db_close(void); |
|
82 |
- |
|
83 |
-/*! |
|
84 |
- * Initialises the DB API, check the table version and closes the connection. |
|
85 |
- * This should be called from the mod_init function. |
|
86 |
- * |
|
87 |
- * \return 0 means ok, -1 means an error occurred. |
|
88 |
- */ |
|
89 |
-int userblacklist_db_init(void); |
|
90 |
- |
|
91 |
-/*! |
|
92 |
- * Initialize the DB connection without checking the table version and DB URL. |
|
93 |
- * This should be called from child_init. An already existing database |
|
94 |
- * connection will be closed, and a new one created. |
|
95 |
- * |
|
96 |
- * \return 0 means ok, -1 means an error occurred. |
|
97 |
- */ |
|
98 |
-int userblacklist_db_open(void); |
|
99 |
- |
|
100 |
-#endif |
9 | 9 |
similarity index 56% |
10 | 10 |
rename from src/modules/userblacklist/README |
11 | 11 |
rename to src/modules/userblocklist/README |
... | ... |
@@ -1,4 +1,4 @@ |
1 |
-userblacklist Module |
|
1 |
+userblocklist Module |
|
2 | 2 |
|
3 | 3 |
Edited by |
4 | 4 |
|
... | ... |
@@ -30,40 +30,40 @@ Pawel Kuzak |
30 | 30 |
3.1. use_domain (integer) |
31 | 31 |
3.2. match_mode (integer) |
32 | 32 |
3.3. db_url (String) |
33 |
- 3.4. userblacklist_table (String) |
|
34 |
- 3.5. userblacklist_id_col (string) |
|
35 |
- 3.6. userblacklist_username_col (string) |
|
36 |
- 3.7. userblacklist_domain_col (string) |
|
37 |
- 3.8. userblacklist_prefix_col (string) |
|
38 |
- 3.9. userblacklist_whitelist_col (string) |
|
39 |
- 3.10. globalblacklist_table (String) |
|
40 |
- 3.11. globalblacklist_id_col (string) |
|
41 |
- 3.12. globalblacklist_prefix_col (string) |
|
42 |
- 3.13. globalblacklist_whitelist_col (string) |
|
43 |
- 3.14. globalblacklist_description_col (string) |
|
33 |
+ 3.4. userblocklist_table (String) |
|
34 |
+ 3.5. userblocklist_id_col (string) |
|
35 |
+ 3.6. userblocklist_username_col (string) |
|
36 |
+ 3.7. userblocklist_domain_col (string) |
|
37 |
+ 3.8. userblocklist_prefix_col (string) |
|
38 |
+ 3.9. userblocklist_whitelist_col (string) |
|
39 |
+ 3.10. globalblocklist_table (String) |
|
40 |
+ 3.11. globalblocklist_id_col (string) |
|
41 |
+ 3.12. globalblocklist_prefix_col (string) |
|
42 |
+ 3.13. globalblocklist_whitelist_col (string) |
|
43 |
+ 3.14. globalblocklist_description_col (string) |
|
44 | 44 |
|
45 | 45 |
4. Functions |
46 | 46 |
|
47 |
- 4.1. check_user_blacklist (string user, string domain, |
|
47 |
+ 4.1. check_user_blocklist (string user, string domain, |
|
48 | 48 |
string number, string table) |
49 | 49 |
|
50 | 50 |
4.2. check_user_whitelist (string user, string domain, |
51 | 51 |
string number, string table) |
52 | 52 |
|
53 |
- 4.3. check_blacklist ([string table]) |
|
53 |
+ 4.3. check_blocklist ([string table]) |
|
54 | 54 |
4.4. check_whitelist (string table) |
55 | 55 |
|
56 | 56 |
5. RPC Commands |
57 | 57 |
|
58 |
- 5.1. userblacklist.reload_blacklist |
|
58 |
+ 5.1. userblocklist.reload_blocklist |
|
59 | 59 |
|
60 | 60 |
6. MI Commands |
61 | 61 |
|
62 |
- 6.1. reload_blacklist |
|
63 |
- 6.2. dump_blacklist |
|
64 |
- 6.3. check_blacklist prefix |
|
62 |
+ 6.1. reload_blocklist |
|
63 |
+ 6.2. dump_blocklist |
|
64 |
+ 6.3. check_blocklist prefix |
|
65 | 65 |
6.4. check_whitelist prefix |
66 |
- 6.5. check_userblacklist user [domain] prefix |
|
66 |
+ 6.5. check_userblocklist user [domain] prefix |
|
67 | 67 |
6.6. check_userwhitelist user [domain] prefix |
68 | 68 |
|
69 | 69 |
7. Installation and Running |
... | ... |
@@ -75,30 +75,30 @@ Pawel Kuzak |
75 | 75 |
1.1. Set use_domain parameter |
76 | 76 |
1.2. Set match_mode parameter |
77 | 77 |
1.3. Set db_url parameter |
78 |
- 1.4. Set userblacklist_table parameter |
|
79 |
- 1.5. Set userblacklist_id_col parameter |
|
80 |
- 1.6. Set userblacklist_username_col parameter |
|
81 |
- 1.7. Set userblacklist_domain_col parameter |
|
82 |
- 1.8. Set userblacklist_prefix_col parameter |
|
83 |
- 1.9. Set userblacklist_whitelist_col parameter |
|
84 |
- 1.10. Set globalblacklist_table parameter |
|
85 |
- 1.11. Set globalblacklist_id_col parameter |
|
86 |
- 1.12. Set globalblacklist_prefix_col parameter |
|
87 |
- 1.13. Set globalblacklist_whitelist_col parameter |
|
88 |
- 1.14. Set globalblacklist_description_col parameter |
|
89 |
- 1.15. check_user_blacklist usage |
|
78 |
+ 1.4. Set userblocklist_table parameter |
|
79 |
+ 1.5. Set userblocklist_id_col parameter |
|
80 |
+ 1.6. Set userblocklist_username_col parameter |
|
81 |
+ 1.7. Set userblocklist_domain_col parameter |
|
82 |
+ 1.8. Set userblocklist_prefix_col parameter |
|
83 |
+ 1.9. Set userblocklist_whitelist_col parameter |
|
84 |
+ 1.10. Set globalblocklist_table parameter |
|
85 |
+ 1.11. Set globalblocklist_id_col parameter |
|
86 |
+ 1.12. Set globalblocklist_prefix_col parameter |
|
87 |
+ 1.13. Set globalblocklist_whitelist_col parameter |
|
88 |
+ 1.14. Set globalblocklist_description_col parameter |
|
89 |
+ 1.15. check_user_blocklist usage |
|
90 | 90 |
1.16. check_user_whitelist usage |
91 |
- 1.17. check_blacklist usage |
|
91 |
+ 1.17. check_blocklist usage |
|
92 | 92 |
1.18. check_whitelist usage |
93 |
- 1.19. userblacklist.reload_blacklist usage |
|
94 |
- 1.20. reload_blacklist usage |
|
95 |
- 1.21. dump_blacklist usage |
|
96 |
- 1.22. check_blacklist usage |
|
93 |
+ 1.19. userblocklist.reload_blocklist usage |
|
94 |
+ 1.20. reload_blocklist usage |
|
95 |
+ 1.21. dump_blocklist usage |
|
96 |
+ 1.22. check_blocklist usage |
|
97 | 97 |
1.23. check_whitelist usage |
98 |
- 1.24. check_userblacklist usage |
|
98 |
+ 1.24. check_userblocklist usage |
|
99 | 99 |
1.25. check_userwhitelist usage |
100 |
- 1.26. Example database content - globalblacklist table |
|
101 |
- 1.27. Example database content - userblacklist table |
|
100 |
+ 1.26. Example database content - globalblocklist table |
|
101 |
+ 1.27. Example database content - userblocklist table |
|
102 | 102 |
|
103 | 103 |
Chapter 1. Admin Guide |
104 | 104 |
|
... | ... |
@@ -115,40 +115,40 @@ Chapter 1. Admin Guide |
115 | 115 |
3.1. use_domain (integer) |
116 | 116 |
3.2. match_mode (integer) |
117 | 117 |
3.3. db_url (String) |
118 |
- 3.4. userblacklist_table (String) |
|
119 |
- 3.5. userblacklist_id_col (string) |
|
120 |
- 3.6. userblacklist_username_col (string) |
|
121 |
- 3.7. userblacklist_domain_col (string) |
|
122 |
- 3.8. userblacklist_prefix_col (string) |
|
123 |
- 3.9. userblacklist_whitelist_col (string) |
|
124 |
- 3.10. globalblacklist_table (String) |
|
125 |
- 3.11. globalblacklist_id_col (string) |
|
126 |
- 3.12. globalblacklist_prefix_col (string) |
|
127 |
- 3.13. globalblacklist_whitelist_col (string) |
|
128 |
- 3.14. globalblacklist_description_col (string) |
|
118 |
+ 3.4. userblocklist_table (String) |
|
119 |
+ 3.5. userblocklist_id_col (string) |
|
120 |
+ 3.6. userblocklist_username_col (string) |
|
121 |
+ 3.7. userblocklist_domain_col (string) |
|
122 |
+ 3.8. userblocklist_prefix_col (string) |
|
123 |
+ 3.9. userblocklist_whitelist_col (string) |
|
124 |
+ 3.10. globalblocklist_table (String) |
|
125 |
+ 3.11. globalblocklist_id_col (string) |
|
126 |
+ 3.12. globalblocklist_prefix_col (string) |
|
127 |
+ 3.13. globalblocklist_whitelist_col (string) |
|
128 |
+ 3.14. globalblocklist_description_col (string) |
|
129 | 129 |
|
130 | 130 |
4. Functions |
131 | 131 |
|
132 |
- 4.1. check_user_blacklist (string user, string domain, string |
|
132 |
+ 4.1. check_user_blocklist (string user, string domain, string |
|
133 | 133 |
number, string table) |
134 | 134 |
|
135 | 135 |
4.2. check_user_whitelist (string user, string domain, string |
136 | 136 |
number, string table) |
137 | 137 |
|
138 |
- 4.3. check_blacklist ([string table]) |
|
138 |
+ 4.3. check_blocklist ([string table]) |
|
139 | 139 |
4.4. check_whitelist (string table) |
140 | 140 |
|
141 | 141 |
5. RPC Commands |
142 | 142 |
|
143 |
- 5.1. userblacklist.reload_blacklist |
|
143 |
+ 5.1. userblocklist.reload_blocklist |
|
144 | 144 |
|
145 | 145 |
6. MI Commands |
146 | 146 |
|
147 |
- 6.1. reload_blacklist |
|
148 |
- 6.2. dump_blacklist |
|
149 |
- 6.3. check_blacklist prefix |
|
147 |
+ 6.1. reload_blocklist |
|
148 |
+ 6.2. dump_blocklist |
|
149 |
+ 6.3. check_blocklist prefix |
|
150 | 150 |
6.4. check_whitelist prefix |
151 |
- 6.5. check_userblacklist user [domain] prefix |
|
151 |
+ 6.5. check_userblocklist user [domain] prefix |
|
152 | 152 |
6.6. check_userwhitelist user [domain] prefix |
153 | 153 |
|
154 | 154 |
7. Installation and Running |
... | ... |
@@ -157,25 +157,25 @@ Chapter 1. Admin Guide |
157 | 157 |
|
158 | 158 |
1. Overview |
159 | 159 |
|
160 |
- The userblacklist module allows Kamailio to handle blacklists on a per |
|
160 |
+ The userblocklist module allows Kamailio to handle blocklists on a per |
|
161 | 161 |
user basis. This information is stored in a database table, which is |
162 | 162 |
queried to decide if the number (more exactly, the request URI user) is |
163 |
- blacklisted or not. |
|
163 |
+ blocklisted or not. |
|
164 | 164 |
|
165 | 165 |
An additional functionality that this module provides is the ability to |
166 |
- handle global blacklists. This lists are loaded on startup into memory, |
|
167 |
- thus providing a better performance than the userblacklist case. These |
|
168 |
- global blacklists are useful to allow only calls to certain |
|
166 |
+ handle global blocklists. This lists are loaded on startup into memory, |
|
167 |
+ thus providing a better performance than the userblocklist case. These |
|
168 |
+ global blocklists are useful to allow only calls to certain |
|
169 | 169 |
international destinations, i.e. block all not whitelisted numbers. |
170 |
- They could also be used to prevent the blacklisting of important |
|
170 |
+ They could also be used to prevent the blocklisting of important |
|
171 | 171 |
numbers, as whitelisting is supported too. This is useful for example |
172 | 172 |
to prevent the customer from blocking emergency call number or service |
173 | 173 |
hotlines. |
174 | 174 |
|
175 |
- The module exports four functions, check_blacklist, check_whitelist, |
|
176 |
- check_user_blacklist and check_user_whitelist for usage in the |
|
175 |
+ The module exports four functions, check_blocklist, check_whitelist, |
|
176 |
+ check_user_blocklist and check_user_whitelist for usage in the |
|
177 | 177 |
configuration file. Furthermore it provides a MI function to reload the |
178 |
- global blacklist cache. |
|
178 |
+ global blocklist cache. |
|
179 | 179 |
|
180 | 180 |
Please note that only numerical strings for matching are supported at |
181 | 181 |
the moment (the used library supports this already, but its not yet |
... | ... |
@@ -205,28 +205,28 @@ Chapter 1. Admin Guide |
205 | 205 |
3.1. use_domain (integer) |
206 | 206 |
3.2. match_mode (integer) |
207 | 207 |
3.3. db_url (String) |
208 |
- 3.4. userblacklist_table (String) |
|
209 |
- 3.5. userblacklist_id_col (string) |
|
210 |
- 3.6. userblacklist_username_col (string) |
|
211 |
- 3.7. userblacklist_domain_col (string) |
|
212 |
- 3.8. userblacklist_prefix_col (string) |
|
213 |
- 3.9. userblacklist_whitelist_col (string) |
|
214 |
- 3.10. globalblacklist_table (String) |
|
215 |
- 3.11. globalblacklist_id_col (string) |
|
216 |
- 3.12. globalblacklist_prefix_col (string) |
|
217 |
- 3.13. globalblacklist_whitelist_col (string) |
|
218 |
- 3.14. globalblacklist_description_col (string) |
|
208 |
+ 3.4. userblocklist_table (String) |
|
209 |
+ 3.5. userblocklist_id_col (string) |
|
210 |
+ 3.6. userblocklist_username_col (string) |
|
211 |
+ 3.7. userblocklist_domain_col (string) |
|
212 |
+ 3.8. userblocklist_prefix_col (string) |
|
213 |
+ 3.9. userblocklist_whitelist_col (string) |
|
214 |
+ 3.10. globalblocklist_table (String) |
|
215 |
+ 3.11. globalblocklist_id_col (string) |
|
216 |
+ 3.12. globalblocklist_prefix_col (string) |
|
217 |
+ 3.13. globalblocklist_whitelist_col (string) |
|
218 |
+ 3.14. globalblocklist_description_col (string) |
|
219 | 219 |
|
220 | 220 |
3.1. use_domain (integer) |
221 | 221 |
|
222 |
- If set to non-zero value, the domain column in the userblacklist table |
|
222 |
+ If set to non-zero value, the domain column in the userblocklist table |
|
223 | 223 |
is used. |
224 | 224 |
|
225 | 225 |
Default value is “0”. |
226 | 226 |
|
227 | 227 |
Example 1.1. Set use_domain parameter |
228 | 228 |
... |
229 |
-modparam("userblacklist", "use_domain", 1) |
|
229 |
+modparam("userblocklist", "use_domain", 1) |
|
230 | 230 |
... |
231 | 231 |
|
232 | 232 |
3.2. match_mode (integer) |
... | ... |
@@ -242,7 +242,7 @@ modparam("userblacklist", "use_domain", 1) |
242 | 242 |
|
243 | 243 |
Example 1.2. Set match_mode parameter |
244 | 244 |
... |
245 |
-modparam("userblacklist", "match_mode", 128) |
|
245 |
+modparam("userblocklist", "match_mode", 128) |
|
246 | 246 |
... |
247 | 247 |
|
248 | 248 |
3.3. db_url (String) |
... | ... |
@@ -253,127 +253,127 @@ modparam("userblacklist", "match_mode", 128) |
253 | 253 |
|
254 | 254 |
Example 1.3. Set db_url parameter |
255 | 255 |
... |
256 |
-modparam("userblacklist", "db_url", "dbdriver://username:password@dbhost/dbname" |
|
256 |
+modparam("userblocklist", "db_url", "dbdriver://username:password@dbhost/dbname" |
|
257 | 257 |
) |
258 | 258 |
... |
259 | 259 |
|
260 |
-3.4. userblacklist_table (String) |
|
260 |
+3.4. userblocklist_table (String) |
|
261 | 261 |
|
262 |
- Name of the userblacklist table for the userblacklist module. |
|
262 |
+ Name of the userblocklist table for the userblocklist module. |
|
263 | 263 |
|
264 |
- Default value is “userblacklist”. |
|
264 |
+ Default value is “userblocklist”. |
|
265 | 265 |
|
266 |
- Example 1.4. Set userblacklist_table parameter |
|
266 |
+ Example 1.4. Set userblocklist_table parameter |
|
267 | 267 |
... |
268 |
-modparam("userblacklist", "userblacklist_table", "userblacklist") |
|
268 |
+modparam("userblocklist", "userblocklist_table", "userblocklist") |
|
269 | 269 |
... |
270 | 270 |
|
271 |
-3.5. userblacklist_id_col (string) |
|
271 |
+3.5. userblocklist_id_col (string) |
|
272 | 272 |
|
273 | 273 |
unique ID |
274 | 274 |
|
275 |
- Example 1.5. Set userblacklist_id_col parameter |
|
275 |
+ Example 1.5. Set userblocklist_id_col parameter |
|
276 | 276 |
... |
277 |
-modparam("userblacklist", "userblacklist_id_col", "id") |
|
277 |
+modparam("userblocklist", "userblocklist_id_col", "id") |
|
278 | 278 |
... |
279 | 279 |
|
280 |
-3.6. userblacklist_username_col (string) |
|
280 |
+3.6. userblocklist_username_col (string) |
|
281 | 281 |
|
282 |
- The user that is used for the blacklist lookup. |
|
282 |
+ The user that is used for the blocklist lookup. |
|
283 | 283 |
|
284 |
- Example 1.6. Set userblacklist_username_col parameter |
|
284 |
+ Example 1.6. Set userblocklist_username_col parameter |
|
285 | 285 |
... |
286 |
-modparam("userblacklist", "userblacklist_username_col", "username") |
|
286 |
+modparam("userblocklist", "userblocklist_username_col", "username") |
|
287 | 287 |
... |
288 | 288 |
|
289 |
-3.7. userblacklist_domain_col (string) |
|
289 |
+3.7. userblocklist_domain_col (string) |
|
290 | 290 |
|
291 |
- The domain that is used for the blacklist lookup. |
|
291 |
+ The domain that is used for the blocklist lookup. |
|
292 | 292 |
|
293 |
- Example 1.7. Set userblacklist_domain_col parameter |
|
293 |
+ Example 1.7. Set userblocklist_domain_col parameter |
|
294 | 294 |
... |
295 |
-modparam("userblacklist", "userblacklist_domain_col", "domain") |
|
295 |
+modparam("userblocklist", "userblocklist_domain_col", "domain") |
|
296 | 296 |
... |
297 | 297 |
|
298 |
-3.8. userblacklist_prefix_col (string) |
|
298 |
+3.8. userblocklist_prefix_col (string) |
|
299 | 299 |
|
300 |
- The prefix that is matched for the blacklist. |
|
300 |
+ The prefix that is matched for the blocklist. |
|
301 | 301 |
|
302 |
- Example 1.8. Set userblacklist_prefix_col parameter |
|
302 |
+ Example 1.8. Set userblocklist_prefix_col parameter |
|
303 | 303 |
... |
304 |
-modparam("userblacklist", "userblacklist_prefix_col", "prefix") |
|
304 |
+modparam("userblocklist", "userblocklist_prefix_col", "prefix") |
|
305 | 305 |
... |
306 | 306 |
|
307 |
-3.9. userblacklist_whitelist_col (string) |
|
307 |
+3.9. userblocklist_whitelist_col (string) |
|
308 | 308 |
|
309 |
- Specify if this a blacklist (0) or a whitelist (1) entry. |
|
309 |
+ Specify if this a blocklist (0) or a whitelist (1) entry. |
|
310 | 310 |
|
311 |
- Example 1.9. Set userblacklist_whitelist_col parameter |
|
311 |
+ Example 1.9. Set userblocklist_whitelist_col parameter |
|
312 | 312 |
... |
313 |
-modparam("userblacklist", "userblacklist_whitelist_col", "whitelist") |
|
313 |
+modparam("userblocklist", "userblocklist_whitelist_col", "whitelist") |
|
314 | 314 |
... |
315 | 315 |
|
316 |
-3.10. globalblacklist_table (String) |
|
316 |
+3.10. globalblocklist_table (String) |
|
317 | 317 |
|
318 |
- Name of the globalblacklist table for the userblacklist module. Please |
|
319 |
- note that this table is used when the check_blacklist function is |
|
318 |
+ Name of the globalblocklist table for the userblocklist module. Please |
|
319 |
+ note that this table is used when the check_blocklist function is |
|
320 | 320 |
called with no parameters. |
321 | 321 |
|
322 |
- Default value is “globalblacklist”. |
|
322 |
+ Default value is “globalblocklist”. |
|
323 | 323 |
|
324 |
- Example 1.10. Set globalblacklist_table parameter |
|
324 |
+ Example 1.10. Set globalblocklist_table parameter |
|
325 | 325 |
... |
326 |
-modparam("userblacklist", "globalblacklist_table", "globalblacklist") |
|
326 |
+modparam("userblocklist", "globalblocklist_table", "globalblocklist") |
|
327 | 327 |
... |
328 | 328 |
|
329 |
-3.11. globalblacklist_id_col (string) |
|
329 |
+3.11. globalblocklist_id_col (string) |
|
330 | 330 |
|
331 | 331 |
unique ID |
332 | 332 |
|
333 |
- Example 1.11. Set globalblacklist_id_col parameter |
|
333 |
+ Example 1.11. Set globalblocklist_id_col parameter |
|
334 | 334 |
... |
335 |
-modparam("userblacklist", "globalblacklist_id_col", "id") |
|
335 |
+modparam("userblocklist", "globalblocklist_id_col", "id") |
|
336 | 336 |
... |
337 | 337 |
|
338 |
-3.12. globalblacklist_prefix_col (string) |
|
338 |
+3.12. globalblocklist_prefix_col (string) |
|
339 | 339 |
|
340 |
- The prefix that is matched for the blacklist. |
|
340 |
+ The prefix that is matched for the blocklist. |
|
341 | 341 |
|
342 |
- Example 1.12. Set globalblacklist_prefix_col parameter |
|
342 |
+ Example 1.12. Set globalblocklist_prefix_col parameter |
|
343 | 343 |
... |
344 |
-modparam("userblacklist", "globalblacklist_prefix_col", "prefix") |
|
344 |
+modparam("userblocklist", "globalblocklist_prefix_col", "prefix") |
|
345 | 345 |
... |
346 | 346 |
|
347 |
-3.13. globalblacklist_whitelist_col (string) |
|
347 |
+3.13. globalblocklist_whitelist_col (string) |
|
348 | 348 |
|
349 |
- Specify if this a blacklist (0) or a whitelist (1) entry. |
|
349 |
+ Specify if this a blocklist (0) or a whitelist (1) entry. |
|
350 | 350 |
|
351 |
- Example 1.13. Set globalblacklist_whitelist_col parameter |
|
351 |
+ Example 1.13. Set globalblocklist_whitelist_col parameter |
|
352 | 352 |
... |
353 |
-modparam("userblacklist", "globalblacklist_whitelist_col", "whitelist") |
|
353 |
+modparam("userblocklist", "globalblocklist_whitelist_col", "whitelist") |
|
354 | 354 |
... |
355 | 355 |
|
356 |
-3.14. globalblacklist_description_col (string) |
|
356 |
+3.14. globalblocklist_description_col (string) |
|
357 | 357 |
|
358 | 358 |
A comment for the entry. |
359 | 359 |
|
360 |
- Example 1.14. Set globalblacklist_description_col parameter |
|
360 |
+ Example 1.14. Set globalblocklist_description_col parameter |
|
361 | 361 |
... |
362 |
-modparam("userblacklist", "globalblacklist_description_col", "description") |
|
362 |
+modparam("userblocklist", "globalblocklist_description_col", "description") |
|
363 | 363 |
... |
364 | 364 |
|
365 | 365 |
4. Functions |
366 | 366 |
|
367 |
- 4.1. check_user_blacklist (string user, string domain, string number, |
|
367 |
+ 4.1. check_user_blocklist (string user, string domain, string number, |
|
368 | 368 |
string table) |
369 | 369 |
|
370 | 370 |
4.2. check_user_whitelist (string user, string domain, string number, |
371 | 371 |
string table) |
372 | 372 |
|
373 |
- 4.3. check_blacklist ([string table]) |
|
373 |
+ 4.3. check_blocklist ([string table]) |
|
374 | 374 |
4.4. check_whitelist (string table) |
375 | 375 |
|
376 |
-4.1. check_user_blacklist (string user, string domain, string number, string |
|
376 |
+4.1. check_user_blocklist (string user, string domain, string number, string |
|
377 | 377 |
table) |
378 | 378 |
|
379 | 379 |
Finds the longest prefix that matches the request URI user (or the |
... | ... |
@@ -384,11 +384,11 @@ table) |
384 | 384 |
are optional, the defaults are used if they are omitted. The number |
385 | 385 |
parameter can be used to check for example against the from URI user. |
386 | 386 |
|
387 |
- Example 1.15. check_user_blacklist usage |
|
387 |
+ Example 1.15. check_user_blocklist usage |
|
388 | 388 |
... |
389 | 389 |
$avp(i:80) = $rU; |
390 | 390 |
# rewrite the R-URI |
391 |
-if (!check_user_blacklist("$avp(i:80)", "$avp(i:82)")) { |
|
391 |
+if (!check_user_blocklist("$avp(i:80)", "$avp(i:82)")) { |
|
392 | 392 |
sl_send_reply("403", "Forbidden"); |
393 | 393 |
exit; |
394 | 394 |
} |
... | ... |
@@ -415,16 +415,16 @@ if (!check_user_whitelist("$avp(i:80)", "$avp(i:82)")) { |
415 | 415 |
} |
416 | 416 |
... |
417 | 417 |
|
418 |
-4.3. check_blacklist ([string table]) |
|
418 |
+4.3. check_blocklist ([string table]) |
|
419 | 419 |
|
420 | 420 |
Finds the longest prefix that matches the request URI for the given |
421 | 421 |
table. If a match is found and it is not set to whitelist, false is |
422 | 422 |
returned. Otherwise, true is returned. If no table is given, then |
423 |
- globalblacklist_table is used. |
|
423 |
+ globalblocklist_table is used. |
|
424 | 424 |
|
425 |
- Example 1.17. check_blacklist usage |
|
425 |
+ Example 1.17. check_blocklist usage |
|
426 | 426 |
... |
427 |
-if (!check_blacklist("globalblacklist")) { |
|
427 |
+if (!check_blocklist("globalblocklist")) { |
|
428 | 428 |
sl_send_reply("403", "Forbidden"); |
429 | 429 |
exit; |
430 | 430 |
} |
... | ... |
@@ -438,7 +438,7 @@ if (!check_blacklist("globalblacklist")) { |
438 | 438 |
|
439 | 439 |
Example 1.18. check_whitelist usage |
440 | 440 |
... |
441 |
-if (!check_whitelist("globalblacklist")) { |
|
441 |
+if (!check_whitelist("globalblocklist")) { |
|
442 | 442 |
sl_send_reply("403", "Forbidden"); |
443 | 443 |
exit; |
444 | 444 |
} |
... | ... |
@@ -446,62 +446,62 @@ if (!check_whitelist("globalblacklist")) { |
446 | 446 |
|
447 | 447 |
5. RPC Commands |
448 | 448 |
|
449 |
- 5.1. userblacklist.reload_blacklist |
|
449 |
+ 5.1. userblocklist.reload_blocklist |
|
450 | 450 |
|
451 |
-5.1. userblacklist.reload_blacklist |
|
451 |
+5.1. userblocklist.reload_blocklist |
|
452 | 452 |
|
453 |
- Reload the internal global blacklist cache. This is necessary after the |
|
454 |
- database tables for the global blacklist have been changed. |
|
453 |
+ Reload the internal global blocklist cache. This is necessary after the |
|
454 |
+ database tables for the global blocklist have been changed. |
|
455 | 455 |
|
456 |
- Example 1.19. userblacklist.reload_blacklist usage |
|
456 |
+ Example 1.19. userblocklist.reload_blocklist usage |
|
457 | 457 |
... |
458 |
-kamcmd userblacklist.reload_blacklist |
|
458 |
+kamcmd userblocklist.reload_blocklist |
|
459 | 459 |
... |
460 | 460 |
|
461 | 461 |
6. MI Commands |
462 | 462 |
|
463 |
- 6.1. reload_blacklist |
|
464 |
- 6.2. dump_blacklist |
|
465 |
- 6.3. check_blacklist prefix |
|
463 |
+ 6.1. reload_blocklist |
|
464 |
+ 6.2. dump_blocklist |
|
465 |
+ 6.3. check_blocklist prefix |
|
466 | 466 |
6.4. check_whitelist prefix |
467 |
- 6.5. check_userblacklist user [domain] prefix |
|
467 |
+ 6.5. check_userblocklist user [domain] prefix |
|
468 | 468 |
6.6. check_userwhitelist user [domain] prefix |
469 | 469 |
|
470 |
-6.1. reload_blacklist |
|
470 |
+6.1. reload_blocklist |
|
471 | 471 |
|
472 |
- Reload the internal global blacklist cache. This is necessary after the |
|
473 |
- database tables for the global blacklist have been changed. |
|
472 |
+ Reload the internal global blocklist cache. This is necessary after the |
|
473 |
+ database tables for the global blocklist have been changed. |
|
474 | 474 |
|
475 |
- Example 1.20. reload_blacklist usage |
|
475 |
+ Example 1.20. reload_blocklist usage |
|
476 | 476 |
... |
477 |
- kamctl fifo reload_blacklist |
|
477 |
+ kamctl fifo reload_blocklist |
|
478 | 478 |
... |
479 | 479 |
|
480 |
-6.2. dump_blacklist |
|
480 |
+6.2. dump_blocklist |
|
481 | 481 |
|
482 |
- Dumps the default, in memory, global_blacklist content to stdout. Note |
|
483 |
- that a reload_blacklist should be issued before, in order to see the |
|
482 |
+ Dumps the default, in memory, global_blocklist content to stdout. Note |
|
483 |
+ that a reload_blocklist should be issued before, in order to see the |
|
484 | 484 |
latest content of the database. |
485 | 485 |
|
486 |
- Example 1.21. dump_blacklist usage |
|
486 |
+ Example 1.21. dump_blocklist usage |
|
487 | 487 |
... |
488 |
- kamctl fifo reload_blacklist |
|
489 |
- kamctl fifo dump_blacklist |
|
488 |
+ kamctl fifo reload_blocklist |
|
489 |
+ kamctl fifo dump_blocklist |
|
490 | 490 |
... |
491 | 491 |
|
492 |
-6.3. check_blacklist prefix |
|
492 |
+6.3. check_blocklist prefix |
|
493 | 493 |
|
494 | 494 |
Searches in the default, in memory, global list. Finds the longest |
495 | 495 |
prefix that matches the given prefix parameter. Returns true if the |
496 | 496 |
prefix is found and the whitelist is not set. Returns false otherwise - |
497 | 497 |
either prefix found and whitelist set or prefix not found. Note that a |
498 |
- reload_blacklist should be issued before, in order to check through the |
|
498 |
+ reload_blocklist should be issued before, in order to check through the |
|
499 | 499 |
latest content of the database. |
500 | 500 |
|
501 |
- Example 1.22. check_blacklist usage |
|
501 |
+ Example 1.22. check_blocklist usage |
|
502 | 502 |
... |
503 |
- kamctl fifo reload_blacklist |
|
504 |
- kamctl fifo check_blacklist prefix |
|
503 |
+ kamctl fifo reload_blocklist |
|
504 |
+ kamctl fifo check_blocklist prefix |
|
505 | 505 |
... |
506 | 506 |
|
507 | 507 |
6.4. check_whitelist prefix |
... | ... |
@@ -510,16 +510,16 @@ kamcmd userblacklist.reload_blacklist |
510 | 510 |
prefix that matches the given prefix parameter. Returns true if the |
511 | 511 |
prefix is found and the whitelist is set. Returns false otherwise - |
512 | 512 |
either prefix found and whitelist not set or prefix not found. Note |
513 |
- that a reload_blacklist should be issued before, in order to check |
|
513 |
+ that a reload_blocklist should be issued before, in order to check |
|
514 | 514 |
through the latest content of the database. |
515 | 515 |
|
516 | 516 |
Example 1.23. check_whitelist usage |
517 | 517 |
... |
518 |
- kamctl fifo reload_blacklist |
|
518 |
+ kamctl fifo reload_blocklist |
|
519 | 519 |
kamctl fifo check_whitelist prefix |
520 | 520 |
... |
521 | 521 |
|
522 |
-6.5. check_userblacklist user [domain] prefix |
|
522 |
+6.5. check_userblocklist user [domain] prefix |
|
523 | 523 |
|
524 | 524 |
Searches in the default user list table. Finds the longest prefix for |
525 | 525 |
the given user@domain that matches the given prefix parameter. Returns |
... | ... |
@@ -528,9 +528,9 @@ kamcmd userblacklist.reload_blacklist |
528 | 528 |
Note that the domain parameter is optional. If not given, the second |
529 | 529 |
parameter is the considered to be the prefix. |
530 | 530 |
|
531 |
- Example 1.24. check_userblacklist usage |
|
531 |
+ Example 1.24. check_userblocklist usage |
|
532 | 532 |
... |
533 |
- kamctl fifo check_userblacklist user [do |
|
533 |
+ kamctl fifo check_userblocklist user [do |
|
534 | 534 |
main] prefix |
535 | 535 |
... |
536 | 536 |
|
... | ... |
@@ -555,18 +555,18 @@ main] prefix |
555 | 555 |
|
556 | 556 |
7.1. Database setup |
557 | 557 |
|
558 |
- Before running Kamailio with the userblacklist module, you have to |
|
559 |
- setup the database table where the module will read the blacklist data. |
|
558 |
+ Before running Kamailio with the userblocklist module, you have to |
|
559 |
+ setup the database table where the module will read the blocklist data. |
|
560 | 560 |
For that, if the table was not created by the installation script or |
561 | 561 |
you choose to install everything by yourself you can use the |
562 |
- userblacklist-create.sql SQL script in the database directories in the |
|
562 |
+ userblocklist-create.sql SQL script in the database directories in the |
|
563 | 563 |
kamailio/scripts folder as template. Database and table name can be set |
564 | 564 |
with module parameters so they can be changed, but the name of the |
565 | 565 |
columns must be as they are in the SQL script. You can also find the |
566 | 566 |
complete database documentation on the project webpage, |
567 | 567 |
https://www.kamailio.org/docs/db-tables/kamailio-db-devel.html. |
568 | 568 |
|
569 |
- Example 1.26. Example database content - globalblacklist table |
|
569 |
+ Example 1.26. Example database content - globalblocklist table |
|
570 | 570 |
... |
571 | 571 |
+----+-----------+-----------+ |
572 | 572 |
| id | prefix | whitelist | |
... | ... |
@@ -578,12 +578,12 @@ main] prefix |
578 | 578 |
+----+-----------+-----------+ |
579 | 579 |
... |
580 | 580 |
|
581 |
- This table will setup a global blacklist for all numbers, only allowing |
|
581 |
+ This table will setup a global blocklist for all numbers, only allowing |
|
582 | 582 |
calls starting with “1”. Numbers that starts with “123456” and |
583 |
- “123455787” are also blacklisted, because the longest prefix will be |
|
583 |
+ “123455787” are also blocklisted, because the longest prefix will be |
|
584 | 584 |
matched. |
585 | 585 |
|
586 |
- Example 1.27. Example database content - userblacklist table |
|
586 |
+ Example 1.27. Example database content - userblocklist table |
|
587 | 587 |
... |
588 | 588 |
+----+----------------+-------------+-----------+-----------+ |
589 | 589 |
| id | username | domain | prefix | whitelist | |
... | ... |
@@ -598,7 +598,7 @@ main] prefix |
598 | 598 |
+----+----------------+-------------+-----------+-----------+ |
599 | 599 |
... |
600 | 600 |
|
601 |
- This table will setup user specific blacklists for certain usernames. |
|
601 |
+ This table will setup user specific blocklists for certain usernames. |
|
602 | 602 |
For example for user “49721123456788” the prefix “1234” will be not |
603 | 603 |
allowed, but the number “123456788” is allowed. Additionally a domain |
604 | 604 |
could be specified that is used for username matching if the |
605 | 605 |
similarity index 79% |
606 | 606 |
rename from src/modules/userblacklist/db.c |
607 | 607 |
rename to src/modules/userblocklist/db.c |
... | ... |
@@ -20,13 +20,13 @@ |
20 | 20 |
|
21 | 21 |
/*! |
22 | 22 |
* \file |
23 |
- * \brief USERBLACKLIST :: database access |
|
24 |
- * \ingroup userblacklist |
|
25 |
- * - Module: \ref userblacklist |
|
23 |
+ * \brief USERBLOCKLIST :: database access |
|
24 |
+ * \ingroup userblocklist |
|
25 |
+ * - Module: \ref userblocklist |
|
26 | 26 |
*/ |
27 | 27 |
|
28 | 28 |
#include "db.h" |
29 |
-#include "db_userblacklist.h" |
|
29 |
+#include "db_userblocklist.h" |
|
30 | 30 |
|
31 | 31 |
#include "../../lib/srdb1/db.h" |
32 | 32 |
#include "../../core/mem/mem.h" |
... | ... |
@@ -45,8 +45,8 @@ extern int match_mode; |
45 | 45 |
int db_build_userbl_tree(const str *username, const str *domain, |
46 | 46 |
const str *dbtable, struct dtrie_node_t *root, int use_domain) |
47 | 47 |
{ |
48 |
- db_key_t columns[2] = { &userblacklist_prefix_col, &userblacklist_whitelist_col }; |
|
49 |
- db_key_t key[2] = { &userblacklist_username_col, &userblacklist_domain_col }; |
|
48 |
+ db_key_t columns[2] = { &userblocklist_prefix_col, &userblocklist_allowlist_col }; |
|
49 |
+ db_key_t key[2] = { &userblocklist_username_col, &userblocklist_domain_col }; |
|
50 | 50 |
|
51 | 51 |
db_val_t val[2]; |
52 | 52 |
db1_res_t *res; |
... | ... |
@@ -60,11 +60,11 @@ int db_build_userbl_tree(const str *username, const str *domain, |
60 | 60 |
VAL_STR(val + 1).s = domain->s; |
61 | 61 |
VAL_STR(val + 1).len = domain->len; |
62 | 62 |
|
63 |
- if (userblacklist_dbf.use_table(userblacklist_dbh, dbtable) < 0) { |
|
63 |
+ if (userblocklist_dbf.use_table(userblocklist_dbh, dbtable) < 0) { |
|
64 | 64 |
LM_ERR("cannot use db table '%.*s'.\n", dbtable->len, dbtable->s); |
65 | 65 |
return -1; |
66 | 66 |
} |
67 |
- if (userblacklist_dbf.query(userblacklist_dbh, key, 0, val, columns, |
|
67 |
+ if (userblocklist_dbf.query(userblocklist_dbh, key, 0, val, columns, |
|
68 | 68 |
(!use_domain) ? (1) : (2), 2, 0, &res) < 0) { |
69 | 69 |
LM_ERR("error while executing query on db table '%.*s'\n", |
70 | 70 |
dbtable->len, dbtable->s); |
... | ... |
@@ -79,13 +79,13 @@ int db_build_userbl_tree(const str *username, const str *domain, |
79 | 79 |
if ((RES_ROWS(res)[i].values[0].type == DB1_STRING) && |
80 | 80 |
(RES_ROWS(res)[i].values[1].type == DB1_INT)) { |
81 | 81 |
|
82 |
- /* LM_DBG("insert into tree prefix %s, whitelist %d", |
|
82 |
+ /* LM_DBG("insert into tree prefix %s, allowlist %d", |
|
83 | 83 |
RES_ROWS(res)[i].values[0].val.string_val, |
84 | 84 |
RES_ROWS(res)[i].values[1].val.int_val); */ |
85 | 85 |
if (RES_ROWS(res)[i].values[1].val.int_val == 0) { |
86 |
- nodeflags=(void *)MARK_BLACKLIST; |
|
86 |
+ nodeflags=(void *)MARK_BLOCKLIST; |
|
87 | 87 |
} else { |
88 |
- nodeflags=(void *)MARK_WHITELIST; |
|
88 |
+ nodeflags=(void *)MARK_ALLOWLIST; |
|
89 | 89 |
} |
90 | 90 |
|
91 | 91 |
if (dtrie_insert(root, RES_ROWS(res)[i].values[0].val.string_val, |
... | ... |
@@ -101,7 +101,7 @@ int db_build_userbl_tree(const str *username, const str *domain, |
101 | 101 |
} |
102 | 102 |
} |
103 | 103 |
} |
104 |
- userblacklist_dbf.free_result(userblacklist_dbh, res); |
|
104 |
+ userblocklist_dbf.free_result(userblocklist_dbh, res); |
|
105 | 105 |
|
106 | 106 |
return n; |
107 | 107 |
} |
... | ... |
@@ -113,17 +113,17 @@ int db_build_userbl_tree(const str *username, const str *domain, |
113 | 113 |
*/ |
114 | 114 |
int db_reload_source(const str *dbtable, struct dtrie_node_t *root) |
115 | 115 |
{ |
116 |
- db_key_t columns[2] = { &globalblacklist_prefix_col, &globalblacklist_whitelist_col }; |
|
116 |
+ db_key_t columns[2] = { &globalblocklist_prefix_col, &globalblocklist_allowlist_col }; |
|
117 | 117 |
db1_res_t *res; |
118 | 118 |
int i; |
119 | 119 |
int n = 0; |
120 | 120 |
void *nodeflags; |
121 | 121 |
|
122 |
- if (userblacklist_dbf.use_table(userblacklist_dbh, dbtable) < 0) { |
|
122 |
+ if (userblocklist_dbf.use_table(userblocklist_dbh, dbtable) < 0) { |
|
123 | 123 |
LM_ERR("cannot use db table '%.*s'\n", dbtable->len, dbtable->s); |
124 | 124 |
return -1; |
125 | 125 |
} |
126 |
- if (userblacklist_dbf.query(userblacklist_dbh, NULL, NULL, NULL, |
|
126 |
+ if (userblocklist_dbf.query(userblocklist_dbh, NULL, NULL, NULL, |
|
127 | 127 |
columns, 0, 2, NULL, &res) < 0) { |
128 | 128 |
LM_ERR("error while executing query on db table '%.*s'\n", |
129 | 129 |
dbtable->len, dbtable->s); |
... | ... |
@@ -138,13 +138,13 @@ int db_reload_source(const str *dbtable, struct dtrie_node_t *root) |
138 | 138 |
if ((RES_ROWS(res)[i].values[0].type == DB1_STRING) && |
139 | 139 |
(RES_ROWS(res)[i].values[1].type == DB1_INT)) { |
140 | 140 |
|
141 |
- /* LM_DBG("insert into tree prefix %s, whitelist %d", |
|
141 |
+ /* LM_DBG("insert into tree prefix %s, allowlist %d", |
|
142 | 142 |
RES_ROWS(res)[i].values[0].val.string_val, |
143 | 143 |
RES_ROWS(res)[i].values[1].val.int_val); */ |
144 | 144 |
if (RES_ROWS(res)[i].values[1].val.int_val == 0) { |
145 |
- nodeflags=(void *)MARK_BLACKLIST; |
|
145 |
+ nodeflags=(void *)MARK_BLOCKLIST; |
|
146 | 146 |
} else { |
147 |
- nodeflags=(void *)MARK_WHITELIST; |
|
147 |
+ nodeflags=(void *)MARK_ALLOWLIST; |
|
148 | 148 |
} |
149 | 149 |
|
150 | 150 |
if (dtrie_insert(root, RES_ROWS(res)[i].values[0].val.string_val, |
... | ... |
@@ -160,7 +160,7 @@ int db_reload_source(const str *dbtable, struct dtrie_node_t *root) |
160 | 160 |
} |
161 | 161 |
} |
162 | 162 |
} |
163 |
- userblacklist_dbf.free_result(userblacklist_dbh, res); |
|
163 |
+ userblocklist_dbf.free_result(userblocklist_dbh, res); |
|
164 | 164 |
|
165 | 165 |
return n; |
166 | 166 |
} |
167 | 167 |
similarity index 88% |
168 | 168 |
rename from src/modules/userblacklist/db.h |
169 | 169 |
rename to src/modules/userblocklist/db.h |
... | ... |
@@ -20,9 +20,9 @@ |
20 | 20 |
|
21 | 21 |
/*! |
22 | 22 |
* \file |
23 |
- * \brief USERBLACKLIST :: database access |
|
24 |
- * \ingroup userblacklist |
|
25 |
- * - Module: \ref userblacklist |
|
23 |
+ * \brief USERBLOCKLIST :: database access |
|
24 |
+ * \ingroup userblocklist |
|
25 |
+ * - Module: \ref userblocklist |
|
26 | 26 |
*/ |
27 | 27 |
|
28 | 28 |
#ifndef _DB_H_ |
... | ... |
@@ -31,8 +31,8 @@ |
31 | 31 |
#include "../../core/sr_module.h" |
32 | 32 |
#include "../../lib/trie/dtrie.h" |
33 | 33 |
|
34 |
-#define MARK_WHITELIST 1 |
|
35 |
-#define MARK_BLACKLIST 2 |
|
34 |
+#define MARK_ALLOWLIST 1 |
|
35 |
+#define MARK_BLOCKLIST 2 |
|
36 | 36 |
|
37 | 37 |
int db_build_userbl_tree(const str *user, const str *domain, const str *table, struct dtrie_node_t *root, int use_domain); |
38 | 38 |
int db_reload_source(const str *table, struct dtrie_node_t *root); |
39 | 39 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,116 @@ |
1 |
+/*! |
|
2 |
+ * \file |
|
3 |
+ * \ingroup db |
|
4 |
+ * \brief Database support for modules. |
|
5 |
+ * |
|
6 |
+ * Database support functions for modules. |
|
7 |
+ * |
|
8 |
+ * @cond |
|
9 |
+ * WARNING: |
|
10 |
+ * This file was autogenerated from the XML source file |
|
11 |
+ * ../../modules/userblocklist/kamailio-userblocklist.xml. |
|
12 |
+ * It can be regenerated by running 'make modules' in the db/schema |
|
13 |
+ * directory of the source code. You need to have xsltproc and |
|
14 |
+ * docbook-xsl stylesheets installed. |
|
15 |
+ * ALL CHANGES DONE HERE WILL BE LOST IF THE FILE IS REGENERATED |
|
16 |
+ * @endcond |
|
17 |
+ */ |
|
18 |
+ |
|
19 |
+#include "db_userblocklist.h" |
|
20 |
+ |
|
21 |
+/* database variables */ |
|
22 |
+/* TODO assign read-write or read-only URI, introduce a parameter in XML */ |
|
23 |
+ |
|
24 |
+//extern str userblocklist_db_url; |
|
25 |
+db1_con_t * userblocklist_dbh = NULL; |
|
26 |
+db_func_t userblocklist_dbf; |
|
27 |
+ |
|
28 |
+str userblocklist_table = str_init("userblocklist"); |
|
29 |
+ |
|
30 |
+/* column names */ |
|
31 |
+str userblocklist_id_col = str_init("id"); |
|
32 |
+str userblocklist_username_col = str_init("username"); |
|
33 |
+str userblocklist_domain_col = str_init("domain"); |
|
34 |
+str userblocklist_prefix_col = str_init("prefix"); |
|
35 |
+str userblocklist_allowlist_col = str_init("allowlist"); |
|
36 |
+ |
|
37 |
+/* table version */ |
|
38 |
+const unsigned int userblocklist_version = 1; |
|
39 |
+ |
|
40 |
+str globalblocklist_table = str_init("globalblocklist"); |
|
41 |
+ |
|
42 |
+/* column names */ |
|
43 |
+str globalblocklist_id_col = str_init("id"); |
|
44 |
+str globalblocklist_prefix_col = str_init("prefix"); |
|
45 |
+str globalblocklist_allowlist_col = str_init("allowlist"); |
|
46 |
+str globalblocklist_description_col = str_init("description"); |
|
47 |
+ |
|
48 |
+/* table version */ |
|
49 |
+const unsigned int globalblocklist_version = 1; |
|
50 |
+ |
|
51 |
+ |
|
52 |
+/* |
|
53 |
+ * Closes the DB connection. |
|
54 |
+ */ |
|
55 |
+void userblocklist_db_close(void) { |
|
56 |
+ if (userblocklist_dbh) { |
|
57 |
+ userblocklist_dbf.close(userblocklist_dbh); |
|
58 |
+ userblocklist_dbh = NULL; |
|
59 |
+ } |
|
60 |
+} |
|
61 |
+ |
|
62 |
+ |
|
63 |
+/*! |
|
64 |
+ * Initialises the DB API, check the table version and closes the connection. |
|
65 |
+ * This should be called from the mod_init function. |
|
66 |
+ * |
|
67 |
+ * \return 0 means ok, -1 means an error occurred. |
|
68 |
+ */ |
|
69 |
+int userblocklist_db_init(void) { |
|
70 |
+ if (!userblocklist_db_url.s || !userblocklist_db_url.len) { |
|
71 |
+ LM_ERR("you have to set the db_url module parameter.\n"); |
|
72 |
+ return -1; |
|
73 |
+ } |
|
74 |
+ if (db_bind_mod(&userblocklist_db_url, &userblocklist_dbf) < 0) { |
|
75 |
+ LM_ERR("can't bind database module.\n"); |
|
76 |
+ return -1; |
|
77 |
+ } |
|
78 |
+ if ((userblocklist_dbh = userblocklist_dbf.init(&userblocklist_db_url)) == NULL) { |
|
79 |
+ LM_ERR("can't connect to database.\n"); |
|
80 |
+ return -1; |
|
81 |
+ } |
|
82 |
+ if (db_check_table_version(&userblocklist_dbf, userblocklist_dbh, |
|
83 |
+ &userblocklist_table, userblocklist_version) < 0) { |
|
84 |
+ DB_TABLE_VERSION_ERROR(userblocklist_table); |
|
85 |
+ userblocklist_db_close(); |
|
86 |
+ return -1; |
|
87 |
+ } |
|
88 |
+ if (db_check_table_version(&userblocklist_dbf, userblocklist_dbh, |
|
89 |
+ &globalblocklist_table, globalblocklist_version) < 0) { |
|
90 |
+ DB_TABLE_VERSION_ERROR(globalblocklist_table); |
|
91 |
+ userblocklist_db_close(); |
|
92 |
+ return -1; |
|
93 |
+ } |
|
94 |
+ userblocklist_db_close(); |
|
95 |
+ return 0; |
|
96 |
+} |
|
97 |
+ |
|
98 |
+ |
|
99 |
+/*! |
|
100 |
+ * Initialize the DB connection without checking the table version and DB URL. |
|
101 |
+ * This should be called from child_init. An already existing database |
|
102 |
+ * connection will be closed, and a new one created. |
|
103 |
+ * |
|
104 |
+ * \return 0 means ok, -1 means an error occurred. |
|
105 |
+ */ |
|
106 |
+int userblocklist_db_open(void) { |
|
107 |
+ if (userblocklist_dbh) { |
|
108 |
+ userblocklist_dbf.close(userblocklist_dbh); |
|
109 |
+ } |
|
110 |
+ if ((userblocklist_dbh = userblocklist_dbf.init(&userblocklist_db_url)) == NULL) { |
|
111 |
+ LM_ERR("can't connect to database.\n"); |
|
112 |
+ return -1; |
|
113 |
+ } |
|
114 |
+ return 0; |
|
115 |
+} |
|
116 |
+ |
0 | 117 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,100 @@ |
1 |
+/*! |
|
2 |
+ * \file |
|
3 |
+ * \ingroup db |
|
4 |
+ * \brief Database support for modules. |
|
5 |
+ * |
|
6 |
+ * Database support functions for modules. |
|
7 |
+ * |
|
8 |
+ * @cond |
|
9 |
+ * WARNING: |
|
10 |
+ * This file was autogenerated from the XML source file |
|
11 |
+ * ../../modules/userblocklist/kamailio-userblocklist.xml. |
|
12 |
+ * It can be regenerated by running 'make modules' in the db/schema |
|
13 |
+ * directory of the source code. You need to have xsltproc and |
|
14 |
+ * docbook-xsl stylesheets installed. |
|
15 |
+ * ALL CHANGES DONE HERE WILL BE LOST IF THE FILE IS REGENERATED |
|
16 |
+ * @endcond |
|
17 |
+ */ |
|
18 |
+ |
|
19 |
+#ifndef db_userblocklist_h |
|
20 |
+#define db_userblocklist_h |
|
21 |
+ |
|
22 |
+ |
|
23 |
+/* necessary includes */ |
|
24 |
+#include "../../lib/srdb1/db.h" |
|
25 |
+#include "../../core/str.h" |
|
26 |
+#include "../../core/ut.h" |
|
27 |
+ |
|
28 |
+#include <string.h> |
|
29 |
+ |
|
30 |
+ |
|
31 |
+/* database variables */ |
|
32 |
+ |
|
33 |
+extern str userblocklist_db_url; |
|
34 |
+extern db1_con_t * userblocklist_dbh; |
|
35 |
+extern db_func_t userblocklist_dbf; |
|
36 |
+ |
|
37 |
+#define userblocklist_DB_URL { "db_url", PARAM_STR, &userblocklist_db_url }, |
|
38 |
+ |
|
39 |
+#define userblocklist_DB_TABLE { "userblocklist_table", PARAM_STR, &userblocklist_table }, |
|
40 |
+ |
|
41 |
+extern str userblocklist_table; |
|
42 |
+ |
|
43 |
+/* column names */ |
|
44 |
+extern str userblocklist_id_col; |
|
45 |
+extern str userblocklist_username_col; |
|
46 |
+extern str userblocklist_domain_col; |
|
47 |
+extern str userblocklist_prefix_col; |
|
48 |
+extern str userblocklist_allowlist_col; |
|
49 |
+#define userblocklist_DB_COLS \ |
|
50 |
+{ "userblocklist_id_col", PARAM_STR, &userblocklist_id_col }, \ |
|
51 |
+{ "userblocklist_username_col", PARAM_STR, &userblocklist_username_col }, \ |
|
52 |
+{ "userblocklist_domain_col", PARAM_STR, &userblocklist_domain_col }, \ |
|
53 |
+{ "userblocklist_prefix_col", PARAM_STR, &userblocklist_prefix_col }, \ |
|
54 |
+{ "userblocklist_allowlist_col", PARAM_STR, &userblocklist_allowlist_col }, \ |
|
55 |
+ |
|
56 |
+/* table version */ |
|
57 |
+extern const unsigned int userblocklist_version; |
|
58 |
+ |
|
59 |
+#define globalblocklist_DB_TABLE { "globalblocklist_table", PARAM_STR, &globalblocklist_table }, |
|
60 |
+ |
|
61 |
+extern str globalblocklist_table; |
|
62 |
+ |
|
63 |
+/* column names */ |
|
64 |
+extern str globalblocklist_id_col; |
|
65 |
+extern str globalblocklist_prefix_col; |
|
66 |
+extern str globalblocklist_allowlist_col; |
|
67 |
+extern str globalblocklist_description_col; |
|
68 |
+#define globalblocklist_DB_COLS \ |
|
69 |
+{ "globalblocklist_id_col", PARAM_STR, &globalblocklist_id_col }, \ |
|
70 |
+{ "globalblocklist_prefix_col", PARAM_STR, &globalblocklist_prefix_col }, \ |
|
71 |
+{ "globalblocklist_allowlist_col", PARAM_STR, &globalblocklist_allowlist_col }, \ |
|
72 |
+{ "globalblocklist_description_col", PARAM_STR, &globalblocklist_description_col }, \ |
|
73 |
+ |
|
74 |
+/* table version */ |
|
75 |
+extern const unsigned int globalblocklist_version; |
|
76 |
+ |
|
77 |
+ |
|
78 |
+/* |
|
79 |
+ * Closes the DB connection. |
|
80 |
+ */ |
|
81 |
+void userblocklist_db_close(void); |
|
82 |
+ |
|
83 |
+/*! |
|
84 |
+ * Initialises the DB API, check the table version and closes the connection. |
|
85 |
+ * This should be called from the mod_init function. |
|
86 |
+ * |
|
87 |
+ * \return 0 means ok, -1 means an error occurred. |
|
88 |
+ */ |
|
89 |
+int userblocklist_db_init(void); |
|
90 |
+ |
|
91 |
+/*! |
|
92 |
+ * Initialize the DB connection without checking the table version and DB URL. |
|
93 |
+ * This should be called from child_init. An already existing database |
|
94 |
+ * connection will be closed, and a new one created. |
|
95 |
+ * |
|
96 |
+ * \return 0 means ok, -1 means an error occurred. |
|
97 |
+ */ |
|
98 |
+int userblocklist_db_open(void); |
|
99 |
+ |
|
100 |
+#endif |
0 | 101 |
similarity index 75% |
1 | 102 |
rename from src/modules/userblacklist/doc/Makefile |
2 | 103 |
rename to src/modules/userblocklist/doc/Makefile |
... | ... |
@@ -1,4 +1,4 @@ |
1 |
-docs = userblacklist.xml |
|
1 |
+docs = userblocklist.xml |
|
2 | 2 |
|
3 | 3 |
docbook_dir = ../../../../doc/docbook |
4 | 4 |
include $(docbook_dir)/Makefile.module |