enable building + linking of RUA support
This commit is contained in:
parent
84839c04ea
commit
656ad301a8
14
src/Makefile
14
src/Makefile
|
@ -9,9 +9,9 @@ PKG_LDFLAGS:=$(shell pkg-config --libs libosmocore libosmovty libosmogsm libasn1
|
|||
CFLAGS:=-g -Wall $(PKG_INCLUDES) -Ihnbap/
|
||||
LDFLAGS:=$(PKG_LDFLAGS) -lsctp
|
||||
|
||||
HNBAP_OBJS=hnbap_encoder.o hnbap_decoder.o
|
||||
HNBAP_OBJS=hnbap_encoder.o hnbap_decoder.o hnbap_common.o
|
||||
RUA_OBJS=rua_encoder.o rua_decoder.o rua_common.o
|
||||
RANAP_OBJS=#ranap_encoder.o ranap_decoder.o
|
||||
RUA_OBJS=#rua_encoder.o rua_decoder.o
|
||||
|
||||
LIBS=hnbap/libosmo-asn1-hnbap.a rua/libosmo-asn1-rua.a ranap/libosmo-asn1-ranap.a
|
||||
|
||||
|
@ -23,20 +23,16 @@ hnbap_encoder.c: $(ASN1_ROOT)/hnbap/HNBAP-PDU-Contents.asn
|
|||
|
||||
.PHONY: rua_encoder.c
|
||||
rua_encoder.c: $(ASN1_ROOT)/rua/RUA-PDU-Contents.asn
|
||||
$(ASN1TOSTRUCT) -f $<
|
||||
$(ASN1TOSTRUCT) -p RUA_ -f $<
|
||||
|
||||
.PHONY: ranap_encoder.c
|
||||
ranap_encoder.c: $(ASN1_ROOT)/ranap/RANAP-PDU-Contents.asn
|
||||
$(ASN1TOSTRUCT) -f $<
|
||||
$(ASN1TOSTRUCT) -p RANAP_ -f $<
|
||||
|
||||
.PHONY: ranap_common.h
|
||||
ranap_common.h:
|
||||
for f in ranap/*.h; do echo "#include \"$f\""; done > ranap_common.h
|
||||
|
||||
.PHONY: rua_common.h
|
||||
rua_common.h:
|
||||
for f in ranap/*.h; do echo "#include \"$f\""; done > rua_common.h
|
||||
|
||||
hnbap/libosmo-asn1-hnbap.a:
|
||||
$(MAKE) -C hnbap
|
||||
|
||||
|
@ -46,7 +42,7 @@ rua/libosmo-asn1-rua.a:
|
|||
ranap/libosmo-asn1-ranap.a:
|
||||
$(MAKE) -C ranap
|
||||
|
||||
hnbgw: asn1helpers.o hnbap_common.o hnbgw.o hnbgw_hnbap.o $(HNBAP_OBJS) $(RUA_OBJS) $(RANAP_OBJS) $(LIBS)
|
||||
hnbgw: asn1helpers.o hnbgw.o hnbgw_hnbap.o $(HNBAP_OBJS) $(RUA_OBJS) $(RANAP_OBJS) $(LIBS)
|
||||
$(CC) $(LDFLAGS) -o $@ $^
|
||||
|
||||
%.o: %.c
|
||||
|
|
|
@ -0,0 +1,138 @@
|
|||
#include <stdint.h>
|
||||
|
||||
#include <osmocom/core/msgb.h>
|
||||
|
||||
#include "rua_common.h"
|
||||
#include "hnbgw.h"
|
||||
|
||||
extern int asn1_xer_print;
|
||||
|
||||
static struct msgb *rua_msgb_alloc(void)
|
||||
{
|
||||
return msgb_alloc(1024, "RUA Tx");
|
||||
}
|
||||
|
||||
#if 0
|
||||
ssize_t rua_generate_initiating_message(uint8_t ** buffer,
|
||||
uint32_t * length,
|
||||
e_RUA_ProcedureCode procedureCode,
|
||||
RUA_Criticality_t criticality,
|
||||
asn_TYPE_descriptor_t * td, void *sptr)
|
||||
{
|
||||
RUA_RUA_PDU_t pdu;
|
||||
ssize_t encoded;
|
||||
|
||||
memset(&pdu, 0, sizeof(pdu));
|
||||
|
||||
pdu.present = RUA_RUA_PDU_PR_initiatingMessage;
|
||||
pdu.choice.initiatingMessage.procedureCode = procedureCode;
|
||||
pdu.choice.initiatingMessage.criticality = criticality;
|
||||
ANY_fromType_aper(&pdu.choice.initiatingMessage.value, td, sptr);
|
||||
|
||||
if (asn1_xer_print)
|
||||
xer_fprint(stdout, &asn_DEF_RUA_RUA_PDU, (void *)&pdu);
|
||||
|
||||
if ((encoded =
|
||||
aper_encode_to_new_buffer(&asn_DEF_RUA_RUA_PDU, 0, &pdu,
|
||||
(void **)buffer)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
*length = encoded;
|
||||
return encoded;
|
||||
}
|
||||
#endif
|
||||
|
||||
struct msgb *rua_generate_successful_outcome(
|
||||
e_RUA_ProcedureCode procedureCode,
|
||||
RUA_Criticality_t criticality,
|
||||
asn_TYPE_descriptor_t * td,
|
||||
void *sptr)
|
||||
{
|
||||
|
||||
RUA_RUA_PDU_t pdu;
|
||||
struct msgb *msg = rua_msgb_alloc();
|
||||
asn_enc_rval_t rval;
|
||||
int rc;
|
||||
|
||||
memset(&pdu, 0, sizeof(pdu));
|
||||
pdu.present = RUA_RUA_PDU_PR_successfulOutcome;
|
||||
pdu.choice.successfulOutcome.procedureCode = procedureCode;
|
||||
pdu.choice.successfulOutcome.criticality = criticality;
|
||||
rc = ANY_fromType_aper(&pdu.choice.successfulOutcome.value, td, sptr);
|
||||
if (rc < 0) {
|
||||
LOGP(DMAIN, LOGL_ERROR, "Error in ANY_fromType_aper\n");
|
||||
msgb_free(msg);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rval = aper_encode_to_buffer(&asn_DEF_RUA_RUA_PDU, &pdu,
|
||||
msg->data, msgb_tailroom(msg));
|
||||
if (rval.encoded < 0) {
|
||||
LOGP(DMAIN, LOGL_ERROR, "Error encoding type %s\n", rval.failed_type->name);
|
||||
msgb_free(msg);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
msgb_put(msg, rval.encoded);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
#if 0
|
||||
ssize_t rua_generate_unsuccessful_outcome(uint8_t ** buffer,
|
||||
uint32_t * length,
|
||||
e_RUA_ProcedureCode procedureCode,
|
||||
RUA_Criticality_t criticality,
|
||||
asn_TYPE_descriptor_t * td,
|
||||
void *sptr)
|
||||
{
|
||||
|
||||
RUA_RUA_PDU_t pdu;
|
||||
ssize_t encoded;
|
||||
|
||||
memset(&pdu, 0, sizeof(pdu));
|
||||
|
||||
pdu.present = RUA_RUA_PDU_PR_unsuccessfulOutcome;
|
||||
pdu.choice.successfulOutcome.procedureCode = procedureCode;
|
||||
pdu.choice.successfulOutcome.criticality = criticality;
|
||||
ANY_fromType_aper(&pdu.choice.successfulOutcome.value, td, sptr);
|
||||
|
||||
if ((encoded =
|
||||
aper_encode_to_new_buffer(&asn_DEF_RUA_RUA_PDU, 0, &pdu,
|
||||
(void **)buffer)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
*length = encoded;
|
||||
|
||||
return encoded;
|
||||
}
|
||||
#endif
|
||||
|
||||
RUA_IE_t *rua_new_ie(RUA_ProtocolIE_ID_t id,
|
||||
RUA_Criticality_t criticality,
|
||||
asn_TYPE_descriptor_t * type, void *sptr)
|
||||
{
|
||||
|
||||
RUA_IE_t *buff;
|
||||
|
||||
if ((buff = malloc(sizeof(*buff))) == NULL) {
|
||||
// Possible error on malloc
|
||||
return NULL;
|
||||
}
|
||||
memset((void *)buff, 0, sizeof(*buff));
|
||||
|
||||
buff->id = id;
|
||||
buff->criticality = criticality;
|
||||
|
||||
ANY_fromType_aper(&buff->value, type, sptr);
|
||||
|
||||
if (asn1_xer_print)
|
||||
if (xer_fprint(stdout, &asn_DEF_RUA_IE, buff) < 0) {
|
||||
free(buff);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return buff;
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
#include <asn_application.h>
|
||||
|
||||
#include "rua/RUA_Ansi-41-IDNNS.h"
|
||||
#include "rua/RUA_CN-DomainIndicator.h"
|
||||
#include "rua/RUA_CSGMembershipStatus.h"
|
||||
#include "rua/RUA_Cause.h"
|
||||
#include "rua/RUA_CauseMisc.h"
|
||||
#include "rua/RUA_CauseProtocol.h"
|
||||
#include "rua/RUA_CauseRadioNetwork.h"
|
||||
#include "rua/RUA_CauseTransport.h"
|
||||
#include "rua/RUA_Connect.h"
|
||||
#include "rua/RUA_ConnectionlessTransfer.h"
|
||||
#include "rua/RUA_Context-ID.h"
|
||||
#include "rua/RUA_Criticality.h"
|
||||
#include "rua/RUA_CriticalityDiagnostics-IE-List.h"
|
||||
#include "rua/RUA_CriticalityDiagnostics.h"
|
||||
#include "rua/RUA_DirectTransfer.h"
|
||||
#include "rua/RUA_Disconnect.h"
|
||||
#include "rua/RUA_ErrorIndication.h"
|
||||
#include "rua/RUA_Establishment-Cause.h"
|
||||
#include "rua/RUA_Gsm-map-IDNNS.h"
|
||||
#include "rua/RUA_IE-Extensions.h"
|
||||
#include "rua/RUA_IE.h"
|
||||
#include "rua/RUA_InitiatingMessage.h"
|
||||
#include "rua/RUA_IntraDomainNasNodeSelector.h"
|
||||
#include "rua/RUA_Presence.h"
|
||||
#include "rua/RUA_PrivateIE-ID.h"
|
||||
#include "rua/RUA_PrivateMessage.h"
|
||||
#include "rua/RUA_ProcedureCode.h"
|
||||
#include "rua/RUA_ProtocolIE-ID.h"
|
||||
#include "rua/RUA_RANAP-Message.h"
|
||||
#include "rua/RUA_RUA-PDU.h"
|
||||
#include "rua/RUA_RoutingParameter.h"
|
||||
#include "rua/RUA_SuccessfulOutcome.h"
|
||||
#include "rua/RUA_TriggeringMessage.h"
|
||||
#include "rua/RUA_TypeOfError.h"
|
||||
#include "rua/RUA_UnsuccessfulOutcome.h"
|
||||
|
||||
#if (ASN1C_ENVIRONMENT_VERSION < 924)
|
||||
# error "You are compiling with the wrong version of ASN1C"
|
||||
#endif
|
||||
|
||||
#include <osmocom/core/logging.h>
|
||||
|
||||
#define RUA_DEBUG(x, args ...) DEBUGP(0, x, ## args)
|
||||
|
||||
extern int asn1_xer_print;
|
||||
|
||||
struct msgb *rua_generate_successful_outcome(
|
||||
e_RUA_ProcedureCode procedureCode,
|
||||
RUA_Criticality_t criticality,
|
||||
asn_TYPE_descriptor_t * td,
|
||||
void *sptr);
|
||||
|
||||
RUA_IE_t *rua_new_ie(RUA_ProtocolIE_ID_t id, RUA_Criticality_t criticality,
|
||||
asn_TYPE_descriptor_t *type, void *sptr);
|
||||
|
Loading…
Reference in New Issue