Commit aff0b849 authored by gauthier's avatar gauthier

moved RAL-LTE from trunk/openair3 to extras/openair3


git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7752 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 007544e1
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@eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
#define MIH_C_INTERFACE
#define MIH_C_C
#include "MIH_C.h"
//-----------------------------------------------------------------------------
void MIH_C_init(void)
{
//-----------------------------------------------------------------------------
}
//-----------------------------------------------------------------------------
void MIH_C_exit(void)
{
//-----------------------------------------------------------------------------
}
/*******************************************************************************
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@eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
#define MIH_C_INTERFACE
#define MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS_C
#include "MIH_C_F13_data_types_for_information_elements_codec.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@eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
#define MIH_C_INTERFACE
#define MIH_C_F2_GENERAL_DATA_TYPES_CODEC_C
#include "MIH_C_F2_general_data_types_codec.h"
//-----------------------------------------------------------------------------
unsigned int MIH_C_BOOLEAN2String(MIH_C_BOOLEAN_T* dataP, char* bufP)
{
//-----------------------------------------------------------------------------
unsigned int buffer_index = 0;
if (*dataP != MIH_C_BOOLEAN_FALSE) {
buffer_index += sprintf(&bufP[buffer_index], "TRUE");
} else {
buffer_index += sprintf(&bufP[buffer_index], "FALSE");
}
return buffer_index;
}
//-----------------------------------------------------------------------------
unsigned int MIH_C_STATUS2String(MIH_C_STATUS_T *statusP, char* bufP)
{
//-----------------------------------------------------------------------------
unsigned int buffer_index = 0;
switch (*statusP) {
case MIH_C_STATUS_SUCCESS:
buffer_index += sprintf(&bufP[buffer_index], "STATUS_SUCCESS");
break;
case MIH_C_STATUS_UNSPECIFIED_FAILURE:
buffer_index += sprintf(&bufP[buffer_index], "STATUS_UNSPECIFIED_FAILURE");
break;
case MIH_C_STATUS_REJECTED:
buffer_index += sprintf(&bufP[buffer_index], "STATUS_REJECTED");
break;
case MIH_C_STATUS_AUTHORIZATION_FAILURE:
buffer_index += sprintf(&bufP[buffer_index], "STATUS_AUTHORIZATION_FAILURE");
break;
case MIH_C_STATUS_NETWORK_ERROR:
buffer_index += sprintf(&bufP[buffer_index], "STATUS_NETWORK_ERROR");
break;
default:
buffer_index += sprintf(&bufP[buffer_index], "UNKNOWN_STATUS");
}
return buffer_index;
}
/*******************************************************************************
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@eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
#define MIH_C_INTERFACE
#define MIH_C_F3_DATA_TYPES_FOR_ADDRESS_CODEC_C
#include "MIH_C_F3_data_types_for_address_codec.h"
//-----------------------------------------------------------------------------
unsigned int MIH_C_3GPP_2G_CELL_ID2String(MIH_C_3GPP_2G_CELL_ID_T *dataP, char* bufP)
{
//-----------------------------------------------------------------------------
unsigned int buffer_index = 0;
buffer_index += sprintf(&bufP[buffer_index], "PLMN_ID = ");
buffer_index += MIH_C_PLMN_ID2String(&dataP->plmn_id, &bufP[buffer_index]);
buffer_index += sprintf(&bufP[buffer_index], "LAC = ");
buffer_index += MIH_C_LAC2String(&dataP->lac, &bufP[buffer_index]);
buffer_index += sprintf(&bufP[buffer_index], "CI = ");
buffer_index += MIH_C_CI2String(&dataP->ci, &bufP[buffer_index]);
return buffer_index;
}
//-----------------------------------------------------------------------------
void MIH_C_3GPP_2G_CELL_ID_encode(Bit_Buffer_t* bbP, MIH_C_3GPP_2G_CELL_ID_T *dataP)
{
//-----------------------------------------------------------------------------
MIH_C_PLMN_ID_encode(bbP, &dataP->plmn_id);
MIH_C_LAC_encode(bbP, &dataP->lac);
MIH_C_CI_encode(bbP, &dataP->ci);
}
//-----------------------------------------------------------------------------
void MIH_C_3GPP_2G_CELL_ID_decode(Bit_Buffer_t* bbP, MIH_C_3GPP_2G_CELL_ID_T *dataP)
{
//-----------------------------------------------------------------------------
MIH_C_PLMN_ID_decode(bbP, &dataP->plmn_id);
MIH_C_LAC_decode(bbP, &dataP->lac);
MIH_C_CI_decode(bbP, &dataP->ci);
}
//-----------------------------------------------------------------------------
unsigned int MIH_C_3GPP_3G_CELL_ID2String(MIH_C_3GPP_3G_CELL_ID_T *dataP, char* bufP)
{
//-----------------------------------------------------------------------------
unsigned int buffer_index = 0;
buffer_index += MIH_C_PLMN_ID2String(&dataP->plmn_id, &bufP[buffer_index]);
buffer_index += MIH_C_CELL_ID2String(&dataP->cell_id, &bufP[buffer_index]);
return buffer_index;
}
//-----------------------------------------------------------------------------
void MIH_C_3GPP_3G_CELL_ID_encode(Bit_Buffer_t* bbP, MIH_C_3GPP_3G_CELL_ID_T *dataP)
{
//-----------------------------------------------------------------------------
MIH_C_PLMN_ID_encode(bbP, &dataP->plmn_id);
MIH_C_CELL_ID_encode(bbP, &dataP->cell_id);
}
//-----------------------------------------------------------------------------
void MIH_C_3GPP_3G_CELL_ID_decode(Bit_Buffer_t* bbP, MIH_C_3GPP_3G_CELL_ID_T *dataP)
{
//-----------------------------------------------------------------------------
MIH_C_PLMN_ID_decode(bbP, &dataP->plmn_id);
MIH_C_CELL_ID_decode(bbP, &dataP->cell_id);
}
//-----------------------------------------------------------------------------
unsigned int MIH_C_LINK_ADDR2String(MIH_C_LINK_ADDR_T *dataP, char* bufP)
{
//-----------------------------------------------------------------------------
unsigned int buffer_index = 0;
switch (dataP->choice) {
case MIH_C_CHOICE_MAC_ADDR:
buffer_index += sprintf(&bufP[buffer_index], "MAC_ADDR = ");
buffer_index += MIH_C_MAC_ADDR2String(&dataP->_union.mac_addr, &bufP[buffer_index]);
break;
case MIH_C_CHOICE_3GPP_3G_CELL_ID:
buffer_index += sprintf(&bufP[buffer_index], "3GPP_3G_CELL_ID = ");
buffer_index = MIH_C_3GPP_3G_CELL_ID2String(&dataP->_union._3gpp_3g_cell_id, &bufP[buffer_index]);
break;
case MIH_C_CHOICE_3GPP_2G_CELL_ID:
buffer_index += sprintf(&bufP[buffer_index], "3GPP_2G_CELL_ID = ");
buffer_index = MIH_C_3GPP_2G_CELL_ID2String(&dataP->_union._3gpp_2g_cell_id, &bufP[buffer_index]);
break;
case MIH_C_CHOICE_3GPP_ADDR:
buffer_index += sprintf(&bufP[buffer_index], "3GPP_ADDR = ");
buffer_index = MIH_C_3GPP_ADDR2String(&dataP->_union._3gpp_addr, &bufP[buffer_index]);
break;
case MIH_C_CHOICE_3GPP2_ADDR:
buffer_index += sprintf(&bufP[buffer_index], "3GPP2_ADDR = ");
buffer_index = MIH_C_3GPP2_ADDR2String(&dataP->_union._3gpp2_addr, &bufP[buffer_index]);
break;
case MIH_C_CHOICE_OTHER_L2_ADDR:
buffer_index += sprintf(&bufP[buffer_index], "OTHER_L2_ADDR = ");
buffer_index = MIH_C_OTHER_L2_ADDR2String(&dataP->_union.other_l2_addr, &bufP[buffer_index]);
break;
default:
buffer_index = sprintf(&bufP[buffer_index], "UNINITIALIZED ADDR");
}
return buffer_index;
}
//-----------------------------------------------------------------------------
void MIH_C_LINK_ADDR_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ADDR_T *dataP)
{
//-----------------------------------------------------------------------------
MIH_C_CHOICE_encode(bbP, &dataP->choice);
switch (dataP->choice) {
case MIH_C_CHOICE_MAC_ADDR:
MIH_C_MAC_ADDR_encode(bbP, &dataP->_union.mac_addr);
break;
case MIH_C_CHOICE_3GPP_3G_CELL_ID:
MIH_C_3GPP_3G_CELL_ID_encode(bbP, &dataP->_union._3gpp_3g_cell_id);
break;
case MIH_C_CHOICE_3GPP_2G_CELL_ID:
MIH_C_3GPP_2G_CELL_ID_encode(bbP, &dataP->_union._3gpp_2g_cell_id);
break;
case MIH_C_CHOICE_3GPP_ADDR:
MIH_C_3GPP_ADDR_encode(bbP, &dataP->_union._3gpp_addr);
break;
case MIH_C_CHOICE_3GPP2_ADDR:
MIH_C_3GPP2_ADDR_encode(bbP, &dataP->_union._3gpp2_addr);
break;
case MIH_C_CHOICE_OTHER_L2_ADDR:
MIH_C_OTHER_L2_ADDR_encode(bbP, &dataP->_union.other_l2_addr);
break;
default:
printf("[MIH_C] ERROR NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_LINK_ADDR_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
void MIH_C_LINK_ADDR_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ADDR_T *dataP)
{
//-----------------------------------------------------------------------------
MIH_C_CHOICE_decode(bbP, &dataP->choice);
switch (dataP->choice) {
case MIH_C_CHOICE_MAC_ADDR:
MIH_C_MAC_ADDR_decode(bbP, &dataP->_union.mac_addr);
break;
case MIH_C_CHOICE_3GPP_3G_CELL_ID:
MIH_C_3GPP_3G_CELL_ID_decode(bbP, &dataP->_union._3gpp_3g_cell_id);
break;
case MIH_C_CHOICE_3GPP_2G_CELL_ID:
MIH_C_3GPP_2G_CELL_ID_decode(bbP, &dataP->_union._3gpp_2g_cell_id);
break;
case MIH_C_CHOICE_3GPP_ADDR:
MIH_C_3GPP_ADDR_decode(bbP, &dataP->_union._3gpp_addr);
break;
case MIH_C_CHOICE_3GPP2_ADDR:
MIH_C_3GPP2_ADDR_decode(bbP, &dataP->_union._3gpp2_addr);
break;
case MIH_C_CHOICE_OTHER_L2_ADDR:
MIH_C_OTHER_L2_ADDR_decode(bbP, &dataP->_union.other_l2_addr);
break;
default:
printf("[MIH_C] ERROR NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_LINK_ADDR_T %d\n", dataP->choice);
}
}
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@eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
#define MIH_C_INTERFACE
#define MIH_C_HEADER_CODEC_C
#include "MIH_C_header_codec.h"
//-----------------------------------------------------------------------------
int MIH_C_HEADER2String(MIH_C_HEADER_T* headerP, char* bufP)
{
//-----------------------------------------------------------------------------
unsigned int buffer_index = 0;
buffer_index += sprintf(&bufP[buffer_index], "HEADER.version: ");
buffer_index += MIH_C_VERSION2String(&headerP->version, &bufP[buffer_index]);
buffer_index += sprintf(&bufP[buffer_index], "\nHEADER.ack_req: ");
buffer_index += MIH_C_ACK_REQ2String(&headerP->ack_req, &bufP[buffer_index]);
buffer_index += sprintf(&bufP[buffer_index], "\nHEADER.ack_rsp: ");
buffer_index += MIH_C_ACK_RSP2String(&headerP->ack_rsp, &bufP[buffer_index]);
buffer_index += sprintf(&bufP[buffer_index], "\nHEADER.uir: ");
buffer_index += MIH_C_UIR2String(&headerP->uir, &bufP[buffer_index]);
buffer_index += sprintf(&bufP[buffer_index], "\nHEADER.more_fragment: ");
buffer_index += MIH_C_M2String(&headerP->more_fragment, &bufP[buffer_index]);
buffer_index += sprintf(&bufP[buffer_index], "\nHEADER.fragment_number: ");
buffer_index += MIH_C_FN2String(&headerP->more_fragment, &bufP[buffer_index]);
buffer_index += sprintf(&bufP[buffer_index], "\nHEADER.service_identifier: ");
buffer_index += MIH_C_SID2String(&headerP->service_identifier, &bufP[buffer_index]);
buffer_index += sprintf(&bufP[buffer_index], "\nHEADER.operation_code: ");
buffer_index += MIH_C_OPCODE2String(&headerP->operation_code, &bufP[buffer_index]);
buffer_index += sprintf(&bufP[buffer_index], "\nHEADER.action_identifier: ");
buffer_index += MIH_C_AID2String(&headerP->action_identifier, &bufP[buffer_index]);
buffer_index += sprintf(&bufP[buffer_index], "\nHEADER.transaction_id: ");
buffer_index += MIH_C_TRANSACTION_ID2String(&headerP->transaction_id, &bufP[buffer_index]);
buffer_index += sprintf(&bufP[buffer_index], "\nHEADER.payload_length: ");
buffer_index += MIH_C_VARIABLE_PAYLOAD_LENGTH2String(&headerP->payload_length, &bufP[buffer_index]);
buffer_index += sprintf(&bufP[buffer_index], "\n");
return buffer_index;
}
//-----------------------------------------------------------------------------
int MIH_C_Link_Header_Encode(Bit_Buffer_t* bbP, MIH_C_HEADER_T* headerP)
{
//-----------------------------------------------------------------------------
u_int8_t reserved = 0;
int status ;
if ((bbP != NULL) && (headerP != NULL)) {
status = MIH_HEADER_ENCODE_OK;
BitBuffer_write8b (bbP, headerP->version, 4);
BitBuffer_writeBool (bbP, headerP->ack_req);
BitBuffer_writeBool (bbP, headerP->ack_rsp);
BitBuffer_writeBool (bbP, headerP->uir);
BitBuffer_writeBool (bbP, headerP->more_fragment);
BitBuffer_write8b (bbP, headerP->fragment_number, 7);
BitBuffer_writeBool (bbP, reserved);
BitBuffer_write8b (bbP, headerP->service_identifier, 4);
BitBuffer_write8b (bbP, headerP->operation_code, 2);
BitBuffer_write16b (bbP, headerP->action_identifier, 10);
BitBuffer_write8b (bbP, reserved, 4);
BitBuffer_write16b (bbP, headerP->transaction_id, 12);
BitBuffer_write16 (bbP, headerP->payload_length);
/*DEBUG_ENCODE("%s: version 0x%02X\n", __FUNCTION__, headerP->version);
DEBUG_ENCODE("%s: ack_req 0x%02X\n", __FUNCTION__, headerP->ack_req);
DEBUG_ENCODE("%s: ack_rsp 0x%02X\n", __FUNCTION__, headerP->ack_rsp);
DEBUG_ENCODE("%s: uir 0x%02X\n", __FUNCTION__, headerP->uir);
DEBUG_ENCODE("%s: more_fragment 0x%02X\n", __FUNCTION__, headerP->more_fragment);
DEBUG_ENCODE("%s: reserved 0x%02X\n", __FUNCTION__, reserved);
DEBUG_ENCODE("%s: service_identifier 0x%02X\n", __FUNCTION__, headerP->service_identifier);
DEBUG_ENCODE("%s: operation_code 0x%02X\n", __FUNCTION__, headerP->operation_code);
DEBUG_ENCODE("%s: action_identifier 0x%04X\n", __FUNCTION__, headerP->action_identifier);
DEBUG_ENCODE("%s: reserved 0x%02X\n", __FUNCTION__, reserved);
DEBUG_ENCODE("%s: transaction_id 0x%04X\n", __FUNCTION__, headerP->transaction_id);
DEBUG_ENCODE("%s: payload_length 0x%02X\n", __FUNCTION__, headerP->payload_length);*/
// may be check for validity of header field -> set MIH_HEADER_DECODE_FAILURE
if (BitBuffer_isCheckWriteOverflowOK(bbP, 0) == BIT_BUFFER_FALSE) {
memset(headerP, 0, sizeof(MIH_C_HEADER_T));
return MIH_HEADER_ENCODE_TOO_SHORT;
} else if (status == MIH_HEADER_ENCODE_FAILURE) {
memset(headerP, 0, sizeof(MIH_C_HEADER_T));
return MIH_HEADER_ENCODE_FAILURE;
} else {
return MIH_HEADER_ENCODE_OK;
}
} else {
memset(headerP, 0, sizeof(MIH_C_HEADER_T));
return MIH_HEADER_ENCODE_BAD_PARAMETER;
}
}
//-----------------------------------------------------------------------------
int MIH_C_Link_Header_Decode(Bit_Buffer_t* bbP, MIH_C_HEADER_T* headerP)
{
//-----------------------------------------------------------------------------
u_int8_t reserved ;
int status ;
if ((bbP != NULL) && (headerP != NULL)) {
status = MIH_HEADER_DECODE_OK;
headerP->version = (MIH_C_VERSION_T)BitBuffer_read(bbP, 4);
headerP->ack_req = (MIH_C_ACK_REQ_T)BitBuffer_readBool(bbP);
headerP->ack_rsp = (MIH_C_ACK_RSP_T)BitBuffer_readBool(bbP);
headerP->uir = (MIH_C_UIR_T)BitBuffer_readBool(bbP);
headerP->more_fragment = (MIH_C_M_T)BitBuffer_readBool(bbP);
headerP->fragment_number = (MIH_C_FN_T)BitBuffer_read(bbP, 7);
reserved = BitBuffer_readBool(bbP);
headerP->service_identifier = (MIH_C_SID_T) BitBuffer_read(bbP, 4);
headerP->operation_code = (MIH_C_OPCODE_T) BitBuffer_read(bbP, 2);
headerP->action_identifier = (MIH_C_AID_T) BitBuffer_read(bbP, 10);
reserved = BitBuffer_read(bbP, 4);
headerP->transaction_id = (MIH_C_TRANSACTION_ID_T) BitBuffer_read(bbP, 12);
headerP->payload_length = (MIH_C_VARIABLE_PAYLOAD_LENGTH_T)BitBuffer_read16(bbP);
/*DEBUG_DECODE("%s: version 0x%02X\n", __FUNCTION__, headerP->version);
DEBUG_DECODE("%s: ack_req 0x%02X\n", __FUNCTION__, headerP->ack_req);
DEBUG_DECODE("%s: ack_rsp 0x%02X\n", __FUNCTION__, headerP->ack_rsp);
DEBUG_DECODE("%s: uir 0x%02X\n", __FUNCTION__, headerP->uir);
DEBUG_DECODE("%s: more_fragment 0x%02X\n", __FUNCTION__, headerP->more_fragment);
DEBUG_DECODE("%s: reserved 0x%02X\n", __FUNCTION__, reserved);
DEBUG_DECODE("%s: service_identifier 0x%02X\n", __FUNCTION__, headerP->service_identifier);
DEBUG_DECODE("%s: operation_code 0x%02X\n", __FUNCTION__, headerP->operation_code);
DEBUG_DECODE("%s: action_identifier 0x%04X\n", __FUNCTION__, headerP->action_identifier);
DEBUG_DECODE("%s: reserved 0x%02X\n", __FUNCTION__, reserved);
DEBUG_DECODE("%s: transaction_id 0x%04X\n", __FUNCTION__, headerP->transaction_id);
DEBUG_DECODE("%s: payload_length 0x%02X\n", __FUNCTION__, headerP->payload_length);*/
// may be check for validity of header field -> set MIH_HEADER_DECODE_FAILURE
if (BitBuffer_isCheckReadOverflowOK(bbP, 0) == BIT_BUFFER_FALSE) {
memset(headerP, 0, sizeof(MIH_C_HEADER_T));
return MIH_HEADER_DECODE_TOO_SHORT;
} else if (status == MIH_HEADER_DECODE_FAILURE) {
memset(headerP, 0, sizeof(MIH_C_HEADER_T));
return MIH_HEADER_DECODE_FAILURE;
} else {
return MIH_HEADER_DECODE_OK;
}
} else {
memset(headerP, 0, sizeof(MIH_C_HEADER_T));
return MIH_HEADER_DECODE_BAD_PARAMETER;
}
}
/*******************************************************************************
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@eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
#define MIH_C_INTERFACE
#define MIH_C_LOG_C
/*
//-----------------------------------------------------------------------------
#include "MIH_C_log.h"
//-----------------------------------------------------------------------------
#define LOG_BUFF_SIZE 2048
static char g_log_buffer_time[24];
static char g_log_buffer[LOG_BUFF_SIZE];
static int g_bypass_header;
//-----------------------------------------------------------------------------
char* getTimeStamp4Log()
//-----------------------------------------------------------------------------
{
int len;
struct timespec time_spec;
unsigned int time_now_micros;
unsigned int time_now_s;
clock_gettime (CLOCK_REALTIME, &time_spec);
time_now_s = (unsigned int) time_spec.tv_sec % 3600;
time_now_micros = (unsigned int) time_spec.tv_nsec/1000;
//len=snprintf(g_log_buffer_time,24, "%06d:%06d", time_now_s, time_now_micros);
len=snprintf(g_log_buffer_time,24, "%03d:%03d", time_now_s, time_now_micros);
return g_log_buffer_time;
}
//-----------------------------------------------------------------------------
int is_newline( char *str, int size){
//-----------------------------------------------------------------------------
int i;
for ( i = 0; i < size; i++ ) {
if ( str[i] == '\n' )
return 1;
}
// if we get all the way to here, there must not have been a newline!
return 0;
}
// Initialize logging system
int MIH_C_log_init(unsigned int log_outputP) {
//-----------------------------------------------------------------------------
g_mih_c_log_output = log_outputP;
g_log_level2string[LOG_EMERG] = "EMERG";
g_log_level2string[LOG_ALERT] = "ALERT";
g_log_level2string[LOG_CRIT] = "CRIT ";
g_log_level2string[LOG_ERR] = "ERR ";
g_log_level2string[LOG_WARNING] = "WARN ";
g_log_level2string[LOG_NOTICE] = "NOTCE";
g_log_level2string[LOG_INFO] = "INFO ";
g_log_level2string[LOG_DEBUG] = "DEBUG";
g_bypass_header = 0;
switch (g_mih_c_log_output){
case LOG_TO_CONSOLE:
printf("***** mRAL V%s logging \n\n",MIH_C_VERSION);
break;
case LOG_TO_FILE:
g_mih_c_log_file = fopen(MIH_C_LOGFILE_NAME,"w"); //start over new file
if (g_mih_c_log_file == NULL){
perror ("MIH_C_log_init - error opening file");
exit(1);
}
fprintf(g_mih_c_log_file, "***** V%s starting logging \n\n",MIH_C_VERSION);
fflush(g_mih_c_log_file);
break;
case LOG_TO_SYSTEM:
openlog(MIH_C_SYSLOG_NAME, LOG_PID, LOG_LOCAL7);
syslog(LOG_NOTICE, "***** V%s starting logging \n\n",MIH_C_VERSION);
break;
default:
printf("MIH_C_log_init: log_outputP error %d", log_outputP);
}
return 0;
}
//-----------------------------------------------------------------------------
// Log messages according to user settings
int MIH_C_log_record(int levelP, const char * log_msgP, ...) {
//-----------------------------------------------------------------------------
struct timespec time_spec;
unsigned int time_now_micros;
unsigned int time_now_s;
va_list log_ap;
int len;
switch (g_mih_c_log_output){
case LOG_TO_CONSOLE:
va_start(log_ap, log_msgP);
len = vsnprintf(g_log_buffer, LOG_BUFF_SIZE-1, log_msgP, log_ap);
va_end(log_ap);
if (g_bypass_header == 0) {
clock_gettime (CLOCK_REALTIME, &time_spec);
time_now_s = (unsigned int) time_spec.tv_sec;
time_now_micros = (unsigned int) time_spec.tv_nsec/1000;
printf("[%06d:%06d][%s][%s] ", time_now_s, time_now_micros, MIH_C_SYSLOG_NAME, g_log_level2string[levelP]);
}
printf("%s",g_log_buffer);
fflush(stdout);
fflush(stderr);
if (is_newline(g_log_buffer,len) == 0 ){
g_bypass_header = 1;
} else {
g_bypass_header = 0;
}
break;
case LOG_TO_FILE:
va_start(log_ap, log_msgP);
len = vsnprintf(g_log_buffer, LOG_BUFF_SIZE-1, log_msgP, log_ap);
va_end(log_ap);
if (g_bypass_header == 0) {
clock_gettime (CLOCK_REALTIME, &time_spec);
time_now_s = (unsigned int) time_spec.tv_sec;
time_now_micros = (unsigned int) time_spec.tv_nsec/1000;
fprintf(g_mih_c_log_file, "[%06d:%06d][%s][%s] ", time_now_s, time_now_micros, MIH_C_SYSLOG_NAME, g_log_level2string[levelP]);
}
fprintf(g_mih_c_log_file, "%s", g_log_buffer);
fflush(g_mih_c_log_file);
if (is_newline(g_log_buffer,len) == 0 ){
g_bypass_header = 1;
} else {
g_bypass_header = 0;
}
break;
case LOG_TO_SYSTEM:
va_start(log_ap, log_msgP);
syslog(levelP, log_msgP, log_ap);
va_end(log_ap);
return 0;
break;
default:
printf("MIH_C_log_record: level error %d", levelP);
}
return 0;
}
//-----------------------------------------------------------------------------
// Close logging system
int MIH_C_log_exit(void) {
//-----------------------------------------------------------------------------
switch (g_mih_c_log_output){
case LOG_TO_CONSOLE:
printf("***** stopping logging \n\n");
break;
case LOG_TO_FILE:
fprintf(g_mih_c_log_file, "***** stopping logging \n\n");
fflush(g_mih_c_log_file);
fclose(g_mih_c_log_file);
break;
case LOG_TO_SYSTEM:
syslog(LOG_NOTICE, "***** stopping logging \n\n");
closelog();
break;
default:
printf("MIH_C_log_exit: output unrecognized error %d", g_mih_c_log_output);
}
return 0;
}
*/
This diff is collapsed.
This diff is collapsed.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
<html xml:lang="en">
<head>
<title> </title>
</head>
<body>-->
&nbsp;
&nbsp;
<DIV ALIGN=CENTER>
<img alt="EURECOM - PMIP6D" src="http://mmsp01.eurecom.fr/EURECOM_logo.gif" height="90" width="270" />
</DIV>
</body>
</html>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Doc updated on 11 June 2012
README file for INTERFACE-802.21 Interface
******************
Release dates
Beta 0 : 06.11.2012
******************
The mih_c-802.21.a library is compiled in the INTERFACE-802.21 directory .
This library can be linked with any C module dealing with 802.21 link interface.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
FILES TO BE USED:
Jamfile
ue_lte_user.conf
ue_lte_user.cpp
README.txt
FILES OBSOLETES:
lte_user.conf
mih_usr.cpp
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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