aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-04-19 18:09:05 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-04-19 18:19:31 +0200
commit5ad72b91bb601f9b9765beeb861191f810f79f65 (patch)
treee2cb4081590c9fe7609eea324593cf0923817d67 /src
parentd045ceb5f01a81fcfbd2b99b2dbc17c53103d6ce (diff)
hnb-test: receive Paging, add CL rx
Add ability to receive ConnectionLess transfers in order to read the Paging and (so far only) print the IMSI paged for.
Diffstat (limited to 'src')
-rw-r--r--src/tests/hnb-test-layers.h4
-rw-r--r--src/tests/hnb-test-ranap.c27
-rw-r--r--src/tests/hnb-test-rua.c17
-rw-r--r--src/tests/hnb-test.c7
4 files changed, 55 insertions, 0 deletions
diff --git a/src/tests/hnb-test-layers.h b/src/tests/hnb-test-layers.h
index ab51ca9..62369f3 100644
--- a/src/tests/hnb-test-layers.h
+++ b/src/tests/hnb-test-layers.h
@@ -6,12 +6,16 @@ struct hnb_test;
/* main calls RUA */
void hnb_test_rua_dt_handle(struct hnb_test *hnb, struct ANY *in);
+void hnb_test_rua_cl_handle(struct hnb_test *hnb, struct ANY *in);
/* RUA calls RANAP */
void hnb_test_rua_dt_handle_ranap(struct hnb_test *hnb,
struct ranap_message_s *ranap_msg);
+void hnb_test_rua_cl_handle_ranap(struct hnb_test *hnb,
+ struct ranap_message_s *ranap_msg);
/* RANAP calls main with actual payload*/
void hnb_test_nas_rx_dtap(struct hnb_test *hnb, void *data, int len);
void hnb_test_rx_secmode_cmd(struct hnb_test *hnb, long ip_alg);
void hnb_test_rx_iu_release(struct hnb_test *hnb);
+void hnb_test_rx_paging(struct hnb_test *hnb, const char *imsi);
diff --git a/src/tests/hnb-test-ranap.c b/src/tests/hnb-test-ranap.c
index a3cae29..e7c9871 100644
--- a/src/tests/hnb-test-ranap.c
+++ b/src/tests/hnb-test-ranap.c
@@ -56,3 +56,30 @@ void hnb_test_rua_dt_handle_ranap(struct hnb_test *hnb,
return;
}
}
+
+void hnb_test_rua_cl_handle_ranap(struct hnb_test *hnb,
+ struct ranap_message_s *ranap_msg)
+{
+ char imsi[16];
+
+ printf("rx ranap_msg->procedureCode %d\n",
+ ranap_msg->procedureCode);
+
+ switch (ranap_msg->procedureCode) {
+ case RANAP_ProcedureCode_id_Paging:
+ if (ranap_msg->msg.pagingIEs.permanentNAS_UE_ID.present == RANAP_PermanentNAS_UE_ID_PR_iMSI) {
+ ranap_bcd_decode(imsi, sizeof(imsi),
+ ranap_msg->msg.pagingIEs.permanentNAS_UE_ID.choice.iMSI.buf,
+ ranap_msg->msg.pagingIEs.permanentNAS_UE_ID.choice.iMSI.size);
+ } else imsi[0] = '\0';
+
+ printf("rx Paging: presence=%hx domain=%d IMSI=%s\n",
+ ranap_msg->msg.pagingIEs.presenceMask,
+ ranap_msg->msg.pagingIEs.cN_DomainIndicator,
+ imsi
+ );
+
+ hnb_test_rx_paging(hnb, imsi);
+ return;
+ }
+}
diff --git a/src/tests/hnb-test-rua.c b/src/tests/hnb-test-rua.c
index e3f44c5..69c41eb 100644
--- a/src/tests/hnb-test-rua.c
+++ b/src/tests/hnb-test-rua.c
@@ -21,3 +21,20 @@ void hnb_test_rua_dt_handle(struct hnb_test *hnb, ANY_t *in)
rua_free_directtransferies(&ies);
}
+void hnb_test_rua_cl_handle(struct hnb_test *hnb, ANY_t *in)
+{
+ RUA_ConnectionlessTransferIEs_t ies;
+ int rc;
+
+ rc = rua_decode_connectionlesstransferies(&ies, in);
+ if (rc < 0) {
+ printf("failed to decode RUA CL IEs\n");
+ return;
+ }
+
+ rc = ranap_cn_rx_cl(hnb_test_rua_cl_handle_ranap, hnb, ies.ranaP_Message.buf, ies.ranaP_Message.size);
+
+ /* FIXME: what to do with the asn1c-allocated memory */
+ rua_free_connectionlesstransferies(&ies);
+}
+
diff --git a/src/tests/hnb-test.c b/src/tests/hnb-test.c
index 2e2baf7..7971b64 100644
--- a/src/tests/hnb-test.c
+++ b/src/tests/hnb-test.c
@@ -459,6 +459,12 @@ void hnb_test_rx_iu_release(struct hnb_test *hnb)
hnb_test_tx_iu_release_compl(hnb);
}
+void hnb_test_rx_paging(struct hnb_test *hnb, const char *imsi)
+{
+ printf(" :) Paging Request for %s :)\n", imsi);
+ /* TODO reply */
+}
+
int hnb_test_hnbap_rx(struct hnb_test *hnb, struct msgb *msg)
{
HNBAP_PDU_t _pdu, *pdu = &_pdu;
@@ -529,6 +535,7 @@ int hnb_test_rua_rx(struct hnb_test *hnb, struct msgb *msg)
switch (pdu->choice.successfulOutcome.procedureCode) {
case RUA_ProcedureCode_id_ConnectionlessTransfer:
printf("RUA rx Connectionless Transfer\n");
+ hnb_test_rua_cl_handle(hnb, &pdu->choice.successfulOutcome.value);
break;
case RUA_ProcedureCode_id_Connect:
printf("RUA rx Connect\n");