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); if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { S1AP_WARN("Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n", 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; } /* Update parameters */ 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); }
int s1ap_sctp_connected_callback(void *args, uint32_t assocId, uint32_t instreams, uint32_t outstreams) { struct s1ap_eNB_description_s* eNB_ref; if ((eNB_ref = s1ap_eNB_add_new()) == NULL) return; eNB_ref->eNB_id = *((uint8_t*)args); eNB_ref->assocId = assocId; eNB_ref->instreams = instreams; eNB_ref->outstreams = outstreams; eNB_ref->state = S1AP_ENB_STATE_DECONNECTED; /* First usable stream for UE associated signalling */ eNB_ref->nextstream = 1; if (s1ap_eNB_generate_s1_setup_request(eNB_ref) < 0) { S1AP_ERROR("[eNB %02d] Failed to encode S1 Setup Request\n", eNB_ref->eNB_id); return -1; } /* Waiting for the response from MME */ while ((volatile)(eNB_ref->state) & S1AP_ENB_STATE_WAITING) { } return 0; }