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,209 +0,0 @@
1
-/*
2
- * Copyright (C) 2006 iptelorg GmbH
3
- *
4
- * This file is part of Kamailio, a free SIP server.
5
- *
6
- * Kamailio 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
- * Kamailio 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19
- */
20
-
21
-/** Kamailio core :: Destination blacklists.
22
- * @file
23
- * @author andrei, Gergo
24
- * @ingroup core
25
- * Module: @ref core
26
- */
27
-
28
-#ifndef dst_black_list_h
29
-#define dst_black_list_h
30
-
31
-#include "ip_addr.h"
32
-#include "parser/msg_parser.h"
33
-#include "timer_ticks.h"
34
-#include "cfg_core.h"
35
-
36
-#define DEFAULT_BLST_TIMEOUT		60  /**< 1 min. */
37
-#define DEFAULT_BLST_MAX_MEM		250 /**< 250 KB */
38
-
39
-/** @name flags: */
40
-/*@{ */
41
-
42
-#define BLST_IS_IPV6		1		/**< set if the address is ipv6 */
43
-#define BLST_ERR_SEND		(1<<1)	/**< set if  send is denied/failed */
44
-#define BLST_ERR_CONNECT	(1<<2)	/**< set if connect failed (tcp/tls) */
45
-#define BLST_ICMP_RCVD		(1<<3)	/**< set if icmp error */
46
-#define BLST_ERR_TIMEOUT	(1<<4)	/**< set if sip timeout */
47
-#define BLST_503			(1<<5)	/**< set for 503 replies */
48
-#define BLST_ADM_PROHIBITED	(1<<6)	/**< administratively prohibited */
49
-#define BLST_PERMANENT		(1<<7)  /**< never deleted, never expires */
50
-/*@} */
51
-
52
-/* uncomment the define above to enable blacklist callbacks support */
53
-/*#define DST_BLACKLIST_HOOKS*/
54
-
55
-#define DST_BLACKLIST_CONTINUE 0 /**< add: do nothing/ignore, search: ignore */
56
-#define DST_BLACKLIST_ACCEPT 1   /**< add: force accept, search: force match */
57
-#define DST_BLACKLIST_DENY  -1   /**< add: deny, search: force no match */
58
-
59
-#define DST_BLACKLIST_ADD_CB 1
60
-#define DST_BLACKLIST_SEARCH_CB 2
61
-
62
-
63
-extern unsigned blst_proto_imask[PROTO_LAST+1];
64
-
65
-#ifdef DST_BLACKLIST_HOOKS
66
-struct blacklist_hook{
67
-	/* WARNING: msg might be NULL, and it might point to shared memory
68
-	 * without locking, do not modify it! msg can be used typically for checking
69
-	 * the message flags with isflagset() */
70
-	int (*on_blst_action)(struct dest_info* si, unsigned char* err_flags,
71
-							struct sip_msg* msg);
72
-	/* called before ser shutdown */
73
-	void (*destroy)(void);
74
-};
75
-
76
-int register_blacklist_hook(struct blacklist_hook *h, int type);
77
-#endif /* DST_BLACKLIST_HOOKS */
78
-
79
-int init_dst_blacklist(void);
80
-#ifdef USE_DST_BLACKLIST_STATS
81
-int init_dst_blacklist_stats(int iproc_num);
82
-#define DST_BLACKLIST_ALL_STATS "bkl_all_stats"
83
-#endif
84
-void destroy_dst_blacklist(void);
85
-
86
-
87
-/** force add to the blacklist.
88
- * like function dst_blacklist_add_to, but no ignore mask or
89
- * blacklist enabled checks are made.
90
- * @see dst_blacklist_add_to for the parameters and return value.
91
- */
92
-int dst_blacklist_force_add_to(unsigned char err_flags, struct dest_info* si,
93
-								struct sip_msg* msg, ticks_t timeout);
94
-
95
-/** force add to the blacklist, long version.
96
- * like function dst_blacklist_su_to, but no ignore mask or
97
- * blacklist enabled checks are made.
98
- * @see dst_blacklist_su_to for the parameters and return value.
99
- */
100
-int dst_blacklist_force_su_to(	unsigned char err_flags,
101
-								unsigned char proto,
102
-								union sockaddr_union* dst,
103
-								struct sip_msg* msg,
104
-								ticks_t timeout);
105
-
106
-
107
-/** checks if blacklist should be used.
108
-  * @param  err_flags - blacklist reason
109
-  * @param si - filled dest_info structure pointer.
110
-  * @return 1 if blacklist is enabled (core_cfg) and the event/error
111
-  *           is not in the ignore list.
112
-  *         0 otherwise
113
-  */
114
-#define should_blacklist(err_flags, si) \
115
-	(cfg_get(core, core_cfg, use_dst_blacklist) && \
116
-		((err_flags) & ~blst_proto_imask[(unsigned)((si)->proto)] & \
117
-		 			   ~(si)->send_flags.blst_imask ))
118
-
119
-
120
-/** checks if blacklist should be used, long version.
121
-  * @param err_flags - blacklist reason
122
-  * @param snd_flags - snd_flags pointer, can be 0.
123
-  * @param proto - protocol, can be 0 (PROTO_NONE).
124
-  * @param su  - sockaddr_union pointer, can be 0.
125
-  * @return 1 if blacklist is enabled (core_cfg) and the event/error
126
-  *           is not in the ignore list. 0 otherwise
127
-  */
128
-#define should_blacklist_su(err_flags, snd_flags, proto, su) \
129
-	(cfg_get(core, core_cfg, use_dst_blacklist) && \
130
-		((err_flags) & ~blst_proto_imask[(unsigned)(proto)] & \
131
-		 			~((snd_flags)?((snd_flags_t*)(snd_flags))->blst_imask:0)))
132
-
133
-
134
-/** adds a dst to the blacklist.
135
- *
136
- * @param  err_flags - blacklist reason
137
- * @param si  - dest_info structure (dst).
138
- * @param msg - sip msg struct. pointer if known, 0 otherwise.
139
- * @param timeout - timeout in ticks.
140
- * @return >=0 on success, -1 on error.
141
- */
142
-#define dst_blacklist_add_to(err_flags, si, msg, timeout) \
143
-	(should_blacklist(err_flags, si)? \
144
-		dst_blacklist_force_add_to((err_flags), (si), (msg), (timeout))\
145
-		: 0)
146
-
147
-
148
-/** adds a dst to the blacklist, long version.
149
- * Similar to dst_blacklist_add_to, but uses "unpacked" parameters.
150
- * @param  err_flags - blacklist reason
151
- * @param proto - protocol.
152
- * @param dst  - sockaddr_union pointer.
153
- * @param snd_flags - snd_flags pointer, can be 0.
154
- * @param msg - sip msg struct. pointer if known, 0 otherwise.
155
- * @param timeout - timeout in ticks.
156
- * @return >=0 on success, -1 on error.
157
- */
158
-#define dst_blacklist_su_to(err_flags, proto, dst, snd_flags, msg, timeout) \
159
-	(should_blacklist_su(err_flags, snd_flags, proto, dst) ? \
160
-		dst_blacklist_force_su_to((err_flags), (proto), (dst), (msg), \
161
-									(timeout))\
162
-		: 0)
163
-
164
-
165
-/** adds a dst to the blacklist with default timeout.
166
- *
167
- * @param  err_flags - blacklist reason
168
- * @param si  - dest_info structure (dst).
169
- * @param msg - sip msg struct. pointer if known, 0 otherwise.
170
- * @return >=0 on success, -1 on error.
171
- * @see dst_blacklist_add_to.
172
- */
173
-#define dst_blacklist_add(err_flags, si, msg) \
174
-	dst_blacklist_add_to(err_flags, si, msg, \
175
-							S_TO_TICKS(cfg_get(core, core_cfg, blst_timeout)))
176
-
177
-
178
-/** adds a dst to the blacklist with default timeout, long version.
179
- * Similar to dst_blacklist_add_to, but uses "unpacked" parameters.
180
- * @param  err_flags - blacklist reason
181
- * @param proto - protocol.
182
- * @param dst  - sockaddr_union pointer.
183
- * @param snd_flags - snd_flags pointer, can be 0.
184
- * @param msg - sip msg struct. pointer if known, 0 otherwise.
185
- * @return >=0 on success, -1 on error.
186
- * @see dst_blacklist_su_to.
187
- */
188
-#define dst_blacklist_su(err_flags, proto, dst, snd_flags, msg) \
189
-	dst_blacklist_su_to(err_flags, proto, dst, snd_flags, msg, \
190
-							S_TO_TICKS(cfg_get(core, core_cfg, blst_timeout)))
191
-
192
-int dst_is_blacklisted(struct dest_info* si, struct sip_msg* msg);
193
-
194
-/** delete an entry from the blacklist. */
195
-int dst_blacklist_del(struct dest_info* si, struct sip_msg* msg);
196
-
197
-/** deletes all the entries from the blacklist except the permanent ones.
198
- * (which are marked with BLST_PERMANENT)
199
- */
200
-void dst_blst_flush(void);
201
-
202
-int use_dst_blacklist_fixup(void *handle, str *gname, str *name, void **val);
203
-
204
-/** KByte to Byte conversion. */
205
-int blst_max_mem_fixup(void *handle, str *gname, str *name, void **val);
206
-
207
-void blst_reinit_ign_masks(str* gname, str* name);
208
-
209
-#endif
Browse code

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

