aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2015-12-17 18:03:52 +0100
committerDaniel Willmann <dwillmann@sysmocom.de>2015-12-17 18:03:52 +0100
commit141a0baac960e6f56b50c0abb0272b5294d6c9da (patch)
tree781a6baac34de11b162469e20d9b9f6722413a99 /src
parent28b9ec1473ab7f679666d9da008a7d88b0fe9e31 (diff)
hnb-test: Add an option to transmit multiple UE register/deregister msgs
Diffstat (limited to 'src')
-rw-r--r--src/tests/hnb-test.c31
-rw-r--r--src/tests/hnb-test.h2
2 files changed, 33 insertions, 0 deletions
diff --git a/src/tests/hnb-test.c b/src/tests/hnb-test.c
index e5f4951..325ace8 100644
--- a/src/tests/hnb-test.c
+++ b/src/tests/hnb-test.c
@@ -91,6 +91,12 @@ int hnb_test_ue_register_tx(struct hnb_test *hnb_test)
char imsi_buf[16];
char *imsi_str = "262019876543210";
+ if (hnb_test->ues > 0) {
+ hnb_test->ues--;
+ } else {
+ return 0;
+ }
+
UERegisterRequest_t request_out;
UERegisterRequestIEs_t request;
memset(&request, 0, sizeof(request));
@@ -189,6 +195,7 @@ int hnb_test_hnbap_rx(struct hnb_test *hnb, struct msgb *msg)
break;
case ProcedureCode_id_UERegister:
rc = hnb_test_rx_ue_register_acc(hnb, &pdu->choice.successfulOutcome.value);
+ hnb_test_ue_register_tx(hnb);
break;
default:
break;
@@ -363,6 +370,28 @@ static int sctp_sock_init(int fd)
return rc;
}
+static void handle_options(int argc, char **argv)
+{
+ while (1) {
+ int idx = 0, c;
+ static const struct option long_options[] = {
+ { "ues", 1, 0, 'u' },
+ { 0, 0, 0, 0 },
+ };
+
+ c = getopt_long(argc, argv, "u:", long_options, &idx);
+
+ if (c == -1)
+ break;
+
+ switch (c) {
+ case 'u':
+ g_hnb_test.ues = atoi(optarg);
+ break;
+ }
+ }
+}
+
int main(int argc, const char *argv)
{
int rc;
@@ -376,6 +405,8 @@ int main(int argc, const char *argv)
vty_init(&vty_info);
+ handle_options(argc, argv);
+
osmo_wqueue_init(&g_hnb_test.wqueue, 16);
g_hnb_test.wqueue.bfd.data = &g_hnb_test;
g_hnb_test.wqueue.read_cb = hnb_read_cb;
diff --git a/src/tests/hnb-test.h b/src/tests/hnb-test.h
index 5778078..8cd018e 100644
--- a/src/tests/hnb-test.h
+++ b/src/tests/hnb-test.h
@@ -64,6 +64,8 @@ struct hnb_test {
uint16_t rnc_id;
uint32_t ctx_id;
+
+ int ues;
};
extern struct hnb_test g_hnb_test;