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.
This commit is contained in:
parent
f168a3b470
commit
edf1367e62
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue