本文整理汇总了C++中LOG_D函数的典型用法代码示例。如果您正苦于以下问题:C++ LOG_D函数的具体用法?C++ LOG_D怎么用?C++ LOG_D使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LOG_D函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CtSelector_RunOnce
CtSelectorRet CtSelector_RunOnce(CtSelector *thiz, uint32_t ms)
{
CtSelectorRet result = SELECTOR_RET_OK;
int ret = 0;
RETURN_VAL_IF_FAIL(thiz, SELECTOR_RET_ERROR);
if (ms == 0)
{
ret = select(thiz->max_fd, &thiz->read_set, &thiz->write_set, NULL, NULL);
}
else
{
struct timeval tv;
tv.tv_sec = ms / 1000;
tv.tv_usec = ms % 1000;
ret = select(thiz->max_fd, &thiz->read_set, &thiz->write_set, NULL, &tv);
}
if (ret == 0)
{
result = SELECTOR_RET_TIMEOUT;
}
else if (ret < 0)
{
LOG_D(TAG, "select failed");
result = SELECTOR_RET_ERROR;
}
else
{
result = SELECTOR_RET_OK;
}
return result;
}
示例2: get_opt
int get_opt(int argc, char *argv[])
{
char opts;
while((opts = getopt(argc, argv, "f:h")) != -1) {
switch (opts) {
case 'f' :
strcpy(filename, optarg);
LOG_D(OCG, "User specified configuration file is \"%s\"\n", filename);
return MODULE_OK;
case 'h' :
LOG_I(OCG, "OCG command : OCG -f \"filename.xml\"\n");
return GET_HELP;
default :
LOG_E(OCG, "OCG command : OCG -f \"filename.xml\"\n");
return GET_HELP;
}
}
return NO_FILE;
}
示例3: getConnector
int LsapiConn::readRespBody()
{
register HttpExtConnector * pHEC = getConnector();
int ret;
size_t bufLen;
if ( !pHEC )
return -1;
int &respState = pHEC->getRespState();
while( m_iPacketLeft > 0 )
{
char * pBuf = pHEC->getRespBuf( bufLen );
if ( !pBuf )
{
return -1;
}
int toRead = m_iPacketLeft + sizeof( m_respHeader );
if ( toRead > (int)bufLen )
toRead = bufLen ;
ret = read( pBuf, toRead );
if ( ret > 0 )
{
int len, packetLen;
if ( D_ENABLED( DL_MEDIUM ) )
LOG_D(( getLogger(), "[%s] process response stream %d bytes, packet left: %d",
getLogId(), ret, m_iPacketLeft ));
if ( ret >= m_iPacketLeft )
{
packetLen = m_iPacketLeft;
m_iPacketLeft = 0;
}
else
{
packetLen = ret;
m_iPacketLeft -= ret;
}
if ( !(respState & 0xff) )
{
len = pHEC->processRespData( pBuf, packetLen );
if ( respState & 0xff )
m_respState = LSAPI_CONN_READ_RESP_BODY;
if ( len == -1 )
return len;
}
else
{
len = pHEC->respBodyRecv( pBuf, packetLen );
}
if ( m_iPacketLeft <= 0 )
{
m_iPacketHeaderLeft = LSAPI_PACKET_HEADER_LEN;
if ( ret > packetLen )
{
if ( D_ENABLED( DL_MEDIUM ) )
LOG_D(( getLogger(), "[%s] process packet header %d bytes",
getLogId(), ret - packetLen ));
int len1 = processPacketHeader( pBuf + packetLen, ret - packetLen );
if ( len1 <= 0 )
return len1;
if (( m_respHeader.m_type != LSAPI_RESP_STREAM )||
( m_iPacketLeft <= 0 ))
return 1;
}
else
break;
}
if ( len == 1)
return 0;
if ( len )
return len;
if ( ret < (int)toRead)
{
pHEC->flushResp();
return 0;
}
}
else
{
return ret;
}
}
return 1;
}
示例4: while
int LsapiConn::processResp()
{
int ret;
while( getState() == PROCESSING )
{
if ( m_iPacketHeaderLeft > 0 )
{
ret = read( ((char *)&m_respHeader) + sizeof( m_respHeader ) - m_iPacketHeaderLeft,
m_iPacketHeaderLeft );
if ( D_ENABLED( DL_MEDIUM ) )
LOG_D(( getLogger(), "[%s] process packet header %d bytes",
getLogId(), ret ));
if ( ret > 0 )
{
m_iPacketHeaderLeft -= ret;
if ( m_iPacketHeaderLeft == 0 )
{
m_iPacketLeft = verifyPacketHeader( &m_respHeader ) -
LSAPI_PACKET_HEADER_LEN;
if ( m_iPacketLeft < 0 )
{
const char * p = (const char *)&m_respHeader;
LOG_WARN(( "[%s] LSAPI Packet header is invalid,"
"('%c','%c','%c','%c','%c','%c','%c','%c')",
getLogId(), *p, *(p+1), *(p+2), *(p+3),
*(p+4), *(p+5), *(p+6), *(p+7) ));
break;
}
// if ( m_iPacketLeft > LSAPI_MAX_HEADER_LEN )
// {
// LOG_WARN(( "[%s] LSAPI Packet is too large: %d",
// getLogId(), m_iPacketLeft ));
// break;
// }
switch( m_respHeader.m_type )
{
case LSAPI_RESP_END:
m_respState = 0;
incReqProcessed();
setInProcess( 0 );
getConnector()->endResponse( 0, 0 );
return 0;
case LSAPI_RESP_HEADER:
m_iCurRespHeader = 0;
m_respState = LSAPI_CONN_READ_RESP_INFO;
m_pRespHeaderProcess = (char *)&m_respInfo;
setRespBuf( m_pRespHeaderProcess );
break;
case LSAPI_REQ_RECEIVED:
m_reqReceived = 1;
break;
}
}
}
else
{
if (( m_respState == LSAPI_CONN_READ_RESP_BODY )&&
( getConnector()))
getConnector()->flushResp();
return ret;
}
}
if ( m_iPacketLeft > 0 )
{
switch( m_respHeader.m_type )
{
case LSAPI_RESP_HEADER:
ret = processRespHeader();
if ( ret <= 0 )
return ret;
break;
case LSAPI_RESP_STREAM:
ret = readRespBody();
if ( ret <= 0 )
{
if (( m_respState == LSAPI_CONN_READ_RESP_BODY )&&
( getConnector()))
getConnector()->flushResp();
return ret;
}
break;
case LSAPI_STDERR_STREAM:
ret = readStderrStream();
if ( ret <= 0 )
return ret;
break;
default:
//error: protocol error
LOG_NOTICE(( getLogger(), "[%s] Unknown Packet Type %c, LSAPI protcol is broken.",
getLogId(), m_respHeader.m_type ));
errno = EIO;
return -1;
}
}
else
{
m_iPacketHeaderLeft = LSAPI_PACKET_HEADER_LEN;
}
}
//.........这里部分代码省略.........
示例5: nio_stat
int FcgiStarter::start( FcgiApp& app )
{
int fd = app.getfd();
FcgiAppConfig& config = app.getConfig();
struct stat st;
// if (( stat( config.getCommand(), &st ) == -1 )||
// ( access(config.getCommand(), X_OK) == -1 ))
// {
// LOG_ERR(("Start FCGI [%s]: invalid path to executable - %s,"
// " not exist or not executable ",
// config.getName(),config.getCommand() ));
// return -1;
// }
// if ( st.st_mode & S_ISUID )
// {
// if ( D_ENABLED( DL_LESS ))
// LOG_D(( "Fast CGI [%s]: Setuid bit is not allowed : %s\n",
// config.getName(), config.getCommand() ));
// return -1;
// }
if ( app.getfd() < 0 )
{
fd = ExtWorker::startServerSock( &config, config.getBackLog() );
if ( fd != -1 )
{
app.setfd( fd );
if ( config.getServerAddr().family() == PF_UNIX )
{
nio_stat( config.getServerAddr().getUnix(), &st );
HttpGlobals::getServerInfo()->addUnixSocket(
config.getServerAddr().getUnix(), &st );
}
}
else
return -1;
}
int instances = config.getInstances();
int cur_instances = app.getCurInstances();
int new_instances = app.getConnPool().getTotalConns() + 2 - cur_instances;
if ( new_instances <= 0 )
new_instances = 1;
if ( instances < new_instances + cur_instances )
{
new_instances = instances - cur_instances;
}
if ( new_instances <= 0 )
return 0;
int i;
for( i = 0; i < new_instances; ++i )
{
int pid;
pid = LocalWorker::workerExec( config, fd );
if ( pid > 0 )
{
if ( D_ENABLED( DL_LESS ) )
LOG_D(( "[%s] add child process pid: %d", app.getName(), pid ));
PidRegistry::add( pid, &app, 0 );
}
else
{
LOG_ERR(("Start FCGI [%s]: failed to start the %d of %d instances.",
config.getName(), i+1, instances ));
break;
}
}
return (i==0)?-1:0;
}
示例6: store_dlsch_buffer
// This function stores the downlink buffer for all the logical channels
void store_dlsch_buffer (module_id_t Mod_id,
frame_t frameP,
sub_frame_t subframeP){
int UE_id,i;
rnti_t rnti;
mac_rlc_status_resp_t rlc_status;
UE_list_t *UE_list = &eNB_mac_inst[Mod_id].UE_list;
UE_TEMPLATE *UE_template;
for (UE_id=UE_list->head;UE_id>=0;UE_id=UE_list->next[UE_id]){
UE_template = &UE_list->UE_template[UE_PCCID(Mod_id,UE_id)][UE_id];
// clear logical channel interface variables
UE_template->dl_buffer_total = 0;
UE_template->dl_pdus_total = 0;
for(i=0;i< MAX_NUM_LCID; i++) {
UE_template->dl_buffer_info[i]=0;
UE_template->dl_pdus_in_buffer[i]=0;
UE_template->dl_buffer_head_sdu_creation_time[i]=0;
UE_template->dl_buffer_head_sdu_remaining_size_to_send[i]=0;
}
rnti = UE_RNTI(Mod_id,UE_id);
for(i=0;i< MAX_NUM_LCID; i++){ // loop over all the logical channels
rlc_status = mac_rlc_status_ind(Mod_id,UE_id, frameP,ENB_FLAG_YES,MBMS_FLAG_NO,i,0 );
UE_template->dl_buffer_info[i] = rlc_status.bytes_in_buffer; //storing the dlsch buffer for each logical channel
UE_template->dl_pdus_in_buffer[i] = rlc_status.pdus_in_buffer;
UE_template->dl_buffer_head_sdu_creation_time[i] = rlc_status.head_sdu_creation_time ;
UE_template->dl_buffer_head_sdu_creation_time_max = cmax(UE_template->dl_buffer_head_sdu_creation_time_max,
rlc_status.head_sdu_creation_time );
UE_template->dl_buffer_head_sdu_remaining_size_to_send[i] = rlc_status.head_sdu_remaining_size_to_send;
UE_template->dl_buffer_head_sdu_is_segmented[i] = rlc_status.head_sdu_is_segmented;
UE_template->dl_buffer_total += UE_template->dl_buffer_info[i];//storing the total dlsch buffer
UE_template->dl_pdus_total += UE_template->dl_pdus_in_buffer[i];
#ifdef DEBUG_eNB_SCHEDULER
/* note for dl_buffer_head_sdu_remaining_size_to_send[i] :
* 0 if head SDU has not been segmented (yet), else remaining size not already segmented and sent
*/
if (UE_template->dl_buffer_info[i]>0)
LOG_D(MAC,"[eNB %d] Frame %d Subframe %d : RLC status for UE %d in LCID%d: total of %d pdus and size %d, head sdu queuing time %d, remaining size %d, is segmeneted %d \n",
Mod_id, frameP, subframeP, UE_id,
i, UE_template->dl_pdus_in_buffer[i],UE_template->dl_buffer_info[i],
UE_template->dl_buffer_head_sdu_creation_time[i],
UE_template->dl_buffer_head_sdu_remaining_size_to_send[i],
UE_template->dl_buffer_head_sdu_is_segmented[i]
);
#endif
}
//#ifdef DEBUG_eNB_SCHEDULER
if ( UE_template->dl_buffer_total>0)
LOG_D(MAC,"[eNB %d] Frame %d Subframe %d : RLC status for UE %d : total DL buffer size %d and total number of pdu %d \n",
Mod_id, frameP, subframeP, UE_id,
UE_template->dl_buffer_total,
UE_template->dl_pdus_total
);
//#endif
}
}
示例7: dlsch_scheduler_pre_processor
//.........这里部分代码省略.........
else if( (min_rb_unit[CC_id] * total_ue_count) <= (frame_parms[CC_id]->N_RB_DL) )
average_rbs_per_user[CC_id] = (uint16_t) floor(frame_parms[CC_id]->N_RB_DL/total_ue_count);
else
average_rbs_per_user[CC_id] = min_rb_unit[CC_id];
}
}
// note: nb_rbs_required is assigned according to total_buffer_dl
// extend nb_rbs_required to capture per LCID RB required
for(i=UE_list->head;i>=0;i=UE_list->next[i]){
for (ii=0;ii<UE_num_active_CC(UE_list,i);ii++) {
CC_id = UE_list->ordered_CCids[ii][i];
// control channel
if (mac_get_rrc_status(Mod_id,1,i) < RRC_RECONFIGURED)
nb_rbs_required_remaining_1[CC_id][i] = nb_rbs_required[CC_id][i];
else
nb_rbs_required_remaining_1[CC_id][i] = cmin(average_rbs_per_user[CC_id],nb_rbs_required[CC_id][i]);
}
}
//Allocation to UEs is done in 2 rounds,
// 1st round: average number of RBs allocated to each UE
// 2nd round: remaining RBs are allocated to high priority UEs
for(r1=0;r1<2;r1++){
for(i=UE_list->head; i>=0;i=UE_list->next[i]) {
for (ii=0;ii<UE_num_active_CC(UE_list,i);ii++) {
CC_id = UE_list->ordered_CCids[ii][i];
if(r1 == 0)
nb_rbs_required_remaining[CC_id][i] = nb_rbs_required_remaining_1[CC_id][i];
else // rb required based only on the buffer - rb allloctaed in the 1st round + extra reaming rb form the 1st round
nb_rbs_required_remaining[CC_id][i] = nb_rbs_required[CC_id][i]-nb_rbs_required_remaining_1[CC_id][i]+nb_rbs_required_remaining[CC_id][i];
LOG_D(MAC,"round %d : nb_rbs_required_remaining[%d][%d]= %d (remaining_1 %d, required %d, pre_nb_available_rbs %d, N_RBG %d, rb_unit %d)\n",
r1, CC_id, i,
nb_rbs_required_remaining[CC_id][i],
nb_rbs_required_remaining_1[CC_id][i],
nb_rbs_required[CC_id][i],
pre_nb_available_rbs[CC_id][i],
N_RBG[CC_id],
min_rb_unit[CC_id]);
}
}
if (total_ue_count > 0 ) {
for(i=UE_list->head; i>=0;i=UE_list->next[i]) {
UE_id = i;
for (ii=0;ii<UE_num_active_CC(UE_list,UE_id);ii++) {
CC_id = UE_list->ordered_CCids[ii][UE_id];
rnti = UE_RNTI(Mod_id,UE_id);
// LOG_D(MAC,"UE %d rnti 0x\n", UE_id, rnti );
if(rnti == 0)
continue;
transmission_mode = mac_xface->get_transmission_mode(Mod_id,CC_id,rnti);
mac_xface->get_ue_active_harq_pid(Mod_id,CC_id,rnti,frameP,subframeP,&harq_pid,&round,0);
rrc_status = mac_get_rrc_status(Mod_id,1,UE_id);
/* 1st allocate for the retx */
// retransmission in data channels
// control channel in the 1st transmission
// data channel for all TM
LOG_D(MAC,"calling dlsch_scheduler_pre_processor_allocate .. \n ");
dlsch_scheduler_pre_processor_allocate (Mod_id,
UE_id,
示例8: pdcp_is_rx_seq_number_valid
/**
* Checks if incoming PDU has a sequence number in accordance with the RX window
* @return 1 if SN is okay, 0 otherwise
* XXX Reordering window should also be handled here
*/
boolean_t pdcp_is_rx_seq_number_valid(uint16_t seq_num, pdcp_t* pdcp_entity,srb_flag_t srb_flagP)
{
uint16_t reordering_window = 0;
#if 0
LOG_D(PDCP, "Incoming RX Sequence number is %04d\n", seq_num);
#endif
if (pdcp_is_seq_num_size_valid(pdcp_entity) == FALSE || pdcp_is_seq_num_valid(seq_num, pdcp_entity->seq_num_size) == FALSE) {
return FALSE;
}
/*
* Mark received sequence numbers to keep track of missing ones
* (and to build PDCP Control PDU for PDCP status report)
*/
if (pdcp_mark_current_pdu_as_received(seq_num, pdcp_entity) == TRUE) {
#if 0
LOG_I(PDCP, "Received sequence number successfuly marked\n");
#endif
} else {
LOG_W(PDCP, "Cannot mark received sequence number on the bitmap!\n");
}
/*
* RX Procedures for SRB and DRBs as described in sec 5.1.2 of 36.323
*/
if (srb_flagP) { // SRB
if (seq_num < pdcp_entity->next_pdcp_rx_sn) {
// decipher and verify the integrity of the PDU (if applicable) using COUNT based on RX_HFN + 1 and the received PDCP SN
pdcp_entity->rx_hfn++;
pdcp_entity->rx_hfn_offset = 0;
} else {
// decipher and verify the integrity of the PDU (if applicable) using COUNT based using COUNT based on RX_HFN and the received PDCP SN
pdcp_entity->rx_hfn_offset = 0;
}
// Assume that integrity verification is applicable and the integrity verification is passed successfully;
// or assume that integrity verification is not applicable:
// same the old next_pdcp_rx_sn to revert otherwise
pdcp_entity->next_pdcp_rx_sn_before_integrity = pdcp_entity->next_pdcp_rx_sn;
#if 0
if (seq_num != pdcp_entity->next_pdcp_rx_sn) {
LOG_D(PDCP,"Re-adjusting the sequence number to %d\n", seq_num);
}
#endif
//set Next_PDCP_RX_SN to the received PDCP SN +1 ;
pdcp_entity->next_pdcp_rx_sn = seq_num;
pdcp_advance_rx_window(pdcp_entity); // + 1, and check if it is larger than Maximum_PDCP_SN:
} else { // DRB
if (pdcp_entity->seq_num_size == PDCP_SN_7BIT) {
reordering_window = REORDERING_WINDOW_SN_7BIT;
} else {
reordering_window = REORDERING_WINDOW_SN_12BIT;
}
switch (pdcp_entity->rlc_mode) {
case RLC_MODE_AM:
if ((seq_num - pdcp_entity->last_submitted_pdcp_rx_sn > reordering_window) ||
((0 <= pdcp_entity->last_submitted_pdcp_rx_sn - seq_num) &&
(pdcp_entity->last_submitted_pdcp_rx_sn - seq_num < reordering_window) )) {
if (seq_num > pdcp_entity->next_pdcp_rx_sn) {
/*
* decipher the PDCP PDU as specified in the subclause 5.6, using COUNT based on RX_HFN - 1 and the received PDCP SN;
*/
pdcp_entity->rx_hfn_offset = -1;
} else {
/*
* decipher the PDCP PDU as specified in the subclause 5.6, using COUNT based on RX_HFN and the received PDCP SN;
*/
pdcp_entity->rx_hfn_offset = 0;
}
// discard this PDCP SDU;
LOG_W(PDCP, "Out of the reordering window (Incoming SN:%d, Expected SN:%d): discard this PDCP SDU\n",
seq_num, pdcp_entity->next_pdcp_rx_sn);
return FALSE;
} else if (pdcp_entity->next_pdcp_rx_sn - seq_num > reordering_window) {
pdcp_entity->rx_hfn++;
// use COUNT based on RX_HFN and the received PDCP SN for deciphering the PDCP PDU;
pdcp_entity->rx_hfn_offset = 0;
pdcp_entity->next_pdcp_rx_sn++;
} else if (seq_num - pdcp_entity->next_pdcp_rx_sn >= reordering_window ) {
// use COUNT based on RX_HFN – 1 and the received PDCP SN for deciphering the PDCP PDU;
pdcp_entity->rx_hfn_offset = -1;
} else if (seq_num >= pdcp_entity->next_pdcp_rx_sn ) {
//.........这里部分代码省略.........
示例9: LOG_D
void CollisionSystem::Update(float dt)
{
// Avoid warnings for not using dt.
LOG_D("[CollisionSystem] Update: " << dt);
CheckCollisions();
}
示例10: rrc_rx_tx
RRC_status_t rrc_rx_tx(uint8_t Mod_id, const frame_t frameP, const eNB_flag_t eNB_flagP,uint8_t index,int CC_id){
uint8_t UE_id;
int32_t current_timestamp_ms, ref_timestamp_ms;
struct timeval ts;
if(eNB_flagP == 0) {
// check timers
if (UE_rrc_inst[Mod_id].Info[index].T300_active == 1) {
if ((UE_rrc_inst[Mod_id].Info[index].T300_cnt % 10) == 0)
LOG_D(RRC,
"[UE %d][RAPROC] Frame %d T300 Count %d ms\n", Mod_id, frameP, UE_rrc_inst[Mod_id].Info[index].T300_cnt);
if (UE_rrc_inst[Mod_id].Info[index].T300_cnt
== T300[UE_rrc_inst[Mod_id].sib2[index]->ue_TimersAndConstants.t300]) {
UE_rrc_inst[Mod_id].Info[index].T300_active = 0;
// ALLOW CCCH to be used
UE_rrc_inst[Mod_id].Srb0[index].Tx_buffer.payload_size = 0;
rrc_ue_generate_RRCConnectionRequest (Mod_id, frameP, index);
return (RRC_ConnSetup_failed);
}
UE_rrc_inst[Mod_id].Info[index].T300_cnt++;
}
if (UE_rrc_inst[Mod_id].sib2[index]) {
if (UE_rrc_inst[Mod_id].Info[index].N310_cnt
== N310[UE_rrc_inst[Mod_id].sib2[index]->ue_TimersAndConstants.n310]) {
UE_rrc_inst[Mod_id].Info[index].T310_active = 1;
}
}
else { // in case we have not received SIB2 yet
if (UE_rrc_inst[Mod_id].Info[index].N310_cnt == 100) {
UE_rrc_inst[Mod_id].Info[index].N310_cnt = 0;
return RRC_PHY_RESYNCH;
}
}
if (UE_rrc_inst[Mod_id].Info[index].T310_active == 1) {
if (UE_rrc_inst[Mod_id].Info[index].N311_cnt
== N311[UE_rrc_inst[Mod_id].sib2[index]->ue_TimersAndConstants.n311]) {
UE_rrc_inst[Mod_id].Info[index].T310_active = 0;
UE_rrc_inst[Mod_id].Info[index].N311_cnt = 0;
}
if ((UE_rrc_inst[Mod_id].Info[index].T310_cnt % 10) == 0)
LOG_D(RRC, "[UE %d] Frame %d T310 Count %d ms\n", Mod_id, frameP, UE_rrc_inst[Mod_id].Info[index].T310_cnt);
if (UE_rrc_inst[Mod_id].Info[index].T310_cnt == T310[UE_rrc_inst[Mod_id].sib2[index]->ue_TimersAndConstants.t310]) {
UE_rrc_inst[Mod_id].Info[index].T310_active = 0;
rrc_t310_expiration (frameP, Mod_id, index);
return (RRC_PHY_RESYNCH);
}
UE_rrc_inst[Mod_id].Info[index].T310_cnt++;
}
if (UE_rrc_inst[Mod_id].Info[index].T304_active==1) {
if ((UE_rrc_inst[Mod_id].Info[index].T304_cnt % 10) == 0)
LOG_D(RRC,"[UE %d][RAPROC] Frame %d T304 Count %d ms\n",Mod_id,frameP,
UE_rrc_inst[Mod_id].Info[index].T304_cnt);
if (UE_rrc_inst[Mod_id].Info[index].T304_cnt == 0) {
UE_rrc_inst[Mod_id].Info[index].T304_active = 0;
UE_rrc_inst[Mod_id].HandoverInfoUe.measFlag = 1;
LOG_E(RRC,"[UE %d] Handover failure..initiating connection re-establishment procedure... \n");
//Implement 36.331, section 5.3.5.6 here
return(RRC_Handover_failed);
}
UE_rrc_inst[Mod_id].Info[index].T304_cnt--;
}
// Layer 3 filtering of RRC measurements
if (UE_rrc_inst[Mod_id].QuantityConfig[0] != NULL) {
ue_meas_filtering(Mod_id,frameP,index);
}
ue_measurement_report_triggering(Mod_id,frameP,index);
if (UE_rrc_inst[Mod_id].Info[0].handoverTarget > 0)
LOG_I(RRC,"[UE %d] Frame %d : RRC handover initiated\n", Mod_id, frameP);
if((UE_rrc_inst[Mod_id].Info[index].State == RRC_HO_EXECUTION) &&
(UE_rrc_inst[Mod_id].HandoverInfoUe.targetCellId != 0xFF)) {
UE_rrc_inst[Mod_id].Info[index].State= RRC_IDLE;
return(RRC_HO_STARTED);
}
}
else { // eNB
check_handovers(Mod_id,frameP);
// counetr, and get the value and aggregate
#ifdef LOCALIZATION
/* for the localization, only primary CC_id might be relevant*/
gettimeofday(&ts, NULL);
current_timestamp_ms = ts.tv_sec * 1000 + ts.tv_usec / 1000;
ref_timestamp_ms = eNB_rrc_inst[Mod_id].reference_timestamp_ms;
for (UE_id=0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
if ((current_timestamp_ms - ref_timestamp_ms > eNB_rrc_inst[Mod_id].aggregation_period_ms) &&
rrc_get_estimated_ue_distance(Mod_id,frameP,UE_id, CC_id,eNB_rrc_inst[Mod_id].loc_type) != -1) {
LOG_D(LOCALIZE, " RRC [UE/id %d -> eNB/id %d] timestamp %d frame %d estimated r = %f\n",
UE_id,
Mod_id,
current_timestamp_ms,
frameP,
rrc_get_estimated_ue_distance(Mod_id,frameP,UE_id, CC_id,eNB_rrc_inst[Mod_id].loc_type));
//.........这里部分代码省略.........
示例11: openair_rrc_top_init
/*------------------------------------------------------------------------------*/
void openair_rrc_top_init(int eMBMS_active, uint8_t cba_group_active,uint8_t HO_active){
/*-----------------------------------------------------------------------------*/
module_id_t module_id;
OAI_UECapability_t *UECap = NULL;
// uint8_t dummy_buffer[100];
LOG_D(RRC, "[OPENAIR][INIT] Init function start: NB_UE_INST=%d, NB_eNB_INST=%d\n", NB_UE_INST, NB_eNB_INST);
if (NB_UE_INST > 0) {
UE_rrc_inst = (UE_RRC_INST*) malloc16(NB_UE_INST*sizeof(UE_RRC_INST));
memset (UE_rrc_inst, 0, NB_UE_INST * sizeof(UE_RRC_INST));
LOG_D(RRC, "ALLOCATE %d Bytes for UE_RRC_INST @ %p\n", (unsigned int)(NB_UE_INST*sizeof(UE_RRC_INST)), UE_rrc_inst);
// fill UE capability
UECap = fill_ue_capability ();
for (module_id = 0; module_id < NB_UE_INST; module_id++) {
UE_rrc_inst[module_id].UECapability = UECap->sdu;
UE_rrc_inst[module_id].UECapability_size = UECap->sdu_size;
}
/*
do_UECapabilityEnquiry(0,
dummy_buffer,
0,
0);*/
#ifdef Rel10
LOG_I(RRC,"[UE] eMBMS active state is %d \n", eMBMS_active);
for (module_id=0;module_id<NB_UE_INST;module_id++) {
UE_rrc_inst[module_id].MBMS_flag = (uint8_t)eMBMS_active;
}
#endif
}
else
UE_rrc_inst = NULL;
if (NB_eNB_INST > 0) {
eNB_rrc_inst = (eNB_RRC_INST*) malloc16(NB_eNB_INST*sizeof(eNB_RRC_INST));
memset (eNB_rrc_inst, 0, NB_eNB_INST * sizeof(eNB_RRC_INST));
LOG_I(RRC,"[eNB] handover active state is %d \n", HO_active);
for (module_id=0;module_id<NB_eNB_INST;module_id++) {
eNB_rrc_inst[module_id].HO_flag = (uint8_t)HO_active;
}
#ifdef Rel10
LOG_I(RRC,"[eNB] eMBMS active state is %d \n", eMBMS_active);
for (module_id=0;module_id<NB_eNB_INST;module_id++) {
eNB_rrc_inst[module_id].MBMS_flag = (uint8_t)eMBMS_active;
}
#endif
#ifdef CBA
for (module_id=0;module_id<NB_eNB_INST;module_id++) {
eNB_rrc_inst[module_id].num_active_cba_groups = cba_group_active;
}
#endif
#ifdef LOCALIZATION
/* later set this from xml or enb.config file*/
struct timeval ts; // time struct
gettimeofday(&ts, NULL); // get the current epoch timestamp
for (module_id=0;module_id<NB_eNB_INST;module_id++) {
eNB_rrc_inst[module_id].reference_timestamp_ms = ts.tv_sec * 1000 + ts.tv_usec / 1000;
initialize(&eNB_rrc_inst[module_id].loc_list);
eNB_rrc_inst[module_id].loc_type=0;
eNB_rrc_inst[module_id].aggregation_period_ms = 5000;
}
#endif
LOG_D(RRC,
"ALLOCATE %d Bytes for eNB_RRC_INST @ %p\n", (unsigned int)(NB_eNB_INST*sizeof(eNB_RRC_INST)), eNB_rrc_inst);
}
else
eNB_rrc_inst = NULL;
#ifndef NO_RRM
#ifndef USER_MODE
Header_buf=(char*)malloc16(sizeof(msg_head_t));
Data=(char*)malloc16(2400);
Header_read_idx=0;
Data_read_idx=0;
Header_size=sizeof(msg_head_t);
#endif //NO_RRM
Data_to_read = 0;
#endif //USER_MODE
}
示例12: files_readdir
static bool files_readdir(honggfuzz_t * hfuzz)
{
DIR *dir = opendir(hfuzz->inputDir);
if (!dir) {
PLOG_W("Couldn't open dir '%s'", hfuzz->inputDir);
return false;
}
defer {
closedir(dir);
};
size_t maxSize = 0UL;
unsigned count = 0;
for (;;) {
errno = 0;
struct dirent *res = readdir(dir);
if (res == NULL && errno != 0) {
PLOG_W("Couldn't read the '%s' dir", hfuzz->inputDir);
return false;
}
if (res == NULL) {
break;
}
char path[PATH_MAX];
snprintf(path, sizeof(path), "%s/%s", hfuzz->inputDir, res->d_name);
struct stat st;
if (stat(path, &st) == -1) {
LOG_W("Couldn't stat() the '%s' file", path);
continue;
}
if (!S_ISREG(st.st_mode)) {
LOG_D("'%s' is not a regular file, skipping", path);
continue;
}
if (st.st_size == 0ULL) {
LOG_D("'%s' is empty", path);
continue;
}
if (hfuzz->maxFileSz != 0UL && st.st_size > (off_t) hfuzz->maxFileSz) {
LOG_W("File '%s' is bigger than maximal defined file size (-F): %" PRId64 " > %"
PRId64, path, (int64_t) st.st_size, (int64_t) hfuzz->maxFileSz);
continue;
}
if (!(hfuzz->files = util_Realloc(hfuzz->files, sizeof(char *) * (count + 1)))) {
PLOG_W("Couldn't allocate memory");
return false;
}
if ((size_t) st.st_size > maxSize) {
maxSize = st.st_size;
}
hfuzz->files[count] = util_StrDup(path);
hfuzz->fileCnt = ++count;
LOG_D("Added '%s' to the list of input files", path);
}
if (count == 0) {
LOG_W("Directory '%s' doesn't contain any regular files", hfuzz->inputDir);
return false;
}
if (hfuzz->maxFileSz == 0UL) {
hfuzz->maxFileSz = maxSize;
}
LOG_I("%zu input files have been added to the list. Max file size: %zu", hfuzz->fileCnt,
hfuzz->maxFileSz);
return true;
}
示例13: phy_adjust_gain
void
phy_adjust_gain (PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id)
{
uint16_t rx_power_fil_dB;
#ifdef EXMIMO
exmimo_config_t *p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr;
uint16_t i;
#endif
int rssi;
rssi = dB_fixed(phy_vars_ue->PHY_measurements.rssi);
if (rssi>0) rx_power_fil_dB = rssi;
else rx_power_fil_dB = phy_vars_ue->PHY_measurements.rx_power_avg_dB[eNB_id];
LOG_D(PHY,"Gain control: rssi %d (%d,%d)\n",
rssi,
phy_vars_ue->PHY_measurements.rssi,
phy_vars_ue->PHY_measurements.rx_power_avg_dB[eNB_id]
);
// Gain control with hysterisis
// Adjust gain in phy_vars_ue->rx_vars[0].rx_total_gain_dB
if (rx_power_fil_dB < TARGET_RX_POWER - 5) //&& (phy_vars_ue->rx_total_gain_dB < MAX_RF_GAIN) )
phy_vars_ue->rx_total_gain_dB+=5;
else if (rx_power_fil_dB > TARGET_RX_POWER + 5) //&& (phy_vars_ue->rx_total_gain_dB > MIN_RF_GAIN) )
phy_vars_ue->rx_total_gain_dB-=5;
if (phy_vars_ue->rx_total_gain_dB>MAX_RF_GAIN) {
/*
if ((openair_daq_vars.rx_rf_mode==0) && (openair_daq_vars.mode == openair_NOT_SYNCHED)) {
openair_daq_vars.rx_rf_mode=1;
phy_vars_ue->rx_total_gain_dB = max(MIN_RF_GAIN,MAX_RF_GAIN-25);
}
else {
*/
phy_vars_ue->rx_total_gain_dB = MAX_RF_GAIN;
} else if (phy_vars_ue->rx_total_gain_dB<MIN_RF_GAIN) {
/*
if ((openair_daq_vars.rx_rf_mode==1) && (openair_daq_vars.mode == openair_NOT_SYNCHED)) {
openair_daq_vars.rx_rf_mode=0;
phy_vars_ue->rx_total_gain_dB = min(MAX_RF_GAIN,MIN_RF_GAIN+25);
}
else {
*/
phy_vars_ue->rx_total_gain_dB = MIN_RF_GAIN;
}
LOG_D(PHY,"Gain control: rx_total_gain_dB = %d (max %d,rxpf %d)\n",phy_vars_ue->rx_total_gain_dB,MAX_RF_GAIN,rx_power_fil_dB);
#ifdef EXMIMO
if (phy_vars_ue->rx_total_gain_dB>phy_vars_ue->rx_gain_max[0]) {
phy_vars_ue->rx_total_gain_dB = phy_vars_ue->rx_gain_max[0];
for (i=0; i<phy_vars_ue->lte_frame_parms.nb_antennas_rx; i++) {
p_exmimo_config->rf.rx_gain[i][0] = 30;
}
} else if (phy_vars_ue->rx_total_gain_dB<(phy_vars_ue->rx_gain_max[0]-30)) {
// for the moment we stay in max gain mode
phy_vars_ue->rx_total_gain_dB = phy_vars_ue->rx_gain_max[0] - 30;
for (i=0; i<phy_vars_ue->lte_frame_parms.nb_antennas_rx; i++) {
p_exmimo_config->rf.rx_gain[i][0] = 0;
}
/*
phy_vars_ue->rx_gain_mode[0] = byp;
phy_vars_ue->rx_gain_mode[1] = byp;
exmimo_pci_interface->rf.rf_mode0 = 22991; //bypass
exmimo_pci_interface->rf.rf_mode1 = 22991; //bypass
if (phy_vars_ue->rx_total_gain_dB<(phy_vars_ue->rx_gain_byp[0]-50)) {
exmimo_pci_interface->rf.rx_gain00 = 0;
exmimo_pci_interface->rf.rx_gain10 = 0;
}
*/
} else {
for (i=0; i<phy_vars_ue->lte_frame_parms.nb_antennas_rx; i++) {
p_exmimo_config->rf.rx_gain[i][0] = 30 - phy_vars_ue->rx_gain_max[0] + phy_vars_ue->rx_total_gain_dB;
}
}
/*
break;
case med_gain:
case byp_gain:
if (phy_vars_ue->rx_total_gain_dB>phy_vars_ue->rx_gain_byp[0]) {
phy_vars_ue->rx_gain_mode[0] = max_gain;
phy_vars_ue->rx_gain_mode[1] = max_gain;
exmimo_pci_interface->rf.rf_mode0 = 55759; //max gain
exmimo_pci_interface->rf.rf_mode1 = 55759; //max gain
if (phy_vars_ue->rx_total_gain_dB>phy_vars_ue->rx_gain_max[0]) {
exmimo_pci_interface->rf.rx_gain00 = 50;
exmimo_pci_interface->rf.rx_gain10 = 50;
//.........这里部分代码省略.........
示例14: main
int main( int argc, char *argv[] )
{
const char *libname = "libui.so";
int classBuf[ 100 ];
int r1[ 10 ];
int r2[ 10 ];
int r3[ 10 ];
int jellybean = 0;
int ( *unflatten )( int *r0, int *r1, int *r2, int *r3 ) = NULL;
printf( "hello world\n" );
fflush( stdout );
void *handle = dlopen( libname, RTLD_NOW | RTLD_GLOBAL );
if( !handle )
{
LOG_D( "error opening %s: %s\n", libname, dlerror() );
return -1;
}
bzero( classBuf, sizeof( classBuf ) );
bzero( r1, sizeof( r1 ) );
bzero( r2, sizeof( r2 ) );
bzero( r3, sizeof( r3 ) );
int ( *constructor )( int *r0 ) = dlsym( handle, "_ZN7android13GraphicBufferC2Ev" );
if( !constructor )
{
LOG_D( "missing android::GraphicBuffer::GraphicBuffer(void)\n" );
return -1;
}
unflatten = dlsym( handle, "_ZN7android13GraphicBuffer9unflattenERPKvRjRPKiS4_" );
if( !unflatten )
{
unflatten = dlsym( handle, "_ZN7android13GraphicBuffer9unflattenEPKvjPij" );
if( !unflatten )
{
LOG_D( "missing android::GraphicBuffer::unflatten\n" );
return -1;
}
jellybean = 1;
}
constructor( classBuf );
// setup bad values
int r1Ref = (int)(&r1[0]);
// this must match
r1[0] = 0x47424652;
// size must be > 0x1f
r2[0] = 0x20;
// attempt to overflow
r1[8] = 0x1000;
r1[9] = 0xFF5;
// make sure we error out on unpatched libs before getting to the point where we corrupt the heap
r1[6] = 0x20;
r1[7] = 0x20;
int ret = 0;
if( !jellybean )
{
ret = unflatten( classBuf, &r1Ref, r2, r3 );
}
else
{
int * val = (int*)(r2[0]);
ret = unflatten( classBuf, r1, val, r3 );
}
// -12 = unpatched 4.4.2
// -22 = patches 5.1.1
switch( ret )
{
case -ENOMEM:
printf( "unpatched\n" );
break;
case -EINVAL:
printf( "patched\n" );
break;
default:
printf( "test is broken ret: %d (%08x)\n", ret, ret );
break;
}
return 0;
}
示例15: while
int HttpListener::handleEvents( short event )
{
static struct conn_data conns[CONN_BATCH_SIZE];
static struct conn_data * pEnd = &conns[CONN_BATCH_SIZE];
struct conn_data * pCur = conns;
int allowed;
int iCount = 0;
ConnLimitCtrl * pCLC = HttpGlobals::getConnLimitCtrl();
int limitType = 1;
allowed = pCLC->availConn();
if ( isSSL() )
{
if ( allowed > pCLC->availSSLConn() )
{
allowed = pCLC->availSSLConn();
limitType = 2;
}
}
while( iCount < allowed )
{
socklen_t len = 24;
pCur->fd = accept( getfd(), (struct sockaddr *)(pCur->achPeerAddr), &len );
if ( pCur->fd == -1 )
{
resetRevent( POLLIN );
if (( errno != EAGAIN )&&( errno != ECONNABORTED )
&&( errno != EINTR ))
{
LOG_ERR(( getLogger(),
"HttpListener::acceptConnection(): [%s] can't accept:%s!",
getAddrStr(), strerror( errno ) ));
}
break;
}
//++iCount;
//addConnection( conns, &iCount );
++pCur;
if ( pCur == pEnd )
{
iCount += CONN_BATCH_SIZE;
batchAddConn( conns, pCur, &iCount );
pCur = conns;
}
}
if ( pCur > conns )
{
int n = pCur - conns;
iCount += n;
if ( n > 1 )
batchAddConn( conns, pCur, &iCount );
else
addConnection( conns, &iCount );
}
if ( iCount > 0 )
{
m_pMapVHost->incRef( iCount );
pCLC->incConn( iCount );
}
if ( iCount >= allowed )
{
if ( limitType == 1 )
{
if ( D_ENABLED( DL_MORE ) )
{
LOG_D(( getLogger(),
"[%s] max connections reached, suspend accepting!",
getAddrStr() ));
}
pCLC->suspendAll();
}
else
{
if ( D_ENABLED( DL_MORE ) )
{
LOG_D(( getLogger(),
"[%s] max SSL connections reached, suspend accepting!",
getAddrStr() ));
}
pCLC->suspendSSL();
}
}
if ( D_ENABLED( DL_MORE ) )
{
LOG_D(( getLogger(),
"[%s] %d connections accepted!", getAddrStr(), iCount ));
}
return 0;
}