Module: sip-router Branch: ser_core_cvs Commit: f73a84d57949101a9d0842d049fe7aab71d8613b URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=f73a84d5...
Author: Andrei Pelinescu-Onciul andrei@iptel.org Committer: Andrei Pelinescu-Onciul andrei@iptel.org Date: Thu Apr 9 19:10:31 2009 +0000
tcp: helper internal macros
- helper macros for getting the local address & port, the peer address & port, the protocol and the compression from a tcp connection structure pointer.
---
tcp_conn.h | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/tcp_conn.h b/tcp_conn.h index 7ae829d..9db6308 100644 --- a/tcp_conn.h +++ b/tcp_conn.h @@ -188,6 +188,31 @@ struct tcp_connection{ };
+/* helper macros */ + +#define TCP_RCV_INFO(c) (&(c)->rcv) + +#define TCP_RCV_LADDR(r) (&((r).dst_ip)) +#define TCP_RCV_LPORT(r) ((r).dst_port) +#define TCP_RCV_PADDR(r) (&((r).src_ip)) +#define TCP_RCV_PPORT(r) ((r).src_port) +#define TCP_RCV_PSU(r) (&(r).src_su) +#define TCP_RCV_SOCK_INFO(r) ((r).bind_address) +#define TCP_RCV_PROTO(r) ((r).proto) +#ifdef USE_COMP +#define TCP_RCV_COMP(r) ((r).comp) +#else +#define TCP_RCV_COMP(r) 0 +#endif /* USE_COMP */ + +#define TCP_LADDR(c) TCP_RCV_LADDR(c->rcv) +#define TCP_LPORT(c) TCP_RCV_LPORT(c->rcv) +#define TCP_PADDR(c) TCP_RCV_PADDR(c->rcv) +#define TCP_PPORT(c) TCP_RCV_PPORT(c->rcv) +#define TCP_PSU(c) TCP_RCV_PSU(c->rcv) +#define TCP_SOCK_INFO(c) TCP_RCV_SOCK_INFO(c->rcv) +#define TCP_PROTO(c) TCP_RCV_PROTO(c->rcv) +#define TCP_COMP(c) TCP_RCV_COMP(c->rcv)