merging develop with develop-nr
This commit is contained in:
@@ -36,7 +36,6 @@
|
||||
#include "commonDef.h"
|
||||
#include "platform_types.h"
|
||||
#include "platform_constants.h"
|
||||
#include "PHY/impl_defs_lte.h"
|
||||
#include "s1ap_messages_types.h"
|
||||
#ifdef CMAKER
|
||||
#include "SystemInformationBlockType2.h"
|
||||
|
||||
@@ -252,12 +252,11 @@ typedef enum {
|
||||
|
||||
typedef struct et_s1ap_s {
|
||||
//et_s1ap_pdu_type_t pdu_type;
|
||||
S1AP_PDU_t pdu; // decoded ASN1 C type: choice of initiatingMessage, successfulOutcome, unsuccessfulOutcome
|
||||
S1AP_S1AP_PDU_t pdu; // decoded ASN1 C type: choice of initiatingMessage, successfulOutcome, unsuccessfulOutcome
|
||||
uint16_t xml_stream_pos_offset;
|
||||
uint16_t binary_stream_pos;
|
||||
uint16_t binary_stream_allocated_size;
|
||||
uint8_t *binary_stream;
|
||||
s1ap_message message; // decoded message: information elements
|
||||
xmlDocPtr doc; // XML representation of the S1AP PDU
|
||||
} et_s1ap_t;
|
||||
|
||||
@@ -300,9 +299,9 @@ typedef struct et_ip_s {
|
||||
union {
|
||||
struct in6_addr ipv6;
|
||||
in_addr_t ipv4;
|
||||
}address;
|
||||
} address;
|
||||
char str[INET6_ADDRSTRLEN+1];
|
||||
}et_ip_t;
|
||||
} et_ip_t;
|
||||
|
||||
typedef struct et_ip_hdr_s {
|
||||
et_ip_t src;
|
||||
@@ -325,7 +324,7 @@ typedef struct et_packet_s {
|
||||
et_packet_status_t status;
|
||||
long timer_id; // ITTI timer id for waiting rx packets
|
||||
struct timeval timestamp_packet; // timestamp when rx or tx packet
|
||||
}et_packet_t;
|
||||
} et_packet_t;
|
||||
|
||||
|
||||
typedef struct sctp_epoll_s {
|
||||
@@ -401,23 +400,23 @@ typedef struct et_event_s {
|
||||
inline void et_free_pointer(void *p) {if (NULL != p) {free(p); p=NULL;}};
|
||||
|
||||
//-------------------------
|
||||
void et_free_packet(et_packet_t* packet);
|
||||
void et_free_scenario(et_scenario_t* scenario);
|
||||
void et_free_packet(et_packet_t *packet);
|
||||
void et_free_scenario(et_scenario_t *scenario);
|
||||
//-------------------------
|
||||
void et_display_packet_s1ap_data(const et_s1ap_t * const s1ap);
|
||||
void et_display_packet_sctp_init(const sctp_inithdr_t * const sctp);
|
||||
void et_display_packet_sctp_initack(const sctp_initackhdr_t * const sctp);
|
||||
void et_display_packet_sctp_data(const sctp_datahdr_t * const sctp);
|
||||
void et_display_packet_sctp(const et_sctp_hdr_t * const sctp);
|
||||
void et_display_packet_ip(const et_ip_hdr_t * const ip);
|
||||
void et_display_packet(const et_packet_t * const packet);
|
||||
void et_display_scenario(const et_scenario_t * const scenario);
|
||||
void et_display_packet_s1ap_data(const et_s1ap_t *const s1ap);
|
||||
void et_display_packet_sctp_init(const sctp_inithdr_t *const sctp);
|
||||
void et_display_packet_sctp_initack(const sctp_initackhdr_t *const sctp);
|
||||
void et_display_packet_sctp_data(const sctp_datahdr_t *const sctp);
|
||||
void et_display_packet_sctp(const et_sctp_hdr_t *const sctp);
|
||||
void et_display_packet_ip(const et_ip_hdr_t *const ip);
|
||||
void et_display_packet(const et_packet_t *const packet);
|
||||
void et_display_scenario(const et_scenario_t *const scenario);
|
||||
//-------------------------
|
||||
int et_s1ap_decode_initiating_message(s1ap_message *message, S1ap_InitiatingMessage_t *initiating_p);
|
||||
int et_s1ap_decode_successful_outcome(s1ap_message *message, S1ap_SuccessfulOutcome_t *successfullOutcome_p);
|
||||
int et_s1ap_decode_unsuccessful_outcome(s1ap_message *message, S1ap_UnsuccessfulOutcome_t *unSuccessfullOutcome_p);
|
||||
int et_s1ap_decode_pdu(S1AP_PDU_t * const pdu, s1ap_message * const message, const uint8_t * const buffer, const uint32_t length);
|
||||
void et_decode_s1ap(et_s1ap_t * const s1ap);
|
||||
int et_s1ap_decode_initiating_message(s1ap_message *message, S1AP_InitiatingMessage_t *initiating_p);
|
||||
int et_s1ap_decode_successful_outcome(s1ap_message *message, S1AP_SuccessfulOutcome_t *successfullOutcome_p);
|
||||
int et_s1ap_decode_unsuccessful_outcome(s1ap_message *message, S1AP_UnsuccessfulOutcome_t *unSuccessfullOutcome_p);
|
||||
int et_s1ap_decode_pdu(S1AP_PDU_t *const pdu, s1ap_message *const message, const uint8_t *const buffer, const uint32_t length);
|
||||
void et_decode_s1ap(et_s1ap_t *const s1ap);
|
||||
//-------------------------
|
||||
int et_s1ap_eNB_compare_assoc_id( struct s1ap_eNB_mme_data_s *p1, struct s1ap_eNB_mme_data_s *p2);
|
||||
uint32_t et_s1ap_generate_eNB_id(void);
|
||||
@@ -427,32 +426,32 @@ void et_s1ap_eNB_insert_new_instance(s1ap_eNB_instance_t *new_instance_p);
|
||||
struct s1ap_eNB_mme_data_s *et_s1ap_eNB_get_MME(s1ap_eNB_instance_t *instance_p,int32_t assoc_id, uint16_t cnx_id);
|
||||
s1ap_eNB_instance_t *et_s1ap_eNB_get_instance(instance_t instance);
|
||||
void et_s1ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer,uint32_t buffer_length, uint16_t stream);
|
||||
int et_handle_s1ap_mismatch_mme_ue_s1ap_id(et_packet_t * const spacket, et_packet_t * const rx_packet);
|
||||
asn_comp_rval_t* et_s1ap_is_matching(et_s1ap_t * const s1ap1, et_s1ap_t * const s1ap2, const uint32_t constraints);
|
||||
et_packet_t* et_build_packet_from_s1ap_data_ind(et_event_s1ap_data_ind_t * const s1ap_data_ind);
|
||||
int et_scenario_set_packet_received(et_packet_t * const packet);
|
||||
int et_s1ap_process_rx_packet(et_event_s1ap_data_ind_t * const sctp_data_ind);
|
||||
void et_s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t * const sctp_data_ind);
|
||||
int et_handle_s1ap_mismatch_mme_ue_s1ap_id(et_packet_t *const spacket, et_packet_t *const rx_packet);
|
||||
asn_comp_rval_t *et_s1ap_is_matching(et_s1ap_t *const s1ap1, et_s1ap_t *const s1ap2, const uint32_t constraints);
|
||||
et_packet_t *et_build_packet_from_s1ap_data_ind(et_event_s1ap_data_ind_t *const s1ap_data_ind);
|
||||
int et_scenario_set_packet_received(et_packet_t *const packet);
|
||||
int et_s1ap_process_rx_packet(et_event_s1ap_data_ind_t *const sctp_data_ind);
|
||||
void et_s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *const sctp_data_ind);
|
||||
void et_s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
|
||||
net_ip_address_t *mme_ip_address,
|
||||
net_ip_address_t *local_ip_addr,
|
||||
uint16_t in_streams,
|
||||
uint16_t out_streams);
|
||||
net_ip_address_t *mme_ip_address,
|
||||
net_ip_address_t *local_ip_addr,
|
||||
uint16_t in_streams,
|
||||
uint16_t out_streams);
|
||||
void et_s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shutdown);
|
||||
void et_s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *s1ap_register_eNB);
|
||||
void et_s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp);
|
||||
void * et_s1ap_eNB_task(void *arg);
|
||||
void *et_s1ap_eNB_task(void *arg);
|
||||
//-------------------------
|
||||
int et_generate_xml_scenario(
|
||||
const char const * xml_in_dir_name,
|
||||
const char const * xml_in_scenario_filename,
|
||||
const char const * enb_config_filename,
|
||||
char const * tsml_out_scenario_filename);
|
||||
const char const *xml_in_dir_name,
|
||||
const char const *xml_in_scenario_filename,
|
||||
const char const *enb_config_filename,
|
||||
char const *tsml_out_scenario_filename);
|
||||
//-------------------------
|
||||
void timeval_add (struct timeval * const result, const struct timeval * const a, const struct timeval * const b);
|
||||
int timeval_subtract (struct timeval * const result, struct timeval * const a, struct timeval * const b);
|
||||
void et_scenario_wait_rx_packet(et_packet_t * const packet);
|
||||
void et_scenario_schedule_tx_packet(et_packet_t * packet);
|
||||
void timeval_add (struct timeval *const result, const struct timeval *const a, const struct timeval *const b);
|
||||
int timeval_subtract (struct timeval *const result, struct timeval *const a, struct timeval *const b);
|
||||
void et_scenario_wait_rx_packet(et_packet_t *const packet);
|
||||
void et_scenario_schedule_tx_packet(et_packet_t *packet);
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event);
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_tx(et_event_t event);
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_rx(et_event_t event);
|
||||
@@ -460,41 +459,41 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event);
|
||||
et_fsm_state_t et_scenario_fsm_notify_event(et_event_t event);
|
||||
//-------------------------
|
||||
void et_parse_s1ap(xmlDocPtr doc, const xmlNode const *s1ap_node, et_s1ap_t * const s1ap);
|
||||
void et_parse_sctp_data_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_datahdr_t * const sctp_hdr);
|
||||
void et_parse_sctp_init_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_inithdr_t * const sctp_hdr);
|
||||
void et_parse_sctp_init_ack_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_initackhdr_t * const sctp_hdr);
|
||||
void et_parse_sctp(xmlDocPtr doc, const xmlNode const *sctp_node, et_sctp_hdr_t * const sctp_hdr);
|
||||
et_packet_t* et_parse_xml_packet(xmlDocPtr doc, xmlNodePtr node);
|
||||
et_scenario_t* et_generate_scenario(const char * const et_scenario_filename);
|
||||
void et_parse_s1ap(xmlDocPtr doc, const xmlNode const *s1ap_node, et_s1ap_t *const s1ap);
|
||||
void et_parse_sctp_data_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_datahdr_t *const sctp_hdr);
|
||||
void et_parse_sctp_init_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_inithdr_t *const sctp_hdr);
|
||||
void et_parse_sctp_init_ack_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_initackhdr_t *const sctp_hdr);
|
||||
void et_parse_sctp(xmlDocPtr doc, const xmlNode const *sctp_node, et_sctp_hdr_t *const sctp_hdr);
|
||||
et_packet_t *et_parse_xml_packet(xmlDocPtr doc, xmlNodePtr node);
|
||||
et_scenario_t *et_generate_scenario(const char *const et_scenario_filename);
|
||||
//-------------------------
|
||||
asn_comp_rval_t * et_s1ap_ies_is_matching(const S1AP_PDU_PR present, s1ap_message * const m1, s1ap_message * const m2, const uint32_t constraints);
|
||||
void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, const S1ap_MME_UE_S1AP_ID_t new_id);
|
||||
void update_xpath_nodes_mme_ue_s1ap_id(et_s1ap_t * const s1ap_payload, xmlNodeSetPtr nodes, const S1ap_MME_UE_S1AP_ID_t new_id);
|
||||
int et_s1ap_update_mme_ue_s1ap_id(et_packet_t * const packet, const S1ap_MME_UE_S1AP_ID_t old_id, const S1ap_MME_UE_S1AP_ID_t new_id);
|
||||
asn_comp_rval_t *et_s1ap_ies_is_matching(const S1AP_PDU_PR present, s1ap_message *const m1, s1ap_message *const m2, const uint32_t constraints);
|
||||
void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t *const s1ap, xmlNode *node, const S1AP_MME_UE_S1AP_ID_t new_id);
|
||||
void update_xpath_nodes_mme_ue_s1ap_id(et_s1ap_t *const s1ap_payload, xmlNodeSetPtr nodes, const S1AP_MME_UE_S1AP_ID_t new_id);
|
||||
int et_s1ap_update_mme_ue_s1ap_id(et_packet_t *const packet, const S1AP_MME_UE_S1AP_ID_t old_id, const S1AP_MME_UE_S1AP_ID_t new_id);
|
||||
//-------------------------
|
||||
asn_comp_rval_t * et_sctp_data_is_matching(sctp_datahdr_t * const sctp1, sctp_datahdr_t * const sctp2, const uint32_t constraints);
|
||||
asn_comp_rval_t * et_sctp_is_matching(et_sctp_hdr_t * const sctp1, et_sctp_hdr_t * const sctp2, const uint32_t constraints);
|
||||
asn_comp_rval_t *et_sctp_data_is_matching(sctp_datahdr_t *const sctp1, sctp_datahdr_t *const sctp2, const uint32_t constraints);
|
||||
asn_comp_rval_t *et_sctp_is_matching(et_sctp_hdr_t *const sctp1, et_sctp_hdr_t *const sctp2, const uint32_t constraints);
|
||||
//------------------------------------------------------------------------------
|
||||
void et_print_hex_octets(const unsigned char * const byte_stream, const unsigned long int num);
|
||||
int et_is_file_exists ( const char const * file_nameP, const char const *file_roleP);
|
||||
void et_print_hex_octets(const unsigned char *const byte_stream, const unsigned long int num);
|
||||
int et_is_file_exists ( const char const *file_nameP, const char const *file_roleP);
|
||||
int et_strip_extension( char *in_filename);
|
||||
void et_get_shift_arg( char * line_argument, shift_packet_t * const shift);
|
||||
int et_split_path ( char * pathP, char *** resP);
|
||||
void et_get_shift_arg( char *line_argument, shift_packet_t *const shift);
|
||||
int et_split_path ( char *pathP, char *** resP);
|
||||
void et_display_node ( xmlNodePtr node, unsigned int indent);
|
||||
void et_display_tree ( xmlNodePtr node, unsigned int indent);
|
||||
char * et_ip2ip_str(const et_ip_t * const ip);
|
||||
int et_compare_et_ip_to_net_ip_address(const et_ip_t * const ip, const net_ip_address_t * const net_ip);
|
||||
int et_hex2data(unsigned char * const data, const unsigned char * const hexstring, const unsigned int len);
|
||||
sctp_cid_t et_chunk_type_str2cid(const xmlChar * const chunk_type_str);
|
||||
const char * const et_chunk_type_cid2str(const sctp_cid_t chunk_type);
|
||||
const char * const et_error_match2str(const int err);
|
||||
et_packet_action_t et_action_str2et_action_t(const xmlChar * const action);
|
||||
void et_ip_str2et_ip(const xmlChar * const ip_str, et_ip_t * const ip);
|
||||
void et_enb_config_init(const char const * lib_config_file_name_pP);
|
||||
char *et_ip2ip_str(const et_ip_t *const ip);
|
||||
int et_compare_et_ip_to_net_ip_address(const et_ip_t *const ip, const net_ip_address_t *const net_ip);
|
||||
int et_hex2data(unsigned char *const data, const unsigned char *const hexstring, const unsigned int len);
|
||||
sctp_cid_t et_chunk_type_str2cid(const xmlChar *const chunk_type_str);
|
||||
const char *const et_chunk_type_cid2str(const sctp_cid_t chunk_type);
|
||||
const char *const et_error_match2str(const int err);
|
||||
et_packet_action_t et_action_str2et_action_t(const xmlChar *const action);
|
||||
void et_ip_str2et_ip(const xmlChar *const ip_str, et_ip_t *const ip);
|
||||
void et_enb_config_init(const char const *lib_config_file_name_pP);
|
||||
const Enb_properties_array_t *et_enb_config_get(void);
|
||||
void et_eNB_app_register(const Enb_properties_array_t *enb_properties);
|
||||
void *et_eNB_app_task(void *args_p);
|
||||
int et_play_scenario(et_scenario_t* const scenario, const struct shift_packet_s *shifts);
|
||||
int et_play_scenario(et_scenario_t *const scenario, const struct shift_packet_s *shifts);
|
||||
|
||||
#endif /* PLAY_SCENARIO_H_ */
|
||||
|
||||
@@ -32,11 +32,10 @@
|
||||
#include "intertask_interface.h"
|
||||
#include "platform_types.h"
|
||||
#include "assertions.h"
|
||||
#include "s1ap_ies_defs.h"
|
||||
#include "s1ap_eNB_decoder.h"
|
||||
#include "play_scenario.h"
|
||||
//-----------------------------------------------------------------------------
|
||||
void et_print_hex_octets(const unsigned char * const byte_stream, const unsigned long int num)
|
||||
void et_print_hex_octets(const unsigned char *const byte_stream, const unsigned long int num)
|
||||
{
|
||||
unsigned long octet_index = 0;
|
||||
|
||||
@@ -82,11 +81,14 @@ void et_print_hex_octets(const unsigned char * const byte_stream, const unsigned
|
||||
void et_display_node(xmlNodePtr node, unsigned int indent)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
if (node->type == XML_ELEMENT_NODE) {
|
||||
xmlChar *path = xmlGetNodePath(node);
|
||||
|
||||
for (i=0; i<indent; i++) {
|
||||
printf(" ");
|
||||
}
|
||||
|
||||
if (node->children != NULL && node->children->type == XML_TEXT_NODE) {
|
||||
xmlChar *content = xmlNodeGetContent(node);
|
||||
printf("%s -> %s\n", path, content);
|
||||
@@ -94,6 +96,7 @@ void et_display_node(xmlNodePtr node, unsigned int indent)
|
||||
} else {
|
||||
printf("%s\n", path);
|
||||
}
|
||||
|
||||
xmlFree(path);
|
||||
}
|
||||
}
|
||||
@@ -106,70 +109,91 @@ void et_display_tree(xmlNodePtr node, unsigned int indent)
|
||||
if (cur_node->type == XML_ELEMENT_NODE) {
|
||||
et_display_node(cur_node, indent);
|
||||
}
|
||||
|
||||
et_display_tree(cur_node->children, indent++);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_packet_s1ap_data(const et_s1ap_t * const s1ap)
|
||||
void et_display_packet_S1AP_data(const et_S1AP_t *const s1ap)
|
||||
{
|
||||
char *message_string = NULL;
|
||||
|
||||
if (s1ap) {
|
||||
message_string = calloc(20000, sizeof(char));
|
||||
AssertFatal (NULL != message_string, "ERROR malloc()failed!\n");
|
||||
s1ap_string_total_size = 0;
|
||||
switch(s1ap->pdu.present) {
|
||||
case S1AP_PDU_PR_initiatingMessage:
|
||||
switch(s1ap->pdu.choice.initiatingMessage.procedureCode) {
|
||||
case S1ap_ProcedureCode_id_downlinkNASTransport: s1ap_xer_print_s1ap_downlinknastransport(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetuprequest(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_UEContextRelease: s1ap_xer_print_s1ap_uecontextreleasecommand(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_Paging: s1ap_xer_print_s1ap_paging(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_uplinkNASTransport: s1ap_xer_print_s1ap_uplinknastransport(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setuprequest(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_initialUEMessage: s1ap_xer_print_s1ap_initialuemessage(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_UEContextReleaseRequest: s1ap_xer_print_s1ap_uecontextreleaserequest(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_UECapabilityInfoIndication:s1ap_xer_print_s1ap_uecapabilityinfoindication(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_NASNonDeliveryIndication: s1ap_xer_print_s1ap_nasnondeliveryindication_(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
default:
|
||||
AssertFatal( 0 , "Unknown procedure ID (%d) for initiating message\n",
|
||||
(int)s1ap->pdu.choice.initiatingMessage.procedureCode);
|
||||
}
|
||||
break;
|
||||
case S1AP_PDU_PR_successfulOutcome:
|
||||
switch(s1ap->pdu.choice.successfulOutcome.procedureCode) {
|
||||
case S1ap_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setupresponse(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetupresponse(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_UEContextRelease: s1ap_xer_print_s1ap_uecontextreleasecomplete(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
default:
|
||||
AssertFatal(0, "Unknown procedure ID (%d) for successfull outcome message\n",
|
||||
(int)s1ap->pdu.choice.successfulOutcome.procedureCode);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1AP_PDU_PR_unsuccessfulOutcome:
|
||||
switch(s1ap->pdu.choice.unsuccessfulOutcome.procedureCode) {
|
||||
case S1ap_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setupfailure(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetupfailure(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
switch(s1ap->pdu.present) {
|
||||
case S1AP_S1AP_PDU_PR_initiatingMessage:
|
||||
switch(s1ap->pdu.choice.initiatingMessage.procedureCode) {
|
||||
case S1AP_ProcedureCode_id_downlinkNASTransport: s1ap_xer_print_s1ap_downlinknastransport(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
case S1AP_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetuprequest(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
case S1AP_ProcedureCode_id_UEContextRelease: s1ap_xer_print_s1ap_uecontextreleasecommand(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
case S1AP_ProcedureCode_id_Paging: s1ap_xer_print_s1ap_paging(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
case S1AP_ProcedureCode_id_uplinkNASTransport: s1ap_xer_print_s1ap_uplinknastransport(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
case S1AP_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setuprequest(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
case S1AP_ProcedureCode_id_initialUEMessage: s1ap_xer_print_s1ap_initialuemessage(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
case S1AP_ProcedureCode_id_UEContextReleaseRequest: s1ap_xer_print_s1ap_uecontextreleaserequest(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
case S1AP_ProcedureCode_id_UECapabilityInfoIndication:s1ap_xer_print_s1ap_uecapabilityinfoindication(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
case S1AP_ProcedureCode_id_NASNonDeliveryIndication: s1ap_xer_print_s1ap_nasnondeliveryindication_(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
default:
|
||||
AssertFatal( 0, "Unknown procedure ID (%d) for initiating message\n",
|
||||
(int)s1ap->pdu.choice.initiatingMessage.procedureCode);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case S1AP_S1AP_PDU_PR_successfulOutcome:
|
||||
switch(s1ap->pdu.choice.successfulOutcome.procedureCode) {
|
||||
case S1AP_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setupresponse(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
case S1AP_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetupresponse(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
case S1AP_ProcedureCode_id_UEContextRelease: s1ap_xer_print_s1ap_uecontextreleasecomplete(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
default:
|
||||
AssertFatal(0, "Unknown procedure ID (%d) for successfull outcome message\n",
|
||||
(int)s1ap->pdu.choice.successfulOutcome.procedureCode);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case S1AP_S1AP_PDU_PR_unsuccessfulOutcome:
|
||||
switch(s1ap->pdu.choice.unsuccessfulOutcome.procedureCode) {
|
||||
case S1AP_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setupfailure(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
case S1AP_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetupfailure(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
default:
|
||||
et_free_pointer(message_string);
|
||||
AssertFatal(0,"Unknown procedure ID (%d) for unsuccessfull outcome message\n",
|
||||
(int)s1ap->pdu.choice.unsuccessfulOutcome.procedureCode);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
et_free_pointer(message_string);
|
||||
AssertFatal(0,"Unknown procedure ID (%d) for unsuccessfull outcome message\n",
|
||||
(int)s1ap->pdu.choice.unsuccessfulOutcome.procedureCode);
|
||||
AssertFatal(0, "Unknown presence (%d) or not implemented\n", (int)s1ap->pdu.present);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
AssertFatal(0, "Unknown presence (%d) or not implemented\n", (int)s1ap->pdu.present);
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf(stdout, "\t\tSCTP.data XML dump:\n%s\n", message_string);
|
||||
et_free_pointer(message_string);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_packet_sctp_init(const sctp_inithdr_t * const sctp)
|
||||
void et_display_packet_sctp_init(const sctp_inithdr_t *const sctp)
|
||||
{
|
||||
|
||||
if (sctp) {
|
||||
fprintf(stdout, "\t\tSCTP.init.init_tag : %u\n", sctp->init_tag);
|
||||
fprintf(stdout, "\t\tSCTP.init.a_rwnd : %u\n", sctp->a_rwnd);
|
||||
@@ -179,9 +203,8 @@ void et_display_packet_sctp_init(const sctp_inithdr_t * const sctp)
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_packet_sctp_initack(const sctp_initackhdr_t * const sctp)
|
||||
void et_display_packet_sctp_initack(const sctp_initackhdr_t *const sctp)
|
||||
{
|
||||
|
||||
if (sctp) {
|
||||
fprintf(stdout, "\t\tSCTP.initack.init_tag : %u\n", sctp->init_tag);
|
||||
fprintf(stdout, "\t\tSCTP.initack.a_rwnd : %u\n", sctp->a_rwnd);
|
||||
@@ -191,17 +214,20 @@ void et_display_packet_sctp_initack(const sctp_initackhdr_t * const sctp)
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_packet_sctp_data(const sctp_datahdr_t * const sctp)
|
||||
void et_display_packet_sctp_data(const sctp_datahdr_t *const sctp)
|
||||
{
|
||||
if (sctp) {
|
||||
fprintf(stdout, "\t\tSCTP.data.tsn : %u\n", sctp->tsn);
|
||||
fprintf(stdout, "\t\tSCTP.data.stream : %u\n", sctp->stream);
|
||||
fprintf(stdout, "\t\tSCTP.data.ssn : %u\n", sctp->ssn);
|
||||
fprintf(stdout, "\t\tSCTP.data.ppid : %u\n", sctp->ppid);
|
||||
|
||||
if (sctp->ppid == 18) {
|
||||
et_display_packet_s1ap_data(&sctp->payload);
|
||||
}
|
||||
|
||||
fprintf(stdout, "\t\tSCTP.data.binary_stream_allocated_size : %u\n", sctp->payload.binary_stream_allocated_size);
|
||||
|
||||
if (NULL != sctp->payload.binary_stream) {
|
||||
fprintf(stdout, "\t\tSCTP.data.binary_stream :\n");
|
||||
et_print_hex_octets(sctp->payload.binary_stream, sctp->payload.binary_stream_allocated_size);
|
||||
@@ -212,29 +238,33 @@ void et_display_packet_sctp_data(const sctp_datahdr_t * const sctp)
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_packet_sctp(const et_sctp_hdr_t * const sctp)
|
||||
void et_display_packet_sctp(const et_sctp_hdr_t *const sctp)
|
||||
{
|
||||
if (sctp) {
|
||||
fprintf(stdout, "\t\tSCTP.src_port : %u\n", sctp->src_port);
|
||||
fprintf(stdout, "\t\tSCTP.dst_port : %u\n", sctp->dst_port);
|
||||
fprintf(stdout, "\t\tSCTP.chunk_type : %s\n", et_chunk_type_cid2str(sctp->chunk_type));
|
||||
|
||||
switch (sctp->chunk_type) {
|
||||
case SCTP_CID_DATA:
|
||||
et_display_packet_sctp_data(&sctp->u.data_hdr);
|
||||
break;
|
||||
|
||||
case SCTP_CID_INIT:
|
||||
et_display_packet_sctp_initack(&sctp->u.init_hdr);
|
||||
break;
|
||||
|
||||
case SCTP_CID_INIT_ACK:
|
||||
et_display_packet_sctp_initack(&sctp->u.init_ack_hdr);
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_packet_ip(const et_ip_hdr_t * const ip)
|
||||
void et_display_packet_ip(const et_ip_hdr_t *const ip)
|
||||
{
|
||||
if (ip) {
|
||||
fprintf(stdout, "\t\tSource address : %s\n", et_ip2ip_str(&ip->src));
|
||||
@@ -243,61 +273,73 @@ void et_display_packet_ip(const et_ip_hdr_t * const ip)
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_packet(const et_packet_t * const packet)
|
||||
void et_display_packet(const et_packet_t *const packet)
|
||||
{
|
||||
if (packet) {
|
||||
fprintf(stdout, "-------------------------------------------------------------------------------\n");
|
||||
fprintf(stdout, "\tPacket:\tnum %u | original frame number %u \n", packet->packet_number, packet->original_frame_number);
|
||||
fprintf(stdout, "\tPacket:\ttime relative to 1st packet %ld.%06lu\n",
|
||||
packet->time_relative_to_first_packet.tv_sec, packet->time_relative_to_first_packet.tv_usec);
|
||||
packet->time_relative_to_first_packet.tv_sec, packet->time_relative_to_first_packet.tv_usec);
|
||||
fprintf(stdout, "\tPacket:\ttime relative to last tx packet %ld.%06lu\n",
|
||||
packet->time_relative_to_last_sent_packet.tv_sec, packet->time_relative_to_last_sent_packet.tv_usec);
|
||||
packet->time_relative_to_last_sent_packet.tv_sec, packet->time_relative_to_last_sent_packet.tv_usec);
|
||||
fprintf(stdout, "\tPacket:\ttime relative to last_received packet %ld.%06lu\n",
|
||||
packet->time_relative_to_last_received_packet.tv_sec, packet->time_relative_to_last_received_packet.tv_usec);
|
||||
packet->time_relative_to_last_received_packet.tv_sec, packet->time_relative_to_last_received_packet.tv_usec);
|
||||
|
||||
switch(packet->action) {
|
||||
case ET_PACKET_ACTION_S1C_SEND:
|
||||
fprintf(stdout, "\tPacket:\tAction SEND\n");
|
||||
break;
|
||||
case ET_PACKET_ACTION_S1C_RECEIVE:
|
||||
fprintf(stdout, "\tPacket:\tAction RECEIVE\n");
|
||||
break;
|
||||
default:
|
||||
fprintf(stdout, "\tPacket:\tAction UNKNOWN\n");
|
||||
case ET_PACKET_ACTION_S1C_SEND:
|
||||
fprintf(stdout, "\tPacket:\tAction SEND\n");
|
||||
break;
|
||||
|
||||
case ET_PACKET_ACTION_S1C_RECEIVE:
|
||||
fprintf(stdout, "\tPacket:\tAction RECEIVE\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stdout, "\tPacket:\tAction UNKNOWN\n");
|
||||
}
|
||||
|
||||
switch(packet->status) {
|
||||
case ET_PACKET_STATUS_NONE:
|
||||
fprintf(stdout, "\tPacket:\tStatus NONE\n");
|
||||
break;
|
||||
case ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT:
|
||||
fprintf(stdout, "\tPacket:\tStatus NOT_TAKEN_IN_ACCOUNT\n");
|
||||
break;
|
||||
case ET_PACKET_STATUS_SCHEDULED_FOR_SENDING:
|
||||
fprintf(stdout, "\tPacket:\tStatus SCHEDULED_FOR_SENDING\n");
|
||||
break;
|
||||
case ET_PACKET_STATUS_SENT:
|
||||
fprintf(stdout, "\tPacket:\tStatus SENT\n");
|
||||
break;
|
||||
case ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING:
|
||||
fprintf(stdout, "\tPacket:\tStatus SCHEDULED_FOR_RECEIVING\n");
|
||||
break;
|
||||
case ET_PACKET_STATUS_RECEIVED:
|
||||
fprintf(stdout, "\tPacket:\tStatus RECEIVED\n");
|
||||
break;
|
||||
default:
|
||||
fprintf(stdout, "\tPacket:\tStatus UNKNOWN\n");
|
||||
case ET_PACKET_STATUS_NONE:
|
||||
fprintf(stdout, "\tPacket:\tStatus NONE\n");
|
||||
break;
|
||||
|
||||
case ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT:
|
||||
fprintf(stdout, "\tPacket:\tStatus NOT_TAKEN_IN_ACCOUNT\n");
|
||||
break;
|
||||
|
||||
case ET_PACKET_STATUS_SCHEDULED_FOR_SENDING:
|
||||
fprintf(stdout, "\tPacket:\tStatus SCHEDULED_FOR_SENDING\n");
|
||||
break;
|
||||
|
||||
case ET_PACKET_STATUS_SENT:
|
||||
fprintf(stdout, "\tPacket:\tStatus SENT\n");
|
||||
break;
|
||||
|
||||
case ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING:
|
||||
fprintf(stdout, "\tPacket:\tStatus SCHEDULED_FOR_RECEIVING\n");
|
||||
break;
|
||||
|
||||
case ET_PACKET_STATUS_RECEIVED:
|
||||
fprintf(stdout, "\tPacket:\tStatus RECEIVED\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stdout, "\tPacket:\tStatus UNKNOWN\n");
|
||||
}
|
||||
|
||||
et_display_packet_ip(&packet->ip_hdr);
|
||||
et_display_packet_sctp(&packet->sctp_hdr);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_scenario(const et_scenario_t * const scenario)
|
||||
void et_display_scenario(const et_scenario_t *const scenario)
|
||||
{
|
||||
et_packet_t *packet = NULL;
|
||||
|
||||
if (scenario) {
|
||||
fprintf(stdout, "Scenario: %s\n", (scenario->name != NULL) ? (char*)scenario->name:"UNKNOWN NAME");
|
||||
fprintf(stdout, "Scenario: %s\n", (scenario->name != NULL) ? (char *)scenario->name:"UNKNOWN NAME");
|
||||
packet = scenario->list_packet;
|
||||
|
||||
while (packet) {
|
||||
et_display_packet(packet);
|
||||
packet = packet->next;
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "platform_types.h"
|
||||
#include "assertions.h"
|
||||
#include "play_scenario.h"
|
||||
#include "s1ap_ies_defs.h"
|
||||
#include "play_scenario_s1ap_eNB_defs.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -46,7 +45,7 @@ et_fsm_state_t g_fsm_state = ET_FSM_STATE_NULL;
|
||||
uint32_t g_constraints = ET_BIT_MASK_MATCH_SCTP_STREAM | ET_BIT_MASK_MATCH_SCTP_SSN;
|
||||
//------------------------------------------------------------------------------
|
||||
// it is assumed that if a time is negative tv_sec and tv_usec are both negative
|
||||
void timeval_add (struct timeval * const result, const struct timeval * const a, const struct timeval * const b)
|
||||
void timeval_add (struct timeval *const result, const struct timeval *const a, const struct timeval *const b)
|
||||
{
|
||||
AssertFatal(((a->tv_sec <= 0) && (a->tv_usec <= 0)) || ((a->tv_sec >= 0) && (a->tv_usec >= 0)), " Bad time format arg a\n");
|
||||
AssertFatal(((b->tv_sec <= 0) && (b->tv_usec <= 0)) || ((b->tv_sec >= 0) && (b->tv_usec >= 0)), " Bad time format arg b\n");
|
||||
@@ -54,6 +53,7 @@ void timeval_add (struct timeval * const result, const struct timeval * const a,
|
||||
long long int r = a->tv_usec + b->tv_usec + (a->tv_sec + b->tv_sec) * 1000000;
|
||||
result->tv_sec = r / (long long int)1000000;
|
||||
result->tv_usec = r % (long long int)1000000;
|
||||
|
||||
if ((result != a) && (result != b)) {
|
||||
LOG_D(ENB_APP, "timeval_add(%ld.%06d, %ld.%06d)=%ld.%06d\n", a->tv_sec, a->tv_usec, b->tv_sec, b->tv_usec, result->tv_sec, result->tv_usec);
|
||||
}
|
||||
@@ -62,7 +62,7 @@ void timeval_add (struct timeval * const result, const struct timeval * const a,
|
||||
//------------------------------------------------------------------------------
|
||||
// it is assumed that if a time is negative tv_sec and tv_usec are both negative
|
||||
// return true if result is positive
|
||||
int timeval_subtract (struct timeval * const result, struct timeval * const a, struct timeval * const b)
|
||||
int timeval_subtract (struct timeval *const result, struct timeval *const a, struct timeval *const b)
|
||||
{
|
||||
AssertFatal(((a->tv_sec <= 0) && (a->tv_usec <= 0)) || ((a->tv_sec >= 0) && (a->tv_usec >= 0)), " Bad time format arg a\n");
|
||||
AssertFatal(((b->tv_sec <= 0) && (b->tv_usec <= 0)) || ((b->tv_sec >= 0) && (b->tv_usec >= 0)), " Bad time format arg b\n");
|
||||
@@ -70,26 +70,30 @@ int timeval_subtract (struct timeval * const result, struct timeval * const a, s
|
||||
long long int r = a->tv_usec - b->tv_usec + (a->tv_sec - b->tv_sec) * 1000000;
|
||||
result->tv_sec = r / (long long int)1000000;
|
||||
result->tv_usec = r % (long long int)1000000;
|
||||
|
||||
if ((result != a) && (result != b)) {
|
||||
LOG_D(ENB_APP, "timeval_subtract(%ld.%06d, %ld.%06d)=%ld.%06d\n", a->tv_sec, a->tv_usec, b->tv_sec, b->tv_usec, result->tv_sec, result->tv_usec);
|
||||
}
|
||||
|
||||
return (result->tv_sec >= 0) && (result->tv_usec >= 0);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void et_scenario_wait_rx_packet(et_packet_t * const packet)
|
||||
void et_scenario_wait_rx_packet(et_packet_t *const packet)
|
||||
{
|
||||
packet->status = ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING;
|
||||
g_fsm_state = ET_FSM_STATE_WAITING_RX_EVENT;
|
||||
|
||||
if (timer_setup (ET_FSM_STATE_WAITING_RX_EVENT_DELAY_SEC, 0, TASK_S1AP, INSTANCE_DEFAULT, TIMER_ONE_SHOT,
|
||||
packet, &packet->timer_id) < 0) {
|
||||
packet, &packet->timer_id) < 0) {
|
||||
AssertFatal(0, " Can not start waiting RX event timer\n");
|
||||
}
|
||||
|
||||
g_scenario->timer_count++;
|
||||
LOG_D(ENB_APP, "Waiting RX packet num %d original frame number %u\n", packet->packet_number, packet->original_frame_number);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_scenario_schedule_tx_packet(et_packet_t * packet)
|
||||
void et_scenario_schedule_tx_packet(et_packet_t *packet)
|
||||
{
|
||||
s1ap_eNB_instance_t *s1ap_eNB_instance = NULL;
|
||||
struct timeval now = { .tv_sec = 0, .tv_usec = 0 };
|
||||
@@ -100,11 +104,9 @@ void et_scenario_schedule_tx_packet(et_packet_t * packet)
|
||||
int last_packet_was_rx = 0;
|
||||
int we_are_too_late = 0;
|
||||
int original_frame_number = -1;
|
||||
|
||||
AssertFatal(NULL != packet, "packet argument is NULL");
|
||||
s1ap_eNB_instance = et_s1ap_eNB_get_instance(packet->enb_instance);
|
||||
AssertFatal(NULL != s1ap_eNB_instance, "Cannot get s1ap_eNB_instance_t for eNB instance %d", packet->enb_instance);
|
||||
|
||||
LOG_D(ENB_APP, "%s\n", __FUNCTION__);
|
||||
g_fsm_state = ET_FSM_STATE_WAITING_TX_EVENT;
|
||||
|
||||
@@ -117,8 +119,8 @@ void et_scenario_schedule_tx_packet(et_packet_t * packet)
|
||||
timeval_subtract(&offset_last_rx_packet,&now,&g_scenario->time_last_rx_packet);
|
||||
LOG_D(ENB_APP, "offset_last_tx_packet=%ld.%06d\n", offset_last_tx_packet.tv_sec, offset_last_tx_packet.tv_usec);
|
||||
LOG_D(ENB_APP, "offset_last_rx_packet=%ld.%06d\n", offset_last_rx_packet.tv_sec, offset_last_rx_packet.tv_usec);
|
||||
|
||||
last_packet_was_rx = timeval_subtract(&offset_tx_rx,&offset_last_tx_packet,&offset_last_rx_packet);
|
||||
|
||||
if (last_packet_was_rx) {
|
||||
LOG_D(ENB_APP, "last_packet_was_rx\n");
|
||||
we_are_too_late = timeval_subtract(&offset,&offset_last_rx_packet,&packet->time_relative_to_last_received_packet);
|
||||
@@ -128,30 +130,32 @@ void et_scenario_schedule_tx_packet(et_packet_t * packet)
|
||||
we_are_too_late = timeval_subtract(&offset,&offset_last_tx_packet,&packet->time_relative_to_last_sent_packet);
|
||||
LOG_D(ENB_APP, "we_are_too_late=%d, offset=%ld.%06d\n", we_are_too_late, offset.tv_sec, offset.tv_usec);
|
||||
}
|
||||
if ((0 == we_are_too_late) && (0 == g_max_speed)){
|
||||
|
||||
if ((0 == we_are_too_late) && (0 == g_max_speed)) {
|
||||
// set timer
|
||||
if ((offset.tv_sec <= 0) || (offset.tv_usec <= 0)){
|
||||
if ((offset.tv_sec <= 0) || (offset.tv_usec <= 0)) {
|
||||
offset.tv_sec = -offset.tv_sec;
|
||||
offset.tv_usec = -offset.tv_usec;
|
||||
}
|
||||
|
||||
LOG_D(ENB_APP, "Send packet num %u original frame number %u in %ld.%06d sec\n",
|
||||
packet->packet_number, packet->original_frame_number, offset.tv_sec, offset.tv_usec);
|
||||
|
||||
packet->packet_number, packet->original_frame_number, offset.tv_sec, offset.tv_usec);
|
||||
packet->status = ET_PACKET_STATUS_SCHEDULED_FOR_SENDING;
|
||||
|
||||
if (timer_setup (offset.tv_sec, offset.tv_usec, TASK_S1AP, INSTANCE_DEFAULT, TIMER_ONE_SHOT,packet, &packet->timer_id) < 0) {
|
||||
AssertFatal(0, " Can not start TX event timer\n");
|
||||
}
|
||||
|
||||
g_scenario->timer_count++;
|
||||
// Done g_fsm_state = ET_FSM_STATE_WAITING_TX_EVENT;
|
||||
} else {
|
||||
// send immediately
|
||||
AssertFatal(0 == gettimeofday(&packet->timestamp_packet, NULL), "gettimeofday() Failed");
|
||||
original_frame_number = packet->original_frame_number;
|
||||
|
||||
do {
|
||||
g_scenario->time_last_tx_packet.tv_sec = packet->timestamp_packet.tv_sec;
|
||||
g_scenario->time_last_tx_packet.tv_usec = packet->timestamp_packet.tv_usec;
|
||||
|
||||
LOG_D(ENB_APP, "Sending packet num %d original frame number %u immediately\n",packet->packet_number, packet->original_frame_number);
|
||||
et_s1ap_eNB_itti_send_sctp_data_req(
|
||||
packet->enb_instance,
|
||||
@@ -163,13 +167,17 @@ void et_scenario_schedule_tx_packet(et_packet_t * packet)
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
packet = packet->next;
|
||||
} while ((NULL != packet) && (packet->original_frame_number == original_frame_number));
|
||||
|
||||
g_fsm_state = ET_FSM_STATE_RUNNING;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SCTP_CID_INIT:
|
||||
case SCTP_CID_INIT_ACK:
|
||||
AssertFatal(0, "Invalid case TX packet SCTP_CID_INIT or SCTP_CID_INIT_ACK");
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(0, "Invalid case TX packet SCTP_CID %d", packet->sctp_hdr.chunk_type);
|
||||
}
|
||||
@@ -177,23 +185,22 @@ void et_scenario_schedule_tx_packet(et_packet_t * packet)
|
||||
//------------------------------------------------------------------------------
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event)
|
||||
{
|
||||
|
||||
switch (event.code){
|
||||
switch (event.code) {
|
||||
case ET_EVENT_TICK:
|
||||
while (NULL != g_scenario->next_packet) {
|
||||
LOG_D(ENB_APP, "EVENT_TICK: Considering packet num %d original frame number %u\n", g_scenario->next_packet->packet_number, g_scenario->next_packet->original_frame_number);
|
||||
|
||||
switch (g_scenario->next_packet->sctp_hdr.chunk_type) {
|
||||
case SCTP_CID_DATA :
|
||||
|
||||
// no init in this scenario, may be sub-scenario
|
||||
if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_SEND) {
|
||||
if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) {
|
||||
et_scenario_schedule_tx_packet(g_scenario->next_packet);
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
|
||||
et_event_t continue_event;
|
||||
continue_event.code = ET_EVENT_TICK;
|
||||
et_scenario_fsm_notify_event(continue_event);
|
||||
|
||||
return g_fsm_state;
|
||||
} else if (g_scenario->next_packet->status != ET_PACKET_STATUS_SCHEDULED_FOR_SENDING) {
|
||||
AssertFatal(0, "Invalid packet status %d", g_scenario->next_packet->status);
|
||||
@@ -201,7 +208,6 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event)
|
||||
} else if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_RECEIVE) {
|
||||
if (g_scenario->next_packet->status == ET_PACKET_STATUS_RECEIVED) {
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
|
||||
} else if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) {
|
||||
et_scenario_wait_rx_packet(g_scenario->next_packet);
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
@@ -212,6 +218,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event)
|
||||
} else {
|
||||
AssertFatal(0, "Invalid packet action %d", g_scenario->next_packet->action);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SCTP_CID_INIT:
|
||||
@@ -223,8 +230,8 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event)
|
||||
case SCTP_CID_ECN_ECNE:
|
||||
case SCTP_CID_ECN_CWR:
|
||||
LOG_D(ENB_APP, "EVENT_TICK: Ignoring packet num %d SCTP CID %s\n",
|
||||
g_scenario->next_packet->packet_number,
|
||||
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
|
||||
g_scenario->next_packet->packet_number,
|
||||
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
|
||||
g_scenario->next_packet->status = ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT;
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
break;
|
||||
@@ -235,20 +242,22 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event)
|
||||
case SCTP_CID_ERROR:
|
||||
case SCTP_CID_SHUTDOWN_COMPLETE:
|
||||
AssertFatal(0, "The scenario should be cleaned (packet %s cannot be processed at this time)",
|
||||
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
|
||||
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_D(ENB_APP, "EVENT_TICK: Ignoring packet num %d SCTP CID %s\n",
|
||||
g_scenario->next_packet->packet_number,
|
||||
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
|
||||
g_scenario->next_packet->packet_number,
|
||||
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
|
||||
g_scenario->next_packet->status = ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT;
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "No Packet found in this scenario: %s\n", g_scenario->name);
|
||||
g_fsm_state = ET_FSM_STATE_NULL;
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
|
||||
if (0 == g_scenario->timer_count) {
|
||||
fprintf(stderr, "End of scenario: %s\n", g_scenario->name);
|
||||
fflush(stderr);
|
||||
@@ -256,21 +265,27 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event)
|
||||
return 0;
|
||||
//exit(0);
|
||||
}
|
||||
|
||||
fprintf(stderr, "Remaining timers running: %d\n", g_scenario->timer_count);
|
||||
return g_fsm_state;
|
||||
break;
|
||||
|
||||
case ET_EVENT_RX_PACKET_TIME_OUT:
|
||||
AssertFatal(0, "Event ET_EVENT_RX_PACKET_TIME_OUT not handled in FSM state ET_FSM_STATE_RUNNING");
|
||||
break;
|
||||
|
||||
case ET_EVENT_TX_TIMED_PACKET:
|
||||
AssertFatal(0, "Event ET_EVENT_TX_TIMED_PACKET not handled in FSM state ET_FSM_STATE_RUNNING");
|
||||
break;
|
||||
|
||||
case ET_EVENT_RX_S1AP:
|
||||
et_s1ap_process_rx_packet(&event.u.s1ap_data_ind);
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_RUNNING", event.code);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
return 0;
|
||||
}
|
||||
@@ -282,7 +297,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_tx(et_event_t event)
|
||||
int original_frame_number = -1;
|
||||
et_packet_t *packet = NULL;
|
||||
|
||||
switch (event.code){
|
||||
switch (event.code) {
|
||||
case ET_EVENT_TICK:
|
||||
fprintf(stdout, "EVENT_TICK: waiting for tx event\n");
|
||||
break;
|
||||
@@ -295,23 +310,23 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_tx(et_event_t event)
|
||||
// send immediately
|
||||
packet = event.u.tx_timed_packet;
|
||||
AssertFatal(0 == gettimeofday(&packet->timestamp_packet, NULL), "gettimeofday() Failed");
|
||||
|
||||
original_frame_number = packet->original_frame_number;
|
||||
|
||||
do {
|
||||
g_scenario->time_last_tx_packet.tv_sec = packet->timestamp_packet.tv_sec;
|
||||
g_scenario->time_last_tx_packet.tv_usec = packet->timestamp_packet.tv_usec;
|
||||
|
||||
LOG_D(ENB_APP, "Sending packet num %d original frame number %u immediately\n",packet->packet_number, packet->original_frame_number);
|
||||
et_s1ap_eNB_itti_send_sctp_data_req(
|
||||
packet->enb_instance,
|
||||
packet->sctp_hdr.u.data_hdr.assoc_id,
|
||||
packet->sctp_hdr.u.data_hdr.payload.binary_stream,
|
||||
packet->sctp_hdr.u.data_hdr.payload.binary_stream_allocated_size,
|
||||
packet->sctp_hdr.u.data_hdr.stream);
|
||||
packet->enb_instance,
|
||||
packet->sctp_hdr.u.data_hdr.assoc_id,
|
||||
packet->sctp_hdr.u.data_hdr.payload.binary_stream,
|
||||
packet->sctp_hdr.u.data_hdr.payload.binary_stream_allocated_size,
|
||||
packet->sctp_hdr.u.data_hdr.stream);
|
||||
packet->status = ET_PACKET_STATUS_SENT;
|
||||
packet = packet->next;
|
||||
g_scenario->next_packet = packet;
|
||||
} while ( (NULL != packet) && (packet->original_frame_number == original_frame_number));
|
||||
|
||||
g_fsm_state = ET_FSM_STATE_RUNNING;
|
||||
break;
|
||||
|
||||
@@ -319,6 +334,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_tx(et_event_t event)
|
||||
default:
|
||||
AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_WAITING_TX", event.code);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
return 0;
|
||||
}
|
||||
@@ -327,7 +343,8 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_tx(et_event_t event)
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_rx(et_event_t event)
|
||||
{
|
||||
int rv = 0;
|
||||
switch (event.code){
|
||||
|
||||
switch (event.code) {
|
||||
case ET_EVENT_TICK:
|
||||
fprintf(stdout, "EVENT_TICK: waiting for rx event\n");
|
||||
break;
|
||||
@@ -340,16 +357,19 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_rx(et_event_t event)
|
||||
|
||||
case ET_EVENT_RX_S1AP:
|
||||
rv = et_s1ap_process_rx_packet(&event.u.s1ap_data_ind);
|
||||
|
||||
// waited packet
|
||||
if (rv == 0) {
|
||||
g_fsm_state = ET_FSM_STATE_RUNNING;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case ET_EVENT_TX_TIMED_PACKET:
|
||||
default:
|
||||
AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_WAITING_RX", event.code);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
return 0;
|
||||
}
|
||||
@@ -357,8 +377,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_rx(et_event_t event)
|
||||
//------------------------------------------------------------------------------
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t event)
|
||||
{
|
||||
|
||||
switch (event.code){
|
||||
switch (event.code) {
|
||||
case ET_EVENT_TICK:
|
||||
break;
|
||||
|
||||
@@ -369,22 +388,20 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even
|
||||
while (NULL != g_scenario->next_packet) {
|
||||
switch (g_scenario->next_packet->sctp_hdr.chunk_type) {
|
||||
case SCTP_CID_DATA :
|
||||
|
||||
// no init in this scenario, may be sub-scenario
|
||||
if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_SEND) {
|
||||
et_scenario_schedule_tx_packet(g_scenario->next_packet);
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
|
||||
et_event_t continue_event;
|
||||
continue_event.code = ET_EVENT_TICK;
|
||||
et_scenario_fsm_notify_event(continue_event);
|
||||
|
||||
return g_fsm_state;
|
||||
} else if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_RECEIVE) {
|
||||
if (g_scenario->next_packet->status == ET_PACKET_STATUS_RECEIVED) {
|
||||
g_scenario->last_rx_packet = g_scenario->next_packet;
|
||||
g_scenario->time_last_rx_packet = g_scenario->last_rx_packet->timestamp_packet;
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
|
||||
} else if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) {
|
||||
et_scenario_wait_rx_packet(g_scenario->next_packet);
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
@@ -395,7 +412,8 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even
|
||||
} else {
|
||||
AssertFatal(0, "Invalid packet action %d", g_scenario->next_packet->action);
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
|
||||
case SCTP_CID_INIT:
|
||||
case SCTP_CID_INIT_ACK:
|
||||
@@ -415,7 +433,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even
|
||||
case SCTP_CID_ERROR:
|
||||
case SCTP_CID_SHUTDOWN_COMPLETE:
|
||||
AssertFatal(0, "The scenario should be cleaned (packet %s cannot be processed at this time)",
|
||||
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
|
||||
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -423,15 +441,18 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "No Packet found in this scenario: %s\n", g_scenario->name);
|
||||
g_fsm_state = ET_FSM_STATE_NULL;
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
|
||||
if (0 == g_scenario->timer_count) {
|
||||
fprintf(stderr, "End of scenario: %s\n", g_scenario->name);
|
||||
fflush(stderr);
|
||||
fflush(stdout);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
fprintf(stderr, "Remaining timers running: %d\n", g_scenario->timer_count);
|
||||
return g_fsm_state;
|
||||
break;
|
||||
@@ -439,13 +460,14 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even
|
||||
default:
|
||||
AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_CONNECTING_S1C", event.code);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
return 0;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event)
|
||||
{
|
||||
switch (event.code){
|
||||
switch (event.code) {
|
||||
case ET_EVENT_TICK:
|
||||
break;
|
||||
|
||||
@@ -458,24 +480,21 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event)
|
||||
|
||||
while (NULL != g_scenario->next_packet) {
|
||||
switch (g_scenario->next_packet->sctp_hdr.chunk_type) {
|
||||
|
||||
case SCTP_CID_DATA :
|
||||
|
||||
// no init in this scenario, may be sub-scenario, ...
|
||||
if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_SEND) {
|
||||
et_scenario_schedule_tx_packet(g_scenario->next_packet);
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
|
||||
et_event_t continue_event;
|
||||
continue_event.code = ET_EVENT_TICK;
|
||||
et_scenario_fsm_notify_event(continue_event);
|
||||
|
||||
return g_fsm_state;
|
||||
} else if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_RECEIVE) {
|
||||
if (g_scenario->next_packet->status == ET_PACKET_STATUS_RECEIVED) {
|
||||
g_scenario->last_rx_packet = g_scenario->next_packet;
|
||||
g_scenario->time_last_rx_packet = g_scenario->last_rx_packet->timestamp_packet;
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
|
||||
} else if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) {
|
||||
et_scenario_wait_rx_packet(g_scenario->next_packet);
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
@@ -486,6 +505,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event)
|
||||
} else {
|
||||
AssertFatal(0, "Invalid packet action %d", g_scenario->next_packet->action);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SCTP_CID_INIT:
|
||||
@@ -518,7 +538,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event)
|
||||
case SCTP_CID_ERROR:
|
||||
case SCTP_CID_SHUTDOWN_COMPLETE:
|
||||
AssertFatal(0, "The scenario should be cleaned (packet %s cannot be processed at this time)",
|
||||
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
|
||||
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -526,6 +546,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event)
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "No Useful packet found in this scenario: %s\n", g_scenario->name);
|
||||
g_fsm_state = ET_FSM_STATE_NULL;
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
@@ -535,6 +556,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event)
|
||||
default:
|
||||
AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_NULL", event.code);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -542,17 +564,23 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event)
|
||||
et_fsm_state_t et_scenario_fsm_notify_event(et_event_t event)
|
||||
{
|
||||
AssertFatal((event.code >= ET_EVENT_START) && (event.code < ET_EVENT_END), "Unknown et_event_t.code %d", event.code);
|
||||
|
||||
pthread_mutex_lock(&g_fsm_lock);
|
||||
switch (g_fsm_state){
|
||||
|
||||
switch (g_fsm_state) {
|
||||
case ET_FSM_STATE_NULL: return et_scenario_fsm_notify_event_state_null(event); break;
|
||||
|
||||
case ET_FSM_STATE_CONNECTING_S1C: return et_scenario_fsm_notify_event_state_connecting_s1c(event); break;
|
||||
|
||||
case ET_FSM_STATE_WAITING_TX_EVENT: return et_scenario_fsm_notify_event_state_waiting_tx(event); break;
|
||||
|
||||
case ET_FSM_STATE_WAITING_RX_EVENT: return et_scenario_fsm_notify_event_state_waiting_rx(event); break;
|
||||
|
||||
case ET_FSM_STATE_RUNNING: return et_scenario_fsm_notify_event_state_running(event); break;
|
||||
|
||||
default:
|
||||
AssertFatal(0, "Case fsm_state %d not handled", g_fsm_state);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
return g_fsm_state;
|
||||
}
|
||||
|
||||
@@ -36,22 +36,25 @@
|
||||
#include "play_scenario.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
asn_comp_rval_t * et_sctp_data_is_matching(sctp_datahdr_t * const sctp1, sctp_datahdr_t * const sctp2, const uint32_t constraints)
|
||||
asn_comp_rval_t *et_sctp_data_is_matching(sctp_datahdr_t *const sctp1, sctp_datahdr_t *const sctp2, const uint32_t constraints)
|
||||
{
|
||||
asn_comp_rval_t *rv = NULL;
|
||||
|
||||
// no comparison for ports
|
||||
if (sctp1->ppid != sctp2->ppid) {
|
||||
if (sctp1->ppid != sctp2->ppid) {
|
||||
S1AP_WARN("No Matching SCTP PPID %u %u\n", sctp1->ppid, sctp2->ppid);
|
||||
rv = calloc(1, sizeof(asn_comp_rval_t));
|
||||
rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_PPID;
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (sctp1->assoc_id != sctp2->assoc_id) {
|
||||
S1AP_WARN("No Matching SCTP assoc id %u %u\n", sctp1->assoc_id, sctp2->assoc_id);
|
||||
rv = calloc(1, sizeof(asn_comp_rval_t));
|
||||
rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_ASSOC_ID;
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (sctp1->stream != sctp2->stream) {
|
||||
if (constraints & ET_BIT_MASK_MATCH_SCTP_STREAM) {
|
||||
rv = calloc(1, sizeof(asn_comp_rval_t));
|
||||
@@ -61,30 +64,33 @@ asn_comp_rval_t * et_sctp_data_is_matching(sctp_datahdr_t * const sctp1, sctp_da
|
||||
S1AP_WARN("No Matching SCTP stream %u %u\n", sctp1->stream, sctp2->stream);
|
||||
}
|
||||
}
|
||||
|
||||
// We do not have SSN from lower layers
|
||||
// if (sctp1->ssn != sctp2->ssn) {
|
||||
// if (constraints & ET_BIT_MASK_MATCH_SCTP_SSN) {
|
||||
// rv = calloc(1, sizeof(asn_comp_rval_t));
|
||||
// rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_SSN;
|
||||
// return rv;
|
||||
// } else {
|
||||
// S1AP_WARN("No Matching SCTP STREAM SN %u %u\n", sctp1->ssn, sctp2->ssn);
|
||||
// }
|
||||
// }
|
||||
// if (sctp1->ssn != sctp2->ssn) {
|
||||
// if (constraints & ET_BIT_MASK_MATCH_SCTP_SSN) {
|
||||
// rv = calloc(1, sizeof(asn_comp_rval_t));
|
||||
// rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_SSN;
|
||||
// return rv;
|
||||
// } else {
|
||||
// S1AP_WARN("No Matching SCTP STREAM SN %u %u\n", sctp1->ssn, sctp2->ssn);
|
||||
// }
|
||||
// }
|
||||
return et_s1ap_is_matching(&sctp1->payload, &sctp2->payload, constraints);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
asn_comp_rval_t * et_sctp_is_matching(et_sctp_hdr_t * const sctp1, et_sctp_hdr_t * const sctp2, const uint32_t constraints)
|
||||
asn_comp_rval_t *et_sctp_is_matching(et_sctp_hdr_t *const sctp1, et_sctp_hdr_t *const sctp2, const uint32_t constraints)
|
||||
{
|
||||
// no comparison for ports
|
||||
asn_comp_rval_t *rv = NULL;
|
||||
if (sctp1->chunk_type != sctp2->chunk_type){
|
||||
|
||||
if (sctp1->chunk_type != sctp2->chunk_type) {
|
||||
S1AP_WARN("No Matching chunk_type %u %u\n", sctp1->chunk_type, sctp2->chunk_type);
|
||||
rv = calloc(1, sizeof(asn_comp_rval_t));
|
||||
rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_CHUNK_TYPE;
|
||||
return rv;
|
||||
}
|
||||
|
||||
switch (sctp1->chunk_type) {
|
||||
case SCTP_CID_DATA:
|
||||
return et_sctp_data_is_matching(&sctp1->u.data_hdr, &sctp2->u.data_hdr, constraints);
|
||||
@@ -93,9 +99,11 @@ asn_comp_rval_t * et_sctp_is_matching(et_sctp_hdr_t * const sctp1, et_sctp_hdr_
|
||||
case SCTP_CID_INIT:
|
||||
AssertFatal(0, "Not needed now");
|
||||
break;
|
||||
|
||||
case SCTP_CID_INIT_ACK:
|
||||
AssertFatal(0, "Not needed now");
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(0, "Not needed now cid %d", sctp1->chunk_type);
|
||||
}
|
||||
|
||||
@@ -59,13 +59,10 @@ int s1ap_eNB_generate_initial_ue_message(uint8_t **buffer,
|
||||
{
|
||||
InitialUEMessageIEs initialUEmessageIEs;
|
||||
InitialUEMessageIEs *initialUEmessageIEs_p = &initialUEmessageIEs;
|
||||
|
||||
memset(initialUEmessageIEs_p, 0, sizeof(InitialUEMessageIEs));
|
||||
|
||||
initialUEmessageIEs.eNB_UE_S1AP_ID = eNB_UE_S1AP_ID;
|
||||
initialUEmessageIEs.nas_pdu.buf = infoNAS;
|
||||
initialUEmessageIEs.nas_pdu.size = sizeof(infoNAS);
|
||||
|
||||
initialUEmessageIEs.tai.tAC.buf = tac;
|
||||
initialUEmessageIEs.tai.tAC.size = 2;
|
||||
initialUEmessageIEs.tai.pLMNidentity.buf = identity;
|
||||
@@ -75,9 +72,7 @@ int s1ap_eNB_generate_initial_ue_message(uint8_t **buffer,
|
||||
initialUEmessageIEs.eutran_cgi.cell_ID.buf = id;
|
||||
initialUEmessageIEs.eutran_cgi.cell_ID.size = 4;
|
||||
initialUEmessageIEs.eutran_cgi.cell_ID.bits_unused = 4;
|
||||
|
||||
initialUEmessageIEs.rrC_Establishment_Cause = RRC_Establishment_Cause_mo_Data;
|
||||
|
||||
return s1ap_eNB_encode_initial_ue_message(initialUEmessageIEs_p, buffer, length);
|
||||
}
|
||||
|
||||
@@ -94,13 +89,10 @@ int main(int argc, char *argv[])
|
||||
asn_enc_rval_t retVal;
|
||||
uint8_t *buffer;
|
||||
uint32_t len;
|
||||
|
||||
SupportedTAs_Item_t ta;
|
||||
PLMNidentity_t plmnIdentity;
|
||||
|
||||
asn_debug = 0;
|
||||
asn1_xer_print = 0;
|
||||
|
||||
S1SetupRequestIEs s1SetupRequest;
|
||||
memset(&s1SetupRequest, 0, sizeof(S1SetupRequestIEs));
|
||||
s1SetupRequest.global_ENB_ID.eNB_ID.present = ENB_ID_PR_macroENB_ID;
|
||||
@@ -108,32 +100,23 @@ int main(int argc, char *argv[])
|
||||
s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.size = 3;
|
||||
s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.bits_unused = 4;
|
||||
OCTET_STRING_fromBuf(&s1SetupRequest.global_ENB_ID.pLMNidentity, identity, 3);
|
||||
|
||||
s1SetupRequest.presenceMask |= S1SETUPREQUESTIES_ENBNAME_PRESENT;
|
||||
OCTET_STRING_fromBuf(&s1SetupRequest.eNBname, "ENB 1 eurecom",
|
||||
strlen("ENB 1 eurecom"));
|
||||
|
||||
memset(&ta, 0, sizeof(SupportedTAs_Item_t));
|
||||
memset(&plmnIdentity, 0, sizeof(PLMNidentity_t));
|
||||
OCTET_STRING_fromBuf(&ta.tAC, tac, 2);
|
||||
OCTET_STRING_fromBuf(&plmnIdentity, identity, 3);
|
||||
ASN_SEQUENCE_ADD(&ta.broadcastPLMNs, &plmnIdentity);
|
||||
ASN_SEQUENCE_ADD(&s1SetupRequest.supportedTAs, &ta);
|
||||
|
||||
s1SetupRequest.defaultPagingDRX = PagingDRX_v64;
|
||||
|
||||
s1ap_eNB_encode_s1setuprequest(&s1SetupRequest, &buffer, &len);
|
||||
|
||||
assoc[0] = sctp_connect_to_remote_host(ip_addr, 36412, &recv_callback);
|
||||
sctp_send_msg(0, 0, buffer, len);
|
||||
|
||||
free(buffer);
|
||||
|
||||
// generateUplinkNASTransport(&buffer, &len);
|
||||
// sctp_send_msg(assoc[0], 0, buffer, len);
|
||||
// s1ap_mme_decode_pdu(buffer, len);
|
||||
|
||||
pthread_join(sctp_get_receiver_thread(assoc[0]), NULL);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "s1ap_common.h"
|
||||
#include "s1ap_eNB.h"
|
||||
#include "s1ap_mme.h"
|
||||
#include "s1ap_ies_defs.h"
|
||||
|
||||
#include "s1ap_eNB_encoder.h"
|
||||
#include "s1ap_eNB_decoder.h"
|
||||
@@ -79,27 +78,22 @@ void s1ap_test_generate_s1_setup_request(uint32_t eNB_id, uint8_t **buffer,
|
||||
SupportedTAs_Item_t ta;
|
||||
PLMNidentity_t plmnIdentity;
|
||||
uint8_t *id_p = (uint8_t *)(&eNB_id + 1);
|
||||
|
||||
memset(&s1SetupRequest, 0, sizeof(S1SetupRequestIEs_t));
|
||||
s1SetupRequest.global_ENB_ID.eNB_ID.present = ENB_ID_PR_macroENB_ID;
|
||||
s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.buf = id_p;
|
||||
s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.size = 3;
|
||||
s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.bits_unused = 4;
|
||||
OCTET_STRING_fromBuf(&s1SetupRequest.global_ENB_ID.pLMNidentity, identity, 3);
|
||||
|
||||
s1SetupRequest.presenceMask |= S1SETUPREQUESTIES_ENBNAME_PRESENT;
|
||||
OCTET_STRING_fromBuf(&s1SetupRequest.eNBname, "ENB 1 eurecom",
|
||||
strlen("ENB 1 eurecom"));
|
||||
|
||||
memset(&ta, 0, sizeof(SupportedTAs_Item_t));
|
||||
memset(&plmnIdentity, 0, sizeof(PLMNidentity_t));
|
||||
OCTET_STRING_fromBuf(&ta.tAC, tac, 2);
|
||||
OCTET_STRING_fromBuf(&plmnIdentity, identity, 3);
|
||||
ASN_SEQUENCE_ADD(&ta.broadcastPLMNs, &plmnIdentity);
|
||||
ASN_SEQUENCE_ADD(&s1SetupRequest.supportedTAs, &ta);
|
||||
|
||||
s1SetupRequest.defaultPagingDRX = PagingDRX_v64;
|
||||
|
||||
s1ap_eNB_encode_s1_setup_request(&s1SetupRequest, buffer, length);
|
||||
}
|
||||
|
||||
@@ -109,13 +103,10 @@ int s1ap_test_generate_initial_ue_message(uint32_t eNB_UE_S1AP_ID,
|
||||
{
|
||||
InitialUEMessageIEs_t initialUEmessageIEs;
|
||||
InitialUEMessageIEs_t *initialUEmessageIEs_p = &initialUEmessageIEs;
|
||||
|
||||
memset(initialUEmessageIEs_p, 0, sizeof(InitialUEMessageIEs_t));
|
||||
|
||||
initialUEmessageIEs.eNB_UE_S1AP_ID = eNB_UE_S1AP_ID & 0x00ffffff;
|
||||
initialUEmessageIEs.nas_pdu.buf = (uint8_t *)infoNAS;
|
||||
initialUEmessageIEs.nas_pdu.size = sizeof(infoNAS);
|
||||
|
||||
initialUEmessageIEs.tai.tAC.buf = (uint8_t *)tac;
|
||||
initialUEmessageIEs.tai.tAC.size = 2;
|
||||
initialUEmessageIEs.tai.pLMNidentity.buf = (uint8_t *)identity;
|
||||
@@ -125,9 +116,7 @@ int s1ap_test_generate_initial_ue_message(uint32_t eNB_UE_S1AP_ID,
|
||||
initialUEmessageIEs.eutran_cgi.cell_ID.buf = (uint8_t *)id;
|
||||
initialUEmessageIEs.eutran_cgi.cell_ID.size = 4;
|
||||
initialUEmessageIEs.eutran_cgi.cell_ID.bits_unused = 4;
|
||||
|
||||
initialUEmessageIEs.rrC_Establishment_Cause = RRC_Establishment_Cause_mo_Data;
|
||||
|
||||
return s1ap_eNB_encode_initial_ue_message(initialUEmessageIEs_p, buffer, length);
|
||||
}
|
||||
|
||||
@@ -140,26 +129,19 @@ int s1ap_test_generate_initial_setup_resp(uint32_t eNB_UE_S1AP_ID,
|
||||
{
|
||||
InitialContextSetupResponseIEs_t initialResponseIEs;
|
||||
InitialContextSetupResponseIEs_t *initialResponseIEs_p = &initialResponseIEs;
|
||||
|
||||
E_RABSetupItemCtxtSURes_t e_RABSetupItemCtxtSURes;
|
||||
|
||||
memset(initialResponseIEs_p, 0, sizeof(InitialContextSetupResponseIEs_t));
|
||||
memset(&e_RABSetupItemCtxtSURes, 0, sizeof(E_RABSetupItemCtxtSURes_t));
|
||||
|
||||
initialResponseIEs_p->mme_ue_s1ap_id = mme_UE_S1AP_ID;
|
||||
initialResponseIEs_p->eNB_UE_S1AP_ID = eNB_UE_S1AP_ID;
|
||||
|
||||
e_RABSetupItemCtxtSURes.e_RAB_ID = eRAB_id;
|
||||
e_RABSetupItemCtxtSURes.transportLayerAddress.buf = (uint8_t *)&ipv4_local;
|
||||
e_RABSetupItemCtxtSURes.transportLayerAddress.size = 4;
|
||||
|
||||
e_RABSetupItemCtxtSURes.gTP_TEID.buf = (uint8_t *)&teid;
|
||||
e_RABSetupItemCtxtSURes.gTP_TEID.size = 4;
|
||||
|
||||
ASN_SEQUENCE_ADD(
|
||||
&initialResponseIEs_p->e_RABSetupListCtxtSURes.e_RABSetupItemCtxtSURes,
|
||||
&e_RABSetupItemCtxtSURes);
|
||||
|
||||
return s1ap_eNB_encode_initial_context_setup_response(initialResponseIEs_p,
|
||||
buffer, length);
|
||||
}
|
||||
@@ -169,19 +151,19 @@ int recv_callback(uint32_t assocId,
|
||||
uint8_t *buffer,
|
||||
uint32_t length)
|
||||
{
|
||||
s1ap_message message;
|
||||
S1AP_S1AP_PDU_t pdu;
|
||||
uint8_t *buffer2;
|
||||
uint32_t len;
|
||||
int j;
|
||||
|
||||
if (s1ap_eNB_decode_pdu(&message, buffer, length) < 0) {
|
||||
if (s1ap_eNB_decode_pdu(&pdu, buffer, length) < 0) {
|
||||
fprintf(stderr, "s1ap_eNB_decode_pdu returned status < 0\n");
|
||||
free(buffer);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (message.procedureCode == ProcedureCode_id_S1Setup
|
||||
&& message.direction == S1AP_PDU_PR_successfulOutcome) {
|
||||
if (pdu.initiatingMessage.procedureCode == S1AP_ProcedureCode_id_S1Setup
|
||||
&& pdu.present == S1AP_S1AP_PDU_PR_successfulOutcome) {
|
||||
for (j = 0; j < nb_ue; j++) {
|
||||
s1ap_test_generate_initial_ue_message(j, &buffer2, &len);
|
||||
|
||||
@@ -194,8 +176,8 @@ int recv_callback(uint32_t assocId,
|
||||
|
||||
free(buffer2);
|
||||
}
|
||||
} else if (message.procedureCode == ProcedureCode_id_InitialContextSetup
|
||||
&& message.direction == S1AP_PDU_PR_initiatingMessage) {
|
||||
} else if (pdu.initiatingMessage.procedureCode == S1AP_ProcedureCode_id_InitialContextSetup
|
||||
&& pdu.present == S1AP_PDU_PR_initiatingMessage) {
|
||||
fprintf(stdout, "Received InitialContextSetup request\n");
|
||||
s1ap_test_generate_initial_setup_resp(
|
||||
message.msg.initialContextSetupRequestIEs.eNB_UE_S1AP_ID,
|
||||
@@ -220,7 +202,6 @@ int recv_callback(uint32_t assocId,
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -231,9 +212,7 @@ int sctp_connected(void *args,
|
||||
{
|
||||
uint8_t *buffer;
|
||||
uint32_t len;
|
||||
|
||||
fprintf(stdout, "New association %d\n", assocId);
|
||||
|
||||
s1ap_test_generate_s1_setup_request(assocId * nb_eNB, &buffer, &len);
|
||||
|
||||
if (sctp_send_msg(assocId, 0, buffer, len) < 0) {
|
||||
@@ -244,7 +223,6 @@ int sctp_connected(void *args,
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
|
||||
connected_eNB++;
|
||||
return 0;
|
||||
}
|
||||
@@ -252,12 +230,9 @@ int sctp_connected(void *args,
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
asn_enc_rval_t retVal;
|
||||
|
||||
int i;
|
||||
|
||||
SupportedTAs_Item_t ta;
|
||||
PLMNidentity_t plmnIdentity;
|
||||
|
||||
asn_debug = 0;
|
||||
asn1_xer_print = 0;
|
||||
|
||||
@@ -278,12 +253,9 @@ int main(int argc, char *argv[])
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
|
||||
// generateUplinkNASTransport(&buffer, &len);
|
||||
// sctp_send_msg(assoc[0], 0, buffer, len);
|
||||
// s1ap_mme_decode_pdu(buffer, len);
|
||||
|
||||
sctp_terminate();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -44,9 +44,7 @@ int recv_callback(uint32_t assocId,
|
||||
uint8_t *buffer,
|
||||
uint32_t length)
|
||||
{
|
||||
|
||||
free(buffer);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -55,14 +53,12 @@ int sctp_connected(void *args,
|
||||
uint32_t instreams,
|
||||
uint32_t outstreams)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
asn_enc_rval_t retVal;
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nb_eNB; i++) {
|
||||
@@ -74,6 +70,5 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
sctp_terminate();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -54,11 +54,9 @@
|
||||
void s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind)
|
||||
{
|
||||
int result;
|
||||
|
||||
DevAssert(sctp_data_ind != NULL);
|
||||
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);
|
||||
result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer);
|
||||
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
|
||||
}
|
||||
@@ -69,16 +67,12 @@ void s1ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uin
|
||||
{
|
||||
MessageDef *message_p;
|
||||
sctp_data_req_t *sctp_data_req;
|
||||
|
||||
message_p = itti_alloc_new_message(TASK_S1AP, SCTP_DATA_REQ);
|
||||
|
||||
sctp_data_req = &message_p->ittiMsg.sctp_data_req;
|
||||
|
||||
sctp_data_req->assoc_id = assoc_id;
|
||||
sctp_data_req->buffer = buffer;
|
||||
sctp_data_req->buffer_length = buffer_length;
|
||||
sctp_data_req->stream = stream;
|
||||
|
||||
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
|
||||
}
|
||||
|
||||
@@ -99,7 +93,6 @@ void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shut
|
||||
/* If there are no more associated MME, inform eNB app */
|
||||
if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb == 0) {
|
||||
MessageDef *message_p;
|
||||
|
||||
message_p = itti_alloc_new_message(TASK_S1AP, S1AP_DEREGISTERED_ENB_IND);
|
||||
S1AP_DEREGISTERED_ENB_IND(message_p).nb_mme = 0;
|
||||
itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->s1ap_eNB_instance->instance, message_p);
|
||||
@@ -118,7 +111,6 @@ void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shut
|
||||
/* If there are no more pending messages, inform eNB app */
|
||||
if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_pending_nb == 0) {
|
||||
MessageDef *message_p;
|
||||
|
||||
message_p = itti_alloc_new_message(TASK_S1AP, S1AP_REGISTER_ENB_CNF);
|
||||
S1AP_REGISTER_ENB_CNF(message_p).nb_mme = mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb;
|
||||
itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->s1ap_eNB_instance->instance, message_p);
|
||||
@@ -130,12 +122,9 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
|
||||
{
|
||||
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);
|
||||
@@ -145,9 +134,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;
|
||||
}
|
||||
|
||||
@@ -155,7 +142,6 @@ 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 */
|
||||
mme_test_s1_start_test(instance_p, s1ap_mme_data_p);
|
||||
}
|
||||
@@ -167,37 +153,26 @@ void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
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));
|
||||
|
||||
/* 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->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.
|
||||
*/
|
||||
@@ -205,7 +180,6 @@ void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
|
||||
s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING;
|
||||
instance_p->s1ap_mme_nb ++;
|
||||
instance_p->s1ap_mme_pending_nb ++;
|
||||
|
||||
itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p);
|
||||
}
|
||||
|
||||
@@ -215,9 +189,7 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
|
||||
{
|
||||
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);
|
||||
|
||||
@@ -233,10 +205,8 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
|
||||
} 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;
|
||||
@@ -247,10 +217,8 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
|
||||
new_instance->mnc = s1ap_register_eNB->mnc;
|
||||
new_instance->mnc_digit_length = s1ap_register_eNB->mnc_digit_length;
|
||||
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_DEBUG("Registered new eNB[%d] and %s eNB id %u\n",
|
||||
instance,
|
||||
s1ap_register_eNB->cell_type == CELL_MACRO_ENB ? "macro" : "home",
|
||||
@@ -274,54 +242,48 @@ void *s1ap_eNB_task(void *arg)
|
||||
{
|
||||
MessageDef *received_msg = NULL;
|
||||
int result;
|
||||
|
||||
S1AP_DEBUG("Starting S1AP layer\n");
|
||||
|
||||
s1ap_eNB_prepare_internal_data();
|
||||
|
||||
itti_mark_task_ready(TASK_S1AP);
|
||||
|
||||
while (1) {
|
||||
itti_receive_msg(TASK_S1AP, &received_msg);
|
||||
|
||||
switch (ITTI_MSG_ID(received_msg)) {
|
||||
case TERMINATE_MESSAGE:
|
||||
itti_exit_task();
|
||||
case TERMINATE_MESSAGE:
|
||||
itti_exit_task();
|
||||
break;
|
||||
|
||||
case S1AP_REGISTER_ENB_REQ: {
|
||||
/* Register a new eNB.
|
||||
* in Virtual mode eNBs will be distinguished using the mod_id/
|
||||
* Each eNB has to send an S1AP_REGISTER_ENB message with its
|
||||
* own parameters.
|
||||
*/
|
||||
s1ap_eNB_handle_register_eNB(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_REGISTER_ENB_REQ(received_msg));
|
||||
}
|
||||
break;
|
||||
|
||||
case S1AP_REGISTER_ENB_REQ: {
|
||||
/* Register a new eNB.
|
||||
* in Virtual mode eNBs will be distinguished using the mod_id/
|
||||
* Each eNB has to send an S1AP_REGISTER_ENB message with its
|
||||
* own parameters.
|
||||
*/
|
||||
s1ap_eNB_handle_register_eNB(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_REGISTER_ENB_REQ(received_msg));
|
||||
}
|
||||
break;
|
||||
|
||||
case SCTP_NEW_ASSOCIATION_RESP: {
|
||||
s1ap_eNB_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&received_msg->ittiMsg.sctp_new_association_resp);
|
||||
}
|
||||
break;
|
||||
|
||||
case SCTP_DATA_IND: {
|
||||
s1ap_eNB_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
default:
|
||||
S1AP_ERROR("Received unhandled message: %d:%s\n",
|
||||
ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
|
||||
case SCTP_NEW_ASSOCIATION_RESP: {
|
||||
s1ap_eNB_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&received_msg->ittiMsg.sctp_new_association_resp);
|
||||
}
|
||||
break;
|
||||
|
||||
case SCTP_DATA_IND: {
|
||||
s1ap_eNB_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -153,22 +153,20 @@ static int compare_buffer(uint8_t *buffer, uint32_t length_buffer,
|
||||
void doit (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
break_on_error = 1;
|
||||
|
||||
// asn1_xer_print = 1;
|
||||
// asn_debug = 1;
|
||||
|
||||
for (i = 0; i < sizeof(s1ap_test) / sizeof(s1ap_test_t); i++) {
|
||||
struct s1ap_message_s message;
|
||||
S1AP_S1AP_PDU_t pdu;
|
||||
uint8_t *buffer;
|
||||
uint32_t length;
|
||||
|
||||
memset(&message, 0, sizeof(struct s1ap_message_s));
|
||||
memset(&pdu, 0, sizeof(pdu));
|
||||
|
||||
if (s1ap_test[i].originating == ENB) {
|
||||
/* eNB originated procedure -> USE MME decoder */
|
||||
if (s1ap_mme_decode_pdu(&message, s1ap_test[i].buffer,
|
||||
if (s1ap_mme_decode_pdu(&pdu, s1ap_test[i].buffer,
|
||||
s1ap_test[i].buf_len) < 0) {
|
||||
fail("Failed to decode %s\n", s1ap_test[i].procedure_name);
|
||||
} else {
|
||||
@@ -176,7 +174,7 @@ void doit (void)
|
||||
}
|
||||
} else {
|
||||
/* MME originated procedure -> USE eNB decoder */
|
||||
if (s1ap_eNB_decode_pdu(&message, s1ap_test[i].buffer,
|
||||
if (s1ap_eNB_decode_pdu(&pdu, s1ap_test[i].buffer,
|
||||
s1ap_test[i].buf_len) < 0) {
|
||||
fail("Failed to decode %s\n", s1ap_test[i].procedure_name);
|
||||
} else {
|
||||
@@ -186,14 +184,14 @@ void doit (void)
|
||||
|
||||
if (s1ap_test[i].originating == ENB) {
|
||||
/* eNB originated procedure -> USE eNB encoder */
|
||||
if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) {
|
||||
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) {
|
||||
fail("Failed to decode %s\n", s1ap_test[i].procedure_name);
|
||||
} else {
|
||||
success("Encoded %s correctly\n", s1ap_test[i].procedure_name);
|
||||
}
|
||||
} else {
|
||||
/* MME originated procedure -> USE mme encoder */
|
||||
if (s1ap_mme_encode_pdu(&message, &buffer, &length) < 0) {
|
||||
if (s1ap_mme_encode_pdu(&pdu, &buffer, &length) < 0) {
|
||||
fail("Failed to encode %s\n", s1ap_test[i].procedure_name);
|
||||
} else {
|
||||
success("Encoded %s correctly\n", s1ap_test[i].procedure_name);
|
||||
|
||||
Reference in New Issue
Block a user