diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-09-08 15:39:18 +0200 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-09-08 15:50:32 +0200 |
commit | f6673b725758c1942835cb7241a3510bfec12c6a (patch) | |
tree | 4124843e2cc6337a8470c05fc1e90104ee8548a6 | |
parent | e75a6297da9337db95e94c4eb1cebc1e72fb9d41 (diff) |
RAB Assign for voice: heed the x213 nsap flag
Add use_x213_nsap arg to ranap_new_msg_rab_assign_voice() and
new_transp_info_rtp(). Pass this to new_transp_layer_addr() to compose 32bit
addresses when use_x213_nsap == false.
This is analogous to ranap_new_msg_rab_assign_data().
Particularly, the ip.access nano3G does not accept x213 NSAP 56bit addresses,
so we want to send 32bit addresses there.
Change-Id: I0c3c95d709c8a2b1c48d7a187faca34102226329
-rw-r--r-- | include/osmocom/ranap/ranap_msg_factory.h | 4 | ||||
-rw-r--r-- | src/ranap_msg_factory.c | 12 | ||||
-rw-r--r-- | src/tests/test-ranap.c | 2 |
3 files changed, 12 insertions, 6 deletions
diff --git a/include/osmocom/ranap/ranap_msg_factory.h b/include/osmocom/ranap/ranap_msg_factory.h index 9639881..120c6e6 100644 --- a/include/osmocom/ranap/ranap_msg_factory.h +++ b/include/osmocom/ranap/ranap_msg_factory.h @@ -32,7 +32,9 @@ struct msgb *ranap_new_msg_iu_rel_compl(void); struct msgb *ranap_new_msg_paging_cmd(const char *imsi, const uint32_t *tmsi, int is_ps, uint32_t cause); /*! \brief generate RANAP RAB ASSIGNMENT REQUEST message for CS (voice) */ -struct msgb *ranap_new_msg_rab_assign_voice(uint8_t rab_id, uint32_t rtp_ip, uint16_t rtp_port); +struct msgb *ranap_new_msg_rab_assign_voice(uint8_t rab_id, uint32_t rtp_ip, + uint16_t rtp_port, + bool use_x213_nsap); /*! \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, diff --git a/src/ranap_msg_factory.c b/src/ranap_msg_factory.c index 401ef4e..695a6be 100644 --- a/src/ranap_msg_factory.c +++ b/src/ranap_msg_factory.c @@ -647,7 +647,8 @@ static void new_transp_layer_addr(BIT_STRING_t *out, uint32_t ip, bool use_x213_ out->bits_unused = 0; } -static RANAP_TransportLayerInformation_t *new_transp_info_rtp(uint32_t ip, uint16_t port) +static RANAP_TransportLayerInformation_t *new_transp_info_rtp(uint32_t ip, uint16_t port, + bool use_x213_nsap) { RANAP_TransportLayerInformation_t *tli = CALLOC(1, sizeof(*tli)); uint8_t binding_id[4]; @@ -661,7 +662,7 @@ static RANAP_TransportLayerInformation_t *new_transp_info_rtp(uint32_t ip, uint1 binding_id[3] = 1; #endif - new_transp_layer_addr(&tli->transportLayerAddress, ip, 1); + new_transp_layer_addr(&tli->transportLayerAddress, ip, use_x213_nsap); tli->iuTransportAssociation.present = RANAP_IuTransportAssociation_PR_bindingID; OCTET_STRING_fromBuf(&tli->iuTransportAssociation.choice.bindingID, (const char *) binding_id, sizeof(binding_id)); @@ -710,7 +711,9 @@ static void assign_new_ra_id(RANAP_RAB_ID_t *id, uint8_t rab_id) } /*! \brief generate RANAP RAB ASSIGNMENT REQUEST message for CS (voice) */ -struct msgb *ranap_new_msg_rab_assign_voice(uint8_t rab_id, uint32_t rtp_ip, uint16_t rtp_port) +struct msgb *ranap_new_msg_rab_assign_voice(uint8_t rab_id, uint32_t rtp_ip, + uint16_t rtp_port, + bool use_x213_nsap) { RANAP_ProtocolIE_FieldPair_t *pair; RANAP_RAB_AssignmentRequestIEs_t ies; @@ -731,7 +734,8 @@ struct msgb *ranap_new_msg_rab_assign_voice(uint8_t rab_id, uint32_t rtp_ip, uin //first.nAS_SynchronisationIndicator = FIXME; first.rAB_Parameters = new_rab_par_voice(); first.userPlaneInformation = new_upi(RANAP_UserPlaneMode_support_mode_for_predefined_SDU_sizes, 1); /* 2? */ - first.transportLayerInformation = new_transp_info_rtp(rtp_ip, rtp_port); + first.transportLayerInformation = new_transp_info_rtp(rtp_ip, rtp_port, + 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 7b1f3bf..ce01b96 100644 --- a/src/tests/test-ranap.c +++ b/src/tests/test-ranap.c @@ -148,7 +148,7 @@ int main(int argc, char **argv) msgb_free(msg); printf("\n==> RAB ASSIGNMENT COMMAND (VOICE)\n"); - msg = ranap_new_msg_rab_assign_voice(1, rtp_ip, rtp_port); + msg = ranap_new_msg_rab_assign_voice(1, rtp_ip, rtp_port, 1); if (msg) printf("%s\n", msgb_hexdump(msg)); msgb_free(msg); |