new RAB: add use_x213_nsap parameter / change it to bool
Allow the *caller* of ranap_new_msg_rab_assign_data() to make the decision for
using 32 bit or longer IP addresses in RAB Assignment Request messages.
This requires a follow-up change in openbsc branch sysmocom/iu.
diff --git a/src/ranap_msg_factory.c b/src/ranap_msg_factory.c
index 7e03b13..0292442 100644
--- a/src/ranap_msg_factory.c
+++ b/src/ranap_msg_factory.c
@@ -614,7 +614,7 @@
return rab;
}
-static void new_transp_layer_addr(BIT_STRING_t *out, uint32_t ip, int use_x213_nsap)
+static void new_transp_layer_addr(BIT_STRING_t *out, uint32_t ip, bool use_x213_nsap)
{
uint8_t *buf;
unsigned int len;
@@ -658,12 +658,13 @@
return tli;
}
-static RANAP_TransportLayerInformation_t *new_transp_info_gtp(uint32_t ip, uint32_t tei)
+static RANAP_TransportLayerInformation_t *new_transp_info_gtp(uint32_t ip, uint32_t tei,
+ bool use_x213_nsap)
{
RANAP_TransportLayerInformation_t *tli = CALLOC(1, sizeof(*tli));
uint32_t binding_buf = htonl(tei);
- new_transp_layer_addr(&tli->transportLayerAddress, ip, 1);
+ new_transp_layer_addr(&tli->transportLayerAddress, ip, use_x213_nsap);
tli->iuTransportAssociation.present = RANAP_IuTransportAssociation_PR_gTP_TEI;
OCTET_STRING_fromBuf(&tli->iuTransportAssociation.choice.gTP_TEI,
(const char *) &binding_buf, sizeof(binding_buf));
@@ -763,7 +764,8 @@
}
/*! \brief generate RANAP RAB ASSIGNMENT REQUEST message for PS (data) */
-struct msgb *ranap_new_msg_rab_assign_data(uint8_t rab_id, uint32_t gtp_ip, uint32_t gtp_tei)
+struct msgb *ranap_new_msg_rab_assign_data(uint8_t rab_id, uint32_t gtp_ip,
+ uint32_t gtp_tei, bool use_x213_nsap)
{
RANAP_ProtocolIE_FieldPair_t *pair;
RANAP_RAB_AssignmentRequestIEs_t ies;
@@ -786,7 +788,8 @@
first.rAB_Parameters = new_rab_par_data(1600000, 800000);
first.userPlaneInformation = new_upi(RANAP_UserPlaneMode_transparent_mode, 1);
- first.transportLayerInformation = new_transp_info_gtp(gtp_ip, gtp_tei);
+ first.transportLayerInformation = new_transp_info_gtp(gtp_ip, gtp_tei,
+ use_x213_nsap);
/* put together the 'Second' part */
RANAP_RAB_SetupOrModifyItemSecond_t second;