aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-04-23 13:50:46 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-04-25 15:34:28 +0200
commitedf1367e62fceddd09e31feef3898c83406e0fda (patch)
tree730eb538e85d5dc2f5c070542479600f7c00fdc4
parentf168a3b4703d98168ae4b96d7bc743571f95d25e (diff)
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.
-rw-r--r--include/osmocom/ranap/ranap_msg_factory.h4
-rw-r--r--src/ranap_msg_factory.c13
-rw-r--r--src/tests/test-ranap.c2
3 files changed, 12 insertions, 7 deletions
diff --git a/include/osmocom/ranap/ranap_msg_factory.h b/include/osmocom/ranap/ranap_msg_factory.h
index cf4350d..9639881 100644
--- a/include/osmocom/ranap/ranap_msg_factory.h
+++ b/include/osmocom/ranap/ranap_msg_factory.h
@@ -1,6 +1,7 @@
#pragma once
#include <stdint.h>
+#include <stdbool.h>
#include <osmocom/ranap/RANAP_Cause.h>
#include <osmocom/ranap/RANAP_CN-DomainIndicator.h>
#include <osmocom/ranap/RANAP_GlobalRNC-ID.h>
@@ -34,7 +35,8 @@ struct msgb *ranap_new_msg_paging_cmd(const char *imsi, const uint32_t *tmsi, in
struct msgb *ranap_new_msg_rab_assign_voice(uint8_t rab_id, uint32_t rtp_ip, uint16_t rtp_port);
/*! \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);
/*! \brief generate RANAP RESET message */
struct msgb *ranap_new_msg_reset(RANAP_CN_DomainIndicator_t domain,
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 @@ static RANAP_RAB_Parameters_t *new_rab_par_data(uint32_t dl_max_bitrate, uint32_
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 @@ static RANAP_TransportLayerInformation_t *new_transp_info_rtp(uint32_t ip, uint1
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 @@ struct msgb *ranap_new_msg_rab_assign_voice(uint8_t rab_id, uint32_t rtp_ip, uin
}
/*! \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 @@ struct msgb *ranap_new_msg_rab_assign_data(uint8_t rab_id, uint32_t gtp_ip, uint
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;
diff --git a/src/tests/test-ranap.c b/src/tests/test-ranap.c
index 713ee8c..acdf05b 100644
--- a/src/tests/test-ranap.c
+++ b/src/tests/test-ranap.c
@@ -96,7 +96,7 @@ int main(int argc, char **argv)
msgb_free(msg);
printf("\n==> RAB ASSIGNMENT COMMAND (DATA)\n");
- msg = ranap_new_msg_rab_assign_data(2, gtp_ip, gtp_tei);
+ msg = ranap_new_msg_rab_assign_data(2, gtp_ip, gtp_tei, 1);
if (msg)
printf("%s\n", msgb_hexdump(msg));
msgb_free(msg);