Olle E. Johansson authored on 16/01/2015 16:38:46
Showing 1 changed files
... ...
@@ -18,7 +18,7 @@
18 18
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19 19
  */
20 20
 
21
-/** SIP-router core :: Destination blacklists.
21
+/** Kamailio core :: Destination blacklists.
22 22
  * @file
23 23
  * @author andrei, Gergo
24 24
  * @ingroup core
Browse code

core : Update include files - delete IDs, update doxygen, delete history

Olle E. Johansson authored on 03/01/2015 10:55:48
Showing 1 changed files
... ...
@@ -1,14 +1,14 @@
1 1
 /*
2 2
  * Copyright (C) 2006 iptelorg GmbH
3 3
  *
4
- * This file is part of ser, a free SIP server.
4
+ * This file is part of Kamailio, a free SIP server.
5 5
  *
6
- * ser is free software; you can redistribute it and/or modify
6
+ * Kamailio is free software; you can redistribute it and/or modify
7 7
  * it under the terms of the GNU General Public License as published by
8 8
  * the Free Software Foundation; either version 2 of the License, or
9 9
  * (at your option) any later version
10 10
  *
11
- * ser is distributed in the hope that it will be useful,
11
+ * Kamailio is distributed in the hope that it will be useful,
12 12
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 13
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 14
  * GNU General Public License for more details.
... ...
@@ -20,18 +20,11 @@
20 20
 
21 21
 /** SIP-router core :: Destination blacklists.
22 22
  * @file
23
+ * @author andrei, Gergo
23 24
  * @ingroup core
24 25
  * Module: @ref core
25 26
  */
26 27
 
27
-/* History:
28
- * --------
29
- *  2006-07-29  created by andrei
30
- *  2007-07-30  dst blacklist measurements added (Gergo)
31
- *  2009-12-22  blacklist ignore mask support and dst_blacklist_{add,su}
32
- *               switched to macros (andrei)
33
- */
34
-
35 28
 #ifndef dst_black_list_h
36 29
 #define dst_black_list_h
37 30
 
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
 /** SIP-router core :: Destination blacklists.
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
... ...
@@ -83,12 +83,12 @@ struct blacklist_hook{
83 83
 int register_blacklist_hook(struct blacklist_hook *h, int type);
84 84
 #endif /* DST_BLACKLIST_HOOKS */
85 85
 
86
-int init_dst_blacklist();
86
+int init_dst_blacklist(void);
87 87
 #ifdef USE_DST_BLACKLIST_STATS
88 88
 int init_dst_blacklist_stats(int iproc_num);
89 89
 #define DST_BLACKLIST_ALL_STATS "bkl_all_stats"
90 90
 #endif
91
-void destroy_dst_blacklist();
91
+void destroy_dst_blacklist(void);
92 92
 
93 93
 
