aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/hnb-test-rua.c
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-02-18 01:18:20 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-02-29 10:02:10 +0100
commitb984f36f58fda99a76261fc90b2f54e7c9c968af (patch)
tree8c65261f4303c387629ee4e9e5b69ad6f4636c59 /src/tests/hnb-test-rua.c
parent32828708b25d506ad81f4cd78e0b423d95507d98 (diff)
hnb-test: decode NAS pdu when receiving RUA from CN
Diffstat (limited to 'src/tests/hnb-test-rua.c')
-rw-r--r--src/tests/hnb-test-rua.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/tests/hnb-test-rua.c b/src/tests/hnb-test-rua.c
new file mode 100644
index 0000000..41df4f2
--- /dev/null
+++ b/src/tests/hnb-test-rua.c
@@ -0,0 +1,37 @@
+
+#include <asn1c/ANY.h>
+#include "../rua_ies_defs.h"
+
+struct ranap_message_s;
+
+typedef void (*ranap_handle_cb)(void *ctx, struct ranap_message_s *ranap_msg);
+
+extern void ranap_msg_dt_print(void *ctx, struct ranap_message_s *ranap_msg);
+extern void ranap_msg_dt_get(void *ctx, struct ranap_message_s *ranap_msg);
+
+static void direct_transfer_nas_pdu_handle(ANY_t *in, ranap_handle_cb handler, void *ctx)
+{
+ RUA_DirectTransferIEs_t ies;
+ int rc;
+
+ rc = rua_decode_directtransferies(&ies, in);
+ if (rc < 0) {
+ printf("print_rua_init_dt(): failed to decode rua IEs\n");
+ return;
+ }
+
+ rc = ranap_cn_rx_co(handler, ctx, ies.ranaP_Message.buf, ies.ranaP_Message.size);
+
+ /* FIXME: what to do with the asn1c-allocated memory */
+ rua_free_directtransferies(&ies);
+}
+
+void direct_transfer_nas_pdu_print(ANY_t *in)
+{
+ direct_transfer_nas_pdu_handle(in, ranap_msg_dt_print, NULL);
+}
+
+void direct_transfer_nas_pdu_get(ANY_t *in, struct msgb *m)
+{
+ direct_transfer_nas_pdu_handle(in, ranap_msg_dt_get, m);
+}