... | ... |
@@ -71,7 +71,7 @@ x jku: branch hash computation over canonical values |
71 | 71 |
x freopen stdin, stdout, stderr to /dev/null |
72 | 72 |
- add a section on building ser & configuring it for maximum performance |
73 | 73 |
(-DF_MALLOC, -DNO_DBG, ... sip_warning=0, a.s.o) |
74 |
-- add src_port, dst_port, proto to cfg.{y,lex} |
|
74 |
+x add src_port, dst_port, proto to cfg.{y,lex} |
|
75 | 75 |
x generic locking lib |
76 | 76 |
x convert tm to use new locking lib |
77 | 77 |
- force add rport (setflag(rport)???) |
... | ... |
@@ -79,6 +79,7 @@ x convert tm to use new locking lib |
79 | 79 |
|
80 | 80 |
optimizations: |
81 | 81 |
- better timer interface with hashes (a la openbsd) |
82 |
+- change lumps (flags for malloc type, recursive? see COND lumps ) |
|
82 | 83 |
- atomic ops? |
83 | 84 |
- assembly for some very common used function |
84 | 85 |
- getsock* cache |
... | ... |
@@ -55,8 +55,11 @@ int check_self(str* host, unsigned short port); |
55 | 55 |
int forward_request( struct sip_msg* msg, struct proxy_l* p, int proto); |
56 | 56 |
int update_sock_struct_from_via( union sockaddr_union* to, |
57 | 57 |
struct via_body* via ); |
58 |
+ |
|
59 |
+/* use src_ip, port=src_port if rport, via port if via port, 5060 otherwise */ |
|
58 | 60 |
#define update_sock_struct_from_ip( to, msg ) \ |
59 | 61 |
init_su((to), &(msg)->rcv.src_ip, \ |
62 |
+ ((msg)->via1->rport)?htons((msg)->rcv.src_port): \ |
|
60 | 63 |
((msg)->via1->port)?htons((msg)->via1->port): htons(SIP_PORT) ) |
61 | 64 |
|
62 | 65 |
int forward_reply( struct sip_msg* msg); |
... | ... |
@@ -259,6 +259,26 @@ static inline short su_getport(union sockaddr_union* su) |
259 | 259 |
|
260 | 260 |
|
261 | 261 |
|
262 |
+/* sets the port number */ |
|
263 |
+static inline void su_setport(union sockaddr_union* su, unsigned short port) |
|
264 |
+{ |
|
265 |
+ switch(su->s.sa_family){ |
|
266 |
+ case AF_INET: |
|
267 |
+ su->sin.sin_port=port; |
|
268 |
+ break; |
|
269 |
+#ifdef USE_IPV6 |
|
270 |
+ case AF_INET6: |
|
271 |
+ su->sin6.sin6_port=port; |
|
272 |
+ break; |
|
273 |
+#endif |
|
274 |
+ default: |
|
275 |
+ LOG(L_CRIT,"su_set_port: BUG: unknown address family %d\n", |
|
276 |
+ su->s.sa_family); |
|
277 |
+ } |
|
278 |
+} |
|
279 |
+ |
|
280 |
+ |
|
281 |
+ |
|
262 | 282 |
/* inits an ip_addr pointer from a sockaddr_union ip address */ |
263 | 283 |
static inline void su2ip_addr(struct ip_addr* ip, union sockaddr_union* su) |
264 | 284 |
{ |
... | ... |
@@ -94,7 +94,9 @@ void destroy_timer() |
94 | 94 |
|
95 | 95 |
|
96 | 96 |
/*register a periodic timer; |
97 |
- * ret: <0 on error*/ |
|
97 |
+ * ret: <0 on error |
|
98 |
+ * Hint: if you need it in a module, register it from mod_init or it |
|
99 |
+ * won't work otherwise*/ |
|
98 | 100 |
int register_timer(timer_function f, void* param, unsigned int interval) |
99 | 101 |
{ |
100 | 102 |
struct sr_timer* t; |