aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-10-07 13:59:30 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-10-09 07:43:54 +0200
commit2381fded689d5e2d19f4ed2e8ab7d7b83788b8b5 (patch)
tree0080bac2b2e8fe75b46039c71f69d8f1bb30b467 /tests
parentf357c877242cbb3618ad4a2ed499e3038ee5d5dd (diff)
gprs-ns/test: Save the last PDU type sent
This records the PDU type of the last message sent to the remote peer in the global variable sent_pdu_type, which can then be used in assertions. Note that sent_pdu_type will remain unchanged if no message has been sent via sendto. Sponsored-by: On-Waves ehf
Diffstat (limited to 'tests')
-rw-r--r--tests/gb/gprs_ns_test.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/gb/gprs_ns_test.c b/tests/gb/gprs_ns_test.c
index 15e36ba1..0b3a76c4 100644
--- a/tests/gb/gprs_ns_test.c
+++ b/tests/gb/gprs_ns_test.c
@@ -32,6 +32,8 @@
#define SGSN_NSEI 0x0100
+static int sent_pdu_type = 0;
+
static int gprs_process_message(struct gprs_ns_inst *nsi, const char *text,
struct sockaddr_in *peer, const unsigned char* data,
size_t data_len);
@@ -265,6 +267,8 @@ ssize_t sendto(int sockfd, const void *buf, size_t len, int flags,
if (!real_sendto)
real_sendto = dlsym(RTLD_NEXT, "sendto");
+ sent_pdu_type = len > 0 ? ((uint8_t *)buf)[0] : -1;
+
if (dest_host == REMOTE_BSS_ADDR)
printf("MESSAGE to BSS, msg length %d\n%s\n\n", len, osmo_hexdump(buf, len));
else if (dest_host == REMOTE_SGSN_ADDR)