Commit 6b2152a2 authored by Cedric Roux's avatar Cedric Roux
Browse files

- Fix incorrect SCTP stream for UE

- Added some message for S1AP
- Fixed PLMN for EPC

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4354 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 932b8dac
......@@ -353,7 +353,8 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id,
if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_desc_p->s1ap_eNB_instance,
initialContextSetupRequest_p->eNB_UE_S1AP_ID)) == NULL) {
S1AP_ERROR("[SCTP %d] Received initial context setup request for non "
"existing UE context\n", assoc_id);
"existing UE context %06x\n", assoc_id,
initialContextSetupRequest_p->eNB_UE_S1AP_ID);
return -1;
}
......
......@@ -113,7 +113,9 @@ int s1ap_eNB_handle_nas_first_req(s1ap_nas_first_req_t *s1ap_nas_first_req_p)
/* Peek a random value for the eNB_ue_s1ap_id */
ue_desc_p->eNB_ue_s1ap_id = (random() + random()) & 0x00ffffff;
if ((collision_p = RB_INSERT(s1ap_ue_map, &instance_p->s1ap_ue_head, ue_desc_p))
== NULL) {
== NULL)
{
S1AP_DEBUG("Found usable eNB_ue_s1ap_id: 0x%06x\n", ue_desc_p->eNB_ue_s1ap_id);
/* Break the loop as the id is not already used by another UE */
break;
}
......@@ -164,12 +166,16 @@ int s1ap_eNB_handle_nas_first_req(s1ap_nas_first_req_t *s1ap_nas_first_req_p)
if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) {
/* Failed to encode message */
return -1;
DevMessage("Failed to encode initial UE message\n");
}
/* Update the current S1AP UE state */
ue_desc_p->ue_state = S1AP_UE_WAITING_CSR;
/* Assign a stream for this UE */
mme_desc_p->nextstream %= mme_desc_p->out_streams;
ue_desc_p->stream = ++mme_desc_p->nextstream;
/* Send encoded message over sctp */
s1ap_eNB_itti_send_sctp_data_req(mme_desc_p->assoc_id, buffer, length, ue_desc_p->stream);
......
MESSAGE_DEF(S1AP_REGISTER_ENB, MESSAGE_PRIORITY_MED, s1ap_register_eNB_t, s1ap_register_eNB)
MESSAGE_DEF(S1AP_REGISTER_ENB , MESSAGE_PRIORITY_MED, s1ap_register_eNB_t , s1ap_register_eNB )
MESSAGE_DEF(S1AP_NAS_FIRST_REQ, MESSAGE_PRIORITY_MED, s1ap_nas_first_req_t, s1ap_nas_first_req)
MESSAGE_DEF(S1AP_UPLINK_NAS , MESSAGE_PRIORITY_MED, s1ap_uplink_nas_t , s1ap_uplink_nas )
MESSAGE_DEF(S1AP_DOWNLINK_NAS , MESSAGE_PRIORITY_MED, s1ap_downlink_nas_t , s1ap_downlink_nas )
\ No newline at end of file
......@@ -22,8 +22,51 @@ typedef struct {
#define S1AP_MAX_NB_MME_IP_ADDRESS 10
/* Provides the establishment cause for the RRC connection request as provided
* by the upper layers. W.r.t. the cause value names: highPriorityAccess
* concerns AC11..AC15, ‘mt’ stands for ‘Mobile Terminating’ and ‘mo’ for
* 'Mobile Originating'. Defined in TS 36.331.
*/
typedef enum {
RRC_CAUSE_EMERGENCY = 0x0,
RRC_CAUSE_HIGH_PRIO_ACCESS = 0x1,
RRC_CAUSE_MT_ACCESS = 0x2,
RRC_CAUSE_MO_SIGNALLING = 0x3,
RRC_CAUSE_MO_DATA = 0x4,
RRC_CAUSE_LAST
} rrc_establishment_cause_t;
typedef struct {
/* For virtual mode, mod_id as defined in the rest of the L1/L2 stack */
uint16_t mcc;
uint16_t mnc;
uint8_t mme_code;
uint16_t mme_group_id;
} gummei_t;
typedef struct {
uint8_t mme_code;
uint32_t m_tmsi;
} s_tmsi_t;
typedef struct {
#define S_TMSI_PROVIDED 0x0
#define GUMMEI_PROVIDED 0x1
unsigned present:1;
union {
gummei_t gummei;
s_tmsi_t s_tmsi;
} identity;
} ue_identity_t;
typedef struct {
/* Octet string data */
uint8_t *buffer;
/* Length of the octet string */
uint32_t length;
} nas_pdu_t, ue_radio_cap_t;
typedef struct {
/* For virtual mode, mod_id of the eNB as defined in the rest of the L1/L2 stack */
uint8_t mod_id;
/* Unique eNB_id to identify the eNB within EPC.
......@@ -61,4 +104,41 @@ typedef struct {
net_ip_address_t mme_ip_address[S1AP_MAX_NB_MME_IP_ADDRESS];
} s1ap_register_eNB_t;
/* The NAS First Req is the first message exchanged between RRC and S1AP
* for an UE.
* The rnti uniquely identifies an UE within a cell. Later the enb_ue_s1ap_id
* will be the unique identifier used between RRC and S1AP.
*/
typedef struct {
/* For virtual mode, mod_id of the eNB as defined in the rest of the L1/L2 stack */
uint8_t mod_id;
/* RNTI of the mobile */
uint16_t rnti;
/* Establishment cause as sent by UE */
rrc_establishment_cause_t establishment_cause;
/* NAS PDU */
nas_pdu_t nas_pdu;
/* If this flag is set S1AP layer is expecting the GUMMEI. If = 0,
* the temporary s-tmsi is used.
*/
ue_identity_t ue_identity;
} s1ap_nas_first_req_t;
typedef struct {
/* For virtual mode, mod_id of the eNB as defined in the rest of the L1/L2 stack */
uint8_t mod_id;
/* Unique UE identifier within an eNB */
unsigned eNB_ue_s1ap_id:24;
/* NAS pdu */
nas_pdu_t nas_pdu;
} s1ap_uplink_nas_t;
typedef s1ap_uplink_nas_t s1ap_downlink_nas_t;
#endif /* S1AP_MESSAGES_TYPES_H_ */
......@@ -281,7 +281,7 @@ ifdef USE_MME
CFLAGS += -DENB_MODE -DENABLE_USE_MME -DENABLE_EVENT_FD -I$(S1AP_DIR) -I$(SCTP_DIR)
S1AP_CFLAGS = $(CFLAGS) -I$(TOP_DIR) $(L2_incl) $(UTIL_incl) $(UTILS_incl)
LIBS += $(S1AP_DIR)/libs1ap.a $(SCTP_DIR)/libsctp.a -lsctp
LIBS += $(S1AP_DIR)/libs1ap.a $(SCTP_DIR)/libsctp.a -lsctp -lcrypt
export S1AP_CFLAGS
$(S1AP_DIR)/libs1ap.a: force_look
......
......@@ -397,6 +397,7 @@ void *l2l1_task(void *args_p) {
s1ap_register_eNB_t *s1ap_register_eNB;
uint32_t hash;
/* FIXME: following parameters should be setup by eNB applicative layer ? */
message_p = itti_alloc_new_message(TASK_L2L1, S1AP_REGISTER_ENB);
s1ap_register_eNB = &message_p->msg.s1ap_register_eNB;
......@@ -405,12 +406,11 @@ void *l2l1_task(void *args_p) {
/* Some default/random parameters */
s1ap_register_eNB->mod_id = eNB_id;
/* FIXME: generate unique eNB id */
s1ap_register_eNB->eNB_id = eNB_id + (hash & 0xFFFF8);
s1ap_register_eNB->cell_type = CELL_MACRO_ENB;
s1ap_register_eNB->tac = 8;
s1ap_register_eNB->tac = 0;
s1ap_register_eNB->mcc = 208;
s1ap_register_eNB->mnc = 35;
s1ap_register_eNB->mnc = 34;
s1ap_register_eNB->default_drx = PAGING_DRX_256;
s1ap_register_eNB->nb_mme = 1;
s1ap_register_eNB->mme_ip_address[0].ipv4 = 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment