9
0
Fork 0

mgcp: Merge the current MGCP code from OpenBSC

There were several changes in the upstream code. These include
statistics, DTMF/RQNT, changes in the parsing code and re-transmission
handling. The last item is the main reason to do the merge now.
This commit is contained in:
Holger Hans Peter Freyther 2012-12-10 15:50:09 +01:00
parent 099e5135fe
commit 65856e5b84
10 changed files with 992 additions and 448 deletions

View File

@ -83,7 +83,7 @@ typedef int (*mgcp_realloc)(struct mgcp_trunk_config *cfg, int endpoint);
typedef int (*mgcp_change)(struct mgcp_trunk_config *cfg, int endpoint, int state);
typedef int (*mgcp_policy)(struct mgcp_trunk_config *cfg, int endpoint, int state, const char *transactio_id);
typedef int (*mgcp_reset)(struct mgcp_trunk_config *cfg);
typedef int (*mgcp_rqnt)(struct mgcp_endpoint *endp, char tone, const char *data);
typedef int (*mgcp_rqnt)(struct mgcp_endpoint *endp, char tone);
#define PORT_ALLOC_STATIC 0
#define PORT_ALLOC_DYNAMIC 1
@ -116,6 +116,8 @@ struct mgcp_trunk_config {
int audio_payload;
int audio_loop;
int omit_rtcp;
/* spec handling */
int force_realloc;
@ -188,12 +190,12 @@ int mgcp_vty_init(void);
int mgcp_endpoints_allocate(struct mgcp_trunk_config *cfg);
void mgcp_free_endp(struct mgcp_endpoint *endp);
int mgcp_reset_transcoder(struct mgcp_config *cfg);
void mgcp_format_stats(struct mgcp_endpoint *endp, char *stats, size_t size);
/*
* format helper functions
*/
struct msgb *mgcp_handle_message(struct mgcp_config *cfg, struct msgb *msg);
struct msgb *mgcp_create_response_with_data(int code, const char *txt, const char *msg, const char *trans, const char *data);
/* adc helper */
static inline int mgcp_timeslot_to_endpoint(int multiplex, int timeslot)
@ -212,5 +214,8 @@ static inline void mgcp_endpoint_to_timeslot(int endpoint, int *multiplex, int *
*timeslot = endpoint % 32;
}
int mgcp_send_reset_ep(struct mgcp_endpoint *endp, int endpoint);
int mgcp_send_reset_all(struct mgcp_config *cfg);
#endif

View File

@ -1,8 +1,8 @@
/* MGCP Private Data */
/*
* (C) 2009-2011 by Holger Hans Peter Freyther <zecke@selfish.org>
* (C) 2009-2011 by On-Waves
* (C) 2009-2012 by Holger Hans Peter Freyther <zecke@selfish.org>
* (C) 2009-2012 by On-Waves
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
@ -47,16 +47,22 @@ struct mgcp_rtp_state {
uint32_t orig_ssrc;
uint32_t ssrc;
uint16_t seq_no;
int lost_no;
uint16_t base_seq;
uint16_t max_seq;
int seq_offset;
int cycles;
uint32_t last_timestamp;
int32_t timestamp_offset;
uint32_t jitter;
int32_t transit;
};
struct mgcp_rtp_end {
/* statistics */
unsigned int packets;
unsigned int octets;
struct in_addr addr;
/* in network byte order */
@ -121,6 +127,10 @@ struct mgcp_endpoint {
/* SSRC/seq/ts patching for loop */
int allow_patch;
/* fields for re-transmission */
char *last_trans;
char *last_response;
/* tap for the endpoint */
struct mgcp_rtp_tap taps[MGCP_TAP_COUNT];
@ -139,9 +149,6 @@ struct mgcp_msg_ptr {
unsigned int length;
};
int mgcp_analyze_header(struct mgcp_config *cfg, struct msgb *msg,
struct mgcp_msg_ptr *ptr, int size,
const char **transaction_id, struct mgcp_endpoint **endp);
int mgcp_send_dummy(struct mgcp_endpoint *endp);
int mgcp_bind_bts_rtp_port(struct mgcp_endpoint *endp, int rtp_port);
int mgcp_bind_net_rtp_port(struct mgcp_endpoint *endp, int rtp_port);
@ -161,5 +168,8 @@ struct mgcp_trunk_config *mgcp_trunk_num(struct mgcp_config *cfg, int index);
struct mgcp_trunk_config *mgcp_trunk_domain(struct mgcp_config *cfg, const char *);
void mgcp_trunk_free(struct mgcp_trunk_config *cfg);
void mgcp_state_calc_loss(struct mgcp_rtp_state *s, struct mgcp_rtp_end *,
uint32_t *expected, int *loss);
uint32_t mgcp_state_calc_jitter(struct mgcp_rtp_state *);
#endif

View File

@ -9,7 +9,7 @@ mgcp_mgw_SOURCES = mgcp_ss7.c mgcp_ss7_vty.c mgcp_hw.c thread.c debug.c \
mgcp/mgcp_protocol.c mgcp/mgcp_network.c mgcp/mgcp_vty.c \
dtmf_scheduler.c
mgcp_mgw_LDADD = $(LAFORGE_LIBS) $(NEXUSWARE_C7_LIBS) $(NEXUSWARE_UNIPORTE_LIBS) \
$(LIBOSMOVTY_LIBS) $(LIBOSMOCORE_LIBS) -lpthread -lcrypto
$(LIBOSMOVTY_LIBS) $(LIBOSMOCORE_LIBS) -lpthread -lcrypto -lrt
cellmgr_ng_SOURCES = main.c mtp_layer3.c thread.c input/ipaccess.c pcap.c \
bss_patch.c bssap_sccp.c bsc_sccp.c bsc_ussd.c links.c \

View File

@ -2,8 +2,8 @@
/* The protocol implementation */
/*
* (C) 2009-2011 by Holger Hans Peter Freyther <zecke@selfish.org>
* (C) 2009-2011 by On-Waves
* (C) 2009-2012 by Holger Hans Peter Freyther <zecke@selfish.org>
* (C) 2009-2012 by On-Waves
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
@ -38,12 +38,18 @@
#warning "Make use of the rtp proxy code"
/* attempt to determine byte order */
#include <sys/types.h>
#include <sys/param.h>
#include <limits.h>
#include <time.h>
#ifndef __BYTE_ORDER
#error "__BYTE_ORDER should be defined by someone"
# ifdef __APPLE__
# define __BYTE_ORDER __DARWIN_BYTE_ORDER
# define __LITTLE_ENDIAN __DARWIN_LITTLE_ENDIAN
# define __BIG_ENDIAN __DARWIN_BIG_ENDIAN
# else
# error "__BYTE_ORDER should be defined by someone"
# endif
#endif
/* according to rtp_proxy.c RFC 3550 */
@ -68,6 +74,10 @@ struct rtp_hdr {
uint32_t ssrc;
} __attribute__((packed));
#define RTP_SEQ_MOD (1 << 16)
#define RTP_MAX_DROPOUT 3000
#define RTP_MAX_MISORDER 100
enum {
DEST_NETWORK = 0,
@ -82,6 +92,29 @@ enum {
#define DUMMY_LOAD 0x23
/**
* This does not need to be a precision timestamp and
* is allowed to wrap quite fast. The returned value is
* milli seconds now.
*/
uint32_t get_current_ts(void)
{
struct timespec tp;
uint64_t ret;
memset(&tp, 0, sizeof(tp));
if (clock_gettime(CLOCK_MONOTONIC, &tp) != 0)
LOGP(DMGCP, LOGL_NOTICE,
"Getting the clock failed.\n");
/* convert it to useconds */
ret = tp.tv_sec;
ret *= 1000;
ret += tp.tv_nsec / 1000 / 1000;
return ret;
}
static int udp_send(int fd, struct in_addr *addr, int port, char *buf, int len)
{
struct sockaddr_in out;
@ -100,10 +133,20 @@ int mgcp_send_dummy(struct mgcp_endpoint *endp)
endp->net_end.rtp_port, buf, 1);
}
/**
* The RFC 3550 Appendix A assumes there are multiple sources but
* some of the supported endpoints (e.g. the nanoBTS) can only handle
* one source and this code will patch packages to appear as if there
* is only one source.
* There is also no probation period for new sources. Every package
* we receive will be seen as a switch in streams.
*/
static void patch_and_count(struct mgcp_endpoint *endp, struct mgcp_rtp_state *state,
int payload, struct sockaddr_in *addr, char *data, int len)
{
uint16_t seq;
uint32_t arrival_time;
int32_t transit, d;
uint16_t seq, udelta;
uint32_t timestamp;
struct rtp_hdr *rtp_hdr;
@ -113,15 +156,19 @@ static void patch_and_count(struct mgcp_endpoint *endp, struct mgcp_rtp_state *s
rtp_hdr = (struct rtp_hdr *) data;
seq = ntohs(rtp_hdr->sequence);
timestamp = ntohl(rtp_hdr->timestamp);
arrival_time = get_current_ts();
if (!state->initialized) {
state->seq_no = seq - 1;
state->base_seq = seq;
state->max_seq = seq - 1;
state->ssrc = state->orig_ssrc = rtp_hdr->ssrc;
state->initialized = 1;
state->last_timestamp = timestamp;
state->jitter = 0;
state->transit = arrival_time - timestamp;
} else if (state->ssrc != rtp_hdr->ssrc) {
state->ssrc = rtp_hdr->ssrc;
state->seq_offset = (state->seq_no + 1) - seq;
state->seq_offset = (state->max_seq + 1) - seq;
state->timestamp_offset = state->last_timestamp - timestamp;
#warning "Always allow to patch the SSRC"
state->patch = 1;
@ -141,11 +188,35 @@ static void patch_and_count(struct mgcp_endpoint *endp, struct mgcp_rtp_state *s
rtp_hdr->timestamp = htonl(timestamp);
}
/* seq changed, now compare if we have lost something */
if (state->seq_no + 1u != seq)
state->lost_no = abs(seq - (state->seq_no + 1));
state->seq_no = seq;
/*
* The below takes the shape of the validation from Appendix A. Check
* if there is something weird with the sequence number, otherwise check
* for a wrap around in the sequence number.
*/
udelta = seq - state->max_seq;
if (udelta < RTP_MAX_DROPOUT) {
if (seq < state->max_seq)
state->cycles += RTP_SEQ_MOD;
} else if (udelta <= RTP_SEQ_MOD + RTP_MAX_MISORDER) {
LOGP(DMGCP, LOGL_NOTICE,
"RTP seqno made a very large jump on 0x%x delta: %u\n",
ENDPOINT_NUMBER(endp), udelta);
}
/*
* calculate the jitter between the two packages. The TS should be
* taken closer to the read function. This was taken from the
* Appendix A of RFC 3550. The local timestamp has a usec resolution.
*/
transit = arrival_time - timestamp;
d = transit - state->transit;
state->transit = transit;
if (d < 0)
d = -d;
state->jitter += d - ((state->jitter + 8) >> 4);
state->max_seq = seq;
state->last_timestamp = timestamp;
if (payload < 0)
@ -214,7 +285,7 @@ static int send_to(struct mgcp_endpoint *endp, int dest, int is_rtp,
&endp->taps[MGCP_TAP_NET_OUT], buf, rc);
return udp_send(endp->net_end.rtp.fd, &endp->net_end.addr,
endp->net_end.rtp_port, buf, rc);
} else {
} else if (!tcfg->omit_rtcp) {
return udp_send(endp->net_end.rtcp.fd, &endp->net_end.addr,
endp->net_end.rtcp_port, buf, rc);
}
@ -227,15 +298,17 @@ static int send_to(struct mgcp_endpoint *endp, int dest, int is_rtp,
&endp->taps[MGCP_TAP_BTS_OUT], buf, rc);
return udp_send(endp->bts_end.rtp.fd, &endp->bts_end.addr,
endp->bts_end.rtp_port, buf, rc);
} else {
} else if (!tcfg->omit_rtcp) {
return udp_send(endp->bts_end.rtcp.fd, &endp->bts_end.addr,
endp->bts_end.rtcp_port, buf, rc);
}
}
return 0;
}
static int recevice_from(struct mgcp_endpoint *endp, int fd, struct sockaddr_in *addr,
char *buf, int bufsize)
static int receive_from(struct mgcp_endpoint *endp, int fd, struct sockaddr_in *addr,
char *buf, int bufsize)
{
int rc;
socklen_t slen = sizeof(*addr);
@ -266,14 +339,16 @@ static int rtp_data_net(struct osmo_fd *fd, unsigned int what)
endp = (struct mgcp_endpoint *) fd->data;
rc = recevice_from(endp, fd->fd, &addr, buf, sizeof(buf));
rc = receive_from(endp, fd->fd, &addr, buf, sizeof(buf));
if (rc <= 0)
return -1;
if (memcmp(&addr.sin_addr, &endp->net_end.addr, sizeof(addr.sin_addr)) != 0) {
LOGP(DMGCP, LOGL_ERROR,
"Data from wrong address %s on 0x%x\n",
inet_ntoa(addr.sin_addr), ENDPOINT_NUMBER(endp));
"Endpoint 0x%x data from wrong address %s vs. ",
ENDPOINT_NUMBER(endp), inet_ntoa(addr.sin_addr));
LOGPC(DMGCP, LOGL_ERROR,
"%s\n", inet_ntoa(endp->net_end.addr));
return -1;
}
@ -294,6 +369,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)
@ -338,7 +414,7 @@ static int rtp_data_bts(struct osmo_fd *fd, unsigned int what)
endp = (struct mgcp_endpoint *) fd->data;
rc = recevice_from(endp, fd->fd, &addr, buf, sizeof(buf));
rc = receive_from(endp, fd->fd, &addr, buf, sizeof(buf));
if (rc <= 0)
return -1;
@ -372,6 +448,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)
@ -389,7 +466,7 @@ static int rtp_data_transcoder(struct mgcp_rtp_end *end, struct mgcp_endpoint *_
int rc, proto;
cfg = _endp->cfg;
rc = recevice_from(_endp, fd->fd, &addr, buf, sizeof(buf));
rc = receive_from(_endp, fd->fd, &addr, buf, sizeof(buf));
if (rc <= 0)
return -1;
@ -575,3 +652,38 @@ int mgcp_free_rtp_port(struct mgcp_rtp_end *end)
return 0;
}
void mgcp_state_calc_loss(struct mgcp_rtp_state *state,
struct mgcp_rtp_end *end, uint32_t *expected,
int *loss)
{
*expected = state->cycles + state->max_seq;
*expected = *expected - state->base_seq + 1;
if (!state->initialized) {
*expected = 0;
*loss = 0;
return;
}
/*
* Make sure the sign is correct and use the biggest
* positive/negative number that fits.
*/
*loss = *expected - end->packets;
if (*expected < end->packets) {
if (*loss > 0)
*loss = INT_MIN;
} else {
if (*loss < 0)
*loss = INT_MAX;
}
}
uint32_t mgcp_state_calc_jitter(struct mgcp_rtp_state *state)
{
if (!state->initialized)
return 0;
return state->jitter >> 4;
}

File diff suppressed because it is too large Load Diff

View File

@ -88,6 +88,10 @@ static void bsc_replace_string(void *ctx, char **dst, const char *newstr)
*dst = talloc_strdup(ctx, newstr);
}
#define RTCP_OMIT_STR "Drop RTCP packets in both directions\n"
struct mgcp_config *g_cfg = NULL;
static struct mgcp_trunk_config *find_trunk(struct mgcp_config *cfg,
@ -108,19 +112,19 @@ static struct mgcp_trunk_config *find_trunk(struct mgcp_config *cfg,
*/
struct cmd_node mgcp_node = {
MGCP_NODE,
"%s(mgcp)#",
"%s(config-mgcp)# ",
1,
};
struct cmd_node vtrunk_node = {
VTRUNK_NODE,
"%s(vtrunk)#",
"%s(config-mgcp-vtrunk)#",
1,
};
struct cmd_node trunk_node = {
TRUNK_NODE,
"%s(trunk)#",
"%s(config-mgcp-trunk)# ",
1,
};
@ -148,7 +152,7 @@ static int config_write_mgcp(struct vty *vty)
vty_out(vty, " rtp ip-dscp %d%s", g_cfg->endp_dscp, VTY_NEWLINE);
if (g_cfg->call_agent_addr)
vty_out(vty, " call agent ip %s%s", g_cfg->call_agent_addr, VTY_NEWLINE);
vty_out(vty, " call-agent ip %s%s", g_cfg->call_agent_addr, VTY_NEWLINE);
if (g_cfg->transcoder_ip)
vty_out(vty, " transcoder-mgw %s%s", g_cfg->transcoder_ip, VTY_NEWLINE);
@ -191,13 +195,12 @@ static void dump_trunk(struct vty *vty, struct mgcp_trunk_config *cfg)
vty_out(vty,
" Endpoint 0x%.2x: CI: %d net: %u/%u bts: %u/%u on %s "
"traffic received bts: %u/%u remote: %u/%u transcoder: %u/%u%s",
"traffic received bts: %u remote: %u transcoder: %u/%u%s",
i, endp->ci,
ntohs(endp->net_end.rtp_port), ntohs(endp->net_end.rtcp_port),
ntohs(endp->bts_end.rtp_port), ntohs(endp->bts_end.rtcp_port),
inet_ntoa(endp->bts_end.addr),
endp->bts_end.packets, endp->bts_state.lost_no,
endp->net_end.packets, endp->net_state.lost_no,
endp->bts_end.packets, endp->net_end.packets,
endp->trans_net.packets, endp->trans_bts.packets,
VTY_NEWLINE);
}
@ -228,8 +231,10 @@ DEFUN(cfg_mgcp,
DEFUN(cfg_mgcp_local_ip,
cfg_mgcp_local_ip_cmd,
"local ip IP",
"Set the IP to be used in SDP records")
"local ip A.B.C.D",
"Local options for the SDP record\n"
IP_STR
"IPv4 Address to use in SDP record\n")
{
struct hostent *hosts;
struct in_addr *addr;
@ -247,8 +252,10 @@ DEFUN(cfg_mgcp_local_ip,
DEFUN(cfg_mgcp_mgw_ip,
cfg_mgcp_mgw_ip_cmd,
"mgw ip IP",
"Set the IP of the MGW for RTP forwarding")
"mgw ip A.B.C.D",
"BTS Audio source/destination options\n"
IP_STR
"IPv4 Address of the BTS\n")
{
struct hostent *hosts;
struct in_addr *addr;
@ -265,10 +272,13 @@ DEFUN(cfg_mgcp_mgw_ip,
return CMD_SUCCESS;
}
#define BIND_STR "Listen/Bind related socket option\n"
DEFUN(cfg_mgcp_bind_ip,
cfg_mgcp_bind_ip_cmd,
"bind ip A.B.C.D",
"Bind the MGCP to this local addr")
BIND_STR
IP_STR
"IPv4 Address to bind to\n")
{
bsc_replace_string(g_cfg, &g_cfg->source_addr, argv[0]);
return CMD_SUCCESS;
@ -277,7 +287,9 @@ DEFUN(cfg_mgcp_bind_ip,
DEFUN(cfg_mgcp_bind_port,
cfg_mgcp_bind_port_cmd,
"bind port <0-65534>",
"Bind the MGCP to this port")
BIND_STR
"Port information\n"
"UDP port to listen for MGCP messages\n")
{
unsigned int port = atoi(argv[0]);
g_cfg->source_port = port;
@ -287,7 +299,9 @@ DEFUN(cfg_mgcp_bind_port,
DEFUN(cfg_mgcp_bind_early,
cfg_mgcp_bind_early_cmd,
"bind early (0|1)",
"Bind all RTP ports early")
BIND_STR
"Bind local ports on start up\n"
"Bind on demand\n" "Bind on startup\n")
{
vty_out(vty, "bind early is deprecated, remove it from the config.\n");
return CMD_WARNING;
@ -309,20 +323,28 @@ static void parse_range(struct mgcp_port_range *range, const char **argv)
}
#define RTP_STR "RTP configuration\n"
#define BTS_START_STR "First UDP port allocated for the BTS side\n"
#define NET_START_STR "First UDP port allocated for the NET side\n"
#define UDP_PORT_STR "UDP Port number\n"
DEFUN(cfg_mgcp_rtp_bts_base_port,
cfg_mgcp_rtp_bts_base_port_cmd,
"rtp bts-base <0-65534>",
"Base port to use")
RTP_STR
BTS_START_STR
UDP_PORT_STR)
{
parse_base(&g_cfg->bts_ports, argv);
return CMD_SUCCESS;
}
#define RANGE_START_STR "Start of the range of ports\n"
#define RANGE_END_STR "End of the range of ports\n"
DEFUN(cfg_mgcp_rtp_bts_range,
cfg_mgcp_rtp_bts_range_cmd,
"rtp bts-range <0-65534> <0-65534>",
"Range of ports to allocate for endpoints\n"
"Start of the range of ports\n" "End of the range of ports\n")
RTP_STR "Range of ports to use for the BTS side\n"
RANGE_START_STR RANGE_END_STR)
{
parse_range(&g_cfg->bts_ports, argv);
return CMD_SUCCESS;
@ -331,8 +353,8 @@ DEFUN(cfg_mgcp_rtp_bts_range,
DEFUN(cfg_mgcp_rtp_net_range,
cfg_mgcp_rtp_net_range_cmd,
"rtp net-range <0-65534> <0-65534>",
"Range of ports to allocate for endpoints\n"
"Start of the range of ports\n" "End of the range of ports\n")
RTP_STR "Range of ports to use for the NET side\n"
RANGE_START_STR RANGE_END_STR)
{
parse_range(&g_cfg->net_ports, argv);
return CMD_SUCCESS;
@ -341,20 +363,21 @@ DEFUN(cfg_mgcp_rtp_net_range,
DEFUN(cfg_mgcp_rtp_net_base_port,
cfg_mgcp_rtp_net_base_port_cmd,
"rtp net-base <0-65534>",
"Base port to use for network port\n" "Port\n")
RTP_STR NET_START_STR UDP_PORT_STR)
{
parse_base(&g_cfg->net_ports, argv);
return CMD_SUCCESS;
}
ALIAS_DEPRECATED(cfg_mgcp_rtp_bts_base_port, cfg_mgcp_rtp_base_port_cmd,
"rtp base <0-65534>", "Base port to use")
"rtp base <0-65534>",
RTP_STR BTS_START_STR UDP_PORT_STR)
DEFUN(cfg_mgcp_rtp_transcoder_range,
cfg_mgcp_rtp_transcoder_range_cmd,
"rtp transcoder-range <0-65534> <0-65534>",
"Range of ports to allocate for the transcoder\n"
"Start of the range of ports\n" "End of the range of ports\n")
RTP_STR "Range of ports to use for the Transcoder\n"
RANGE_START_STR RANGE_END_STR)
{
parse_range(&g_cfg->transcoder_ports, argv);
return CMD_SUCCESS;
@ -363,7 +386,8 @@ DEFUN(cfg_mgcp_rtp_transcoder_range,
DEFUN(cfg_mgcp_rtp_transcoder_base,
cfg_mgcp_rtp_transcoder_base_cmd,
"rtp transcoder-base <0-65534>",
"Base port for the transcoder range\n" "Port\n")
RTP_STR "First UDP port allocated for the Transcoder side\n"
UDP_PORT_STR)
{
parse_base(&g_cfg->transcoder_ports, argv);
return CMD_SUCCESS;
@ -372,7 +396,8 @@ DEFUN(cfg_mgcp_rtp_transcoder_base,
DEFUN(cfg_mgcp_rtp_ip_dscp,
cfg_mgcp_rtp_ip_dscp_cmd,
"rtp ip-dscp <0-255>",
"Set the IP_TOS socket attribute on the RTP/RTCP sockets.\n" "The DSCP value.")
RTP_STR
"Apply IP_TOS to the audio stream\n" "The DSCP value\n")
{
int dscp = atoi(argv[0]);
g_cfg->endp_dscp = dscp;
@ -381,9 +406,13 @@ DEFUN(cfg_mgcp_rtp_ip_dscp,
ALIAS_DEPRECATED(cfg_mgcp_rtp_ip_dscp, cfg_mgcp_rtp_ip_tos_cmd,
"rtp ip-tos <0-255>",
"Set the IP_TOS socket attribute on the RTP/RTCP sockets.\n" "The DSCP value.")
RTP_STR
"Apply IP_TOS to the audio stream\n" "The DSCP value\n")
#define SDP_STR "SDP File related options\n"
#define AUDIO_STR "Audio payload options\n"
DEFUN(cfg_vtrunk_number_endp,
cfg_vtrunk_number_endp_cmd,
"number endpoints <0-65534>",
@ -406,15 +435,24 @@ DEFUN(cfg_vtrunk_number_endp,
return CMD_SUCCESS;
}
#define CALL_AGENT_STR "Callagent information\n"
DEFUN(cfg_mgcp_agent_addr,
cfg_mgcp_agent_addr_cmd,
"call agent ip IP",
"Set the address of the call agent.")
"call-agent ip A.B.C.D",
CALL_AGENT_STR IP_STR
"IPv4 Address of the callagent\n")
{
bsc_replace_string(g_cfg, &g_cfg->call_agent_addr, argv[0]);
return CMD_SUCCESS;
}
ALIAS_DEPRECATED(cfg_mgcp_agent_addr, cfg_mgcp_agent_addr_cmd_old,
"call agent ip A.B.C.D",
CALL_AGENT_STR CALL_AGENT_STR IP_STR
"IPv4 Address of the callagent\n")
DEFUN(cfg_mgcp_transcoder,
cfg_mgcp_transcoder_cmd,
"transcoder-mgw A.B.C.D",
@ -429,8 +467,8 @@ DEFUN(cfg_mgcp_transcoder,
DEFUN(cfg_mgcp_no_transcoder,
cfg_mgcp_no_transcoder_cmd,
NO_STR "transcoder-mgw",
"Disable the transcoding\n")
"no transcoder-mgw",
NO_STR "Disable the transcoding\n")
{
if (g_cfg->transcoder_ip) {
LOGP(DMGCP, LOGL_NOTICE, "Disabling transcoding on future calls.\n");
@ -509,6 +547,10 @@ static void config_write_trunk_common(struct vty *vty,
tcfg->audio_name, VTY_NEWLINE);
vty_out(vty, " loop %d%s",
tcfg->audio_loop, VTY_NEWLINE);
if (tcfg->omit_rtcp)
vty_out(vty, " rtcp-omit%s", VTY_NEWLINE);
else
vty_out(vty, " no rtcp-omit%s", VTY_NEWLINE);
}
static int config_write_trunk(struct vty *vty)
@ -541,8 +583,8 @@ static int config_write_vtrunk(struct vty *vty)
DEFUN(cfg_trunk_payload_number,
cfg_trunk_payload_number_cmd,
"sdp audio payload number <1-255>",
"SDP related\n" "Audio\n" "Payload\n" "Payload Number\n")
"sdp audio-payload number <1-255>",
SDP_STR AUDIO_STR "Number\n" "Payload Number\n")
{
struct mgcp_trunk_config *trunk = vty->index;
unsigned int payload = atoi(argv[0]);
@ -551,10 +593,14 @@ DEFUN(cfg_trunk_payload_number,
return CMD_SUCCESS;
}
ALIAS_DEPRECATED(cfg_trunk_payload_number, cfg_trunk_payload_number_cmd_old,
"sdp audio payload number <1-255>",
SDP_STR AUDIO_STR AUDIO_STR "Number\n" "Payload Number\n")
DEFUN(cfg_trunk_payload_name,
cfg_trunk_payload_name_cmd,
"sdp audio payload name NAME",
"SDP related\n" "Audio\n" "Payload\n" "Payload Name\n")
"sdp audio-payload name NAME",
SDP_STR AUDIO_STR "Payload\n" "Payload Name\n")
{
struct mgcp_trunk_config *trunk = vty->index;
@ -562,10 +608,16 @@ DEFUN(cfg_trunk_payload_name,
return CMD_SUCCESS;
}
ALIAS_DEPRECATED(cfg_trunk_payload_name, cfg_trunk_payload_name_cmd_old,
"sdp audio payload name NAME",
SDP_STR AUDIO_STR AUDIO_STR "Payload\n" "Payload Name\n")
DEFUN(cfg_trunk_loop,
cfg_trunk_loop_cmd,
"loop (0|1)",
"Loop the audio")
"Loop audio for all endpoints on this trunk\n"
"Don't Loop\n" "Loop\n")
{
struct mgcp_trunk_config *trunk = vty->index;
@ -573,6 +625,26 @@ DEFUN(cfg_trunk_loop,
return CMD_SUCCESS;
}
DEFUN(cfg_trunk_omit_rtcp,
cfg_trunk_omit_rtcp_cmd,
"rtcp-omit",
RTCP_OMIT_STR)
{
struct mgcp_trunk_config *trunk = vty->index;
trunk->omit_rtcp = 1;
return CMD_SUCCESS;
}
DEFUN(cfg_trunk_no_omit_rtcp,
cfg_trunk_no_omit_rtcp_cmd,
"no rtcp-omit",
NO_STR RTCP_OMIT_STR)
{
struct mgcp_trunk_config *trunk = vty->index;
trunk->omit_rtcp = 0;
return CMD_SUCCESS;
}
#define TRUNK_TYPE_STR "Virtual trunk\nE1 trunk\n"
#define TRUNK_IDENT_STR "Trunk identifier depending on the type\n"
@ -716,12 +788,70 @@ DEFUN(free_endp, free_endp_cmd,
return CMD_SUCCESS;
}
DEFUN(reset_endp, reset_endp_cmd,
"reset-endpoint (virtual|e1) IDENT NUMBER",
"Reset the given endpoint\n"
TRUNK_TYPE_STR
TRUNK_IDENT_STR
"Endpoint number in hex.\n")
{
struct mgcp_trunk_config *trunk;
struct mgcp_endpoint *endp;
int endp_no, rc;
trunk = find_trunk(g_cfg, argv[0], argv[1]);
if (!trunk) {
vty_out(vty, "%%Trunk %d not found in the config.%s",
atoi(argv[0]), VTY_NEWLINE);
return CMD_WARNING;
}
if (!trunk->endpoints) {
vty_out(vty, "%%Trunk %d has no endpoints allocated.%s",
trunk->trunk_nr, VTY_NEWLINE);
return CMD_WARNING;
}
endp_no = strtoul(argv[2], NULL, 16);
if (endp_no < 1 || endp_no >= trunk->number_endpoints) {
vty_out(vty, "Endpoint number %s/%d is invalid.%s",
argv[1], endp_no, VTY_NEWLINE);
return CMD_WARNING;
}
endp = &trunk->endpoints[endp_no];
rc = mgcp_send_reset_ep(endp, ENDPOINT_NUMBER(endp));
if (rc < 0) {
vty_out(vty, "Error %d sending reset.%s", rc, VTY_NEWLINE);
return CMD_WARNING;
}
return CMD_SUCCESS;
}
DEFUN(reset_all_endp, reset_all_endp_cmd,
"reset-all-endpoints",
"Reset all endpoints\n")
{
int rc;
rc = mgcp_send_reset_all(g_cfg);
if (rc < 0) {
vty_out(vty, "Error %d during endpoint reset.%s",
rc, VTY_NEWLINE);
return CMD_WARNING;
}
return CMD_SUCCESS;
}
int mgcp_vty_init(void)
{
install_element_ve(&show_mgcp_cmd);
install_element(ENABLE_NODE, &loop_endp_cmd);
install_element(ENABLE_NODE, &tap_call_cmd);
install_element(ENABLE_NODE, &free_endp_cmd);
install_element(ENABLE_NODE, &reset_endp_cmd);
install_element(ENABLE_NODE, &reset_all_endp_cmd);
install_element(CONFIG_NODE, &cfg_mgcp_cmd);
install_node(&mgcp_node, config_write_mgcp);
@ -744,6 +874,7 @@ int mgcp_vty_init(void)
install_element(MGCP_NODE, &cfg_mgcp_rtp_ip_dscp_cmd);
install_element(MGCP_NODE, &cfg_mgcp_rtp_ip_tos_cmd);
install_element(MGCP_NODE, &cfg_mgcp_agent_addr_cmd);
install_element(MGCP_NODE, &cfg_mgcp_agent_addr_cmd_old);
install_element(MGCP_NODE, &cfg_mgcp_transcoder_cmd);
install_element(MGCP_NODE, &cfg_mgcp_no_transcoder_cmd);
install_element(MGCP_NODE, &cfg_mgcp_transcoder_remote_base_cmd);
@ -756,7 +887,11 @@ int mgcp_vty_init(void)
install_element(VTRUNK_NODE, &cfg_vtrunk_number_endp_cmd);
install_element(VTRUNK_NODE, &cfg_trunk_payload_number_cmd);
install_element(VTRUNK_NODE, &cfg_trunk_payload_name_cmd);
install_element(VTRUNK_NODE, &cfg_trunk_payload_number_cmd_old);
install_element(VTRUNK_NODE, &cfg_trunk_payload_name_cmd_old);
install_element(VTRUNK_NODE, &cfg_trunk_loop_cmd);
install_element(VTRUNK_NODE, &cfg_trunk_omit_rtcp_cmd);
install_element(VTRUNK_NODE, &cfg_trunk_no_omit_rtcp_cmd);
install_element(MGCP_NODE, &cfg_mgcp_trunk_cmd);
install_node(&trunk_node, config_write_trunk);
@ -765,7 +900,13 @@ int mgcp_vty_init(void)
install_element(TRUNK_NODE, &ournode_end_cmd);
install_element(TRUNK_NODE, &cfg_trunk_payload_number_cmd);
install_element(TRUNK_NODE, &cfg_trunk_payload_name_cmd);
install_element(TRUNK_NODE, &cfg_trunk_payload_number_cmd_old);
install_element(TRUNK_NODE, &cfg_trunk_payload_name_cmd_old);
install_element(TRUNK_NODE, &cfg_trunk_loop_cmd);
install_element(TRUNK_NODE, &cfg_trunk_omit_rtcp_cmd);
install_element(TRUNK_NODE, &cfg_trunk_no_omit_rtcp_cmd);
install_element(TRUNK_NODE, &cfg_trunk_omit_rtcp_cmd);
install_element(TRUNK_NODE, &cfg_trunk_no_omit_rtcp_cmd);
return 0;
}

View File

@ -643,7 +643,7 @@ static int mgcp_ss7_policy(struct mgcp_trunk_config *tcfg, int endp_no, int stat
return rc;
}
static int mgcp_dtmf_cb(struct mgcp_endpoint *endp, char tone, const char *data)
static int mgcp_dtmf_cb(struct mgcp_endpoint *endp, char tone)
{
mgcp_ss7_exec(endp, MGCP_SS7_DTMF, tone);
return 0;

View File

@ -8,4 +8,4 @@ mgcp_patch_test_SOURCES = mgcp_patch_test.c $(top_srcdir)/src/mgcp_patch.c \
$(top_srcdir)/src/mgcp/mgcp_protocol.c \
$(top_srcdir)/src/mgcp/mgcp_network.c \
$(top_srcdir)/src/debug.c
mgcp_patch_test_LDADD = $(LIBOSMOCORE_LIBS)
mgcp_patch_test_LDADD = $(LIBOSMOCORE_LIBS) -lrt

View File

@ -28,6 +28,7 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
static const char mgcp_in[] =
"MDCX 23213 14@mgw MGCP 1.0\r\n"
@ -67,6 +68,36 @@ static const char mgcp_out[] =
"a=T38FaxVersion:0\r\n"
"a=T38MaxBitRate:14400\r\n";
#define AUEP1 "AUEP 158663169 ds/e1-1/2@172.16.6.66 MGCP 1.0\r\n"
#define AUEP1_RET "200 158663169 OK\r\n"
#define AUEP2 "AUEP 18983213 ds/e1-2/1@172.16.6.66 MGCP 1.0\r\n"
#define AUEP2_RET "500 18983213 FAIL\r\n"
#define EMPTY "\r\n"
#define EMPTY_RET NULL
#define SHORT "CRCX \r\n"
#define SHORT_RET "510 000000 FAIL\r\n"
#define MDCX_WRONG_EP "MDCX 18983213 ds/e1-3/1@172.16.6.66 MGCP 1.0\r\n"
#define MDCX_ERR_RET "510 18983213 FAIL\r\n"
#define MDCX_UNALLOCATED "MDCX 18983214 ds/e1-1/2@172.16.6.66 MGCP 1.0\r\n"
#define MDCX_RET "400 18983214 FAIL\r\n"
#define MDCX3 "MDCX 18983215 1@mgw MGCP 1.0\r\n"
#define MDCX3_RET "200 18983215 OK\r\n" \
"I: 1\n" \
"\n" \
"v=0\r\n" \
"o=- 1 23 IN IP4 0.0.0.0\r\n" \
"c=IN IP4 0.0.0.0\r\n" \
"t=0 0\r\n" \
"m=audio 0 RTP/AVP 126\r\n" \
"a=rtpmap:126 AMR/8000\r\n"
#define SHORT2 "CRCX 1"
#define SHORT2_RET "510 000000 FAIL\r\n"
#define SHORT3 "CRCX 1 1@mgw"
#define SHORT4 "CRCX 1 1@mgw MGCP"
#define SHORT5 "CRCX 1 1@mgw MGCP 1.0"
#define CRCX "CRCX 2 1@mgw MGCP 1.0\r\n" \
"M: sendrecv\r\n" \
"C: 2\r\n" \
@ -76,18 +107,51 @@ static const char mgcp_out[] =
"m=audio 5904 RTP/AVP 97\r\n" \
"a=rtpmap:97 GSM-EFR/8000\r\n"
#define CRCX_RET "200 2 OK\r\n" \
"I: 1\n" \
"\n" \
"v=0\r\n" \
"o=- 1 23 IN IP4 0.0.0.0\r\n" \
"c=IN IP4 0.0.0.0\r\n" \
"t=0 0\r\n" \
"m=audio 0 RTP/AVP 126\r\n" \
"a=rtpmap:126 AMR/8000\r\n"
#define CRCX_ZYN "CRCX 2 1@mgw MGCP 1.0\r" \
"M: sendrecv\r" \
"C: 2\r\r" \
"v=0\r" \
"c=IN IP4 123.12.12.123\r" \
"m=audio 5904 RTP/AVP 97\r" \
"a=rtpmap:97 GSM-EFR/8000\r"
#define CRCX_ZYN_RET "200 2 OK\r\n" \
"I: 2\n" \
"\n" \
"v=0\r\n" \
"o=- 2 23 IN IP4 0.0.0.0\r\n" \
"c=IN IP4 0.0.0.0\r\n" \
"t=0 0\r\n" \
"m=audio 0 RTP/AVP 126\r\n" \
"a=rtpmap:126 AMR/8000\r\n"
#define DLCX "DLCX 7 1@mgw MGCP 1.0\r\n" \
"C: 2\r\n"
#define DLCX_RET "250 7 OK\r\n" \
"P: PS=0, OS=0, PR=0, OR=0, PL=0, JI=0\r\n"
#define RQNT "RQNT 186908780 1@mgw MGCP 1.0\r\n" \
"X: B244F267488\r\n" \
"S: D/9\r\n"
#define RQNT2 "RQNT 186908780 1@mgw MGCP 1.0\r\n" \
#define RQNT2 "RQNT 186908781 1@mgw MGCP 1.0\r\n" \
"X: ADD4F26746F\r\n" \
"R: D/[0-9#*](N), G/ft, fxr/t38\r\n"
#define RQNT_RET "200 186908780 OK\r\n"
#define RQNT1_RET "200 186908780 OK\r\n"
#define RQNT2_RET "200 186908781 OK\r\n"
#define ASSERT(a, cmp, b, text) \
if (!((a) cmp (b))) { \
@ -95,6 +159,39 @@ static const char mgcp_out[] =
abort(); \
}
struct mgcp_test {
const char *name;
const char *req;
const char *exp_resp;
};
static const struct mgcp_test tests[] = {
{ "AUEP1", AUEP1, AUEP1_RET },
{ "AUEP2", AUEP2, AUEP2_RET },
{ "MDCX1", MDCX_WRONG_EP, MDCX_ERR_RET },
{ "MDCX2", MDCX_UNALLOCATED, MDCX_RET },
{ "CRCX", CRCX, CRCX_RET },
{ "MDCX3", MDCX3, MDCX3_RET },
{ "DLCX", DLCX, DLCX_RET },
{ "CRCX_ZYN", CRCX_ZYN, CRCX_ZYN_RET },
{ "EMPTY", EMPTY, EMPTY_RET },
{ "SHORT1", SHORT, SHORT_RET },
{ "SHORT2", SHORT2, SHORT2_RET },
{ "SHORT3", SHORT3, SHORT2_RET },
{ "SHORT4", SHORT4, SHORT2_RET },
{ "RQNT1", RQNT, RQNT1_RET },
{ "RQNT2", RQNT2, RQNT2_RET },
{ "DLCX", DLCX, DLCX_RET },
};
static const struct mgcp_test retransmit[] = {
{ "CRCX", CRCX, CRCX_RET },
{ "RQNT1", RQNT, RQNT1_RET },
{ "RQNT2", RQNT2, RQNT2_RET },
{ "MDCX3", MDCX3, MDCX3_RET },
{ "DLCX", DLCX, DLCX_RET },
};
static struct msgb *create_msg(const char *str)
{
struct msgb *msg;
@ -132,7 +229,82 @@ static void test_endp_name_rewriting()
ASSERT(strcmp((const char *)msg_out->l2h, mgcp_out), ==, 0, "Text don't match");
}
static int rqnt_cb(struct mgcp_endpoint *endp, char _tone, const char *data)
static void test_messages(void)
{
struct mgcp_config *cfg;
struct mgcp_trunk_config *tcfg;
int i;
cfg = mgcp_config_alloc();
tcfg = mgcp_vtrunk_alloc(cfg, "mgw");
tcfg->number_endpoints = 64;
mgcp_endpoints_allocate(tcfg);
mgcp_endpoints_allocate(mgcp_trunk_alloc(cfg, 1));
for (i = 0; i < ARRAY_SIZE(tests); i++) {
const struct mgcp_test *t = &tests[i];
struct msgb *inp;
struct msgb *msg;
printf("Testing %s\n", t->name);
inp = create_msg(t->req);
msg = mgcp_handle_message(cfg, inp);
msgb_free(inp);
if (!t->exp_resp) {
if (msg)
printf("%s failed '%s'\n", t->name, (char *) msg->data);
} else if (strcmp((char *) msg->data, t->exp_resp) != 0)
printf("%s failed '%s'\n", t->name, (char *) msg->data);
msgb_free(msg);
}
talloc_free(cfg);
}
static void test_retransmission(void)
{
struct mgcp_config *cfg;
struct mgcp_trunk_config *tcfg;
int i;
cfg = mgcp_config_alloc();
tcfg = mgcp_vtrunk_alloc(cfg, "mgw");
tcfg->number_endpoints = 64;
mgcp_endpoints_allocate(tcfg);
mgcp_endpoints_allocate(mgcp_trunk_alloc(cfg, 1));
for (i = 0; i < ARRAY_SIZE(retransmit); i++) {
const struct mgcp_test *t = &retransmit[i];
struct msgb *inp;
struct msgb *msg;
printf("Testing %s\n", t->name);
inp = create_msg(t->req);
msg = mgcp_handle_message(cfg, inp);
msgb_free(inp);
if (strcmp((char *) msg->data, t->exp_resp) != 0)
printf("%s failed '%s'\n", t->name, (char *) msg->data);
msgb_free(msg);
/* Retransmit... */
printf("Re-transmitting %s\n", t->name);
inp = create_msg(t->req);
msg = mgcp_handle_message(cfg, inp);
msgb_free(inp);
if (strcmp((char *) msg->data, t->exp_resp) != 0)
printf("%s failed '%s'\n", t->name, (char *) msg->data);
msgb_free(msg);
}
talloc_free(cfg);
}
static int rqnt_cb(struct mgcp_endpoint *endp, char _tone)
{
ptrdiff_t tone = _tone;
endp->cfg->data = (void *) tone;
@ -141,8 +313,8 @@ static int rqnt_cb(struct mgcp_endpoint *endp, char _tone, const char *data)
static void test_rqnt_cb(void)
{
struct mgcp_config *cfg;
struct mgcp_trunk_config *tcfg;
struct mgcp_config *cfg;
struct msgb *inp, *msg;
cfg = mgcp_config_alloc();
@ -152,6 +324,8 @@ static void test_rqnt_cb(void)
tcfg->number_endpoints = 64;
mgcp_endpoints_allocate(tcfg);
mgcp_endpoints_allocate(mgcp_trunk_alloc(cfg, 1));
inp = create_msg(CRCX);
msgb_free(mgcp_handle_message(cfg, inp));
msgb_free(inp);
@ -178,11 +352,67 @@ static void test_rqnt_cb(void)
talloc_free(cfg);
}
struct pl_test {
int cycles;
uint16_t base_seq;
uint16_t max_seq;
uint32_t packets;
uint32_t expected;
int loss;
};
static const struct pl_test pl_test_dat[] = {
/* basic.. just one package */
{ .cycles = 0, .base_seq = 0, .max_seq = 0, .packets = 1, .expected = 1, .loss = 0},
/* some packages and a bit of loss */
{ .cycles = 0, .base_seq = 0, .max_seq = 100, .packets = 100, .expected = 101, .loss = 1},
/* wrap around */
{ .cycles = 1<<16, .base_seq = 0xffff, .max_seq = 2, .packets = 4, .expected = 4, .loss = 0},
/* min loss */
{ .cycles = 0, .base_seq = 0, .max_seq = 0, .packets = UINT_MAX, .expected = 1, .loss = INT_MIN },
/* max loss, with wrap around on expected max */
{ .cycles = INT_MAX, .base_seq = 0, .max_seq = UINT16_MAX, .packets = 0, .expected = ((uint32_t)(INT_MAX) + UINT16_MAX + 1), .loss = INT_MAX },
};
static void test_packet_loss_calc(void)
{
int i;
printf("Testing packet loss calculation.\n");
for (i = 0; i < ARRAY_SIZE(pl_test_dat); ++i) {
uint32_t expected;
int loss;
struct mgcp_rtp_state state;
struct mgcp_rtp_end rtp;
memset(&state, 0, sizeof(state));
memset(&rtp, 0, sizeof(rtp));
state.initialized = 1;
state.base_seq = pl_test_dat[i].base_seq;
state.max_seq = pl_test_dat[i].max_seq;
state.cycles = pl_test_dat[i].cycles;
rtp.packets = pl_test_dat[i].packets;
mgcp_state_calc_loss(&state, &rtp, &expected, &loss);
if (loss != pl_test_dat[i].loss || expected != pl_test_dat[i].expected) {
printf("FAIL: Wrong exp/loss at idx(%d) Loss(%d vs. %d) Exp(%u vs. %u)\n",
i, loss, pl_test_dat[i].loss,
expected, pl_test_dat[i].expected);
}
}
}
int main(int argc, char **argv)
{
osmo_init_logging(&log_info);
test_endp_name_rewriting();
test_messages();
test_retransmission();
test_packet_loss_calc();
test_rqnt_cb();
printf("All tests passed.\n");

View File

@ -39,4 +39,31 @@ a=T38MaxBitRate:14400
'
4d 44 43 58 20 32 33 32 31 33 20 31 34 40 66 6f 6f 32 20 4d 47 43 50 20 31 2e 30 0d 0a 43 3a 20 34 61 38 34 61 64 35 64 32 35 66 0d 0a 49 3a 20 25 64 0d 0a 4c 3a 20 70 3a 32 30 2c 20 61 3a 47 53 4d 2d 45 46 52 2c 20 6e 74 3a 49 4e 0d 0a 4d 3a 20 72 65 63 76 6f 6e 6c 79 0d 0a 0d 0a 76 3d 30 0d 0a 6f 3d 2d 20 32 35 38 36 39 36 34 37 37 20 30 20 49 4e 20 49 50 34 20 31 37 32 2e 31 36 2e 31 2e 31 30 37 0d 0a 73 3d 2d 0d 0a 63 3d 49 4e 20 49 50 34 20 31 37 32 2e 31 36 2e 31 2e 31 30 37 0d 0a 74 3d 30 20 30 0d 0a 6d 3d 61 75 64 69 6f 20 36 36 36 36 20 52 54 50 2f 41 56 50 20 31 32 37 0d 0a 61 3d 72 74 70 6d 61 70 3a 31 32 37 20 47 53 4d 2d 45 46 52 2f 38 30 30 30 2f 31 0d 0a 61 3d 70 74 69 6d 65 3a 32 30 0d 0a 61 3d 72 65 63 76 6f 6e 6c 79 0d 0a 6d 3d 69 6d 61 67 65 20 34 34 30 32 20 75 64 70 74 6c 20 74 33 38 0d 0a 61 3d 54 33 38 46 61 78 56 65 72 73 69 6f 6e 3a 30 0d 0a 61 3d 54 33 38 4d 61 78 42 69 74 52 61 74 65 3a 31 34 34 30 30 0d 0a
4d 44 43 58 20 32 33 32 31 33 20 31 34 40 66 6f 6f 32 20 4d 47 43 50 20 31 2e 30 0d 0a 43 3a 20 34 61 38 34 61 64 35 64 32 35 66 0d 0a 49 3a 20 25 64 0d 0a 4c 3a 20 70 3a 32 30 2c 20 61 3a 47 53 4d 2d 45 46 52 2c 20 6e 74 3a 49 4e 0d 0a 4d 3a 20 72 65 63 76 6f 6e 6c 79 0d 0a 0d 0a 76 3d 30 0d 0a 6f 3d 2d 20 32 35 38 36 39 36 34 37 37 20 30 20 49 4e 20 49 50 34 20 31 37 32 2e 31 36 2e 31 2e 31 30 37 0d 0a 73 3d 2d 0d 0a 63 3d 49 4e 20 49 50 34 20 31 37 32 2e 31 36 2e 31 2e 31 30 37 0d 0a 74 3d 30 20 30 0d 0a 6d 3d 61 75 64 69 6f 20 36 36 36 36 20 52 54 50 2f 41 56 50 20 31 32 37 0d 0a 61 3d 72 74 70 6d 61 70 3a 31 32 37 20 47 53 4d 2d 45 46 52 2f 38 30 30 30 2f 31 0d 0a 61 3d 70 74 69 6d 65 3a 32 30 0d 0a 61 3d 72 65 63 76 6f 6e 6c 79 0d 0a 6d 3d 69 6d 61 67 65 20 34 34 30 32 20 75 64 70 74 6c 20 74 33 38 0d 0a 61 3d 54 33 38 46 61 78 56 65 72 73 69 6f 6e 3a 30 0d 0a 61 3d 54 33 38 4d 61 78 42 69 74 52 61 74 65 3a 31 34 34 30 30 0d 0a
Testing AUEP1
Testing AUEP2
Testing MDCX1
Testing MDCX2
Testing CRCX
Testing MDCX3
Testing DLCX
Testing CRCX_ZYN
Testing EMPTY
Testing SHORT1
Testing SHORT2
Testing SHORT3
Testing SHORT4
Testing RQNT1
Testing RQNT2
Testing DLCX
Testing CRCX
Re-transmitting CRCX
Testing RQNT1
Re-transmitting RQNT1
Testing RQNT2
Re-transmitting RQNT2
Testing MDCX3
Re-transmitting MDCX3
Testing DLCX
Re-transmitting DLCX
Testing packet loss calculation.
All tests passed.