- helper macros for getting the local address & port, the peer
address & port, the protocol and the compression from a tcp
connection structure pointer.
... | ... |
@@ -188,6 +188,31 @@ struct tcp_connection{ |
188 | 188 |
}; |
189 | 189 |
|
190 | 190 |
|
191 |
+/* helper macros */ |
|
192 |
+ |
|
193 |
+#define TCP_RCV_INFO(c) (&(c)->rcv) |
|
194 |
+ |
|
195 |
+#define TCP_RCV_LADDR(r) (&((r).dst_ip)) |
|
196 |
+#define TCP_RCV_LPORT(r) ((r).dst_port) |
|
197 |
+#define TCP_RCV_PADDR(r) (&((r).src_ip)) |
|
198 |
+#define TCP_RCV_PPORT(r) ((r).src_port) |
|
199 |
+#define TCP_RCV_PSU(r) (&(r).src_su) |
|
200 |
+#define TCP_RCV_SOCK_INFO(r) ((r).bind_address) |
|
201 |
+#define TCP_RCV_PROTO(r) ((r).proto) |
|
202 |
+#ifdef USE_COMP |
|
203 |
+#define TCP_RCV_COMP(r) ((r).comp) |
|
204 |
+#else |
|
205 |
+#define TCP_RCV_COMP(r) 0 |
|
206 |
+#endif /* USE_COMP */ |
|
207 |
+ |
|
208 |
+#define TCP_LADDR(c) TCP_RCV_LADDR(c->rcv) |
|
209 |
+#define TCP_LPORT(c) TCP_RCV_LPORT(c->rcv) |
|
210 |
+#define TCP_PADDR(c) TCP_RCV_PADDR(c->rcv) |
|
211 |
+#define TCP_PPORT(c) TCP_RCV_PPORT(c->rcv) |
|
212 |
+#define TCP_PSU(c) TCP_RCV_PSU(c->rcv) |
|
213 |
+#define TCP_SOCK_INFO(c) TCP_RCV_SOCK_INFO(c->rcv) |
|
214 |
+#define TCP_PROTO(c) TCP_RCV_PROTO(c->rcv) |
|
215 |
+#define TCP_COMP(c) TCP_RCV_COMP(c->rcv) |
|
191 | 216 |
|
192 | 217 |
|
193 | 218 |
|