Commit bd304710 authored by Gabriel's avatar Gabriel

[OAI-UE] merge com4Innov branch to integration branch

parent 0fb34b2e
...@@ -644,7 +644,7 @@ add_boolean_option(ENABLE_USE_CPU_EXECUTION_TIME True "Add data in vcd traces: d ...@@ -644,7 +644,7 @@ add_boolean_option(ENABLE_USE_CPU_EXECUTION_TIME True "Add data in vcd traces: d
add_boolean_option(ENABLE_VCD True "always true now, time measurements of proc calls and var displays") add_boolean_option(ENABLE_VCD True "always true now, time measurements of proc calls and var displays")
add_boolean_option(ENABLE_VCD_FIFO True "time measurements of proc calls and var displays sent to FIFO (one more thread)") add_boolean_option(ENABLE_VCD_FIFO True "time measurements of proc calls and var displays sent to FIFO (one more thread)")
add_boolean_option(HARD_RT False "???") add_boolean_option(HARD_RT False "???")
add_boolean_option(LINUX False "used in weird memcpy() in pdcp.c ???") add_boolean_option(LINUX True "used in weird memcpy() in pdcp.c ???")
add_boolean_option(LINUX_LIST False "used only in lists.c: either use OAI implementation of lists or Linux one (should be True, but it is False") add_boolean_option(LINUX_LIST False "used only in lists.c: either use OAI implementation of lists or Linux one (should be True, but it is False")
add_boolean_option(LOG_NO_THREAD True "Disable thread for log, seems always set to true") add_boolean_option(LOG_NO_THREAD True "Disable thread for log, seems always set to true")
add_boolean_option(OPENAIR_LTE True "Seems legacy: keep it to true") add_boolean_option(OPENAIR_LTE True "Seems legacy: keep it to true")
...@@ -727,7 +727,7 @@ add_boolean_option(TRACE_RLC_UM_TX_STATUS False "TRACE for RLC UM, TO BE CHANGE ...@@ -727,7 +727,7 @@ add_boolean_option(TRACE_RLC_UM_TX_STATUS False "TRACE for RLC UM, TO BE CHANGE
########################## ##########################
# PDCP LAYER OPTIONS # PDCP LAYER OPTIONS
########################## ##########################
add_boolean_option(PDCP_USE_NETLINK False "For eNB, PDCP communicate with a NETLINK socket if connected to network driver, else could use a RT-FIFO") add_boolean_option(PDCP_USE_NETLINK True "For eNB, PDCP communicate with a NETLINK socket if connected to network driver, else could use a RT-FIFO")
add_boolean_option(PDCP_USE_NETLINK_QUEUES False "When PDCP_USE_NETLINK is true, incoming IP packets are stored in queues") add_boolean_option(PDCP_USE_NETLINK_QUEUES False "When PDCP_USE_NETLINK is true, incoming IP packets are stored in queues")
add_boolean_option(LINK_ENB_PDCP_TO_IP_DRIVER False "For eNB, PDCP communicate with a IP driver") add_boolean_option(LINK_ENB_PDCP_TO_IP_DRIVER False "For eNB, PDCP communicate with a IP driver")
add_boolean_option(LINK_ENB_PDCP_TO_GTPV1U True "For eNB, PDCP communicate with GTP-U protocol (eNB<->S-GW)") add_boolean_option(LINK_ENB_PDCP_TO_GTPV1U True "For eNB, PDCP communicate with GTP-U protocol (eNB<->S-GW)")
......
...@@ -656,7 +656,7 @@ typedef struct { ...@@ -656,7 +656,7 @@ typedef struct {
/// \brief Total gains with bypassed RF gain stage (ExpressMIMO2/Lime) /// \brief Total gains with bypassed RF gain stage (ExpressMIMO2/Lime)
uint32_t rx_gain_byp[4]; uint32_t rx_gain_byp[4];
/// \brief Current transmit power /// \brief Current transmit power
int8_t tx_power_dBm[10]; int16_t tx_power_dBm[10];
/// \brief Total number of REs in current transmission /// \brief Total number of REs in current transmission
int tx_total_RE[10]; int tx_total_RE[10];
/// \brief Maximum transmit power /// \brief Maximum transmit power
......
...@@ -119,7 +119,7 @@ typedef struct { ...@@ -119,7 +119,7 @@ typedef struct {
Byte_t digit14:4; Byte_t digit14:4;
Byte_t digit13:4; Byte_t digit13:4;
#define EVEN_PARITY 0 #define EVEN_PARITY 0
#define ODD_PARITY 1 #define ODD_PARITY 0xf
Byte_t parity:4; Byte_t parity:4;
Byte_t digit15:4; Byte_t digit15:4;
} num; } num;
......
...@@ -1356,7 +1356,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf ...@@ -1356,7 +1356,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf
// Trigger BSR Periodic // Trigger BSR Periodic
UE_mac_inst[module_idP].BSR_reporting_active |= BSR_TRIGGER_PERIODIC; UE_mac_inst[module_idP].BSR_reporting_active |= BSR_TRIGGER_PERIODIC;
LOG_I(MAC,"[UE %d] MAC BSR Triggered PeriodicBSR Timer expiry at frame%d subframe %d TBS=%d\n", LOG_D(MAC,"[UE %d] MAC BSR Triggered PeriodicBSR Timer expiry at frame%d subframe %d TBS=%d\n",
module_idP, frameP, subframe, buflen); module_idP, frameP, subframe, buflen);
} }
......
...@@ -493,7 +493,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) ...@@ -493,7 +493,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
ctxt.enb_flag = ctxt_cpy.enb_flag; ctxt.enb_flag = ctxt_cpy.enb_flag;
#ifdef PDCP_DEBUG #ifdef PDCP_DEBUG
LOG_I(PDCP, "[PDCP][NETLINK] pdcp_read_header_g.rb_id = %d\n", pdcp_read_header_g.rb_id); LOG_D(PDCP, "[PDCP][NETLINK] pdcp_read_header_g.rb_id = %d\n", pdcp_read_header_g.rb_id);
#endif #endif
if (ctxt_cpy.enb_flag) { if (ctxt_cpy.enb_flag) {
......
...@@ -426,7 +426,7 @@ rlc_um_rx (const protocol_ctxt_t* const ctxt_pP, void *argP, struct mac_data_ind ...@@ -426,7 +426,7 @@ rlc_um_rx (const protocol_ctxt_t* const ctxt_pP, void *argP, struct mac_data_ind
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
struct mac_status_resp struct mac_status_resp
rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP) rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP,const eNB_flag_t enb_flagP)
{ {
struct mac_status_resp status_resp; struct mac_status_resp status_resp;
uint16_t sdu_size = 0; uint16_t sdu_size = 0;
...@@ -434,6 +434,7 @@ rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP ...@@ -434,6 +434,7 @@ rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP
int32_t diff_time=0; int32_t diff_time=0;
rlc_um_entity_t *rlc_p = NULL; rlc_um_entity_t *rlc_p = NULL;
mem_block_t *mb_p = NULL; mem_block_t *mb_p = NULL;
unsigned int max_li_overhead = 0;
status_resp.buffer_occupancy_in_pdus = 0; status_resp.buffer_occupancy_in_pdus = 0;
status_resp.buffer_occupancy_in_bytes = 0; status_resp.buffer_occupancy_in_bytes = 0;
...@@ -453,7 +454,20 @@ rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP ...@@ -453,7 +454,20 @@ rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP
if ((status_resp.buffer_occupancy_in_bytes > 0) && ((mb_p = list_get_head(&rlc_p->input_sdus)) != NULL)) { if ((status_resp.buffer_occupancy_in_bytes > 0) && ((mb_p = list_get_head(&rlc_p->input_sdus)) != NULL)) {
status_resp.buffer_occupancy_in_bytes += rlc_p->tx_header_min_length_in_bytes; //Fix on full Header size
if (enb_flagP == ENB_FLAG_NO)
{
// compute Length Indicator overhead to inform MAC of maximum full RLC PDU size according to stored SDUs
// For UE scheduler
// Could be useful for eNB: to be checked
if (rlc_p->input_sdus.nb_elements <= 1) {
max_li_overhead = 0;
} else {
unsigned int num_li = rlc_p->input_sdus.nb_elements - 1;
max_li_overhead = num_li + (num_li >> 1) + (num_li & 1);
}
}
status_resp.buffer_occupancy_in_bytes += (rlc_p->tx_header_min_length_in_bytes + max_li_overhead);
status_resp.buffer_occupancy_in_pdus = rlc_p->input_sdus.nb_elements; status_resp.buffer_occupancy_in_pdus = rlc_p->input_sdus.nb_elements;
diff_time = ctxt_pP->frame - ((struct rlc_um_tx_sdu_management *)mb_p->data)->sdu_creation_time; diff_time = ctxt_pP->frame - ((struct rlc_um_tx_sdu_management *)mb_p->data)->sdu_creation_time;
......
...@@ -186,7 +186,7 @@ protected_rlc_um( void rlc_um_rx (const protocol_ctxt_t* const ctxt_pP, rlc_ ...@@ -186,7 +186,7 @@ protected_rlc_um( void rlc_um_rx (const protocol_ctxt_t* const ctxt_pP, rlc_
* \param[in] tx_statusP Transmission status given by MAC on previous MAC transmission of the PDU. * \param[in] tx_statusP Transmission status given by MAC on previous MAC transmission of the PDU.
* \return The maximum number of bytes that can be served by RLC instance to MAC. * \return The maximum number of bytes that can be served by RLC instance to MAC.
*/ */
public_rlc_um( struct mac_status_resp rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP);) public_rlc_um( struct mac_status_resp rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP, const eNB_flag_t enb_flagP);)
/*! \fn struct mac_data_req rlc_um_mac_data_request (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP) /*! \fn struct mac_data_req rlc_um_mac_data_request (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP)
* \brief Gives PDUs to lower layer MAC. * \brief Gives PDUs to lower layer MAC.
......
...@@ -471,9 +471,9 @@ void rlc_um_v9_3_0_test_exchange_pdus(rlc_um_entity_t *um_txP, ...@@ -471,9 +471,9 @@ void rlc_um_v9_3_0_test_exchange_pdus(rlc_um_entity_t *um_txP,
memset(&mac_rlc_status_resp_tx, 0, sizeof(struct mac_status_resp)); memset(&mac_rlc_status_resp_tx, 0, sizeof(struct mac_status_resp));
memset(&mac_rlc_status_resp_rx, 0, sizeof(struct mac_status_resp)); memset(&mac_rlc_status_resp_rx, 0, sizeof(struct mac_status_resp));
mac_rlc_status_resp_tx = rlc_um_mac_status_indication(um_txP, g_frame, 1, bytes_txP, tx_status); mac_rlc_status_resp_tx = rlc_um_mac_status_indication(um_txP, g_frame, 1, bytes_txP, tx_status,ENB_FLAG_YES);
data_request_tx = rlc_um_mac_data_request(um_txP, g_frame); data_request_tx = rlc_um_mac_data_request(um_txP, g_frame);
mac_rlc_status_resp_rx = rlc_um_mac_status_indication(um_rxP, g_frame, 0, bytes_rxP, tx_status); mac_rlc_status_resp_rx = rlc_um_mac_status_indication(um_rxP, g_frame, 0, bytes_rxP, tx_status,ENB_FLAG_YES);
data_request_rx = rlc_um_mac_data_request(um_rxP, g_frame); data_request_rx = rlc_um_mac_data_request(um_rxP, g_frame);
...@@ -517,9 +517,9 @@ void rlc_um_v9_3_0_test_exchange_delayed_pdus(rlc_um_entity_t *um_txP, ...@@ -517,9 +517,9 @@ void rlc_um_v9_3_0_test_exchange_delayed_pdus(rlc_um_entity_t *um_txP,
memset(&mac_rlc_status_resp_tx, 0, sizeof(struct mac_status_resp)); memset(&mac_rlc_status_resp_tx, 0, sizeof(struct mac_status_resp));
memset(&mac_rlc_status_resp_rx, 0, sizeof(struct mac_status_resp)); memset(&mac_rlc_status_resp_rx, 0, sizeof(struct mac_status_resp));
mac_rlc_status_resp_tx = rlc_um_mac_status_indication(um_txP, g_frame, 1, bytes_txP, tx_status); mac_rlc_status_resp_tx = rlc_um_mac_status_indication(um_txP, g_frame, 1, bytes_txP, tx_status,ENB_FLAG_YES);
data_request_tx = rlc_um_mac_data_request(um_txP, g_frame); data_request_tx = rlc_um_mac_data_request(um_txP, g_frame);
mac_rlc_status_resp_rx = rlc_um_mac_status_indication(um_rxP, g_frame, 0, bytes_rxP, tx_status); mac_rlc_status_resp_rx = rlc_um_mac_status_indication(um_rxP, g_frame, 0, bytes_rxP, tx_status,ENB_FLAG_YES);
data_request_rx = rlc_um_mac_data_request(um_rxP, g_frame); data_request_rx = rlc_um_mac_data_request(um_rxP, g_frame);
......
...@@ -406,7 +406,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind( ...@@ -406,7 +406,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind(
break; break;
case RLC_MODE_UM: case RLC_MODE_UM:
status_resp = rlc_um_mac_status_indication(&ctxt, &rlc_union_p->rlc.um, tb_sizeP, tx_status); status_resp = rlc_um_mac_status_indication(&ctxt, &rlc_union_p->rlc.um, tb_sizeP, tx_status, enb_flagP);
mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes; mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes;
mac_rlc_status_resp.pdus_in_buffer = status_resp.buffer_occupancy_in_pdus; mac_rlc_status_resp.pdus_in_buffer = status_resp.buffer_occupancy_in_pdus;
mac_rlc_status_resp.head_sdu_creation_time = status_resp.head_sdu_creation_time; mac_rlc_status_resp.head_sdu_creation_time = status_resp.head_sdu_creation_time;
......
...@@ -99,7 +99,8 @@ ue_ip_common_class_wireless2ip( ...@@ -99,7 +99,8 @@ ue_ip_common_class_wireless2ip(
hard_header_len = ue_ip_dev[instP]->hard_header_len; hard_header_len = ue_ip_dev[instP]->hard_header_len;
skb_set_mac_header(skb_p, 0); skb_set_mac_header(skb_p, 0);
skb_set_network_header(skb_p, hard_header_len);
skb_p->mark = rb_idP;
//printk("[NAC_COMMIN_RECEIVE]: Packet Type %d (%d,%d)",skb_p->pkt_type,PACKET_HOST,PACKET_BROADCAST); //printk("[NAC_COMMIN_RECEIVE]: Packet Type %d (%d,%d)",skb_p->pkt_type,PACKET_HOST,PACKET_BROADCAST);
skb_p->pkt_type = PACKET_HOST; skb_p->pkt_type = PACKET_HOST;
...@@ -344,7 +345,7 @@ void ue_ip_common_wireless2ip(struct nlmsghdr *nlh_pP) ...@@ -344,7 +345,7 @@ void ue_ip_common_wireless2ip(struct nlmsghdr *nlh_pP)
ue_ip_common_class_wireless2ip(pdcph_p->data_size, ue_ip_common_class_wireless2ip(pdcph_p->data_size,
(unsigned char *)NLMSG_DATA(nlh_pP) + UE_IP_PDCPH_SIZE, (unsigned char *)NLMSG_DATA(nlh_pP) + UE_IP_PDCPH_SIZE,
pdcph_p->inst, 1, //pdcph_p->inst,
pdcph_p->rb_id); pdcph_p->rb_id);
} }
......
...@@ -188,10 +188,11 @@ int decode_attach_accept(attach_accept_msg *attach_accept, uint8_t *buffer, uint ...@@ -188,10 +188,11 @@ int decode_attach_accept(attach_accept_msg *attach_accept, uint8_t *buffer, uint
default: default:
errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI;
LOG_TRACE(WARNING, "DECODE_UNEXPECTED_IEI %x (4 bits)", ieiDecoded);
return TLV_DECODE_UNEXPECTED_IEI; return TLV_DECODE_UNEXPECTED_IEI;
} }
} }
LOG_TRACE(WARNING, "DECODED %d\n", decoded);
return decoded; return decoded;
} }
......
...@@ -38,7 +38,7 @@ int decode_authentication_request(authentication_request_msg *authentication_req ...@@ -38,7 +38,7 @@ int decode_authentication_request(authentication_request_msg *authentication_req
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, AUTHENTICATION_REQUEST_MINIMUM_LENGTH, len); CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, AUTHENTICATION_REQUEST_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */ /* Decoding mandatory fields */
if ((decoded_result = decode_u8_nas_key_set_identifier(&authentication_request->naskeysetidentifierasme, 0, *(buffer + decoded) >> 4, len - decoded)) < 0) if ((decoded_result = decode_u8_nas_key_set_identifier(&authentication_request->naskeysetidentifierasme, 0, *(buffer + decoded), len - decoded)) < 0)
return decoded_result; return decoded_result;
decoded++; decoded++;
......
...@@ -72,6 +72,8 @@ int decode_security_mode_command(security_mode_command_msg *security_mode_comman ...@@ -72,6 +72,8 @@ int decode_security_mode_command(security_mode_command_msg *security_mode_comman
decoded += decoded_result; decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */ /* Set corresponding mask to 1 in presencemask */
security_mode_command->presencemask |= SECURITY_MODE_COMMAND_IMEISV_REQUEST_PRESENT; security_mode_command->presencemask |= SECURITY_MODE_COMMAND_IMEISV_REQUEST_PRESENT;
LOG_I(NAS," SECURITY MODE COMMAND: IMEISV_REQUEST: %d \n",security_mode_command->imeisvrequest);
break; break;
case SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_IEI: case SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_IEI:
......
...@@ -76,8 +76,11 @@ int encode_security_mode_complete(security_mode_complete_msg *security_mode_comp ...@@ -76,8 +76,11 @@ int encode_security_mode_complete(security_mode_complete_msg *security_mode_comp
/* Checking IEI and pointer */ /* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, SECURITY_MODE_COMPLETE_MINIMUM_LENGTH, len); CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, SECURITY_MODE_COMPLETE_MINIMUM_LENGTH, len);
LOG_I(NAS,"SECURITY MODE COMMAND COMPLETE: presencemask: %d \n",security_mode_complete->presencemask);
if ((security_mode_complete->presencemask & SECURITY_MODE_COMPLETE_IMEISV_PRESENT) if ((security_mode_complete->presencemask & SECURITY_MODE_COMPLETE_IMEISV_PRESENT)
== SECURITY_MODE_COMPLETE_IMEISV_PRESENT) { == SECURITY_MODE_COMPLETE_IMEISV_PRESENT) {
LOG_I(NAS,"SECURITY MODE COMMAND COMPLETE: encode imeisv \n");
if ((encode_result = if ((encode_result =
encode_mobile_identity(&security_mode_complete->imeisv, encode_mobile_identity(&security_mode_complete->imeisv,
SECURITY_MODE_COMPLETE_IMEISV_IEI, buffer + encoded, len - SECURITY_MODE_COMPLETE_IMEISV_IEI, buffer + encoded, len -
...@@ -87,7 +90,7 @@ int encode_security_mode_complete(security_mode_complete_msg *security_mode_comp ...@@ -87,7 +90,7 @@ int encode_security_mode_complete(security_mode_complete_msg *security_mode_comp
else else
encoded += encode_result; encoded += encode_result;
} }
LOG_I(NAS,"SECURITY MODE COMMAND COMPLETE done !!! \n");
return encoded; return encoded;
} }
...@@ -41,10 +41,24 @@ int decode_emergency_number_list(EmergencyNumberList *emergencynumberlist, uint8 ...@@ -41,10 +41,24 @@ int decode_emergency_number_list(EmergencyNumberList *emergencynumberlist, uint8
ielen = *(buffer + decoded); ielen = *(buffer + decoded);
decoded++; decoded++;
CHECK_LENGTH_DECODER(len - decoded, ielen); CHECK_LENGTH_DECODER(len - decoded, ielen);
emergencynumberlist->lengthofemergency = *(buffer + decoded); int information_element_index = 0;
decoded++; while ((decoded < ielen) && (information_element_index < EMERGENCY_NUMBER_LIST_MAX_NUMBER_INFORMATION)) {
emergencynumberlist->emergencyservicecategoryvalue = *(buffer + decoded) & 0x1f; emergencynumberlist->emergency_number_information[information_element_index].lengthofemergency = *(buffer + decoded);
decoded++; decoded++;
emergencynumberlist->emergency_number_information[information_element_index].emergencyservicecategoryvalue = *(buffer + decoded) & 0x1f;
decoded++;
int remaining_len = emergencynumberlist->emergency_number_information[information_element_index].lengthofemergency - 1;
int digit_index = 0;
while (remaining_len > 0) {
emergencynumberlist->emergency_number_information[information_element_index].bcd_digits[digit_index++] = *(buffer + decoded);
decoded++;
remaining_len --;
}
while (digit_index < EMERGENCY_NUMBER_LIST_MAX_2DIGITS) {
emergencynumberlist->emergency_number_information[information_element_index].bcd_digits[digit_index++] = 0xFF;
}
information_element_index++;
}
#if defined (NAS_DEBUG) #if defined (NAS_DEBUG)
dump_emergency_number_list_xml(emergencynumberlist, iei); dump_emergency_number_list_xml(emergencynumberlist, iei);
#endif #endif
...@@ -67,11 +81,16 @@ int encode_emergency_number_list(EmergencyNumberList *emergencynumberlist, uint8 ...@@ -67,11 +81,16 @@ int encode_emergency_number_list(EmergencyNumberList *emergencynumberlist, uint8
lenPtr = (buffer + encoded); lenPtr = (buffer + encoded);
encoded ++; encoded ++;
*(buffer + encoded) = emergencynumberlist->lengthofemergency; for ( int ie_index = 0; ie_index < emergencynumberlist->num_emergency_elements; ie_index++) {
encoded++; *(buffer + encoded) = emergencynumberlist->emergency_number_information[ie_index].lengthofemergency;
*(buffer + encoded) = 0x00 | encoded++;
(emergencynumberlist->emergencyservicecategoryvalue & 0x1f); *(buffer + encoded) = 0x00 |
encoded++; (emergencynumberlist->emergency_number_information[ie_index].emergencyservicecategoryvalue & 0x1f);
encoded++;
for (int bcd2_index = 0; bcd2_index < (emergencynumberlist->emergency_number_information[ie_index].lengthofemergency - 1); bcd2_index++) {
*(buffer + encoded) = emergencynumberlist->emergency_number_information[ie_index].bcd_digits[bcd2_index];
}
}
*lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0);
return encoded; return encoded;
} }
...@@ -83,9 +102,20 @@ void dump_emergency_number_list_xml(EmergencyNumberList *emergencynumberlist, ui ...@@ -83,9 +102,20 @@ void dump_emergency_number_list_xml(EmergencyNumberList *emergencynumberlist, ui
if (iei > 0) if (iei > 0)
/* Don't display IEI if = 0 */ /* Don't display IEI if = 0 */
printf(" <IEI>0x%X</IEI>\n", iei); printf(" <IEI>0x%X</IEI>\n", iei);
for ( int ie_index = 0; ie_index < emergencynumberlist->num_emergency_elements; ie_index++) {
printf(" <Length of emergency>%u</Length of emergency>\n", emergencynumberlist->lengthofemergency); printf(" <Length of emergency>%u</Length of emergency>\n", emergencynumberlist->emergency_number_information[ie_index].lengthofemergency);
printf(" <Emergency service category value>%u</Emergency service category value>\n", emergencynumberlist->emergencyservicecategoryvalue); printf(" <Emergency service category value>%u</Emergency service category value>\n", emergencynumberlist->emergency_number_information[ie_index].emergencyservicecategoryvalue);
for (int bcd2_index = 0; bcd2_index < (emergencynumberlist->emergency_number_information[ie_index].lengthofemergency - 1); bcd2_index++) {
uint8_t bcd1 = emergencynumberlist->emergency_number_information[ie_index].bcd_digits[bcd2_index] & 0x0f;
uint8_t bcd2 = (emergencynumberlist->emergency_number_information[ie_index].bcd_digits[bcd2_index] & 0xf0) >> 4;
if (bcd1 < 10) {
printf(" <BCD Digit%u>%u</BCD Digit%u>\n", (bcd2_index*2)+1, bcd1, (bcd2_index*2)+1);
if (bcd2 < 10) {
printf(" <BCD Digit%u>%u</BCD Digit%u>\n", (bcd2_index*2)+2, bcd2, (bcd2_index*2)+2);
}
}
}
}
printf("</Emergency Number List>\n"); printf("</Emergency Number List>\n");
} }
...@@ -32,8 +32,14 @@ ...@@ -32,8 +32,14 @@
#define EMERGENCY_NUMBER_LIST_MAXIMUM_LENGTH 50 #define EMERGENCY_NUMBER_LIST_MAXIMUM_LENGTH 50
typedef struct EmergencyNumberList_tag { typedef struct EmergencyNumberList_tag {
uint8_t lengthofemergency; uint8_t num_emergency_elements;
uint8_t emergencyservicecategoryvalue:5; struct {
uint8_t lengthofemergency;
uint8_t emergencyservicecategoryvalue:5;
#define EMERGENCY_NUMBER_LIST_MAX_2DIGITS 6
uint8_t bcd_digits[EMERGENCY_NUMBER_LIST_MAX_2DIGITS]; // length to be fixed
#define EMERGENCY_NUMBER_LIST_MAX_NUMBER_INFORMATION 2
} emergency_number_information[EMERGENCY_NUMBER_LIST_MAX_NUMBER_INFORMATION];
} EmergencyNumberList; } EmergencyNumberList;
int encode_emergency_number_list(EmergencyNumberList *emergencynumberlist, uint8_t iei, uint8_t *buffer, uint32_t len); int encode_emergency_number_list(EmergencyNumberList *emergencynumberlist, uint8_t iei, uint8_t *buffer, uint32_t len);
......
...@@ -575,6 +575,8 @@ static int encode_imei_mobile_identity(ImeiMobileIdentity_t *imei, uint8_t *buff ...@@ -575,6 +575,8 @@ static int encode_imei_mobile_identity(ImeiMobileIdentity_t *imei, uint8_t *buff
static int encode_imeisv_mobile_identity(ImeisvMobileIdentity_t *imeisv, uint8_t *buffer) static int encode_imeisv_mobile_identity(ImeisvMobileIdentity_t *imeisv, uint8_t *buffer)
{ {
uint32_t encoded = 0; uint32_t encoded = 0;
LOG_I(NAS,"SECURITY MODE COMMAND COMPLETE: encode_imeisv_mobile_identity \n");
*(buffer + encoded) = 0x00 | (imeisv->digit1 << 4) | (imeisv->oddeven << 3) | *(buffer + encoded) = 0x00 | (imeisv->digit1 << 4) | (imeisv->oddeven << 3) |
(imeisv->typeofidentity); (imeisv->typeofidentity);
encoded++; encoded++;
...@@ -590,12 +592,15 @@ static int encode_imeisv_mobile_identity(ImeisvMobileIdentity_t *imeisv, uint8_t ...@@ -590,12 +592,15 @@ static int encode_imeisv_mobile_identity(ImeisvMobileIdentity_t *imeisv, uint8_t
encoded++; encoded++;
*(buffer + encoded) = 0x00 | (imeisv->digit13 << 4) | imeisv->digit12; *(buffer + encoded) = 0x00 | (imeisv->digit13 << 4) | imeisv->digit12;
encoded++; encoded++;
*(buffer + encoded) = 0x00 | (imeisv->digit15 << 4) | imeisv->digit14;
encoded++;
*(buffer + encoded) = 0x00 | (imeisv->parity << 4) | imeisv->digit16;
if (imeisv->oddeven != MOBILE_IDENTITY_EVEN) { //if (imeisv->oddeven != MOBILE_IDENTITY_EVEN) {
*(buffer + encoded) = 0x00 | (imeisv->digit15 << 4) | imeisv->digit14; // *(buffer + encoded) = 0x00 | (imeisv->digit15 << 4) | imeisv->digit14;
} else { //} else {
*(buffer + encoded) = 0xf0 | imeisv->digit14; // *(buffer + encoded) = 0xf0 | imeisv->digit14;
} //}
encoded++; encoded++;
return encoded; return encoded;
......
...@@ -73,8 +73,63 @@ typedef struct { ...@@ -73,8 +73,63 @@ typedef struct {
uint8_t mbmssessionid; uint8_t mbmssessionid;
} TmgiMobileIdentity_t; } TmgiMobileIdentity_t;
typedef struct imeisv_s{
uint8_t digit1:4;
uint8_t oddeven:1;
uint8_t typeofidentity:3;
uint8_t digit2:4;
uint8_t digit3:4;
uint8_t digit4:4;
uint8_t digit5:4;
uint8_t digit6:4;
uint8_t digit7:4;
uint8_t digit8:4;
uint8_t digit9:4;
uint8_t digit10:4;
uint8_t digit11:4;
uint8_t digit12:4;
uint8_t digit13:4;
uint8_t digit14:4;
uint8_t digit15:4;
uint8_t digit16:4;
#define EVEN_PARITY 0
#define ODD_PARITY 1
uint8_t parity:4;
} imeisv_t;
#if 0
typedef struct imeisv_s {
uint8_t length;
union {
struct {
uint8_t tac2:4;
uint8_t tac1:4;
uint8_t tac4:4;
uint8_t tac3:4;
uint8_t tac6:4;
uint8_t tac5:4;
uint8_t tac8:4;
uint8_t tac7:4;
uint8_t snr2:4;
uint8_t snr1:4;
uint8_t snr4:4;
uint8_t snr3:4;
uint8_t snr6:4;
uint8_t snr5:4;
uint8_t svn2:4;
uint8_t svn1:4;
#define EVEN_PARITY 0
#define ODD_PARITY 1
uint8_t parity:4;
} num;
#define IMEISV_BCD8_SIZE 9
uint8_t value[IMEISV_BCD8_SIZE];
} u;
} imeisv_t;
#endif
typedef ImsiMobileIdentity_t ImeiMobileIdentity_t; typedef ImsiMobileIdentity_t ImeiMobileIdentity_t;
typedef ImsiMobileIdentity_t ImeisvMobileIdentity_t; typedef imeisv_t ImeisvMobileIdentity_t;
typedef ImsiMobileIdentity_t TmsiMobileIdentity_t; typedef ImsiMobileIdentity_t TmsiMobileIdentity_t;
typedef ImsiMobileIdentity_t NoMobileIdentity_t; typedef ImsiMobileIdentity_t NoMobileIdentity_t;
......
...@@ -120,6 +120,7 @@ typedef struct emm_as_security_s { ...@@ -120,6 +120,7 @@ typedef struct emm_as_security_s {
uint8_t ucs2; uint8_t ucs2;
uint8_t uia; /* Replayed UMTS integrity algorithms */ uint8_t uia; /* Replayed UMTS integrity algorithms */
uint8_t gea; /* Replayed GPRS encryption algorithms */ uint8_t gea; /* Replayed GPRS encryption algorithms */
uint8_t imeisv_request;
uint8_t umts_present; uint8_t umts_present;
uint8_t gprs_present; uint8_t gprs_present;
......
...@@ -472,13 +472,15 @@ int emm_recv_security_mode_command(security_mode_command_msg *msg, ...@@ -472,13 +472,15 @@ int emm_recv_security_mode_command(security_mode_command_msg *msg,
* Message processing * Message processing
*/ */
/* Execute the security mode control procedure initiated by the network */ /* Execute the security mode control procedure initiated by the network */
LOG_I(NAS,"Execute the security mode control procedure initiated by the network: imeisvrequest %d\n",msg->imeisvrequest);
rc = emm_proc_security_mode_command( rc = emm_proc_security_mode_command(
msg->naskeysetidentifier.tsc != NAS_KEY_SET_IDENTIFIER_MAPPED, msg->naskeysetidentifier.tsc != NAS_KEY_SET_IDENTIFIER_MAPPED,
msg->naskeysetidentifier.naskeysetidentifier, msg->naskeysetidentifier.naskeysetidentifier,
msg->selectednassecurityalgorithms.typeofcipheringalgorithm, msg->selectednassecurityalgorithms.typeofcipheringalgorithm,
msg->selectednassecurityalgorithms.typeofintegrityalgorithm, msg->selectednassecurityalgorithms.typeofintegrityalgorithm,
msg->replayeduesecuritycapabilities.eea, msg->replayeduesecuritycapabilities.eea,
msg->replayeduesecuritycapabilities.eia); msg->replayeduesecuritycapabilities.eia,
msg->imeisvrequest & 0x7);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
......
...@@ -855,6 +855,35 @@ int emm_send_security_mode_complete(const emm_as_security_t *msg, ...@@ -855,6 +855,35 @@ int emm_send_security_mode_complete(const emm_as_security_t *msg,
/* Mandatory - Message type */ /* Mandatory - Message type */
emm_msg->messagetype = SECURITY_MODE_COMPLETE; emm_msg->messagetype = SECURITY_MODE_COMPLETE;
if(msg->imeisv_request)
{
// configure imeisv param
emm_msg->presencemask |= SECURITY_MODE_COMPLETE_IMEISV_PRESENT;
// 33 85 76 02 05 26 84 01 F1
emm_msg->imeisv.imeisv;
emm_msg->imeisv.imeisv.digit1 = 0x3;
emm_msg->imeisv.imeisv.oddeven = 0x0;
emm_msg->imeisv.imeisv.typeofidentity = 0x3;
emm_msg->imeisv.imeisv.digit2 = 0x5;
emm_msg->imeisv.imeisv.digit3 = 0x7;
emm_msg->imeisv.imeisv.digit4 = 0x4;
emm_msg->imeisv.imeisv.digit5 = 0x7;
emm_msg->imeisv.imeisv.digit6 = 0x3;
emm_msg->imeisv.imeisv.digit7 = 0x0;
emm_msg->imeisv.imeisv.digit8 = 0x4;
emm_msg->imeisv.imeisv.digit9 = 0x0;
emm_msg->imeisv.imeisv.digit10 = 0x0;
emm_msg->imeisv.imeisv.digit11 = 0x7;
emm_msg->imeisv.imeisv.digit12 = 0x0;
emm_msg->imeisv.imeisv.digit13 = 0x5;
emm_msg->imeisv.imeisv.digit14 = 0x3;
emm_msg->imeisv.imeisv.digit15 = 0x0;
emm_msg->imeisv.imeisv.digit16 = 0x0;
emm_msg->imeisv.imeisv.parity = ODD_PARITY;
size += SECURITY_MODE_COMPLETE_MAXIMUM_LENGTH;
}
LOG_FUNC_RETURN (size); LOG_FUNC_RETURN (size);
} }
......
...@@ -146,7 +146,7 @@ static void _security_release(emm_security_context_t *ctx); ...@@ -146,7 +146,7 @@ static void _security_release(emm_security_context_t *ctx);
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_security_mode_command(int native_ksi, int ksi, int emm_proc_security_mode_command(int native_ksi, int ksi,
int seea, int seia, int reea, int reia) int seea, int seia, int reea, int reia, int imeisv_request)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -329,6 +329,7 @@ int emm_proc_security_mode_command(int native_ksi, int ksi, ...@@ -329,6 +329,7 @@ int emm_proc_security_mode_command(int native_ksi, int ksi,
emm_sap.u.emm_as.u.security.guti = _emm_data.guti; emm_sap.u.emm_as.u.security.guti = _emm_data.guti;
emm_sap.u.emm_as.u.security.ueid = 0; emm_sap.u.emm_as.u.security.ueid = 0;
emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_SMC; emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_SMC;
emm_sap.u.emm_as.u.security.imeisv_request = imeisv_request;
emm_sap.u.emm_as.u.security.emm_cause = emm_cause; emm_sap.u.emm_as.u.security.emm_cause = emm_cause;
/* Setup EPS NAS security data */ /* Setup EPS NAS security data */
emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx, emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx,
......
...@@ -174,7 +174,7 @@ int emm_proc_authentication_delete(void); ...@@ -174,7 +174,7 @@ int emm_proc_authentication_delete(void);
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
int emm_proc_security_mode_command(int native_ksi, int ksi, int seea, int seia, int emm_proc_security_mode_command(int native_ksi, int ksi, int seea, int seia,
int reea, int reia); int reea, int reia,int imeisv_request);
/* /*
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
......
...@@ -188,9 +188,9 @@ void pdcp_rlc_test_exchange_pdus(rlc_um_entity_t *um_txP, ...@@ -188,9 +188,9 @@ void pdcp_rlc_test_exchange_pdus(rlc_um_entity_t *um_txP,
memset(&mac_rlc_status_resp_tx, 0, sizeof(struct mac_status_resp)); memset(&mac_rlc_status_resp_tx, 0, sizeof(struct mac_status_resp));
memset(&mac_rlc_status_resp_rx, 0, sizeof(struct mac_status_resp)); memset(&mac_rlc_status_resp_rx, 0, sizeof(struct mac_status_resp));
mac_rlc_status_resp_tx = rlc_um_mac_status_indication(um_txP, bytes_txP, tx_status); mac_rlc_status_resp_tx = rlc_um_mac_status_indication(um_txP, bytes_txP, tx_status, ENB_FLAG_YES);
data_request_tx = rlc_um_mac_data_request(um_txP); data_request_tx = rlc_um_mac_data_request(um_txP);
mac_rlc_status_resp_rx = rlc_um_mac_status_indication(um_rxP, bytes_rxP, tx_status); mac_rlc_status_resp_rx = rlc_um_mac_status_indication(um_rxP, bytes_rxP, tx_status, ENB_FLAG_YES);
data_request_rx = rlc_um_mac_data_request(um_rxP); data_request_rx = rlc_um_mac_data_request(um_rxP);
......
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