aboutsummaryrefslogtreecommitdiffstats
path: root/src/ranap_common.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2015-12-16 23:07:19 +0100
committerHarald Welte <laforge@gnumonks.org>2015-12-16 23:07:19 +0100
commitace1d24d346d1f1184f2aceb34016f4e9143199a (patch)
tree54724db1bfe94399087fcebe099ff975d7f123d1 /src/ranap_common.c
parent462db35426cc66653d0a2987af82ed1e0959a5c5 (diff)
ranap_common: Add function to wrap IEs into a RANAP_ProtocolIE_FieldPair_t
The FieldPair is a strange construct of RANAP Radio Access Bearer assignment, where certain IEs appear in pairs.
Diffstat (limited to 'src/ranap_common.c')
-rw-r--r--src/ranap_common.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/ranap_common.c b/src/ranap_common.c
index 8c212d3..b1021b0 100644
--- a/src/ranap_common.c
+++ b/src/ranap_common.c
@@ -22,10 +22,7 @@
#include <osmocom/core/msgb.h>
-//#include "ranap_common.h"
-#include "ranap/RANAP_RANAP-PDU.h"
-#include "ranap/RANAP_ProtocolIE-ID.h"
-#include "ranap/RANAP_IE.h"
+#include "ranap_common.h"
#include "hnbgw.h"
extern int asn1_xer_print;
@@ -173,3 +170,34 @@ RANAP_IE_t *ranap_new_ie(RANAP_ProtocolIE_ID_t id,
return buff;
}
+
+RANAP_ProtocolIE_FieldPair_t *ranap_new_ie_pair(RANAP_ProtocolIE_ID_t id,
+ RANAP_Criticality_t criticality1,
+ asn_TYPE_descriptor_t *type1, void *sptr1,
+ RANAP_Criticality_t criticality2,
+ asn_TYPE_descriptor_t *type2, void *sptr2)
+{
+
+ RANAP_ProtocolIE_FieldPair_t *buff;
+
+ if ((buff = malloc(sizeof(*buff))) == NULL) {
+ // Possible error on malloc
+ return NULL;
+ }
+ memset((void *)buff, 0, sizeof(*buff));
+
+ buff->id = id;
+ buff->firstCriticality = criticality1;
+ buff->secondCriticality = criticality2;
+
+ ANY_fromType_aper(&buff->firstValue, type1, sptr1);
+ ANY_fromType_aper(&buff->secondValue, type2, sptr2);
+
+ if (asn1_xer_print)
+ if (xer_fprint(stdout, &asn_DEF_RANAP_IE, buff) < 0) {
+ free(buff);
+ return NULL;
+ }
+
+ return buff;
+}