Merge branch 'develop' into develop-nr
This commit is contained in:
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
@@ -253,15 +253,6 @@ for key in iesDefs:
|
||||
f.write(" %s_t *%s,\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
|
||||
f.write(" ANY_t *any_p);\n\n")
|
||||
|
||||
f.write("/* %s in iesDefs not in ieofielist.values() */\n" % (key))
|
||||
f.write("/** \\brief Compare function for %s ies.\n" % (key))
|
||||
f.write(" * \\param %s Pointer to the ASN1 structure.\n" % (firstlower))
|
||||
f.write(" * \\param %s Pointer to the ASN1 structure.\n" % (firstlower))
|
||||
f.write(" **/\n")
|
||||
f.write("asn_comp_rval_t * %s_compare_%s(\n" % (fileprefix, keylowerunderscore))
|
||||
f.write(" %s_t *%s1,\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
|
||||
f.write(" %s_t *%s2);\n\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
|
||||
|
||||
if len(iesDefs[key]["ies"]) == 0:
|
||||
continue
|
||||
|
||||
@@ -298,13 +289,6 @@ for key in iesDefs:
|
||||
f.write("int %s_decode_%s(\n" % (fileprefix, firstlower.lower()))
|
||||
f.write(" %sIEs_t *%sIEs,\n" % (asn1cStruct, firstlower))
|
||||
f.write(" %s_t *%s);\n\n" % (asn1cStruct, lowerFirstCamelWord(asn1cStruct)))
|
||||
f.write("/** \\brief Compare function for %s ies.\n" % (key))
|
||||
f.write(" * \\param %s Pointer to the IES structure.\n" % (firstlower))
|
||||
f.write(" * \\param %s Pointer to the IES structure.\n" % (firstlower))
|
||||
f.write(" **/\n")
|
||||
f.write("asn_comp_rval_t * %s_compare_%s(\n" % (fileprefix, firstlower.lower()))
|
||||
f.write(" %sIEs_t *%s1,\n" % (asn1cStruct, firstlower))
|
||||
f.write(" %sIEs_t *%s2);\n\n" % (asn1cStruct, firstlower))
|
||||
|
||||
|
||||
|
||||
@@ -634,19 +618,19 @@ xer_encode_local(asn_TYPE_descriptor_t *td, void *sptr,
|
||||
mname = td->xml_tag;
|
||||
mlen = strlen(mname);
|
||||
|
||||
_i_ASN_TEXT_INDENT(0, indent);
|
||||
_ASN_CALLBACK3("<", 1, mname, mlen, ">", 1);
|
||||
ASN__TEXT_INDENT(0, indent);
|
||||
ASN__CALLBACK3("<", 1, mname, mlen, ">", 1);
|
||||
|
||||
tmper = td->xer_encoder(td, sptr, indent + 1, XER_F_BASIC, cb, app_key);
|
||||
tmper = td->op->xer_encoder(td, sptr, indent + 1, XER_F_BASIC, cb, app_key);
|
||||
if(tmper.encoded == -1) return tmper;
|
||||
|
||||
_ASN_CALLBACK3("</", 2, mname, mlen, ">\\n", xcan);
|
||||
ASN__CALLBACK3("</", 2, mname, mlen, ">\\n", xcan);
|
||||
|
||||
er.encoded = 4 + xcan + (2 * mlen) + tmper.encoded;
|
||||
|
||||
_ASN_ENCODED_OK(er);
|
||||
ASN__ENCODED_OK(er);
|
||||
cb_failed:
|
||||
_ASN_ENCODE_FAILED;
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
""")
|
||||
|
||||
@@ -714,7 +698,7 @@ for (key, value) in iesDefs.items():
|
||||
f.write(" cb(\" </%s>\\n\", %d, app_key);\n" % (key, len(" </%s>\n" % (key))))
|
||||
f.write(" cb(\"</%s-PDU>\\n\", %d, app_key);\n" % (key, len("</%s-PDU>\n" % (key))))
|
||||
|
||||
f.write(" _ASN_ENCODED_OK(er);\n")
|
||||
f.write(" ASN__ENCODED_OK(er);\n")
|
||||
#if key not in ieofielist.values():
|
||||
#f.write("cb_failed:\n")
|
||||
#f.write(" return er;\n")
|
||||
@@ -731,119 +715,6 @@ f.write("#include \"%s_common.h\"\n#include \"%s_ies_defs.h\"\n" % (fileprefix,
|
||||
f.write("#include \"%s-ProtocolIE-ID.h\"\n\n" % (fileprefix_first_upper))
|
||||
|
||||
|
||||
for key in iesDefs:
|
||||
if key in ieofielist.values():
|
||||
continue
|
||||
structName = re.sub('ies', '', key)
|
||||
asn1cStruct = re.sub('-', '_', re.sub('IEs', '', key))
|
||||
asn1cStruct = re.sub('Item', 'List', asn1cStruct)
|
||||
if asn1cStruct.rfind('_') == len(asn1cStruct) - 1:
|
||||
asn1cStruct = asn1cStruct[:-1]
|
||||
asn1cStructfirstlower = asn1cStruct[:1].lower() + asn1cStruct[1:]
|
||||
firstwordlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct)))
|
||||
|
||||
iesaccess = ""
|
||||
if key not in ieofielist.values():
|
||||
iesaccess = "%s_ies." % (firstwordlower)
|
||||
|
||||
keyName = re.sub('-', '_', key)
|
||||
keyupperunderscore = keyName.upper()
|
||||
# No IE to encode...
|
||||
if len(iesDefs[key]["ies"]) == 0:
|
||||
continue
|
||||
|
||||
f.write("asn_comp_rval_t * %s_compare_%s(\n" % (fileprefix, re.sub('-', '_', structName.lower())))
|
||||
f.write(" %s_t *%s1,\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
|
||||
f.write(" %s_t *%s2) {\n\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
|
||||
|
||||
f.write(" asn_comp_rval_t *rv = NULL;\n\n")
|
||||
f.write(" asn_comp_rval_t *rv2 = NULL;\n\n")
|
||||
|
||||
f.write(" assert(%s1 != NULL);\n" % (lowerFirstCamelWord(re.sub('-', '_', key))));
|
||||
f.write(" assert(%s2 != NULL);\n" % (lowerFirstCamelWord(re.sub('-', '_', key))));
|
||||
|
||||
loop = 0
|
||||
for ie in iesDefs[key]["ies"]:
|
||||
iename = re.sub('-', '_', re.sub('id-', '', ie[0]))
|
||||
ienameunderscore = re.sub('-', '_', iename)
|
||||
ienamefirstwordlower = lowerFirstCamelWord(iename)
|
||||
ieupperunderscore = re.sub('-', '_', re.sub('id-', '', ie[0])).upper()
|
||||
ietypeunderscore = re.sub('-', '_', ie[2])
|
||||
|
||||
if ie[3] != "mandatory":
|
||||
|
||||
loop = loop + 1
|
||||
if loop == 1:
|
||||
#f.write(" %s_IE_t *ie1 = NULL;\n" % (fileprefix_first_upper))
|
||||
#f.write(" %s_IE_t *ie2 = NULL;\n" % (fileprefix_first_upper))
|
||||
f.write(" if (%s1->presenceMask != %s2->presenceMask) {rv=calloc(1,sizeof(asn_comp_rval_t));rv->name = asn_DEF_%s.name;rv->structure1 = %s1;rv->structure2 = %s2;rv->err_code = COMPARE_ERR_CODE_VALUE_NULL; return rv;}\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), lowerFirstCamelWord(re.sub('-', '_', key)), ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', key)), lowerFirstCamelWord(re.sub('-', '_', key))))
|
||||
|
||||
if ie[3] == "optional":
|
||||
f.write(" /* Optional field */\n")
|
||||
elif ie[3] == "conditional":
|
||||
f.write(" /* Conditional field */\n")
|
||||
f.write(" if (%s1->presenceMask & %s_%s_PRESENT) {\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), keyupperunderscore, ieupperunderscore))
|
||||
|
||||
|
||||
if ie[2] in ieofielist.keys():
|
||||
f.write(" /* collection field */\n")
|
||||
f.write(" rv2 = %s_compare_%s(&%s1->%s, &%s2->%s);\n" % (fileprefix, ietypeunderscore.lower(), lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower ))
|
||||
f.write(" if(rv2) {")
|
||||
f.write(" if (NULL == rv) {")
|
||||
f.write(" rv = rv2;")
|
||||
f.write(" } else {")
|
||||
f.write(" rv2->next = rv;")
|
||||
f.write(" rv = rv2;")
|
||||
f.write(" }")
|
||||
f.write(" rv2 = NULL;")
|
||||
f.write(" }")
|
||||
else:
|
||||
f.write(" /* simple field */\n")
|
||||
f.write(" rv2 = asn_DEF_%s.compare(&asn_DEF_%s, &%s1->%s, &asn_DEF_%s, &%s2->%s); \n" % (ietypeunderscore, ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower, ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower ))
|
||||
f.write(" if (rv2) {")
|
||||
f.write(" if (NULL == rv) {")
|
||||
f.write(" rv = rv2;")
|
||||
f.write(" } else {")
|
||||
f.write(" rv2->next = rv;")
|
||||
f.write(" rv = rv2;")
|
||||
f.write(" }")
|
||||
f.write(" rv2 = NULL;")
|
||||
f.write(" if (!rv->name) rv->name = asn_DEF_%s.name;" % (ietypeunderscore))
|
||||
f.write(" }")
|
||||
|
||||
f.write(" assert(0);\n");
|
||||
f.write(" }\n\n")
|
||||
|
||||
else:
|
||||
if ie[2] in ieofielist.keys():
|
||||
f.write(" /* Mandatory collection field */\n")
|
||||
f.write(" rv2 = %s_compare_%s(&%s1->%s, &%s2->%s);\n" % (fileprefix, ietypeunderscore.lower(), lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower ))
|
||||
f.write(" if (rv2) {\n")
|
||||
f.write(" if (NULL == rv) {\n")
|
||||
f.write(" rv = rv2;\n")
|
||||
f.write(" } else {\n")
|
||||
f.write(" rv2->next = rv;\n")
|
||||
f.write(" rv = rv2;\n")
|
||||
f.write(" }\n")
|
||||
f.write(" rv2 = NULL;\n")
|
||||
f.write(" }\n")
|
||||
|
||||
else:
|
||||
f.write(" /* Mandatory simple field */\n")
|
||||
f.write(" rv2 = asn_DEF_%s.compare(&asn_DEF_%s, &%s1->%s, &asn_DEF_%s, &%s2->%s);\n" % (ietypeunderscore, ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower, ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower ))
|
||||
f.write(" if(rv2) {\n")
|
||||
f.write(" if (NULL == rv) {\n")
|
||||
f.write(" rv = rv2;\n")
|
||||
f.write(" } else {\n")
|
||||
f.write(" rv2->next = rv;\n")
|
||||
f.write(" rv = rv2;\n")
|
||||
f.write(" }\n")
|
||||
f.write(" rv2 = NULL;\n")
|
||||
f.write(" if (!rv->name) rv->name = asn_DEF_%s.name;\n" % (ietypeunderscore))
|
||||
f.write(" }\n")
|
||||
f.write(" return rv;\n")
|
||||
f.write("}\n\n")
|
||||
|
||||
for (key, value) in iesDefs.items():
|
||||
if key not in ieofielist.values():
|
||||
continue
|
||||
@@ -859,30 +730,3 @@ for (key, value) in iesDefs.items():
|
||||
break
|
||||
|
||||
f.write("extern asn_TYPE_descriptor_t asn_DEF_%s;\n" % (ietypeunderscore))
|
||||
|
||||
f.write("asn_comp_rval_t * %s_compare_%s(\n" % (fileprefix, re.sub('-', '_', i).lower()))
|
||||
f.write(" %sIEs_t *%sIEs1,\n" % (re.sub('-', '_', i), lowerFirstCamelWord(re.sub('-', '_', i))))
|
||||
f.write(" %sIEs_t *%sIEs2) {\n\n" % (re.sub('-', '_', i), lowerFirstCamelWord(re.sub('-', '_', i))))
|
||||
f.write(" int i;\n")
|
||||
f.write(" asn_comp_rval_t *rv = NULL;\n\n")
|
||||
f.write(" asn_comp_rval_t *rv2 = NULL;\n\n")
|
||||
|
||||
|
||||
f.write(" assert(%sIEs1 != NULL);\n" % (lowerFirstCamelWord(re.sub('-', '_', i))));
|
||||
f.write(" assert(%sIEs2 != NULL);\n\n" % (lowerFirstCamelWord(re.sub('-', '_', i))));
|
||||
|
||||
f.write(" for (i = 0; i < %sIEs1->%s.count; i++) {\n" % (lowerFirstCamelWord(re.sub('-', '_', i)), re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key)))))
|
||||
f.write(" rv2 = asn_DEF_%s.compare(&asn_DEF_%s, %sIEs1->%s.array[i], &asn_DEF_%s, %sIEs2->%s.array[i]);\n" % (ietypeunderscore, ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', i)), re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key))), ietypeunderscore, lowerFirstCamelWord(re.sub('-', '_', i)), re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key)))))
|
||||
f.write(" if(rv2) {")
|
||||
f.write(" if (NULL == rv) {")
|
||||
f.write(" rv = rv2;")
|
||||
f.write(" } else {")
|
||||
f.write(" rv2->next = rv;")
|
||||
f.write(" rv = rv2;")
|
||||
f.write(" }")
|
||||
f.write(" rv2 = NULL;")
|
||||
f.write(" }")
|
||||
f.write(" }\n")
|
||||
f.write(" return rv;\n")
|
||||
f.write("}\n\n")
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@ extern int asn1_xer_print;
|
||||
# define S1AP_DEBUG(x, args...) do { fprintf(stdout, "[S1AP][D]"x, ##args); } while(0)
|
||||
#endif
|
||||
|
||||
|
||||
#define S1AP_FIND_PROTOCOLIE_BY_ID(IE_TYPE, ie, container, IE_ID, mandatory) \
|
||||
do {\
|
||||
IE_TYPE **ptr; \
|
||||
@@ -102,15 +103,17 @@ extern int asn1_xer_print;
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
if (mandatory) DevAssert(ie != NULL); \
|
||||
if (ie == NULL ) { \
|
||||
S1AP_ERROR("S1AP_FIND_PROTOCOLIE_BY_ID: %s %d: ie is NULL\n",__FILE__,__LINE__);\
|
||||
} \
|
||||
if (mandatory) DevAssert(ie != NULL); \
|
||||
} while(0)
|
||||
|
||||
/** \brief Function callback prototype.
|
||||
**/
|
||||
typedef int (*s1ap_message_decoded_callback)(
|
||||
uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
S1AP_S1AP_PDU_t *pdu
|
||||
uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
S1AP_S1AP_PDU_t *pdu
|
||||
);
|
||||
|
||||
/** \brief Handle criticality
|
||||
|
||||
+54
-89
@@ -61,7 +61,7 @@
|
||||
#include "assertions.h"
|
||||
#include "conversions.h"
|
||||
#if defined(TEST_S1C_MME)
|
||||
#include "oaisim_mme_test_s1c.h"
|
||||
#include "oaisim_mme_test_s1c.h"
|
||||
#endif
|
||||
|
||||
s1ap_eNB_config_t s1ap_config;
|
||||
@@ -74,22 +74,17 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
|
||||
|
||||
void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp);
|
||||
|
||||
uint32_t s1ap_generate_eNB_id(void)
|
||||
{
|
||||
uint32_t s1ap_generate_eNB_id(void) {
|
||||
char *out;
|
||||
char hostname[50];
|
||||
int ret;
|
||||
uint32_t eNB_id;
|
||||
|
||||
/* Retrieve the host name */
|
||||
ret = gethostname(hostname, sizeof(hostname));
|
||||
DevAssert(ret == 0);
|
||||
|
||||
out = crypt(hostname, "eurecom");
|
||||
DevAssert(out != NULL);
|
||||
|
||||
eNB_id = ((out[0] << 24) | (out[1] << 16) | (out[2] << 8) | out[3]);
|
||||
|
||||
return eNB_id;
|
||||
}
|
||||
|
||||
@@ -99,55 +94,42 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
|
||||
uint16_t in_streams,
|
||||
uint16_t out_streams,
|
||||
uint8_t broadcast_plmn_num,
|
||||
uint8_t broadcast_plmn_index[PLMN_LIST_MAX_SIZE])
|
||||
{
|
||||
uint8_t broadcast_plmn_index[PLMN_LIST_MAX_SIZE]) {
|
||||
MessageDef *message_p = NULL;
|
||||
sctp_new_association_req_t *sctp_new_association_req_p = NULL;
|
||||
s1ap_eNB_mme_data_t *s1ap_mme_data_p = NULL;
|
||||
struct s1ap_eNB_mme_data_s *mme = NULL;
|
||||
|
||||
DevAssert(instance_p != NULL);
|
||||
DevAssert(mme_ip_address != NULL);
|
||||
|
||||
message_p = itti_alloc_new_message(TASK_S1AP, SCTP_NEW_ASSOCIATION_REQ);
|
||||
|
||||
sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req;
|
||||
|
||||
sctp_new_association_req_p->port = S1AP_PORT_NUMBER;
|
||||
sctp_new_association_req_p->ppid = S1AP_SCTP_PPID;
|
||||
|
||||
sctp_new_association_req_p->in_streams = in_streams;
|
||||
sctp_new_association_req_p->out_streams = out_streams;
|
||||
|
||||
memcpy(&sctp_new_association_req_p->remote_address,
|
||||
mme_ip_address,
|
||||
sizeof(*mme_ip_address));
|
||||
|
||||
memcpy(&sctp_new_association_req_p->local_address,
|
||||
local_ip_addr,
|
||||
sizeof(*local_ip_addr));
|
||||
|
||||
S1AP_INFO("[eNB %d] check the mme registration state\n",instance_p->instance);
|
||||
|
||||
mme = NULL;
|
||||
|
||||
if ( mme == NULL ) {
|
||||
|
||||
/* Create new MME descriptor */
|
||||
s1ap_mme_data_p = calloc(1, sizeof(*s1ap_mme_data_p));
|
||||
DevAssert(s1ap_mme_data_p != NULL);
|
||||
|
||||
s1ap_mme_data_p->cnx_id = s1ap_eNB_fetch_add_global_cnx_id();
|
||||
sctp_new_association_req_p->ulp_cnx_id = s1ap_mme_data_p->cnx_id;
|
||||
|
||||
s1ap_mme_data_p->assoc_id = -1;
|
||||
s1ap_mme_data_p->broadcast_plmn_num = broadcast_plmn_num;
|
||||
|
||||
for (int i = 0; i < broadcast_plmn_num; ++i)
|
||||
s1ap_mme_data_p->broadcast_plmn_index[i] = broadcast_plmn_index[i];
|
||||
|
||||
s1ap_mme_data_p->s1ap_eNB_instance = instance_p;
|
||||
|
||||
STAILQ_INIT(&s1ap_mme_data_p->served_gummei);
|
||||
|
||||
/* Insert the new descriptor in list of known MME
|
||||
* but not yet associated.
|
||||
*/
|
||||
@@ -158,12 +140,10 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
|
||||
} else if (mme->state == S1AP_ENB_STATE_WAITING) {
|
||||
instance_p->s1ap_mme_pending_nb ++;
|
||||
sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id;
|
||||
|
||||
S1AP_INFO("[eNB %d] MME already registered, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n",
|
||||
instance_p->instance,
|
||||
mme->state, mme->cnx_id,
|
||||
instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb);
|
||||
|
||||
/*s1ap_mme_data_p->cnx_id = mme->cnx_id;
|
||||
sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id;
|
||||
|
||||
@@ -181,13 +161,10 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
|
||||
}
|
||||
|
||||
|
||||
void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *s1ap_register_eNB)
|
||||
{
|
||||
void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *s1ap_register_eNB) {
|
||||
s1ap_eNB_instance_t *new_instance;
|
||||
uint8_t index;
|
||||
|
||||
DevAssert(s1ap_register_eNB != NULL);
|
||||
|
||||
/* Look if the provided instance already exists */
|
||||
new_instance = s1ap_eNB_get_instance(instance);
|
||||
|
||||
@@ -197,38 +174,36 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
|
||||
DevCheck(new_instance->cell_type == s1ap_register_eNB->cell_type, new_instance->cell_type, s1ap_register_eNB->cell_type, 0);
|
||||
DevCheck(new_instance->num_plmn == s1ap_register_eNB->num_plmn, new_instance->num_plmn, s1ap_register_eNB->num_plmn, 0);
|
||||
DevCheck(new_instance->tac == s1ap_register_eNB->tac, new_instance->tac, s1ap_register_eNB->tac, 0);
|
||||
for (int i = 0; i < new_instance->num_plmn; i++)
|
||||
{
|
||||
|
||||
for (int i = 0; i < new_instance->num_plmn; i++) {
|
||||
DevCheck(new_instance->mcc[i] == s1ap_register_eNB->mcc[i], new_instance->mcc[i], s1ap_register_eNB->mcc[i], 0);
|
||||
DevCheck(new_instance->mnc[i] == s1ap_register_eNB->mnc[i], new_instance->mnc[i], s1ap_register_eNB->mnc[i], 0);
|
||||
DevCheck(new_instance->mnc_digit_length[i] == s1ap_register_eNB->mnc_digit_length[i], new_instance->mnc_digit_length[i], s1ap_register_eNB->mnc_digit_length[i], 0);
|
||||
}
|
||||
|
||||
DevCheck(new_instance->default_drx == s1ap_register_eNB->default_drx, new_instance->default_drx, s1ap_register_eNB->default_drx, 0);
|
||||
} else {
|
||||
new_instance = calloc(1, sizeof(s1ap_eNB_instance_t));
|
||||
DevAssert(new_instance != NULL);
|
||||
|
||||
RB_INIT(&new_instance->s1ap_ue_head);
|
||||
RB_INIT(&new_instance->s1ap_mme_head);
|
||||
|
||||
/* Copy usefull parameters */
|
||||
new_instance->instance = instance;
|
||||
new_instance->eNB_name = s1ap_register_eNB->eNB_name;
|
||||
new_instance->eNB_id = s1ap_register_eNB->eNB_id;
|
||||
new_instance->cell_type = s1ap_register_eNB->cell_type;
|
||||
new_instance->tac = s1ap_register_eNB->tac;
|
||||
for (int i = 0; i < s1ap_register_eNB->num_plmn; i++)
|
||||
{
|
||||
|
||||
for (int i = 0; i < s1ap_register_eNB->num_plmn; i++) {
|
||||
new_instance->mcc[i] = s1ap_register_eNB->mcc[i];
|
||||
new_instance->mnc[i] = s1ap_register_eNB->mnc[i];
|
||||
new_instance->mnc_digit_length[i] = s1ap_register_eNB->mnc_digit_length[i];
|
||||
}
|
||||
|
||||
new_instance->num_plmn = s1ap_register_eNB->num_plmn;
|
||||
new_instance->default_drx = s1ap_register_eNB->default_drx;
|
||||
|
||||
/* Add the new instance to the list of eNB (meaningfull in virtual mode) */
|
||||
s1ap_eNB_insert_new_instance(new_instance);
|
||||
|
||||
S1AP_INFO("Registered new eNB[%d] and %s eNB id %u\n",
|
||||
instance,
|
||||
s1ap_register_eNB->cell_type == CELL_MACRO_ENB ? "macro" : "home",
|
||||
@@ -250,16 +225,12 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
|
||||
}
|
||||
}
|
||||
|
||||
void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp)
|
||||
{
|
||||
void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) {
|
||||
s1ap_eNB_instance_t *instance_p;
|
||||
s1ap_eNB_mme_data_t *s1ap_mme_data_p;
|
||||
|
||||
DevAssert(sctp_new_association_resp != NULL);
|
||||
|
||||
instance_p = s1ap_eNB_get_instance(instance);
|
||||
DevAssert(instance_p != NULL);
|
||||
|
||||
s1ap_mme_data_p = s1ap_eNB_get_MME(instance_p, -1,
|
||||
sctp_new_association_resp->ulp_cnx_id);
|
||||
DevAssert(s1ap_mme_data_p != NULL);
|
||||
@@ -269,9 +240,7 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
|
||||
sctp_new_association_resp->sctp_state,
|
||||
instance,
|
||||
sctp_new_association_resp->ulp_cnx_id);
|
||||
|
||||
s1ap_handle_s1_setup_message(s1ap_mme_data_p, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -279,20 +248,17 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
|
||||
s1ap_mme_data_p->assoc_id = sctp_new_association_resp->assoc_id;
|
||||
s1ap_mme_data_p->in_streams = sctp_new_association_resp->in_streams;
|
||||
s1ap_mme_data_p->out_streams = sctp_new_association_resp->out_streams;
|
||||
|
||||
/* Prepare new S1 Setup Request */
|
||||
s1ap_eNB_generate_s1_setup_request(instance_p, s1ap_mme_data_p);
|
||||
}
|
||||
|
||||
static
|
||||
void s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind)
|
||||
{
|
||||
void s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) {
|
||||
int result;
|
||||
|
||||
DevAssert(sctp_data_ind != NULL);
|
||||
#if defined(TEST_S1C_MME)
|
||||
mme_test_s1_notify_sctp_data_ind(sctp_data_ind->assoc_id, sctp_data_ind->stream,
|
||||
sctp_data_ind->buffer, sctp_data_ind->buffer_length);
|
||||
sctp_data_ind->buffer, sctp_data_ind->buffer_length);
|
||||
#else
|
||||
s1ap_eNB_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream,
|
||||
sctp_data_ind->buffer, sctp_data_ind->buffer_length);
|
||||
@@ -301,23 +267,19 @@ void s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind)
|
||||
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
|
||||
}
|
||||
|
||||
void s1ap_eNB_init(void)
|
||||
{
|
||||
void s1ap_eNB_init(void) {
|
||||
S1AP_DEBUG("Starting S1AP layer\n");
|
||||
|
||||
s1ap_eNB_prepare_internal_data();
|
||||
|
||||
itti_mark_task_ready(TASK_S1AP);
|
||||
MSC_START_USE();
|
||||
}
|
||||
|
||||
void *s1ap_eNB_process_itti_msg(void* notUsed)
|
||||
{
|
||||
void *s1ap_eNB_process_itti_msg(void *notUsed) {
|
||||
MessageDef *received_msg = NULL;
|
||||
int result;
|
||||
itti_receive_msg(TASK_S1AP, &received_msg);
|
||||
itti_receive_msg(TASK_S1AP, &received_msg);
|
||||
|
||||
switch (ITTI_MSG_ID(received_msg)) {
|
||||
switch (ITTI_MSG_ID(received_msg)) {
|
||||
case TERMINATE_MESSAGE:
|
||||
S1AP_WARN(" *** Exiting S1AP thread\n");
|
||||
itti_exit_task();
|
||||
@@ -371,22 +333,28 @@ void *s1ap_eNB_process_itti_msg(void* notUsed)
|
||||
|
||||
case S1AP_E_RAB_SETUP_RESP: {
|
||||
s1ap_eNB_e_rab_setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_E_RAB_SETUP_RESP(received_msg));
|
||||
&S1AP_E_RAB_SETUP_RESP(received_msg));
|
||||
}
|
||||
break;
|
||||
|
||||
case S1AP_E_RAB_MODIFY_RESP: {
|
||||
s1ap_eNB_e_rab_modify_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_E_RAB_MODIFY_RESP(received_msg));
|
||||
&S1AP_E_RAB_MODIFY_RESP(received_msg));
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case S1AP_NAS_NON_DELIVERY_IND: {
|
||||
s1ap_eNB_nas_non_delivery_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_NAS_NON_DELIVERY_IND(received_msg));
|
||||
}
|
||||
break;
|
||||
|
||||
case S1AP_PATH_SWITCH_REQ: {
|
||||
s1ap_eNB_path_switch_req(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_PATH_SWITCH_REQ(received_msg));
|
||||
}
|
||||
break;
|
||||
|
||||
case S1AP_UE_CONTEXT_RELEASE_COMPLETE: {
|
||||
s1ap_ue_context_release_complete(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_UE_CONTEXT_RELEASE_COMPLETE(received_msg));
|
||||
@@ -396,11 +364,8 @@ void *s1ap_eNB_process_itti_msg(void* notUsed)
|
||||
case S1AP_UE_CONTEXT_RELEASE_REQ: {
|
||||
s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL; // test
|
||||
struct s1ap_eNB_ue_context_s *ue_context_p = NULL; // test
|
||||
|
||||
s1ap_ue_context_release_req(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_UE_CONTEXT_RELEASE_REQ(received_msg));
|
||||
|
||||
|
||||
s1ap_eNB_instance_p = s1ap_eNB_get_instance(ITTI_MESSAGE_GET_INSTANCE(received_msg)); // test
|
||||
DevAssert(s1ap_eNB_instance_p != NULL); // test
|
||||
|
||||
@@ -413,9 +378,9 @@ void *s1ap_eNB_process_itti_msg(void* notUsed)
|
||||
}
|
||||
break;
|
||||
|
||||
case S1AP_E_RAB_RELEASE_RESPONSE: {
|
||||
s1ap_eNB_e_rab_release_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_E_RAB_RELEASE_RESPONSE(received_msg));
|
||||
case S1AP_E_RAB_RELEASE_RESPONSE: {
|
||||
s1ap_eNB_e_rab_release_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_E_RAB_RELEASE_RESPONSE(received_msg));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -423,20 +388,18 @@ void *s1ap_eNB_process_itti_msg(void* notUsed)
|
||||
S1AP_ERROR("Received unhandled message: %d:%s\n",
|
||||
ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg);
|
||||
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
|
||||
|
||||
received_msg = NULL;
|
||||
return NULL;
|
||||
result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg);
|
||||
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
|
||||
received_msg = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void *s1ap_eNB_task(void *arg)
|
||||
{
|
||||
void *s1ap_eNB_task(void *arg) {
|
||||
s1ap_eNB_init();
|
||||
|
||||
|
||||
while (1) {
|
||||
(void) s1ap_eNB_process_itti_msg(NULL);
|
||||
}
|
||||
@@ -444,23 +407,26 @@ void *s1ap_eNB_task(void *arg)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/*
|
||||
* eNB generate a S1 setup request towards MME
|
||||
*/
|
||||
static int s1ap_eNB_generate_s1_setup_request(
|
||||
s1ap_eNB_instance_t *instance_p, s1ap_eNB_mme_data_t *s1ap_mme_data_p)
|
||||
s1ap_eNB_instance_t *instance_p,
|
||||
s1ap_eNB_mme_data_t *s1ap_mme_data_p)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
S1AP_S1AP_PDU_t pdu;
|
||||
S1AP_S1SetupRequest_t *out;
|
||||
S1AP_S1SetupRequestIEs_t *ie;
|
||||
S1AP_SupportedTAs_Item_t *ta;
|
||||
S1AP_PLMNidentity_t *plmn;
|
||||
uint8_t *buffer;
|
||||
uint32_t len;
|
||||
S1AP_S1AP_PDU_t pdu;
|
||||
S1AP_S1SetupRequest_t *out = NULL;
|
||||
S1AP_S1SetupRequestIEs_t *ie = NULL;
|
||||
S1AP_SupportedTAs_Item_t *ta = NULL;
|
||||
S1AP_PLMNidentity_t *plmn = NULL;
|
||||
uint8_t *buffer = NULL;
|
||||
uint32_t len = 0;
|
||||
int ret = 0;
|
||||
|
||||
DevAssert(instance_p != NULL);
|
||||
DevAssert(s1ap_mme_data_p != NULL);
|
||||
|
||||
s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING;
|
||||
|
||||
/* Prepare the S1AP message to encode */
|
||||
memset(&pdu, 0, sizeof(pdu));
|
||||
pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage;
|
||||
@@ -468,7 +434,6 @@ static int s1ap_eNB_generate_s1_setup_request(
|
||||
pdu.choice.initiatingMessage.criticality = S1AP_Criticality_reject;
|
||||
pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_S1SetupRequest;
|
||||
out = &pdu.choice.initiatingMessage.value.choice.S1SetupRequest;
|
||||
|
||||
/* mandatory */
|
||||
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_Global_ENB_ID;
|
||||
@@ -519,7 +484,6 @@ static int s1ap_eNB_generate_s1_setup_request(
|
||||
ASN_SEQUENCE_ADD(&ie->value.choice.SupportedTAs.list, ta);
|
||||
}
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
/* mandatory */
|
||||
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_DefaultPagingDRX;
|
||||
@@ -540,6 +504,7 @@ static int s1ap_eNB_generate_s1_setup_request(
|
||||
|
||||
/* optional */
|
||||
#if (S1AP_VERSION >= MAKE_VERSION(13, 0, 0))
|
||||
|
||||
if (0) {
|
||||
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_UE_RetentionInformation;
|
||||
@@ -558,6 +523,7 @@ static int s1ap_eNB_generate_s1_setup_request(
|
||||
// ie->value.choice.NB_IoT_DefaultPagingDRX = ;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
}
|
||||
|
||||
#endif /* #if (S1AP_VERSION >= MAKE_VERSION(14, 0, 0)) */
|
||||
|
||||
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &len) < 0) {
|
||||
@@ -567,6 +533,5 @@ static int s1ap_eNB_generate_s1_setup_request(
|
||||
|
||||
/* Non UE-Associated signalling -> stream = 0 */
|
||||
s1ap_eNB_itti_send_sctp_data_req(instance_p->instance, s1ap_mme_data_p->assoc_id, buffer, len, 0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -36,103 +36,52 @@
|
||||
#include "s1ap_common.h"
|
||||
#include "s1ap_eNB_decoder.h"
|
||||
|
||||
static int s1ap_eNB_decode_initiating_message(S1AP_S1AP_PDU_t *pdu)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
MessagesIds message_id;
|
||||
static int s1ap_eNB_decode_initiating_message(S1AP_S1AP_PDU_t *pdu) {
|
||||
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
|
||||
DevAssert(pdu != NULL);
|
||||
|
||||
switch(pdu->choice.initiatingMessage.procedureCode) {
|
||||
case S1AP_ProcedureCode_id_downlinkNASTransport:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_DOWNLINK_NAS_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
|
||||
res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_downlink_nas_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_downlink_nas_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
case S1AP_ProcedureCode_id_InitialContextSetup:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
|
||||
res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_initial_context_setup_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
case S1AP_ProcedureCode_id_UEContextRelease:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_UE_CONTEXT_RELEASE_COMMAND_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
|
||||
res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_ue_context_release_command_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_ue_context_release_command_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
case S1AP_ProcedureCode_id_Paging:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_PAGING_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
|
||||
res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_paging_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_paging_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
S1AP_INFO("Paging initiating message\n");
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
case S1AP_ProcedureCode_id_E_RABSetup:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_E_RAB_SETUP_REQUEST_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
|
||||
res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_e_rab_setup_request_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_e_rab_setup_request_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
S1AP_INFO("E_RABSetup initiating message\n");
|
||||
break;
|
||||
|
||||
case S1AP_ProcedureCode_id_E_RABModify:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_E_RAB_MODIFY_REQUEST_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
|
||||
res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_e_rab_modify_request_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_e_rab_modify_request_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
S1AP_INFO("E_RABModify initiating message\n");
|
||||
break;
|
||||
|
||||
case S1AP_ProcedureCode_id_E_RABRelease:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_E_RAB_RELEASE_REQUEST_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
|
||||
res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_e_rab_release_request_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_e_rab_release_request_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
S1AP_INFO("TODO E_RABRelease initiating message\n");
|
||||
break;
|
||||
|
||||
case S1AP_ProcedureCode_id_ErrorIndication:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_ERROR_INDICATION_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
|
||||
res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_error_indication_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_error_indication_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
S1AP_INFO("TODO ErrorIndication initiating message\n");
|
||||
break;
|
||||
@@ -148,21 +97,18 @@ static int s1ap_eNB_decode_initiating_message(S1AP_S1AP_PDU_t *pdu)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int s1ap_eNB_decode_successful_outcome(S1AP_S1AP_PDU_t *pdu)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
MessagesIds message_id;
|
||||
static int s1ap_eNB_decode_successful_outcome(S1AP_S1AP_PDU_t *pdu) {
|
||||
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
|
||||
DevAssert(pdu != NULL);
|
||||
|
||||
switch(pdu->choice.successfulOutcome.procedureCode) {
|
||||
case S1AP_ProcedureCode_id_S1Setup:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_S1_SETUP_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_s1_setup_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_s1_setup_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
case S1AP_ProcedureCode_id_PathSwitchRequest:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
@@ -175,21 +121,17 @@ static int s1ap_eNB_decode_successful_outcome(S1AP_S1AP_PDU_t *pdu)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int s1ap_eNB_decode_unsuccessful_outcome(S1AP_S1AP_PDU_t *pdu)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
MessagesIds message_id;
|
||||
static int s1ap_eNB_decode_unsuccessful_outcome(S1AP_S1AP_PDU_t *pdu) {
|
||||
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
|
||||
DevAssert(pdu != NULL);
|
||||
|
||||
switch(pdu->choice.unsuccessfulOutcome.procedureCode) {
|
||||
case S1AP_ProcedureCode_id_S1Setup:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_S1_SETUP_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_s1_setup_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_s1_setup_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_PathSwitchRequest:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
@@ -203,13 +145,10 @@ static int s1ap_eNB_decode_unsuccessful_outcome(S1AP_S1AP_PDU_t *pdu)
|
||||
}
|
||||
|
||||
int s1ap_eNB_decode_pdu(S1AP_S1AP_PDU_t *pdu, const uint8_t *const buffer,
|
||||
const uint32_t length)
|
||||
{
|
||||
const uint32_t length) {
|
||||
asn_dec_rval_t dec_ret;
|
||||
|
||||
DevAssert(pdu != NULL);
|
||||
DevAssert(buffer != NULL);
|
||||
|
||||
dec_ret = aper_decode(NULL,
|
||||
&asn_DEF_S1AP_S1AP_PDU,
|
||||
(void **)&pdu,
|
||||
|
||||
@@ -47,8 +47,7 @@ static inline int s1ap_eNB_encode_successfull_outcome(S1AP_S1AP_PDU_t *pdu,
|
||||
static inline int s1ap_eNB_encode_unsuccessfull_outcome(S1AP_S1AP_PDU_t *pdu,
|
||||
uint8_t **buffer, uint32_t *len);
|
||||
|
||||
int s1ap_eNB_encode_pdu(S1AP_S1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len)
|
||||
{
|
||||
int s1ap_eNB_encode_pdu(S1AP_S1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len) {
|
||||
int ret = -1;
|
||||
DevAssert(pdu != NULL);
|
||||
DevAssert(buffer != NULL);
|
||||
@@ -79,71 +78,43 @@ int s1ap_eNB_encode_pdu(S1AP_S1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len)
|
||||
|
||||
static inline
|
||||
int s1ap_eNB_encode_initiating(S1AP_S1AP_PDU_t *pdu,
|
||||
uint8_t **buffer, uint32_t *len)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
MessagesIds message_id;
|
||||
uint8_t **buffer, uint32_t *len) {
|
||||
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
|
||||
DevAssert(pdu != NULL);
|
||||
|
||||
switch(pdu->choice.initiatingMessage.procedureCode) {
|
||||
case S1AP_ProcedureCode_id_S1Setup:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_S1_SETUP_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_s1_setup_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_s1_setup_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
case S1AP_ProcedureCode_id_uplinkNASTransport:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_UPLINK_NAS_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_uplink_nas_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_uplink_nas_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
case S1AP_ProcedureCode_id_UECapabilityInfoIndication:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_UE_CAPABILITY_IND_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_ue_capability_ind_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_ue_capability_ind_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
case S1AP_ProcedureCode_id_initialUEMessage:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_INITIAL_UE_MESSAGE_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_initial_ue_message_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_initial_ue_message_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
case S1AP_ProcedureCode_id_NASNonDeliveryIndication:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_NAS_NON_DELIVERY_IND_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_nas_non_delivery_ind_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_nas_non_delivery_ind_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
case S1AP_ProcedureCode_id_UEContextReleaseRequest:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_UE_CONTEXT_RELEASE_REQ_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_ue_context_release_req_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_ue_context_release_req_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
case S1AP_ProcedureCode_id_PathSwitchRequest:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
@@ -166,63 +137,35 @@ int s1ap_eNB_encode_initiating(S1AP_S1AP_PDU_t *pdu,
|
||||
|
||||
static inline
|
||||
int s1ap_eNB_encode_successfull_outcome(S1AP_S1AP_PDU_t *pdu,
|
||||
uint8_t **buffer, uint32_t *len)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
MessagesIds message_id;
|
||||
uint8_t **buffer, uint32_t *len) {
|
||||
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
|
||||
DevAssert(pdu != NULL);
|
||||
|
||||
switch(pdu->choice.successfulOutcome.procedureCode) {
|
||||
case S1AP_ProcedureCode_id_InitialContextSetup:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_initial_context_setup_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
case S1AP_ProcedureCode_id_UEContextRelease:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_UE_CONTEXT_RELEASE_COMPLETE_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_ue_context_release_complete_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_ue_context_release_complete_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
case S1AP_ProcedureCode_id_E_RABSetup:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_E_RAB_SETUP_RESPONSE_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_e_rab_setup_response_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_e_rab_setup_response_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
S1AP_INFO("E_RABSetup successful message\n");
|
||||
break;
|
||||
|
||||
case S1AP_ProcedureCode_id_E_RABModify:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_E_RAB_MODIFY_RESPONSE_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_e_rab_modify_response_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_e_rab_modify_response_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
S1AP_INFO("E_RABModify successful message\n");
|
||||
break;
|
||||
|
||||
case S1AP_ProcedureCode_id_E_RABRelease:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_E_RAB_RELEASE_RESPONSE_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_e_rab_release_response_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_e_rab_release_response_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
S1AP_INFO("E_RAB Release successful message\n");
|
||||
break;
|
||||
@@ -246,21 +189,13 @@ int s1ap_eNB_encode_successfull_outcome(S1AP_S1AP_PDU_t *pdu,
|
||||
|
||||
static inline
|
||||
int s1ap_eNB_encode_unsuccessfull_outcome(S1AP_S1AP_PDU_t *pdu,
|
||||
uint8_t **buffer, uint32_t *len)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
MessagesIds message_id;
|
||||
uint8_t **buffer, uint32_t *len) {
|
||||
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
|
||||
DevAssert(pdu != NULL);
|
||||
|
||||
switch(pdu->choice.unsuccessfulOutcome.procedureCode) {
|
||||
case S1AP_ProcedureCode_id_InitialContextSetup:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_initial_context_setup_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
|
||||
+678
-354
File diff suppressed because it is too large
Load Diff
+1689
-1489
File diff suppressed because it is too large
Load Diff
@@ -49,4 +49,7 @@ int s1ap_eNB_e_rab_modify_resp(instance_t instance,
|
||||
|
||||
int s1ap_eNB_e_rab_release_resp(instance_t instance,
|
||||
s1ap_e_rab_release_resp_t *e_rab_release_resp_p);
|
||||
|
||||
int s1ap_eNB_path_switch_req(instance_t instance,
|
||||
s1ap_path_switch_req_t *path_switch_req_p);
|
||||
#endif /* S1AP_ENB_NAS_PROCEDURES_H_ */
|
||||
|
||||
@@ -321,3 +321,79 @@ s1ap_eNB_nnsf_select_mme_by_gummei(s1ap_eNB_instance_t *instance_p,
|
||||
* connectivity. */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
struct s1ap_eNB_mme_data_s *
|
||||
s1ap_eNB_nnsf_select_mme_by_gummei_no_cause(s1ap_eNB_instance_t *instance_p,
|
||||
s1ap_gummei_t gummei)
|
||||
{
|
||||
struct s1ap_eNB_mme_data_s *mme_data_p = NULL;
|
||||
struct s1ap_eNB_mme_data_s *mme_highest_capacity_p = NULL;
|
||||
uint8_t current_capacity = 0;
|
||||
|
||||
RB_FOREACH(mme_data_p, s1ap_mme_map, &instance_p->s1ap_mme_head) {
|
||||
struct served_gummei_s *gummei_p = NULL;
|
||||
|
||||
if (mme_data_p->state != S1AP_ENB_STATE_CONNECTED) {
|
||||
/* The association between MME and eNB is not ready for the moment,
|
||||
* go to the next known MME.
|
||||
*/
|
||||
if (mme_data_p->state == S1AP_ENB_OVERLOAD) {
|
||||
/* MME is overloaded. We have to check the RRC establishment
|
||||
* cause and take decision to the select this MME depending on
|
||||
* the overload state.
|
||||
*/
|
||||
} else {
|
||||
/* The MME is not overloaded, association is simply not ready. */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (current_capacity < mme_data_p->relative_mme_capacity) {
|
||||
/* We find a better MME, keep a reference to it */
|
||||
current_capacity = mme_data_p->relative_mme_capacity;
|
||||
mme_highest_capacity_p = mme_data_p;
|
||||
}
|
||||
|
||||
/* Looking for MME gummei matching the one provided by NAS */
|
||||
STAILQ_FOREACH(gummei_p, &mme_data_p->served_gummei, next) {
|
||||
struct served_group_id_s *group_id_p = NULL;
|
||||
struct mme_code_s *mme_code_p = NULL;
|
||||
struct plmn_identity_s *served_plmn_p = NULL;
|
||||
|
||||
STAILQ_FOREACH(served_plmn_p, &gummei_p->served_plmns, next) {
|
||||
if ((served_plmn_p->mcc == gummei.mcc) &&
|
||||
(served_plmn_p->mnc == gummei.mnc)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
STAILQ_FOREACH(mme_code_p, &gummei_p->mme_codes, next) {
|
||||
if (mme_code_p->mme_code == gummei.mme_code) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
STAILQ_FOREACH(group_id_p, &gummei_p->served_group_ids, next) {
|
||||
if (group_id_p->mme_group_id == gummei.mme_group_id) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* The MME matches the parameters provided by the NAS layer ->
|
||||
* the MME is knwown and the association is ready.
|
||||
* Return the reference to the MME to use it for this UE.
|
||||
*/
|
||||
if ((group_id_p != NULL) &&
|
||||
(mme_code_p != NULL) &&
|
||||
(served_plmn_p != NULL)) {
|
||||
return mme_data_p;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* At this point no MME matches the provided GUMMEI. Select the one with the
|
||||
* highest relative capacity.
|
||||
* In case the list of known MME is empty, simply return NULL, that way the RRC
|
||||
* layer should know about it and reject RRC connectivity.
|
||||
*/
|
||||
return mme_highest_capacity_p;
|
||||
}
|
||||
|
||||
@@ -42,4 +42,8 @@ s1ap_eNB_nnsf_select_mme_by_gummei(s1ap_eNB_instance_t *instance_p,
|
||||
rrc_establishment_cause_t cause,
|
||||
s1ap_gummei_t gummei);
|
||||
|
||||
struct s1ap_eNB_mme_data_s*
|
||||
s1ap_eNB_nnsf_select_mme_by_gummei_no_cause(s1ap_eNB_instance_t *instance_p,
|
||||
s1ap_gummei_t gummei);
|
||||
|
||||
#endif /* S1AP_ENB_NNSF_H_ */
|
||||
|
||||
@@ -47,60 +47,60 @@ int s1ap_eNB_handle_overload_start(uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
S1AP_S1AP_PDU_t *pdu)
|
||||
{
|
||||
s1ap_eNB_mme_data_t *mme_desc_p;
|
||||
S1AP_OverloadStart_t *container;
|
||||
S1AP_OverloadStartIEs_t *ie;
|
||||
s1ap_eNB_mme_data_t *mme_desc_p;
|
||||
S1AP_OverloadStart_t *container;
|
||||
S1AP_OverloadStartIEs_t *ie;
|
||||
|
||||
DevAssert(pdu != NULL);
|
||||
DevAssert(pdu != NULL);
|
||||
|
||||
container = &pdu->choice.initiatingMessage.value.choice.OverloadStart;
|
||||
container = &pdu->choice.initiatingMessage.value.choice.OverloadStart;
|
||||
|
||||
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_OverloadStartIEs_t, ie, container,
|
||||
S1AP_ProtocolIE_ID_id_OverloadResponse, true);
|
||||
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_OverloadStartIEs_t, ie, container,
|
||||
S1AP_ProtocolIE_ID_id_OverloadResponse, true);
|
||||
if (ie != NULL) {
|
||||
DevCheck(ie->value.choice.OverloadResponse.present ==
|
||||
S1AP_OverloadResponse_PR_overloadAction,
|
||||
S1AP_OverloadResponse_PR_overloadAction, 0, 0);
|
||||
}
|
||||
/* Non UE-associated signalling -> stream 0 */
|
||||
DevCheck(stream == 0, stream, 0, 0);
|
||||
|
||||
DevCheck(ie->value.choice.OverloadResponse.present ==
|
||||
S1AP_OverloadResponse_PR_overloadAction,
|
||||
S1AP_OverloadResponse_PR_overloadAction, 0, 0);
|
||||
if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) {
|
||||
/* No MME context associated */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Non UE-associated signalling -> stream 0 */
|
||||
DevCheck(stream == 0, stream, 0, 0);
|
||||
/* Mark the MME as overloaded and set the overload state according to
|
||||
* the value received.
|
||||
*/
|
||||
mme_desc_p->state = S1AP_ENB_OVERLOAD;
|
||||
mme_desc_p->overload_state =
|
||||
ie->value.choice.OverloadResponse.choice.overloadAction;
|
||||
|
||||
if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) {
|
||||
/* No MME context associated */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Mark the MME as overloaded and set the overload state according to
|
||||
* the value received.
|
||||
*/
|
||||
mme_desc_p->state = S1AP_ENB_OVERLOAD;
|
||||
mme_desc_p->overload_state =
|
||||
ie->value.choice.OverloadResponse.choice.overloadAction;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int s1ap_eNB_handle_overload_stop(uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
S1AP_S1AP_PDU_t *pdu)
|
||||
{
|
||||
/* We received Overload stop message, meaning that the MME is no more
|
||||
* overloaded. This is an empty message, with only message header and no
|
||||
* Information Element.
|
||||
*/
|
||||
DevAssert(pdu != NULL);
|
||||
/* We received Overload stop message, meaning that the MME is no more
|
||||
* overloaded. This is an empty message, with only message header and no
|
||||
* Information Element.
|
||||
*/
|
||||
DevAssert(pdu != NULL);
|
||||
|
||||
s1ap_eNB_mme_data_t *mme_desc_p;
|
||||
s1ap_eNB_mme_data_t *mme_desc_p;
|
||||
|
||||
/* Non UE-associated signalling -> stream 0 */
|
||||
DevCheck(stream == 0, stream, 0, 0);
|
||||
/* Non UE-associated signalling -> stream 0 */
|
||||
DevCheck(stream == 0, stream, 0, 0);
|
||||
|
||||
if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) {
|
||||
/* No MME context associated */
|
||||
return -1;
|
||||
}
|
||||
if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) {
|
||||
/* No MME context associated */
|
||||
return -1;
|
||||
}
|
||||
|
||||
mme_desc_p->state = S1AP_ENB_STATE_CONNECTED;
|
||||
mme_desc_p->overload_state = S1AP_NO_OVERLOAD;
|
||||
return 0;
|
||||
mme_desc_p->state = S1AP_ENB_STATE_CONNECTED;
|
||||
mme_desc_p->overload_state = S1AP_NO_OVERLOAD;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -42,107 +42,109 @@ void s1ap_eNB_generate_trace_failure(struct s1ap_eNB_ue_context_s *ue_desc_p,
|
||||
S1AP_E_UTRAN_Trace_ID_t *trace_id,
|
||||
S1AP_Cause_t *cause_p)
|
||||
{
|
||||
S1AP_S1AP_PDU_t pdu;
|
||||
S1AP_TraceFailureIndication_t *out;
|
||||
S1AP_TraceFailureIndicationIEs_t *ie;
|
||||
uint8_t *buffer = NULL;
|
||||
uint32_t length;
|
||||
S1AP_S1AP_PDU_t pdu;
|
||||
S1AP_TraceFailureIndication_t *out;
|
||||
S1AP_TraceFailureIndicationIEs_t *ie;
|
||||
uint8_t *buffer = NULL;
|
||||
uint32_t length;
|
||||
|
||||
DevAssert(ue_desc_p != NULL);
|
||||
DevAssert(trace_id != NULL);
|
||||
DevAssert(cause_p != NULL);
|
||||
DevAssert(ue_desc_p != NULL);
|
||||
DevAssert(trace_id != NULL);
|
||||
DevAssert(cause_p != NULL);
|
||||
|
||||
/* Prepare the S1AP message to encode */
|
||||
memset(&pdu, 0, sizeof(pdu));
|
||||
pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage;
|
||||
pdu.choice.initiatingMessage.procedureCode = S1AP_ProcedureCode_id_TraceFailureIndication;
|
||||
pdu.choice.initiatingMessage.criticality = S1AP_Criticality_ignore;
|
||||
pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_TraceFailureIndication;
|
||||
out = &pdu.choice.initiatingMessage.value.choice.TraceFailureIndication;
|
||||
/* Prepare the S1AP message to encode */
|
||||
memset(&pdu, 0, sizeof(pdu));
|
||||
pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage;
|
||||
pdu.choice.initiatingMessage.procedureCode = S1AP_ProcedureCode_id_TraceFailureIndication;
|
||||
pdu.choice.initiatingMessage.criticality = S1AP_Criticality_ignore;
|
||||
pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_TraceFailureIndication;
|
||||
out = &pdu.choice.initiatingMessage.value.choice.TraceFailureIndication;
|
||||
|
||||
/* mandatory */
|
||||
ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID;
|
||||
ie->criticality = S1AP_Criticality_reject;
|
||||
ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_MME_UE_S1AP_ID;
|
||||
ie->value.choice.MME_UE_S1AP_ID = ue_desc_p->mme_ue_s1ap_id;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
/* mandatory */
|
||||
ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID;
|
||||
ie->criticality = S1AP_Criticality_reject;
|
||||
ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_MME_UE_S1AP_ID;
|
||||
ie->value.choice.MME_UE_S1AP_ID = ue_desc_p->mme_ue_s1ap_id;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
/* mandatory */
|
||||
ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID;
|
||||
ie->criticality = S1AP_Criticality_reject;
|
||||
ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_ENB_UE_S1AP_ID;
|
||||
ie->value.choice.ENB_UE_S1AP_ID = ue_desc_p->eNB_ue_s1ap_id;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
/* mandatory */
|
||||
ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID;
|
||||
ie->criticality = S1AP_Criticality_reject;
|
||||
ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_ENB_UE_S1AP_ID;
|
||||
ie->value.choice.ENB_UE_S1AP_ID = ue_desc_p->eNB_ue_s1ap_id;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
/* mandatory */
|
||||
ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_E_UTRAN_Trace_ID;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_E_UTRAN_Trace_ID;
|
||||
memcpy(&ie->value.choice.E_UTRAN_Trace_ID, trace_id, sizeof(S1AP_E_UTRAN_Trace_ID_t));
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
/* mandatory */
|
||||
ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_E_UTRAN_Trace_ID;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_E_UTRAN_Trace_ID;
|
||||
memcpy(&ie->value.choice.E_UTRAN_Trace_ID, trace_id, sizeof(S1AP_E_UTRAN_Trace_ID_t));
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
/* mandatory */
|
||||
ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_Cause;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_Cause;
|
||||
memcpy(&ie->value.choice.Cause, cause_p, sizeof(S1AP_Cause_t));
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
/* mandatory */
|
||||
ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_Cause;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_Cause;
|
||||
memcpy(&ie->value.choice.Cause, cause_p, sizeof(S1AP_Cause_t));
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) {
|
||||
return;
|
||||
}
|
||||
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
s1ap_eNB_itti_send_sctp_data_req(ue_desc_p->mme_ref->s1ap_eNB_instance->instance,
|
||||
ue_desc_p->mme_ref->assoc_id, buffer,
|
||||
length, ue_desc_p->tx_stream);
|
||||
s1ap_eNB_itti_send_sctp_data_req(ue_desc_p->mme_ref->s1ap_eNB_instance->instance,
|
||||
ue_desc_p->mme_ref->assoc_id, buffer,
|
||||
length, ue_desc_p->tx_stream);
|
||||
}
|
||||
|
||||
int s1ap_eNB_handle_trace_start(uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
S1AP_S1AP_PDU_t *pdu)
|
||||
{
|
||||
S1AP_TraceStart_t *container;
|
||||
S1AP_TraceStartIEs_t *ie;
|
||||
struct s1ap_eNB_ue_context_s *ue_desc_p;
|
||||
struct s1ap_eNB_mme_data_s *mme_ref_p;
|
||||
S1AP_TraceStart_t *container;
|
||||
S1AP_TraceStartIEs_t *ie;
|
||||
struct s1ap_eNB_ue_context_s *ue_desc_p = NULL;
|
||||
struct s1ap_eNB_mme_data_s *mme_ref_p;
|
||||
|
||||
DevAssert(pdu != NULL);
|
||||
DevAssert(pdu != NULL);
|
||||
|
||||
container = &pdu->choice.initiatingMessage.value.choice.TraceStart;
|
||||
container = &pdu->choice.initiatingMessage.value.choice.TraceStart;
|
||||
|
||||
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_TraceStartIEs_t, ie, container,
|
||||
S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, TRUE);
|
||||
mme_ref_p = s1ap_eNB_get_MME(NULL, assoc_id, 0);
|
||||
DevAssert(mme_ref_p != NULL);
|
||||
|
||||
if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_ref_p->s1ap_eNB_instance,
|
||||
ie->value.choice.ENB_UE_S1AP_ID)) == NULL) {
|
||||
/* Could not find context associated with this eNB_ue_s1ap_id -> generate
|
||||
* trace failure indication.
|
||||
*/
|
||||
S1AP_E_UTRAN_Trace_ID_t trace_id;
|
||||
S1AP_Cause_t cause;
|
||||
memset(&trace_id, 0, sizeof(S1AP_E_UTRAN_Trace_ID_t));
|
||||
memset(&cause, 0, sizeof(S1AP_Cause_t));
|
||||
cause.present = S1AP_Cause_PR_radioNetwork;
|
||||
cause.choice.radioNetwork = S1AP_CauseRadioNetwork_unknown_pair_ue_s1ap_id;
|
||||
s1ap_eNB_generate_trace_failure(ue_desc_p, &trace_id, &cause);
|
||||
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_TraceStartIEs_t, ie, container,
|
||||
S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, TRUE);
|
||||
mme_ref_p = s1ap_eNB_get_MME(NULL, assoc_id, 0);
|
||||
DevAssert(mme_ref_p != NULL);
|
||||
if (ie != NULL) {
|
||||
ue_desc_p = s1ap_eNB_get_ue_context(mme_ref_p->s1ap_eNB_instance,
|
||||
ie->value.choice.ENB_UE_S1AP_ID);
|
||||
}
|
||||
if (ue_desc_p == NULL) {
|
||||
/* Could not find context associated with this eNB_ue_s1ap_id -> generate
|
||||
* trace failure indication.
|
||||
*/
|
||||
S1AP_E_UTRAN_Trace_ID_t trace_id;
|
||||
S1AP_Cause_t cause;
|
||||
memset(&trace_id, 0, sizeof(S1AP_E_UTRAN_Trace_ID_t));
|
||||
memset(&cause, 0, sizeof(S1AP_Cause_t));
|
||||
cause.present = S1AP_Cause_PR_radioNetwork;
|
||||
cause.choice.radioNetwork = S1AP_CauseRadioNetwork_unknown_pair_ue_s1ap_id;
|
||||
s1ap_eNB_generate_trace_failure(NULL, &trace_id, &cause);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int s1ap_eNB_handle_deactivate_trace(uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
S1AP_S1AP_PDU_t *message_p)
|
||||
{
|
||||
// S1AP_DeactivateTraceIEs_t *deactivate_trace_p;
|
||||
//
|
||||
// deactivate_trace_p = &message_p->msg.deactivateTraceIEs;
|
||||
// S1AP_DeactivateTraceIEs_t *deactivate_trace_p;
|
||||
//
|
||||
// deactivate_trace_p = &message_p->msg.deactivateTraceIEs;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user