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.
This commit is contained in:
parent
462db35426
commit
ace1d24d34
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -616,3 +616,8 @@ struct msgb *ranap_generate_outcome(
|
|||
RANAP_IE_t *ranap_new_ie(RANAP_ProtocolIE_ID_t id, RANAP_Criticality_t criticality,
|
||||
asn_TYPE_descriptor_t *type, void *sptr);
|
||||
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue