aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2016-01-01 16:18:55 +0100
committerHarald Welte <laforge@gnumonks.org>2016-01-01 16:47:13 +0100
commit37223d82188bdee65a994eb163bbaa69a481a8b8 (patch)
tree81ca55396a51c737392959222c83bac67ad54dda
parent01de8d716a2fbf2b2a951edc20178c5abd24a080 (diff)
ranap_msg_factory: functions for RAB and IU Release Request
-rw-r--r--src/ranap_msg_factory.c69
-rw-r--r--src/ranap_msg_factory.h6
2 files changed, 75 insertions, 0 deletions
diff --git a/src/ranap_msg_factory.c b/src/ranap_msg_factory.c
index c3d5afe..51f923c 100644
--- a/src/ranap_msg_factory.c
+++ b/src/ranap_msg_factory.c
@@ -580,9 +580,14 @@ static RANAP_TransportLayerInformation_t *new_transp_info_rtp(uint32_t ip, uint1
RANAP_TransportLayerInformation_t *tli = CALLOC(1, sizeof(*tli));
uint8_t binding_id[4];
+#if 0
binding_id[0] = port >> 8;
binding_id[1] = port & 0xff;
binding_id[2] = binding_id[3] = 0;
+#else
+ binding_id[0] = binding_id[1] = binding_id[2] = 0;
+ binding_id[3] = 1;
+#endif
new_transp_layer_addr(&tli->transportLayerAddress, ip, 1);
tli->iuTransportAssociation.present = RANAP_IuTransportAssociation_PR_bindingID;
@@ -771,3 +776,67 @@ struct msgb *ranap_new_msg_rab_assign_data(uint8_t rab_id, uint32_t gtp_ip, uint
return msg;
}
+
+struct msgb *ranap_new_msg_iu_rel_req(const RANAP_Cause_t *cause)
+{
+ RANAP_Iu_ReleaseRequestIEs_t ies;
+ RANAP_Iu_ReleaseRequest_t out;
+ struct msgb *msg;
+ int rc;
+
+ memset(&ies, 0, sizeof(ies));
+ memset(&out, 0, sizeof(out));
+
+ memcpy(&ies.cause, cause, sizeof(ies.cause));
+
+ rc = ranap_encode_iu_releaserequesties(&out, &ies);
+ if (rc < 0)
+ return NULL;
+
+ /* encode the output into the msgb */
+ msg = ranap_generate_initiating_message(RANAP_ProcedureCode_id_Iu_ReleaseRequest,
+ RANAP_Criticality_reject,
+ &asn_DEF_RANAP_Iu_ReleaseRequest, &out);
+ ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RANAP_Iu_ReleaseRequest, &out);
+
+ return msg;
+}
+
+struct msgb *ranap_new_msg_rab_rel_req(uint8_t rab_id, const RANAP_Cause_t *cause)
+{
+ RANAP_RAB_ReleaseItemIEs_t item_ies;
+ RANAP_RAB_ReleaseRequestIEs_t ies;
+ RANAP_RAB_ReleaseRequest_t out;
+ struct msgb *msg;
+ int rc;
+
+ memset(&item_ies, 0, sizeof(item_ies));
+ memset(&ies, 0, sizeof(ies));
+ memset(&out, 0, sizeof(out));
+
+ /* put together the ReleaseItem */
+ assign_new_ra_id(&item_ies.raB_ReleaseItem.rAB_ID, rab_id);
+ memcpy(&item_ies.raB_ReleaseItem.cause, cause, sizeof(item_ies.raB_ReleaseItem.cause));
+
+ /* add to the list */
+ rc = ranap_encode_rab_releaseitemies(&ies.raB_ReleaseList, &item_ies);
+ if (rc < 0)
+ return NULL;
+ ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RANAP_RAB_ReleaseItem, &item_ies.raB_ReleaseItem);
+
+ /* encoe the list IEs into the output */
+ rc = ranap_encode_rab_releaserequesties(&out, &ies);
+ if (rc < 0)
+ return NULL;
+ /* 'out' has been generated, we can release the input */
+ ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RANAP_RAB_ReleaseList, &ies.raB_ReleaseList);
+
+ /* encode the output into the msgb */
+ msg = ranap_generate_initiating_message(RANAP_ProcedureCode_id_RAB_ReleaseRequest,
+ RANAP_Criticality_reject,
+ &asn_DEF_RANAP_RAB_ReleaseRequest, &out);
+
+ ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RANAP_RAB_ReleaseRequest, &out);
+
+ return msg;
+}
diff --git a/src/ranap_msg_factory.h b/src/ranap_msg_factory.h
index e48b1bf..810bee5 100644
--- a/src/ranap_msg_factory.h
+++ b/src/ranap_msg_factory.h
@@ -39,3 +39,9 @@ struct msgb *ranap_new_msg_reset_ack(RANAP_CN_DomainIndicator_t domain,
struct msgb *ranap_new_msg_initial_ue(uint32_t conn_id, int is_ps,
RANAP_GlobalRNC_ID_t *rnc_id,
uint8_t *nas_pdu, unsigned int nas_len);
+
+/*! \brief generate RANAP IU RELEASE REQUEST message */
+struct msgb *ranap_new_msg_iu_rel_req(const RANAP_Cause_t *cause);
+
+/*! \brief generate RANAP RAB RELEASE REQUEST message */
+struct msgb *ranap_new_msg_rab_rel_req(uint8_t rab_id, const RANAP_Cause_t *cause);