94 94
 /** force add to the blacklist.
Browse code

doxygen documentation fixes

Henning Westerholt authored on 27/07/2011 22:22:09
Showing 1 changed files
... ...
@@ -1,6 +1,4 @@
1 1
 /*
2
- * $Id$
3
- *
4 2
  * Copyright (C) 2006 iptelorg GmbH
5 3
  *
6 4
  * This file is part of ser, a free SIP server.
... ...
@@ -94,7 +92,7 @@ void destroy_dst_blacklist();
94 92
 
95 93
 
96 94
 /** force add to the blacklist.
97
- * like @function dst_blacklist_add_to, but no ignore mask or
95
+ * like function dst_blacklist_add_to, but no ignore mask or
98 96
  * blacklist enabled checks are made.
99 97
  * @see dst_blacklist_add_to for the parameters and return value.
100 98
  */
... ...
@@ -102,7 +100,7 @@ int dst_blacklist_force_add_to(unsigned char err_flags, struct dest_info* si,
102 100
 								struct sip_msg* msg, ticks_t timeout);
103 101
 
104 102
 /** force add to the blacklist, long version.
105
- * like @function dst_blacklist_su_to, but no ignore mask or
103
+ * like function dst_blacklist_su_to, but no ignore mask or
106 104
  * blacklist enabled checks are made.
107 105
  * @see dst_blacklist_su_to for the parameters and return value.
108 106
  */
... ...
@@ -127,13 +125,12 @@ int dst_blacklist_force_su_to(	unsigned char err_flags,
127 125
 
128 126
 
129 127
 /** checks if blacklist should be used, long version.
130
-  * @param  err_flags - blacklist reason
128
+  * @param err_flags - blacklist reason
131 129
   * @param snd_flags - snd_flags pointer, can be 0.
132 130
   * @param proto - protocol, can be 0 (PROTO_NONE).
133
-  * @param si  - sockaddr_union pointer, can be 0.
131
+  * @param su  - sockaddr_union pointer, can be 0.
134 132
   * @return 1 if blacklist is enabled (core_cfg) and the event/error
135
-  *           is not in the ignore list.
136
-  *         0 otherwise
133
+  *           is not in the ignore list. 0 otherwise
137 134
   */
138 135
 #define should_blacklist_su(err_flags, snd_flags, proto, su) \
139 136
 	(cfg_get(core, core_cfg, use_dst_blacklist) && \
Browse code

Merge remote branch 'origin/andrei/blst_send_flags'

Support for blacklist ignore flags, both global and on a per
message basis.
E.g.:
per message:
if (method=~"MESSAGE")
blst_set_ignore(6);

global:
sercmd cfg.set_now_int core dst_blacklist_tcp_imask 16

* origin/andrei/blst_send_flags:
NEWS: minor blacklist flag number correction
tm: blacklist on 503 reply fixed for send flags
NEWS: mentioned blacklist ignore masks
core: cfg script support for blacklist ignore masks
blst: global config variables for ignoring blacklist events
blst: docs for blst_{set,clear}_ignore script functions
blst: functions for ignoring blacklist events
blst: use dst_blacklist_force_add
tm: simplified blacklist add code
blacklist: ignore mask support
tm: updated to the new snd_flags_t structure
core: send_flags preliminary blacklist support

Conflicts:
NEWS
cfg.lex
cfg.y
dst_blacklist.h

Andrei Pelinescu-Onciul authored on 19/02/2010 15:37:51
Showing 0 changed files
Browse code

blst: global config variables for ignoring blacklist events

Blacklist events can now be ignored on a per protocol basis, by
setting the corresponding new config variable:
dst_blacklist_udp_imask
dst_blacklist_tcp_imask
dst_blacklist_tls_imask
dst_blacklist_sctp_imask

E.g.: sercmd cfg.set_now_int core dst_blacklist_tcp_imask 6
(ignore send and connect errors on tcp when deciding whether or
not to blacklist)

Andrei Pelinescu-Onciul authored on 15/02/2010 20:37:28
Showing 1 changed files
... ...
@@ -65,6 +65,9 @@
65 65
 #define DST_BLACKLIST_ADD_CB 1
66 66
 #define DST_BLACKLIST_SEARCH_CB 2
67 67
 
68
+
69
+extern unsigned blst_proto_imask[PROTO_LAST+1];
70
+
68 71
 #ifdef DST_BLACKLIST_HOOKS
69 72
 struct blacklist_hook{
70 73
 	/* WARNING: msg might be NULL, and it might point to shared memory
... ...
@@ -109,14 +112,15 @@ int dst_blacklist_force_su_to(	unsigned char err_flags,
109 112
 
110 113
 /** checks if blacklist should be used.
111 114
   * @param  err_flags - blacklist reason
112
-  * @param si - filled dst_info structure pointer.
115
+  * @param si - filled dest_info structure pointer.
113 116
   * @return 1 if blacklist is enabled (core_cfg) and the event/error
114 117
   *           is not in the ignore list.
115 118
   *         0 otherwise
116 119
   */
117 120
 #define should_blacklist(err_flags, si) \
118 121
 	(cfg_get(core, core_cfg, use_dst_blacklist) && \
119
-		((err_flags) & (si)->send_flags.blst_imask))
122
+		((err_flags) & ~blst_proto_imask[(unsigned)((si)->proto)] & \
123
+		 			   ~(si)->send_flags.blst_imask ))
120 124
 
121 125
 
122 126
 /** checks if blacklist should be used, long version.
... ...
@@ -130,7 +134,7 @@ int dst_blacklist_force_su_to(	unsigned char err_flags,
130 134
   */
131 135
 #define should_blacklist_su(err_flags, snd_flags, proto, su) \
132 136
 	(cfg_get(core, core_cfg, use_dst_blacklist) && \
133
-		((err_flags) & \
137
+		((err_flags) & ~blst_proto_imask[(unsigned)(proto)] & \
134 138
 		 			~((snd_flags)?((snd_flags_t*)(snd_flags))->blst_imask:0)))
135 139
 
136 140
 
... ...
@@ -205,4 +209,6 @@ int use_dst_blacklist_fixup(void *handle, str *gname, str *name, void **val);
205 209
 /* KByte to Byte conversion */
206 210
 int blst_max_mem_fixup(void *handle, str *gname, str *name, void **val);
207 211
 
212
+void blst_reinit_ign_masks(str* gname, str* name);
213
+
208 214
 #endif
Browse code

blacklist: ignore mask support

blacklist:
- a blacklist ignore mask (part of the send flags) is now
supported by the blacklist functions
- blacklist add functions don't require anymore checking if the
blacklist is enabled
- added dst_blacklist_force_add_to() and dst_blacklist_force_su_to()
tcp:
- updated to the changed dst_blacklist_su()
- a tcp connection send_flags and blacklist ignore mask are
inherited from the packet that opens the connection
sctp:
- updated to the changed dst_blacklist_su()

Andrei Pelinescu-Onciul authored on 23/12/2009 08:44:12
Showing 1 changed files
... ...
@@ -30,6 +30,8 @@
30 30
  * --------
31 31
  *  2006-07-29  created by andrei
32 32
  *  2007-07-30  dst blacklist measurements added (Gergo)
33
+ *  2009-12-22  blacklist ignore mask support and dst_blacklist_{add,su}
34
+ *               switched to macros (andrei)
33 35
  */
34 36
 
35 37
 #ifndef dst_black_list_h
... ...
@@ -85,27 +87,110 @@ int init_dst_blacklist_stats(int iproc_num);
85 87
 void destroy_dst_blacklist();
86 88
 
87 89
 
88
-/* like dst_blacklist_add, but the timeout can be also set */
89
-int dst_blacklist_add_to(unsigned char err_flags, struct dest_info* si,
90
-						struct sip_msg* msg, ticks_t timeout);
91
-/* like above, but using a differnt way of passing the target */
92
-int dst_blacklist_su_to(unsigned char err_flags, unsigned char proto,
93
-							union sockaddr_union* dst,
94
-							struct sip_msg* msg, ticks_t timeout);
90
+/** force add to the blacklist.
91
+ * like @function dst_blacklist_add_to, but no ignore mask or
92
+ * blacklist enabled checks are made.
93
+ * @see dst_blacklist_add_to for the parameters and return value.
94
+ */
95
+int dst_blacklist_force_add_to(unsigned char err_flags, struct dest_info* si,
96
+								struct sip_msg* msg, ticks_t timeout);
95 97
 
96
-/** adds a dst to the blacklist with default timeout.
97
- * @see dst_blacklist_add_to for more details.
98
+/** force add to the blacklist, long version.
99
+ * like @function dst_blacklist_su_to, but no ignore mask or
100
+ * blacklist enabled checks are made.
101
+ * @see dst_blacklist_su_to for the parameters and return value.
98 102
  */
99
-#define dst_blacklist_add(err_flags, si, msg) \
100
-	dst_blacklist_add_to((err_flags), (si), (msg), \
101
-		S_TO_TICKS(cfg_get(core, core_cfg, blst_timeout)))
103
+int dst_blacklist_force_su_to(	unsigned char err_flags,
104
+								unsigned char proto,
105
+								union sockaddr_union* dst,
106
+								struct sip_msg* msg,
107
+								ticks_t timeout);
108
+
109
+
110
+/** checks if blacklist should be used.
111
+  * @param  err_flags - blacklist reason
112
+  * @param si - filled dst_info structure pointer.
113
+  * @return 1 if blacklist is enabled (core_cfg) and the event/error
114
+  *           is not in the ignore list.
115
+  *         0 otherwise
116
+  */
117
+#define should_blacklist(err_flags, si) \
118
+	(cfg_get(core, core_cfg, use_dst_blacklist) && \
119
+		((err_flags) & (si)->send_flags.blst_imask))
120
+
121
+
122
+/** checks if blacklist should be used, long version.
123
+  * @param  err_flags - blacklist reason
124
+  * @param snd_flags - snd_flags pointer, can be 0.
125
+  * @param proto - protocol, can be 0 (PROTO_NONE).
126
+  * @param si  - sockaddr_union pointer, can be 0.
127
+  * @return 1 if blacklist is enabled (core_cfg) and the event/error
128
+  *           is not in the ignore list.
129
+  *         0 otherwise
130
+  */
131
+#define should_blacklist_su(err_flags, snd_flags, proto, su) \
132
+	(cfg_get(core, core_cfg, use_dst_blacklist) && \
133
+		((err_flags) & \
134
+		 			~((snd_flags)?((snd_flags_t*)(snd_flags))->blst_imask:0)))
135
+
136
+
137
+/** adds a dst to the blacklist.
138
+ *
139
+ * @param  err_flags - blacklist reason
140
+ * @param si  - dest_info structure (dst).
141
+ * @param msg - sip msg struct. pointer if known, 0 otherwise.
142
+ * @param timeout - timeout in ticks.
143
+ * @return >=0 on success, -1 on error.
144
+ */
145
+#define dst_blacklist_add_to(err_flags, si, msg, timeout) \
146
+	(should_blacklist(err_flags, si)? \
147
+		dst_blacklist_force_add_to((err_flags), (si), (msg), (timeout))\
148
+		: 0)
149
+
150
+
151
+/** adds a dst to the blacklist, long version.
152
+ * Similar to dst_blacklist_add_to, but uses "unpacked" parameters.
153
+ * @param  err_flags - blacklist reason
154
+ * @param proto - protocol.
155
+ * @param dst  - sockaddr_union pointer.
156
+ * @param snd_flags - snd_flags pointer, can be 0.
157
+ * @param msg - sip msg struct. pointer if known, 0 otherwise.
158
+ * @param timeout - timeout in ticks.
159
+ * @return >=0 on success, -1 on error.
160
+ */
161
+#define dst_blacklist_su_to(err_flags, proto, dst, snd_flags, msg, timeout) \
162
+	(should_blacklist_su(err_flags, snd_flags, proto, dst) ? \
163
+		dst_blacklist_force_su_to((err_flags), (proto), (dst), (msg), \
164
+									(timeout))\
165
+		: 0)
166
+
102 167
 
103 168
 /** adds a dst to the blacklist with default timeout.
104
- * @see dst_blacklist_su_to for more details.
169
+ *
170
+ * @param  err_flags - blacklist reason
171
+ * @param si  - dest_info structure (dst).
172
+ * @param msg - sip msg struct. pointer if known, 0 otherwise.
173
+ * @return >=0 on success, -1 on error.
174
+ * @see dst_blacklist_add_to.
175
+ */
176
+#define dst_blacklist_add(err_flags, si, msg) \
177
+	dst_blacklist_add_to(err_flags, si, msg, \
178
+							S_TO_TICKS(cfg_get(core, core_cfg, blst_timeout)))
179
+
180
+
181
+/** adds a dst to the blacklist with default timeout, long version.
182
+ * Similar to dst_blacklist_add_to, but uses "unpacked" parameters.
183
+ * @param  err_flags - blacklist reason
184
+ * @param proto - protocol.
185
+ * @param dst  - sockaddr_union pointer.
186
+ * @param snd_flags - snd_flags pointer, can be 0.
187
+ * @param msg - sip msg struct. pointer if known, 0 otherwise.
188
+ * @return >=0 on success, -1 on error.
189
+ * @see dst_blacklist_su_to.
105 190
  */
106
-#define dst_blacklist_su(err_flags, proto, dst, msg) \
107
-	dst_blacklist_su_to((err_flags), (proto), (dst), (msg), \
108
-		S_TO_TICKS(cfg_get(core, core_cfg, blst_timeout)))
191
+#define dst_blacklist_su(err_flags, proto, dst, snd_flags, msg) \
192
+	dst_blacklist_su_to(err_flags, proto, dst, snd_flags, msg, \
193
+							S_TO_TICKS(cfg_get(core, core_cfg, blst_timeout)))
109 194
 
110 195
 int dst_is_blacklisted(struct dest_info* si, struct sip_msg* msg);
111 196
 /* delete an entry from the blacklist */
Browse code

Documentation and doxygen updates

oej authored on 25/10/2009 19:49:25
Showing 1 changed files
... ...
@@ -1,8 +1,6 @@
1 1
 /*
2 2
  * $Id$
3 3
  *
4
- * resolver related functions
5
- *
6 4
  * Copyright (C) 2006 iptelorg GmbH
7 5
  *
8 6
  * This file is part of ser, a free SIP server.
... ...
@@ -12,11 +10,6 @@
12 10
  * the Free Software Foundation; either version 2 of the License, or
13 11
  * (at your option) any later version
14 12
  *
15
- * For a license to use the ser software under conditions
16
- * other than those described here, or to purchase support for this
17
- * software, please contact iptel.org by e-mail at the following addresses:
18
- *    info@iptel.org
19
- *
20 13
  * ser is distributed in the hope that it will be useful,
21 14
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 15
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
... ...
@@ -26,6 +19,14 @@
26 19
  * along with this program; if not, write to the Free Software
27 20
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28 21
  */
22
+
23
+/**
24
+ * @file
25
+ * @brief SIP-router core :: Destination blacklists
26
+ * @ingroup core
27
+ * Module: @ref core
28
+ */
29
+
29 30
 /* History:
30 31
  * --------
31 32
  *  2006-07-29  created by andrei
... ...
@@ -40,25 +41,28 @@
40 41
 #include "timer_ticks.h"
41 42
 #include "cfg_core.h"
42 43
 
43
-#define DEFAULT_BLST_TIMEOUT		60  /* 1 min. */
44
-#define DEFAULT_BLST_MAX_MEM		250 /* 250 KB */
44
+#define DEFAULT_BLST_TIMEOUT		60  /**< 1 min. */
45
+#define DEFAULT_BLST_MAX_MEM		250 /**< 250 KB */
46
+
47
+/** @name flags: */
48
+/*@{ */
45 49
 
46
-/* flags: */
47
-#define BLST_IS_IPV6		1		/* set if the address is ipv6 */
48
-#define BLST_ERR_SEND		(1<<1)	/* set if  send is denied/failed */
49
-#define BLST_ERR_CONNECT	(1<<2)	/* set if connect failed (tcp/tls) */
50
-#define BLST_ICMP_RCVD		(1<<3)	/* set if icmp error */
51
-#define BLST_ERR_TIMEOUT	(1<<4)	/* set if sip timeout */
52
-#define BLST_503			(1<<5)	/* set for 503 replies */
53
-#define BLST_ADM_PROHIBITED	(1<<6)	/* administratively prohibited */
54
-#define BLST_PERMANENT		(1<<7)  /* never deleted, never expires */
50
+#define BLST_IS_IPV6		1		/**< set if the address is ipv6 */
51
+#define BLST_ERR_SEND		(1<<1)	/**< set if  send is denied/failed */
52
+#define BLST_ERR_CONNECT	(1<<2)	/**< set if connect failed (tcp/tls) */
53
+#define BLST_ICMP_RCVD		(1<<3)	/**< set if icmp error */
54
+#define BLST_ERR_TIMEOUT	(1<<4)	/**< set if sip timeout */
55
+#define BLST_503			(1<<5)	/**< set for 503 replies */
56
+#define BLST_ADM_PROHIBITED	(1<<6)	/**< administratively prohibited */
57
+#define BLST_PERMANENT		(1<<7)  /**< never deleted, never expires */
58
+/*@} */
55 59
 
56 60
 /* uncomment the define above to enable blacklist callbacks support */
57 61
 /*#define DST_BLACKLIST_HOOKS*/
58 62
 
59
-#define DST_BLACKLIST_CONTINUE 0 /* add: do nothing/ignore, search: ignore */
60
-#define DST_BLACKLIST_ACCEPT 1   /* add: force accept, search: force match */
61
-#define DST_BLACKLIST_DENY  -1   /* add: deny, search: force no match */
63
+#define DST_BLACKLIST_CONTINUE 0 /**< add: do nothing/ignore, search: ignore */
64
+#define DST_BLACKLIST_ACCEPT 1   /**< add: force accept, search: force match */
65
+#define DST_BLACKLIST_DENY  -1   /**< add: deny, search: force no match */
62 66
 
63 67
 #define DST_BLACKLIST_ADD_CB 1
64 68
 #define DST_BLACKLIST_SEARCH_CB 2
... ...
@@ -85,22 +89,22 @@ int init_dst_blacklist_stats(int iproc_num);
85 89
 void destroy_dst_blacklist();
86 90
 
87 91
 
88
-/* like dst_blacklist_add, but the timeout can be also set */
92
+/** @brief like dst_blacklist_add, but the timeout can be also set */
89 93
 int dst_blacklist_add_to(unsigned char err_flags, struct dest_info* si,
90 94
 						struct sip_msg* msg, ticks_t timeout);
91
-/* like above, but using a differnt way of passing the target */
95
+/** @brief like above, but using a differnt way of passing the target */
92 96
 int dst_blacklist_su_to(unsigned char err_flags, unsigned char proto,
93 97
 							union sockaddr_union* dst,
94 98
 							struct sip_msg* msg, ticks_t timeout);
95 99
 
96
-/** adds a dst to the blacklist with default timeout.
100
+/** @brief adds a dst to the blacklist with default timeout.
97 101
  * @see dst_blacklist_add_to for more details.
98 102
  */
99 103
 #define dst_blacklist_add(err_flags, si, msg) \
100 104
 	dst_blacklist_add_to((err_flags), (si), (msg), \
101 105
 		S_TO_TICKS(cfg_get(core, core_cfg, blst_timeout)))
102 106
 
103
-/** adds a dst to the blacklist with default timeout.
107
+/** @brief adds a dst to the blacklist with default timeout.
104 108
  * @see dst_blacklist_su_to for more details.
105 109
  */
106 110
 #define dst_blacklist_su(err_flags, proto, dst, msg) \
... ...
@@ -108,16 +112,18 @@ int dst_blacklist_su_to(unsigned char err_flags, unsigned char proto,
108 112
 		S_TO_TICKS(cfg_get(core, core_cfg, blst_timeout)))
109 113
 
110 114
 int dst_is_blacklisted(struct dest_info* si, struct sip_msg* msg);
111
-/* delete an entry from the blacklist */
115
+
116
+/** @brief  delete an entry from the blacklist */
112 117
 int dst_blacklist_del(struct dest_info* si, struct sip_msg* msg);
113 118
 
114
-/* deletes all the entries from the blacklist except the permanent ones
119
+/** @brief deletes all the entries from the blacklist except the permanent ones
115 120
  * (which are marked with BLST_PERMANENT)
116 121
  */
117 122
 void dst_blst_flush(void);
118 123
 
119 124
 int use_dst_blacklist_fixup(void *handle, str *gname, str *name, void **val);
120
-/* KByte to Byte conversion */
125
+
126
+/** @brief KByte to Byte conversion */
121 127
 int blst_max_mem_fixup(void *handle, str *gname, str *name, void **val);
122 128
 
123 129
 #endif
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
... ...
@@ -116,8 +116,8 @@ int dst_blacklist_del(struct dest_info* si, struct sip_msg* msg);
116 116
  */
117 117
 void dst_blst_flush(void);
118 118
 
119
-int use_dst_blacklist_fixup(void *handle, str *name, void **val);
119
+int use_dst_blacklist_fixup(void *handle, str *gname, str *name, void **val);
120 120
 /* KByte to Byte conversion */
121
-int blst_max_mem_fixup(void *handle, str *name, void **val);
121
+int blst_max_mem_fixup(void *handle, str *gname, str *name, void **val);
122 122
 
123 123
 #endif
Browse code

blst: another blacklist dest. function version

- added dst_blacklist_su(), which is a variant of dst_blacklist_add()
(different way of passing the blacklist target)

Andrei Pelinescu-Onciul authored on 26/02/2009 23:09:22
Showing 1 changed files
... ...
@@ -88,12 +88,25 @@ void destroy_dst_blacklist();
88 88
 /* like dst_blacklist_add, but the timeout can be also set */
89 89
 int dst_blacklist_add_to(unsigned char err_flags, struct dest_info* si,
90 90
 						struct sip_msg* msg, ticks_t timeout);
91
+/* like above, but using a differnt way of passing the target */
92
+int dst_blacklist_su_to(unsigned char err_flags, unsigned char proto,
93
+							union sockaddr_union* dst,
94
+							struct sip_msg* msg, ticks_t timeout);
91 95
 
92
-/* adds a dst to the blacklist with default timeout */
96
+/** adds a dst to the blacklist with default timeout.
97
+ * @see dst_blacklist_add_to for more details.
98
+ */
93 99
 #define dst_blacklist_add(err_flags, si, msg) \
94 100
 	dst_blacklist_add_to((err_flags), (si), (msg), \
95 101
 		S_TO_TICKS(cfg_get(core, core_cfg, blst_timeout)))
96 102
 
103
+/** adds a dst to the blacklist with default timeout.
104
+ * @see dst_blacklist_su_to for more details.
105
+ */
106
+#define dst_blacklist_su(err_flags, proto, dst, msg) \
107
+	dst_blacklist_su_to((err_flags), (proto), (dst), (msg), \
108
+		S_TO_TICKS(cfg_get(core, core_cfg, blst_timeout)))
109
+
97 110
 int dst_is_blacklisted(struct dest_info* si, struct sip_msg* msg);
98 111
 /* delete an entry from the blacklist */
99 112
 int dst_blacklist_del(struct dest_info* si, struct sip_msg* msg);
Browse code

- use_dns_cache can be enabled/disabled runtime - dns_cache_init is introduced: if set to 0, the dns cache is not initialized, and cannot be enabled later (default is 1) - dst_blacklist_init is introduced: if set to 0, the dst blacklist is not initialized (similar to dns_cache_init) (default is 1)

Miklos Tirpak authored on 11/02/2008 17:11:59
Showing 1 changed files
... ...
@@ -103,6 +103,7 @@ int dst_blacklist_del(struct dest_info* si, struct sip_msg* msg);
103 103
  */
104 104
 void dst_blst_flush(void);
105 105
 
106
+int use_dst_blacklist_fixup(void *handle, str *name, void **val);
106 107
 /* KByte to Byte conversion */
107 108
 int blst_max_mem_fixup(void *handle, str *name, void **val);
108 109
 
Browse code

Destination blacklist parameters have been updated to the config framework, the following variables are changeable runtime:

- use_dst_blacklist
- dst_blacklist_expire
- dst_blacklist_mem

Miklos Tirpak authored on 13/12/2007 15:29:55
Showing 1 changed files
... ...
@@ -38,8 +38,10 @@
38 38
 #include "ip_addr.h"
39 39
 #include "parser/msg_parser.h"
40 40
 #include "timer_ticks.h"
41
+#include "cfg_core.h"
41 42
 
42 43
 #define DEFAULT_BLST_TIMEOUT		60  /* 1 min. */
44
+#define DEFAULT_BLST_MAX_MEM		250 /* 250 KB */
43 45
 
44 46
 /* flags: */
45 47
 #define BLST_IS_IPV6		1		/* set if the address is ipv6 */
... ...
@@ -89,7 +91,8 @@ int dst_blacklist_add_to(unsigned char err_flags, struct dest_info* si,
89 91
 
90 92
 /* adds a dst to the blacklist with default timeout */
91 93
 #define dst_blacklist_add(err_flags, si, msg) \
92
-	dst_blacklist_add_to((err_flags), (si), (msg), S_TO_TICKS(blst_timeout))
94
+	dst_blacklist_add_to((err_flags), (si), (msg), \
95
+		S_TO_TICKS(cfg_get(core, core_cfg, blst_timeout)))
93 96
 
94 97
 int dst_is_blacklisted(struct dest_info* si, struct sip_msg* msg);
95 98
 /* delete an entry from the blacklist */
... ...
@@ -100,4 +103,7 @@ int dst_blacklist_del(struct dest_info* si, struct sip_msg* msg);
100 103
  */
101 104
 void dst_blst_flush(void);
102 105
 
106
+/* KByte to Byte conversion */
107
+int blst_max_mem_fixup(void *handle, str *name, void **val);
108
+
103 109
 #endif
Browse code

- dst blacklist measurements added

Gergely Kovacs authored on 31/07/2007 13:27:55
Showing 1 changed files
... ...
@@ -22,13 +22,14 @@
22 22
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 23
  * GNU General Public License for more details.
24 24
  *
25
- * You should have received a copy of the GNU General Public License 
26
- * along with this program; if not, write to the Free Software 
25
+ * You should have received a copy of the GNU General Public License
26
+ * along with this program; if not, write to the Free Software
27 27
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28 28
  */
29 29
 /* History:
30 30
  * --------
31 31
  *  2006-07-29  created by andrei
32
+ *  2007-07-30  dst blacklist measurements added (Gergo)
32 33
  */
33 34
 
34 35
 #ifndef dst_black_list_h
... ...
@@ -75,6 +76,10 @@ int register_blacklist_hook(struct blacklist_hook *h, int type);
75 76
 #endif /* DST_BLACKLIST_HOOKS */
76 77
 
77 78
 int init_dst_blacklist();
79
+#ifdef USE_DST_BLACKLIST_STATS
80
+int init_dst_blacklist_stats(int iproc_num);
81
+#define DST_BLACKLIST_ALL_STATS "bkl_all_stats"
82
+#endif
78 83
 void destroy_dst_blacklist();
79 84
 
80 85
 
Browse code

- added support for deleting an entry from the blacklist (dst_blacklist_del()) - added support for adding an entry to the blacklist with a specific timeout (dst_blacklist_add_to()) - fixed missing hash stats for _dst_blacklist_lst_find - added a special flag for 503 replies

Andrei Pelinescu-Onciul authored on 30/07/2007 19:42:03
Showing 1 changed files
... ...
@@ -36,6 +36,9 @@
36 36
 
37 37
 #include "ip_addr.h"
38 38
 #include "parser/msg_parser.h"
39
+#include "timer_ticks.h"
40
+
41
+#define DEFAULT_BLST_TIMEOUT		60  /* 1 min. */
39 42
 
40 43
 /* flags: */
41 44
 #define BLST_IS_IPV6		1		/* set if the address is ipv6 */
... ...
@@ -43,7 +46,7 @@
43 46
 #define BLST_ERR_CONNECT	(1<<2)	/* set if connect failed (tcp/tls) */
44 47
 #define BLST_ICMP_RCVD		(1<<3)	/* set if icmp error */
45 48
 #define BLST_ERR_TIMEOUT	(1<<4)	/* set if sip timeout */
46
-#define BLST_RESERVED		(1<<5)	/* not used yet */
49
+#define BLST_503			(1<<5)	/* set for 503 replies */
47 50
 #define BLST_ADM_PROHIBITED	(1<<6)	/* administratively prohibited */
48 51
 #define BLST_PERMANENT		(1<<7)  /* never deleted, never expires */
49 52
 
... ...
@@ -62,7 +65,8 @@ struct blacklist_hook{
62 65
 	/* WARNING: msg might be NULL, and it might point to shared memory
63 66
 	 * without locking, do not modify it! msg can be used typically for checking
64 67
 	 * the message flags with isflagset() */
65
-	int (*on_blst_action)(struct dest_info* si, unsigned char* err_flags, struct sip_msg* msg);
68
+	int (*on_blst_action)(struct dest_info* si, unsigned char* err_flags,
69
+							struct sip_msg* msg);
66 70
 	/* called before ser shutdown */
67 71
 	void (*destroy)(void);
68 72
 };
... ...
@@ -73,9 +77,18 @@ int register_blacklist_hook(struct blacklist_hook *h, int type);
73 77
 int init_dst_blacklist();
74 78
 void destroy_dst_blacklist();
75 79
 
76
-int dst_blacklist_add(unsigned char err_flags, struct dest_info* si, struct sip_msg* msg);
80
+
81
+/* like dst_blacklist_add, but the timeout can be also set */
82
+int dst_blacklist_add_to(unsigned char err_flags, struct dest_info* si,
83
+						struct sip_msg* msg, ticks_t timeout);
84
+
85
+/* adds a dst to the blacklist with default timeout */
86
+#define dst_blacklist_add(err_flags, si, msg) \
87
+	dst_blacklist_add_to((err_flags), (si), (msg), S_TO_TICKS(blst_timeout))
77 88
 
78 89
 int dst_is_blacklisted(struct dest_info* si, struct sip_msg* msg);
90
+/* delete an entry from the blacklist */
91
+int dst_blacklist_del(struct dest_info* si, struct sip_msg* msg);
79 92
 
80 93
 /* deletes all the entries from the blacklist except the permanent ones
81 94
  * (which are marked with BLST_PERMANENT)
Browse code

dst blacklist callbacks are extended with the sip msg parameter.

WARNING: the sip msg might be in shared memory without locking,
do not modify it!

Miklos Tirpak authored on 26/07/2007 11:52:22
Showing 1 changed files
... ...
@@ -35,6 +35,7 @@
35 35
 #define dst_black_list_h
36 36
 
37 37
 #include "ip_addr.h"
38
+#include "parser/msg_parser.h"
38 39
 
39 40
 /* flags: */
40 41
 #define BLST_IS_IPV6		1		/* set if the address is ipv6 */
... ...
@@ -58,7 +59,10 @@
58 59
 
59 60
 #ifdef DST_BLACKLIST_HOOKS
60 61
 struct blacklist_hook{
61
-	int (*on_blst_action)(struct dest_info* si, unsigned char* err_flags);
62
+	/* WARNING: msg might be NULL, and it might point to shared memory
63
+	 * without locking, do not modify it! msg can be used typically for checking
64
+	 * the message flags with isflagset() */
65
+	int (*on_blst_action)(struct dest_info* si, unsigned char* err_flags, struct sip_msg* msg);
62 66
 	/* called before ser shutdown */
63 67
 	void (*destroy)(void);
64 68
 };
... ...
@@ -69,9 +73,9 @@ int register_blacklist_hook(struct blacklist_hook *h, int type);
69 73
 int init_dst_blacklist();
70 74
 void destroy_dst_blacklist();
71 75
 
72
-int dst_blacklist_add(unsigned char err_flags, struct dest_info* si);
76
+int dst_blacklist_add(unsigned char err_flags, struct dest_info* si, struct sip_msg* msg);
73 77
 
74
-int dst_is_blacklisted(struct dest_info* si);
78
+int dst_is_blacklisted(struct dest_info* si, struct sip_msg* msg);
75 79
 
76 80
 /* deletes all the entries from the blacklist except the permanent ones
77 81
  * (which are marked with BLST_PERMANENT)
Browse code

New RPC commands to manipulate the destination blacklist:

- dst_blacklist.view: dumps the content of the blacklist
- dst_blacklist.delete_all: deletes all the entries
(except the permanent ones)
- dst_blacklist.add: Adds a new entry to the blacklsit

Miklos Tirpak authored on 26/07/2007 11:42:53
Showing 1 changed files
... ...
@@ -72,4 +72,10 @@ void destroy_dst_blacklist();
72 72
 int dst_blacklist_add(unsigned char err_flags, struct dest_info* si);
73 73
 
74 74
 int dst_is_blacklisted(struct dest_info* si);
75
+
76
+/* deletes all the entries from the blacklist except the permanent ones
77
+ * (which are marked with BLST_PERMANENT)
78
+ */
79
+void dst_blst_flush(void);
80
+
75 81
 #endif
Browse code

- change blacklist_hook s/on_blst_add/on_blst_action/ (it can be used now also for search)

Andrei Pelinescu-Onciul authored on 26/06/2007 15:35:06
Showing 1 changed files
... ...
@@ -58,7 +58,7 @@
58 58
 
59 59
 #ifdef DST_BLACKLIST_HOOKS
60 60
 struct blacklist_hook{
61
-	int (*on_blst_add)(struct dest_info* si, unsigned char* err_flags);
61
+	int (*on_blst_action)(struct dest_info* si, unsigned char* err_flags);
62 62
 	/* called before ser shutdown */
63 63
 	void (*destroy)(void);
64 64
 };
Browse code

- callback support also for search/is_blacklisted (can be used to implement permanent blacklists, whitelists a.s.o.) - lock only if the hash bucket list is non-empty

Andrei Pelinescu-Onciul authored on 26/06/2007 15:30:07
Showing 1 changed files
... ...
@@ -46,11 +46,15 @@
46 46
 #define BLST_ADM_PROHIBITED	(1<<6)	/* administratively prohibited */
47 47
 #define BLST_PERMANENT		(1<<7)  /* never deleted, never expires */
48 48
 
49
-
49
+/* uncomment the define above to enable blacklist callbacks support */
50 50
 /*#define DST_BLACKLIST_HOOKS*/
51 51
 
52
-#define DST_BLACKLIST_ACCEPT 0
53
-#define DST_BLACKLIST_DENY  -1
52
+#define DST_BLACKLIST_CONTINUE 0 /* add: do nothing/ignore, search: ignore */
53
+#define DST_BLACKLIST_ACCEPT 1   /* add: force accept, search: force match */
54
+#define DST_BLACKLIST_DENY  -1   /* add: deny, search: force no match */
55
+
56
+#define DST_BLACKLIST_ADD_CB 1
57
+#define DST_BLACKLIST_SEARCH_CB 2
54 58
 
55 59
 #ifdef DST_BLACKLIST_HOOKS
56 60
 struct blacklist_hook{
... ...
@@ -59,7 +63,7 @@ struct blacklist_hook{
59 63
 	void (*destroy)(void);
60 64
 };
61 65
 
62
-int register_blacklist_hook(struct blacklist_hook *h);
66
+int register_blacklist_hook(struct blacklist_hook *h, int type);
63 67
 #endif /* DST_BLACKLIST_HOOKS */
64 68
 
65 69
 int init_dst_blacklist();
Browse code

- added callbacks/hooks for dst_blacklist_add: one can register such a callback and deny adding a destination to the blacklist list, or it can change the destinations flags.

- autodetect if locks or lock_set are not limited and if so use
one lock per hash bucket or a lock_set of hash table size (should work
better on multiple cpus, less cacheline invalidations)

Andrei Pelinescu-Onciul authored on 30/05/2007 22:22:42
Showing 1 changed files
... ...
@@ -46,6 +46,22 @@
46 46
 #define BLST_ADM_PROHIBITED	(1<<6)	/* administratively prohibited */
47 47
 #define BLST_PERMANENT		(1<<7)  /* never deleted, never expires */
48 48
 
49
+
50
+/*#define DST_BLACKLIST_HOOKS*/
51
+
52
+#define DST_BLACKLIST_ACCEPT 0
53
+#define DST_BLACKLIST_DENY  -1
54
+
55
+#ifdef DST_BLACKLIST_HOOKS
56
+struct blacklist_hook{
57
+	int (*on_blst_add)(struct dest_info* si, unsigned char* err_flags);
58
+	/* called before ser shutdown */
59
+	void (*destroy)(void);
60
+};
61
+
62
+int register_blacklist_hook(struct blacklist_hook *h);
63
+#endif /* DST_BLACKLIST_HOOKS */
64
+
49 65
 int init_dst_blacklist();
50 66
 void destroy_dst_blacklist();
51 67
 
Browse code

- dns cache support (ser will cache both positive and negative responses if turned on, see doc/dns.txt for more details & config options) - dns failover support: when a name resolves to more then 1 ip (either multiple A or AAAA records or multiple SRVs) and sending to the first ip fails, ser will retry with the others. By default is off. See doc/dns.txt for more details/config options a.s.o. - destination blacklist: when sending to some destination (defined by ip:port and protocol) fails, ser will temporarily add this destination in a blacklist giving future sends the opportunity of i