mgcp: Count the received octets as of the MGCP specification

Count the received octets. This is encouraged by the MGCP specification.
Use a 32bit counter that is good enough for more than 12 hours of a EFR
call. This limit is good enough for the current configuration.
This commit is contained in:
Holger Hans Peter Freyther 2012-09-12 11:38:37 +02:00
parent 2a60a11c48
commit 952f752ffa
3 changed files with 4 additions and 0 deletions

View File

@ -55,6 +55,7 @@ struct mgcp_rtp_state {
struct mgcp_rtp_end {
/* statistics */
unsigned int packets;
unsigned int octets;
struct in_addr addr;
/* in network byte order */

View File

@ -296,6 +296,7 @@ static int rtp_data_net(struct osmo_fd *fd, unsigned int what)
proto = fd == &endp->net_end.rtp ? PROTO_RTP : PROTO_RTCP;
endp->net_end.packets += 1;
endp->net_end.octets += rc;
forward_data(fd->fd, &endp->taps[MGCP_TAP_NET_IN], buf, rc);
if (endp->is_transcoded)
@ -374,6 +375,7 @@ static int rtp_data_bts(struct osmo_fd *fd, unsigned int what)
/* do this before the loop handling */
endp->bts_end.packets += 1;
endp->bts_end.octets += rc;
forward_data(fd->fd, &endp->taps[MGCP_TAP_BTS_IN], buf, rc);
if (endp->is_transcoded)

View File

@ -897,6 +897,7 @@ static void mgcp_rtp_end_reset(struct mgcp_rtp_end *end)
}
end->packets = 0;
end->octets = 0;
memset(&end->addr, 0, sizeof(end->addr));
end->rtp_port = end->rtcp_port = 0;
end->payload_type = -1;