Commit d27641a4 authored by gauthier's avatar gauthier

Begin to begin sending packets (many things to do hash assoc id, mme_ue_id, nas security, etc)

parent 7c28ae73
...@@ -216,6 +216,8 @@ add_definitions("-DPACKAGE_BUGREPORT=\"openair4g-devel@lists.eurecom.fr\"") ...@@ -216,6 +216,8 @@ add_definitions("-DPACKAGE_BUGREPORT=\"openair4g-devel@lists.eurecom.fr\"")
# Debug related options # Debug related options
######################################### #########################################
add_boolean_option(ASN_DEBUG False "ASN1 coder/decoder Debug")
add_boolean_option(EMIT_ASN_DEBUG False "ASN1 coder/decoder Debug")
add_boolean_option(MSG_PRINT False "print debug messages") add_boolean_option(MSG_PRINT False "print debug messages")
add_boolean_option(DISABLE_XER_PRINT False "print XER Format") add_boolean_option(DISABLE_XER_PRINT False "print XER Format")
add_boolean_option(XER_PRINT False "print XER Format") add_boolean_option(XER_PRINT False "print XER Format")
...@@ -1660,6 +1662,12 @@ target_link_libraries (test_epc_generate_scenario ...@@ -1660,6 +1662,12 @@ target_link_libraries (test_epc_generate_scenario
add_executable(test_epc_play_scenario add_executable(test_epc_play_scenario
${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario.c ${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario.c
${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_decode.c
${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_display.c
${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_fsm.c
${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_parse.c
${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_s1ap.c
${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_sctp.c
${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario.h ${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario.h
${OPENAIR2_DIR}/ENB_APP/enb_config.h ${OPENAIR2_DIR}/ENB_APP/enb_config.h
${OPENAIR2_DIR}/COMMON/commonDef.h ${OPENAIR2_DIR}/COMMON/commonDef.h
......
...@@ -7,7 +7,7 @@ set ( DEBUG_OMG False ) ...@@ -7,7 +7,7 @@ set ( DEBUG_OMG False )
set ( DISABLE_XER_PRINT False ) set ( DISABLE_XER_PRINT False )
set ( DRIVER2013 True ) set ( DRIVER2013 True )
set ( EMOS False ) set ( EMOS False )
set ( EMIT_ASN_DEBUG True ) set ( EMIT_ASN_DEBUG False )
set ( ENABLE_FXP True ) set ( ENABLE_FXP True )
set ( ENABLE_ITTI True ) set ( ENABLE_ITTI True )
set ( ENABLE_NAS_UE_LOGGING True ) set ( ENABLE_NAS_UE_LOGGING True )
...@@ -76,4 +76,4 @@ set ( SMBV False ) ...@@ -76,4 +76,4 @@ set ( SMBV False )
set ( TEST_OMG False ) set ( TEST_OMG False )
set ( USE_MME "R10" ) set ( USE_MME "R10" )
set ( USER_MODE True ) set ( USER_MODE True )
set ( XER_PRINT False ) set ( XER_PRINT True )
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
# Contact Information # Contact Information
# OpenAirInterface Admin: openair_admin@eurecom.fr # OpenAirInterface Admin: openair_admin@eurecom.fr
# OpenAirInterface Tech : openair_tech@eurecom.fr # OpenAirInterface Tech : openair_tech@eurecom.fr
# OpenAirInterface Dev : openair4g-devel@eurecom.fr # OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
# #
# Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE # Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
# #
......
...@@ -72,9 +72,9 @@ s1ap_eNB_config_t s1ap_config; ...@@ -72,9 +72,9 @@ s1ap_eNB_config_t s1ap_config;
static int s1ap_eNB_generate_s1_setup_request( 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);
static
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);
static
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);
uint32_t s1ap_generate_eNB_id(void) uint32_t s1ap_generate_eNB_id(void)
...@@ -150,7 +150,7 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, ...@@ -150,7 +150,7 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p); itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p);
} }
static
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; s1ap_eNB_instance_t *new_instance;
...@@ -210,7 +210,6 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t * ...@@ -210,7 +210,6 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
} }
} }
static
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_instance_t *instance_p;
......
This diff is collapsed.
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
*******************************************************************************/ *******************************************************************************/
/* /*
play_scenario.h et_scenario.h
------------------- -------------------
AUTHOR : Lionel GAUTHIER AUTHOR : Lionel GAUTHIER
COMPANY : EURECOM COMPANY : EURECOM
...@@ -42,21 +42,44 @@ ...@@ -42,21 +42,44 @@
# include <libxml/tree.h> # include <libxml/tree.h>
# include <netinet/in.h> # include <netinet/in.h>
#include "enb_config.h"
#include "s1ap_ies_defs.h" #include "s1ap_ies_defs.h"
# define ET_ENB_REGISTER_RETRY_DELAY 3
/** @defgroup _enb_app ENB APP
* @ingroup _oai2
* @{
*/
typedef enum { typedef enum {
ACTION_S1C_START = 0, ET_PACKET_STATUS_START = 0,
ACTION_S1C_NULL = ACTION_S1C_START, ET_PACKET_STATUS_NONE = ET_PACKET_STATUS_START,
ACTION_S1C_SEND, ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT,
ACTION_S1C_RECEIVE, ET_PACKET_STATUS_SCHEDULED_FOR_SENDING,
ACTION_S1C_END ET_PACKET_STATUS_SENT,
} test_action_t; ET_PACKET_STATUS_SENT_WITH_ERRORS,
ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING,
ET_PACKET_STATUS_RECEIVED,
ET_PACKET_STATUS_RECEIVED_WITH_ERRORS,
ET_PACKET_STATUS_END
} et_packet_status_t;
typedef enum {
ET_FSM_STATE_START = 0,
ET_FSM_STATE_NULL = ET_FSM_STATE_START,
ET_FSM_STATE_CONNECTING_SCTP,
ET_FSM_STATE_WAITING_TX_EVENT,
ET_FSM_STATE_WAITING_RX_EVENT,
ET_FSM_STATE_END
} et_fsm_state_t;
typedef enum {
ET_PACKET_ACTION_S1C_START = 0,
ET_PACKET_ACTION_S1C_NULL = ET_PACKET_ACTION_S1C_START,
ET_PACKET_ACTION_S1C_SEND,
ET_PACKET_ACTION_S1C_RECEIVE,
ET_PACKET_ACTION_S1C_END
} et_packet_action_t;
// from kernel source file 3.19/include/linux/sctp.h // from kernel source file 3.19/include/linux/sctp.h
typedef enum { typedef enum {
...@@ -94,16 +117,17 @@ typedef enum { ...@@ -94,16 +117,17 @@ typedef enum {
TEST_S1AP_PDU_TYPE_SUCCESSFUL_OUTCOME, TEST_S1AP_PDU_TYPE_SUCCESSFUL_OUTCOME,
TEST_S1AP_PDU_TYPE_UNSUCCESSFUL_OUTCOME, TEST_S1AP_PDU_TYPE_UNSUCCESSFUL_OUTCOME,
TEST_S1AP_PDU_TYPE_END TEST_S1AP_PDU_TYPE_END
} test_s1ap_pdu_type_t; } et_s1ap_pdu_type_t;
typedef struct test_s1ap_s { typedef struct et_s1ap_s {
//test_s1ap_pdu_type_t pdu_type; //et_s1ap_pdu_type_t pdu_type;
S1AP_PDU_t pdu; // decoded ASN1 C type: choice of initiatingMessage, successfulOutcome, unsuccessfulOutcome
uint16_t binary_stream_pos; uint16_t binary_stream_pos;
uint16_t binary_stream_allocated_size; uint16_t binary_stream_allocated_size;
uint8_t *binary_stream; uint8_t *binary_stream;
s1ap_message message; s1ap_message message; // decoded message: information elements
} test_s1ap_t; } et_s1ap_t;
// from kernel source file 3.19/include/linux/sctp.h, Big Endians // from kernel source file 3.19/include/linux/sctp.h, Big Endians
...@@ -112,7 +136,7 @@ typedef struct sctp_datahdr_s { ...@@ -112,7 +136,7 @@ typedef struct sctp_datahdr_s {
uint16_t stream; uint16_t stream;
uint16_t ssn; uint16_t ssn;
uint32_t ppid; uint32_t ppid;
test_s1ap_t payload; et_s1ap_t payload;
} sctp_datahdr_t; } sctp_datahdr_t;
// from kernel source file 3.19/include/linux/sctp.h, Big Endians // from kernel source file 3.19/include/linux/sctp.h, Big Endians
...@@ -127,7 +151,7 @@ typedef struct sctp_inithdr { ...@@ -127,7 +151,7 @@ typedef struct sctp_inithdr {
typedef sctp_inithdr_t sctp_initackhdr_t; typedef sctp_inithdr_t sctp_initackhdr_t;
typedef struct test_sctp_hdr_s { typedef struct et_sctp_hdr_s {
unsigned int src_port; unsigned int src_port;
unsigned int dst_port; unsigned int dst_port;
sctp_cid_t chunk_type; sctp_cid_t chunk_type;
...@@ -136,38 +160,145 @@ typedef struct test_sctp_hdr_s { ...@@ -136,38 +160,145 @@ typedef struct test_sctp_hdr_s {
sctp_inithdr_t init_hdr; sctp_inithdr_t init_hdr;
sctp_initackhdr_t init_ack_hdr; sctp_initackhdr_t init_ack_hdr;
} u; } u;
} test_sctp_hdr_t; } et_sctp_hdr_t;
typedef struct test_ip_s { typedef struct et_ip_s {
unsigned int address_family; // AF_INET, AF_INET6 unsigned int address_family; // AF_INET, AF_INET6
union { union {
struct in6_addr ipv6; struct in6_addr ipv6;
in_addr_t ipv4; in_addr_t ipv4;
}address; }address;
}test_ip_t; }et_ip_t;
typedef struct test_ip_hdr_s { typedef struct et_ip_hdr_s {
test_ip_t src; et_ip_t src;
test_ip_t dst; et_ip_t dst;
} test_ip_hdr_t; } et_ip_hdr_t;
typedef struct test_packet_s { typedef struct et_packet_s {
test_action_t action; et_packet_action_t action;
struct timeval time_relative_to_first_packet; struct timeval time_relative_to_first_packet;
struct timeval time_relative_to_last_sent_packet; struct timeval time_relative_to_last_sent_packet;
struct timeval time_relative_to_last_received_packet; struct timeval time_relative_to_last_received_packet;
unsigned int original_frame_number; unsigned int original_frame_number;
unsigned int packet_number; unsigned int packet_number;
test_ip_hdr_t ip_hdr; et_ip_hdr_t ip_hdr;
test_sctp_hdr_t sctp_hdr; et_sctp_hdr_t sctp_hdr;
struct test_packet_s *next; struct et_packet_s *next;
}test_packet_t; //scenario running vars
et_packet_status_t status;
}et_packet_t;
typedef struct sctp_epoll_s {
/* Array of events monitored by the task.
* By default only one fd is monitored (the one used to received messages
* from other tasks).
* More events can be suscribed later by the task itself.
*/
struct epoll_event *events;
int epoll_nb_events;
} thread_desc_t;
typedef struct test_scenario_s { typedef struct et_scenario_s {
xmlChar *name; xmlChar *name;
test_packet_t *list_packet; et_packet_t *list_packet;
}test_scenario_t;
// playing scenario
et_packet_t *waited_packet;
et_packet_t *current_packet;
} et_scenario_t;
typedef enum {
ET_EVENT_START = 0,
ET_EVENT_INIT = ET_EVENT_START,
ET_EVENT_RX_SCTP_EVENT,
ET_EVENT_RX_S1AP,
ET_EVENT_RX_X2AP,
ET_EVENT_RX_PACKET_TIME_OUT,
ET_EVENT_TX_PACKET,
ET_EVENT_STOP,
ET_EVENT_END
} et_event_code_t;
typedef struct et_event_init_s {
et_scenario_t *scenario;
} et_event_init_t;
typedef struct et_event_s1ap_data_ind_s {
sctp_datahdr_t sctp_datahdr;
} et_event_s1ap_data_ind_t;
typedef struct et_event_s1ap_data_req_s {
} et_event_s1ap_data_req_t;
typedef struct et_event_s {
et_event_code_t code;
union {
et_event_init_t init;
et_event_s1ap_data_ind_t s1ap_data_ind;
et_event_s1ap_data_req_t s1ap_data_req;
} u;
} et_event_t;
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_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);
//-------------------------
void et_s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind);
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);
//-------------------------
int et_scenario_fsm_notify_event_state_null(et_event_t event);
int 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_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);
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_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);
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);
uint32_t 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);
inline void free_pointer(void *p) {if (NULL != p) {free(p); p=NULL;}}; #endif /* PLAY_SCENARIO_H_ */
#endif /* ENB_CONFIG_H_ */
/** @} */
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
/*
play_scenario_decode.c
-------------------
AUTHOR : Lionel GAUTHIER
COMPANY : EURECOM
EMAIL : Lionel.Gauthier@eurecom.fr
*/
#include "intertask_interface.h"
#include "platform_types.h"
#include "s1ap_ies_defs.h"
#include "s1ap_eNB_decoder.h"
#include "assertions.h"
#include "play_scenario.h"
//------------------------------------------------------------------------------
int et_s1ap_decode_initiating_message(s1ap_message *message, S1ap_InitiatingMessage_t *initiating_p)
{
int ret = -1;
DevAssert(initiating_p != NULL);
message->procedureCode = initiating_p->procedureCode;
message->criticality = initiating_p->criticality;
switch(initiating_p->procedureCode) {
case S1ap_ProcedureCode_id_downlinkNASTransport:
ret = s1ap_decode_s1ap_downlinknastransporties(&message->msg.s1ap_DownlinkNASTransportIEs,&initiating_p->value);
break;
case S1ap_ProcedureCode_id_InitialContextSetup:
ret = s1ap_decode_s1ap_initialcontextsetuprequesties(&message->msg.s1ap_InitialContextSetupRequestIEs, &initiating_p->value);
break;
case S1ap_ProcedureCode_id_UEContextRelease:
ret = s1ap_decode_s1ap_uecontextreleasecommandies(&message->msg.s1ap_UEContextReleaseCommandIEs, &initiating_p->value);
break;
case S1ap_ProcedureCode_id_Paging:
ret = s1ap_decode_s1ap_pagingies(&message->msg.s1ap_PagingIEs, &initiating_p->value);
break;
case S1ap_ProcedureCode_id_uplinkNASTransport:
ret = s1ap_decode_s1ap_uplinknastransporties (&message->msg.s1ap_UplinkNASTransportIEs, &initiating_p->value);
break;
case S1ap_ProcedureCode_id_S1Setup:
ret = s1ap_decode_s1ap_s1setuprequesties (&message->msg.s1ap_S1SetupRequestIEs, &initiating_p->value);
break;
case S1ap_ProcedureCode_id_initialUEMessage:
ret = s1ap_decode_s1ap_initialuemessageies (&message->msg.s1ap_InitialUEMessageIEs, &initiating_p->value);
break;
case S1ap_ProcedureCode_id_UEContextReleaseRequest:
ret = s1ap_decode_s1ap_uecontextreleaserequesties (&message->msg.s1ap_UEContextReleaseRequestIEs, &initiating_p->value);
break;
case S1ap_ProcedureCode_id_UECapabilityInfoIndication:
ret = s1ap_decode_s1ap_uecapabilityinfoindicationies (&message->msg.s1ap_UECapabilityInfoIndicationIEs, &initiating_p->value);
break;
case S1ap_ProcedureCode_id_NASNonDeliveryIndication:
ret = s1ap_decode_s1ap_nasnondeliveryindication_ies (&message->msg.s1ap_NASNonDeliveryIndication_IEs, &initiating_p->value);
break;
default:
AssertFatal( 0 , "Unknown procedure ID (%d) for initiating message\n",
(int)initiating_p->procedureCode);
return -1;
}
return ret;
}
//------------------------------------------------------------------------------
int et_s1ap_decode_successful_outcome(s1ap_message *message, S1ap_SuccessfulOutcome_t *successfullOutcome_p)
{
int ret = -1;
DevAssert(successfullOutcome_p != NULL);
message->procedureCode = successfullOutcome_p->procedureCode;
message->criticality = successfullOutcome_p->criticality;
switch(successfullOutcome_p->procedureCode) {
case S1ap_ProcedureCode_id_S1Setup:
ret = s1ap_decode_s1ap_s1setupresponseies(
&message->msg.s1ap_S1SetupResponseIEs, &successfullOutcome_p->value);
break;
case S1ap_ProcedureCode_id_InitialContextSetup:
ret = s1ap_decode_s1ap_initialcontextsetupresponseies (&message->msg.s1ap_InitialContextSetupResponseIEs, &successfullOutcome_p->value);
break;
case S1ap_ProcedureCode_id_UEContextRelease:
ret = s1ap_decode_s1ap_uecontextreleasecompleteies (&message->msg.s1ap_UEContextReleaseCompleteIEs, &successfullOutcome_p->value);
break;
default:
AssertFatal(0, "Unknown procedure ID (%d) for successfull outcome message\n",
(int)successfullOutcome_p->procedureCode);
return -1;
}
return ret;
}
//------------------------------------------------------------------------------
int et_s1ap_decode_unsuccessful_outcome(s1ap_message *message, S1ap_UnsuccessfulOutcome_t *unSuccessfullOutcome_p)
{
int ret = -1;
DevAssert(unSuccessfullOutcome_p != NULL);
message->procedureCode = unSuccessfullOutcome_p->procedureCode;
message->criticality = unSuccessfullOutcome_p->criticality;
switch(unSuccessfullOutcome_p->procedureCode) {
case S1ap_ProcedureCode_id_S1Setup:
ret = s1ap_decode_s1ap_s1setupfailureies(&message->msg.s1ap_S1SetupFailureIEs, &unSuccessfullOutcome_p->value);
break;
case S1ap_ProcedureCode_id_InitialContextSetup:
ret = s1ap_decode_s1ap_initialcontextsetupfailureies (&message->msg.s1ap_InitialContextSetupFailureIEs, &unSuccessfullOutcome_p->value);
break;
default:
AssertFatal(0,"Unknown procedure ID (%d) for unsuccessfull outcome message\n",
(int)unSuccessfullOutcome_p->procedureCode);
break;
}
return ret;
}
//------------------------------------------------------------------------------
int et_s1ap_decode_pdu(S1AP_PDU_t * const pdu, s1ap_message * const message, const uint8_t * const buffer, const uint32_t length)
{
asn_dec_rval_t dec_ret;
DevAssert(buffer != NULL);
memset((void *)pdu, 0, sizeof(S1AP_PDU_t));
dec_ret = aper_decode(NULL,
&asn_DEF_S1AP_PDU,
(void **)&pdu,
buffer,
length,
0,
0);
if (dec_ret.code != RC_OK) {
S1AP_ERROR("Failed to decode pdu\n");
return -1;
}
message->direction = pdu->present;
switch(pdu->present) {
case S1AP_PDU_PR_initiatingMessage:
return et_s1ap_decode_initiating_message(message,
&pdu->choice.initiatingMessage);
case S1AP_PDU_PR_successfulOutcome:
return et_s1ap_decode_successful_outcome(message,
&pdu->choice.successfulOutcome);
case S1AP_PDU_PR_unsuccessfulOutcome:
return et_s1ap_decode_unsuccessful_outcome(message,
&pdu->choice.unsuccessfulOutcome);
default:
AssertFatal(0, "Unknown presence (%d) or not implemented\n", (int)pdu->present);
break;
}
return -1;
}
//------------------------------------------------------------------------------
void et_decode_s1ap(et_s1ap_t * const s1ap)
{
if (NULL != s1ap) {
if (et_s1ap_decode_pdu(&s1ap->pdu, &s1ap->message, s1ap->binary_stream, s1ap->binary_stream_allocated_size) < 0) {
AssertFatal (0, "ERROR %s() Cannot decode S1AP message!\n", __FUNCTION__);
}
}
}
This diff is collapsed.
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
/*
play_scenario_fsm.c
-------------------
AUTHOR : Lionel GAUTHIER
COMPANY : EURECOM
EMAIL : Lionel.Gauthier@eurecom.fr
*/
#include <stdio.h>
#include "intertask_interface.h"
#include "platform_types.h"
#include "assertions.h"
#include "play_scenario.h"
et_scenario_t *g_scenario = NULL;
et_fsm_state_t g_fsm_state = ET_FSM_STATE_NULL;
//------------------------------------------------------------------------------
int et_scenario_fsm_notify_event_state_null(et_event_t event)
{
et_packet_t *packet = NULL;
const Enb_properties_array_t *enb_properties_p = NULL;
uint32_t register_enb_pending;
switch (event.code){
case ET_EVENT_INIT:
AssertFatal(NULL == g_scenario, "Current scenario not ended");
g_scenario = event.u.init.scenario;
packet = g_scenario->list_packet;
while (NULL != packet) {
switch (packet->sctp_hdr.chunk_type) {
case SCTP_CID_DATA :
// no init in this scenario, may be sub-scenario
if (packet->action == ET_PACKET_ACTION_S1C_SEND) {
} else if (packet->action == ET_PACKET_ACTION_S1C_RECEIVE) {
g_scenario->waited_packet = packet;
} else {
packet->status = ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT;
packet = packet->next;
}
break;
case SCTP_CID_INIT:
case SCTP_CID_INIT_ACK:
enb_properties_p = enb_config_get();
/* Try to register each eNB */
g_fsm_state = ET_FSM_STATE_CONNECTING_SCTP;
register_enb_pending = et_eNB_app_register (enb_properties_p);
break;
case SCTP_CID_HEARTBEAT:
case SCTP_CID_HEARTBEAT_ACK:
case SCTP_CID_COOKIE_ECHO:
case SCTP_CID_COOKIE_ACK:
case SCTP_CID_ECN_ECNE:
case SCTP_CID_ECN_CWR:
packet->status = ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT;
packet = packet->next;
break;
case SCTP_CID_ABORT:
case SCTP_CID_SHUTDOWN:
case SCTP_CID_SHUTDOWN_ACK:
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(packet->sctp_hdr.chunk_type));
break;