aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-01-22 17:37:56 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-01-22 21:33:18 +0100
commit36260e915a23892e5275866ef943783ec6a8e404 (patch)
tree9cafb893a7acd9ed1ba6ef7d8c1b6ef0b45fb739
parentddf8eae7da02b20dd4310af9428a1eb18b1dd57d (diff)
pcap: Classify the direction of such a message
-rw-r--r--include/bsc_data.h6
-rw-r--r--src/link_udp.c4
-rw-r--r--src/links.c2
-rw-r--r--src/sctp_m2ua.c4
4 files changed, 10 insertions, 6 deletions
diff --git a/include/bsc_data.h b/include/bsc_data.h
index 8c827e2..8b72785 100644
--- a/include/bsc_data.h
+++ b/include/bsc_data.h
@@ -161,6 +161,10 @@ int link_clear_all(struct mtp_link_set *);
void mgcp_forward(struct bsc_data *bsc, const uint8_t *data, unsigned int length);
/* pcap */
-int mtp_handle_pcap(struct mtp_link *, const uint8_t *data, int length);
+enum {
+ NET_IN,
+ NET_OUT,
+};
+int mtp_handle_pcap(struct mtp_link *, int dir, const uint8_t *data, int length);
#endif
diff --git a/src/link_udp.c b/src/link_udp.c
index a9b2d9b..1e24faf 100644
--- a/src/link_udp.c
+++ b/src/link_udp.c
@@ -61,7 +61,7 @@ static int udp_write_cb(struct bsc_fd *fd, struct msgb *msg)
}
LOGP(DINP, LOGL_DEBUG, "Sending MSU: %s\n", hexdump(msg->data, msg->len));
- mtp_handle_pcap(&link->base, msg->l2h, msgb_l2len(msg));
+ mtp_handle_pcap(&link->base, NET_OUT, msg->l2h, msgb_l2len(msg));
/* the assumption is we have connected the socket to the remote */
rc = sendto(fd->fd, msg->data, msg->len, 0,
@@ -136,7 +136,7 @@ static int udp_read_cb(struct bsc_fd *fd)
msg->l2h = msgb_put(msg, length);
LOGP(DINP, LOGL_DEBUG, "MSU data on: %p data %s.\n", link, hexdump(msg->data, msg->len));
- mtp_handle_pcap(link, msg->l2h, msgb_l2len(msg));
+ mtp_handle_pcap(link, NET_IN, msg->l2h, msgb_l2len(msg));
mtp_link_set_data(link, msg);
exit:
diff --git a/src/links.c b/src/links.c
index 1acc8bf..05ac2ee 100644
--- a/src/links.c
+++ b/src/links.c
@@ -177,7 +177,7 @@ int link_clear_all(struct mtp_link_set *set)
return 0;
}
-int mtp_handle_pcap(struct mtp_link *link, const uint8_t *data, int len)
+int mtp_handle_pcap(struct mtp_link *link, int dir, const uint8_t *data, int len)
{
if (link->pcap_fd < 0)
return 0;
diff --git a/src/sctp_m2ua.c b/src/sctp_m2ua.c
index 3f67665..65fde0b 100644
--- a/src/sctp_m2ua.c
+++ b/src/sctp_m2ua.c
@@ -327,7 +327,7 @@ static int m2ua_handle_data(struct sctp_m2ua_conn *conn,
memcpy(msg->l2h, data->dat, data->len);
link = &conn->trans->base;
- mtp_handle_pcap(link, msg->l2h, msgb_l2len(msg));
+ mtp_handle_pcap(link, NET_IN, msg->l2h, msgb_l2len(msg));
mtp_link_set_data(link, msg);
msgb_free(msg);
@@ -469,7 +469,7 @@ static int sctp_m2ua_write(struct mtp_link *link, struct msgb *msg)
if (!m2ua)
return -1;
- mtp_handle_pcap(link, msg->data, msg->len);
+ mtp_handle_pcap(link, NET_OUT, msg->data, msg->len);
m2ua->hdr.msg_class = M2UA_CLS_MAUP;
m2ua->hdr.msg_type = M2UA_MAUP_DATA;