9
0
Fork 0

pcap: Classify the direction of such a message

This commit is contained in:
Holger Hans Peter Freyther 2011-01-22 17:37:56 +01:00
parent ddf8eae7da
commit 36260e915a
4 changed files with 10 additions and 6 deletions

View File

@ -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

View File

@ -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:

View File

@ -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;

View File

@ -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;