Esempio n. 1
0
/*!
 * \brief Parse PES packet header, common to all PES packet types.
 * \param *bitstr: The bitstream to use.
 * \param *header: A pointer to a PES header structure.
 * \return 1 if succeed, 0 otherwise.
 *
 * From 'ISO/IEC 13818-1' specification:
 * 2.4.3.6 PES packet.
 * Table 2-17 – PES packet.
 */
int parse_pes_header(Bitstream_t *bitstr, PesHeader_t *header)
{
    TRACE_2(MPS, "> parse_pes_header()");

    header->offset_start    = bitstream_get_absolute_byte_offset(bitstr);

    header->start_code      = read_bits(bitstr, 32);
    header->stream_id       = header->start_code & 0x000000FF;
    header->payload_length  = read_bits(bitstr, 16);
    header->packet_length   = header->payload_length + 6;

    header->offset_end      = header->offset_start + header->packet_length;

    return SUCCESS;
}
Esempio n. 2
0
File: server.c Progetto: raphui/rdb
void sendVoid( void *data , size_t size )
{
    TRACE_2( SERVER , "sendVoid()");

    ssize_t b = 0;

    if( lastRequester != 0 )
    {
        b = send( lastRequester , data , size , 0 );

        if( b < 0 )
            TRACE_WARNING( SERVER , "Fail to send data");
    }

}
Esempio n. 3
0
File: common.c Progetto: raphui/rdb
int initEnvironment( void )
{
    TRACE_2( COMMON , "initEnvironment().\n");

    int ret = 0;

    env = ( struct environment * )zmalloc( sizeof( struct environment ) );

    if( !env )
    {
        TRACE_ERROR( COMMON , "Failed to allocate environment structure.\n");
        ret = -ENOMEM;
    }

    return ret;
}
Esempio n. 4
0
void launchServer( void )
{
    TRACE_2( SERVERMANAGER , "lanchServer()");

    TRACE_1( SERVERMANAGER , "Start server on port %d..." , portCommander );

    pthread_create( &serverCommanderThread , NULL , ( void * )&createServer , &portCommander );

    TRACE_1( SERVERMANAGER , "Start server on port %d..." , portCli );

    pthread_create( &serverCliThread , NULL , ( void * )&createServer , &portCli );

    /* We have to increment the thread count by 2, because we don't use createThread() function. */
    incrementThreadCount( 2 );

}
Esempio n. 5
0
/****************************************************************************
  Name          : mqa_asapi_unregister
 
  Description   : This routine registers with ASAPi library.
 
  Arguments     : cb - MQA control block
 
  Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE
 
  Notes         : None
******************************************************************************/
static void mqa_asapi_unregister(MQA_CB *cb)
{
	ASAPi_OPR_INFO asapi_or;
	uint32_t rc = NCSCC_RC_SUCCESS;
	TRACE_ENTER();

	/* Register with ASAPi library */

	asapi_or.type = ASAPi_OPR_UNBIND;

	if ((rc = asapi_opr_hdlr(&asapi_or)) != NCSCC_RC_SUCCESS) {
		TRACE_2("ASAPi Deregisteration Failed with returncode %d", rc);
	}

	TRACE_LEAVE();
	return;
}
Esempio n. 6
0
File: file.c Progetto: raphui/wMusic
int writeFile( void *data )
{
    TRACE_2( FILEMANAGER , "writeFile()");

    static int firstTime = 0;
    int status = PC_SUCCESS;

    size_t ret;

    FILE *f = NULL;

    f = fopen( filename , "ab");

    if( f == NULL )
    {
        TRACE_ERROR( FILEMANAGER , "f FILE is NULL");

        status = PC_ERROR;
    }
    else
    {
        ret = fwrite( data , DATA_SIZE , 1 , f );

        if( ret != 1 )
        {
            TRACE_ERROR( FILEMANAGER , "Not all data have been written.");

            status = PC_ERROR;
        }
        else
        {
            TRACE_1( FILEMANAGER , "Data have been written.");

            fclose( f );

            if( firstTime++ == 10 )
            {
                TRACE_1( FILEMANAGER , "Start to stream file.");

                streamFile( filename );
            }
        }
    }

    return status;
}
Esempio n. 7
0
static uint32_t lga_mds_rcv(struct ncsmds_callback_info *mds_cb_info)
{
	lgsv_msg_t *lgsv_msg = (lgsv_msg_t *)mds_cb_info->info.receive.i_msg;
	uint32_t rc;

	pthread_mutex_lock(&lga_cb.cb_lock);

	/* process the message */
	rc = lga_lgs_msg_proc(&lga_cb, lgsv_msg, mds_cb_info->info.receive.i_priority);
	if (rc != NCSCC_RC_SUCCESS) {
		TRACE_2("lga_lgs_msg_proc returned: %d", rc);
	}

	pthread_mutex_unlock(&lga_cb.cb_lock);

	return rc;
}
Esempio n. 8
0
/*!
 * \param *dc The DecodingContext containing macroblock array we want to freed.
 *
 * This function try to freed every macroblock of the picture stored in mb_array.
 * The total number of macroblocks is equal to (picture width / 16) * (picture height / 16).
 */
void freeMbArrayContent(DecodingContext_t *dc)
{
    if (dc->mb_array != NULL)
    {
        unsigned int i = 0;
        for (i = 0; i < dc->PicSizeInMbs; i++)
        {
            if (dc->mb_array[i] != NULL)
            {
                free(dc->mb_array[i]);
                dc->mb_array[i] = NULL;
            }
        }

        TRACE_2(MB, ">> mb_array content freed\n");
    }
}
Esempio n. 9
0
int64_t read_ebml_data_int(Bitstream_t *bitstr, EbmlElement_t *element,
                           FILE *xml, const char *name)
{
    TRACE_2(MKV, "read_ebml_data_int2(%i bits)", element->size*8);
    int64_t value = (int64_t)read_bits_64(bitstr, element->size*8);

    if (name)
    {
        TRACE_1(MKV, "* %s  = %lli", name, value);
        if (xml)
        {
            fprintf(xml, "  <%s>%" PRId64 "</%s>\n", name, value, name);
        }
    }

    return value;
}
Esempio n. 10
0
int music_delivery( sp_session *session , const sp_audioformat *format , const void *frames , int num_frames )
{
    TRACE_2( PLAYERMANAGER , "music_delivery().");

    TRACE_3( PLAYERMANAGER , "Playing music...%d" , num_frames );

    audio_fifo_t *af = &g_audiofifo;
    audio_fifo_data_t *afd;
    size_t s;

    TRACE_3( PLAYERMANAGER , "###############################################");
    TRACE_3( PLAYERMANAGER , "Channels: %d" , format->channels );
    TRACE_3( PLAYERMANAGER , "Rate: %d" , format->sample_rate );
    TRACE_3( PLAYERMANAGER , "NSamples: %d" , num_frames );
    TRACE_3( PLAYERMANAGER , "###############################################");

    // audio discontinuity, do nothing
    if( num_frames == 0 )
    {
        pthread_mutex_unlock( &af->mutex );
        return 0;
    }

    // buffer one second of audio
    if( af->qlen > format->sample_rate )
        return 0;

    s = num_frames * sizeof( int16_t ) * format->channels;
    afd = zmalloc( sizeof( *afd ) + s );

    afd->channels = format->channels;

    afd->rate = format->sample_rate;

    afd->nsamples = num_frames;

    memcpy( afd->samples , frames , s );

    TAILQ_INSERT_TAIL( &af->q , afd , link );
    af->qlen += num_frames;

    pthread_cond_signal( &af->cond );
    pthread_mutex_unlock( &af->mutex );

    return num_frames;
}
Esempio n. 11
0
uint64_t read_ebml_data_uint_UID(Bitstream_t *bitstr, EbmlElement_t *element,
                                 FILE *xml, const char *name)
{
    TRACE_2(MKV, "read_ebml_data_uint_UID(%i bits)", element->size*8);
    uint64_t value = read_bits_64(bitstr, element->size * 8);

    if (name)
    {
        TRACE_1(MKV, "* %08X  = %llu", name, value);
        if (xml)
        {
            fprintf(xml, "  <%s>0x%" PRIX64 "</%s>\n", name, value, name);
        }
    }

    return value;
}
Esempio n. 12
0
/****************************************************************************
  Name          : immnd_mds_msg_send
 
  Description   : This routine sends the Events from IMMND
 
  Arguments     : cb  - ptr to the IMMND CB
                  i_evt - ptr to the IMMSV message
                  o_evt - ptr to the IMMSV message returned
                  timeout - timeout value in 10 ms 
 
  Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE
 
  Notes         : None.
******************************************************************************/
uint32_t immnd_mds_msg_send(IMMND_CB *cb, uint32_t to_svc, MDS_DEST to_dest, IMMSV_EVT *evt)
{
	NCSMDS_INFO mds_info;
	uint32_t rc;

	if (!evt)
		return NCSCC_RC_FAILURE;

	m_NCS_LOCK(&cb->immnd_immd_up_lock, NCS_LOCK_WRITE);

	if ((to_svc == NCSMDS_SVC_ID_IMMD) && (cb->is_immd_up == false)) {
		/* IMMD is not UP */
		TRACE_2("Director Service Is Down");
		m_NCS_UNLOCK(&cb->immnd_immd_up_lock, NCS_LOCK_WRITE);
		return NCSCC_RC_FAILURE;
	}

	m_NCS_UNLOCK(&cb->immnd_immd_up_lock, NCS_LOCK_WRITE);

	memset(&mds_info, 0, sizeof(NCSMDS_INFO));
	mds_info.i_mds_hdl = cb->immnd_mds_hdl;
	mds_info.i_svc_id = NCSMDS_SVC_ID_IMMND;
	mds_info.i_op = MDS_SEND;

	/* fill the send structure */
	mds_info.info.svc_send.i_msg = (NCSCONTEXT)evt;
	mds_info.info.svc_send.i_priority = MDS_SEND_PRIORITY_MEDIUM;
	mds_info.info.svc_send.i_to_svc = to_svc;
	mds_info.info.svc_send.i_sendtype = MDS_SENDTYPE_SND;
	mds_info.info.svc_send.info.snd.i_to_dest = to_dest;

	immsv_msg_trace_send(to_dest, evt);

	/* send the message */
	rc = ncsmds_api(&mds_info);

	if (rc != NCSCC_RC_SUCCESS) {
		LOG_WA("MDS Send Failed to service:%s rc:%u",
		       (to_svc == NCSMDS_SVC_ID_IMMD) ? "IMMD" :
		       (to_svc == NCSMDS_SVC_ID_IMMA_OM) ? "IMMA OM" :
		       (to_svc == NCSMDS_SVC_ID_IMMA_OI) ? "IMMA OI" :
		       (to_svc == NCSMDS_SVC_ID_IMMND) ? "IMMND" : "NO SERVICE!", rc);
	}

	return rc;
}
Esempio n. 13
0
int loadMusic( sp_session *session, char *uri , char *name , playqueue_fifo_t *playqueue )
{
    TRACE_2( PLAYERMANAGER , "loadMusic().");

    int status = PC_SUCCESS;
    char response[255] = { 0 };

    /* If it's the first time we load a track, we have to init the audio driver and the playqueue */
//    if( firstTime++ == 0 )
//        initPlayerEnv();

    LOCK_MUTEX( PLAYERMANAGER , &mutexSession );

    sp_track *track = NULL;

    currentTrack = track;

    if( createTrackFromUri( uri , name ) == PC_ERROR )
        status = PC_ERROR;

    if( currentTrack != NULL)
    {
        TRACE_1( PLAYERMANAGER , "Adding track to the playlist.");

        addTracksToPlayqueue( playqueue , currentTrack );

        snprintf( response , 255 , "OK");

        sendVoid( ( void * )response , strlen( response ) );
    }
    else
    {
        TRACE_ERROR( PLAYERMANAGER , "Cannot add track to the playlist because track is NULL.");

        status = PC_ERROR;

        snprintf( response , 255 , "NOK: Cannot add the track to the playlist because the URI might be invalid.");

        sendVoid( ( void * )response , strlen( response ) );
    }

    UNLOCK_MUTEX( PLAYERMANAGER , &mutexSession );

    return status;
}
Esempio n. 14
0
/****************************************************************************
 * Name          : cpd_amf_csi_rmv_callback
 *
 * Description   : TBD
 *
 *
 * Return Values : None 
 *****************************************************************************/
	void
cpd_amf_csi_rmv_callback(SaInvocationT invocation,
		const SaNameT *compName, const SaNameT *csiName, SaAmfCSIFlagsT csiFlags)
{
	CPD_CB *cb = 0;
	SaAisErrorT saErr = SA_AIS_OK;

	TRACE_ENTER();
	cb = ncshm_take_hdl(NCS_SERVICE_ID_CPD, gl_cpd_cb_hdl);
	if (cb) {
		saAmfResponse(cb->amf_hdl, invocation, saErr);
		ncshm_give_hdl(cb->cpd_hdl);
	}
	
	TRACE_2("cpd amf csi rmv cb invoked");
	TRACE_LEAVE();
	return;
}
Esempio n. 15
0
void sendVoidSocket( int socket , void *data , size_t size )
{
    TRACE_2( SERVERMANAGER , "sendVoidSocket()");

    ssize_t b = 0;

    if( socket != 0 )
    {
        b = send( socket , data , size , 0 );

        if( b < 0 )
            TRACE_WARNING( SERVERMANAGER , "Fail to send data");
    }
    else
    {
        TRACE_ERROR( SERVERMANAGER , "Cannot send data, socket might be disconnected.");
    }
}
Esempio n. 16
0
static int searchCliCmd( const char *cmd )
{
    TRACE_2( CLI , "searchCliCmd( %s )." , cmd );

    int i = 0;

    for( i = 0 ; i < CLI_COUNT_COMMAND ; i++ )
    {
        if( strstr( cmd , cliCmd[i].command ) != NULL )
        {
            TRACE_1( CLI , "Command found, id: %d" , i );

            return i;
        }
    }

    return -EINVAL;
}
Esempio n. 17
0
void end_of_track( sp_session *session )
{
    TRACE_2( PLAYERMANAGER , "end_of_track().");

    TRACE_3( PLAYERMANAGER , "End of track...");

//    LOCK_MUTEX( PLAYERMANAGER , &mutexSession );

    TRACE_3( PLAYERMANAGER , "Removing the track which have been played.");

    sp_track_release( currentTrack );

//    UNLOCK_MUTEX( PLAYERMANAGER , &mutexSession );

//    if( hasNextTrack() == TRUE )
//    {
//        TRACE_1( PLAYERMANAGER , "Load next music !");

//        playMusic( session , "" , currentStreamName );
//    }
    if( nextTrackInStream( currentStreamName ) == PC_SUCCESS )
    {
        TRACE_1( PLAYERMANAGER , "Load next music !");

    }
    else
    {
        TRACE_WARNING( PLAYERMANAGER , "No more music in the mainplaylist");

        audio_fifo_flush( &g_audiofifo );

        LOCK_MUTEX( PLAYERMANAGER , &mutexSession );

        sp_session_player_play( session , 0 );
        sp_session_player_unload( session );

        UNLOCK_MUTEX( PLAYERMANAGER , &mutexSession );

        playing = FALSE;
    }



}
Esempio n. 18
0
/****************************************************************************
 * Name          : glnd_se_lib_init
 *
 * Description   : This is the function which initalize the GLND libarary.
 *
 * Arguments     : pool_id - This is the pool ID.
 *
 * Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE.
 *
 * Notes         : None.
 *****************************************************************************/
uint32_t glnd_se_lib_create(uint8_t pool_id)
{

	GLND_CB *glnd_cb;
	uint32_t rc = NCSCC_RC_FAILURE;
	TRACE_ENTER2("pool id %u", pool_id);

	/* create the CB */
	glnd_cb = glnd_cb_create(pool_id);

	if (!glnd_cb) {
		TRACE_2("GLND cb creation failed");
		goto end;
	}
	rc = NCSCC_RC_SUCCESS;
end:
	TRACE_LEAVE2("%s return value %u", (rc == NCSCC_RC_SUCCESS)?"SUCCESS":"FAILURE", rc);
	return rc;
}
Esempio n. 19
0
void Frontend::handleConstruct_and_GV()
{
	// Walk through call graph and build intermediate representation
	std::vector < Function * >*fctStack = new std::vector < Function * >();

	for (Process *proc : *(this->elab->getProcesses()) ) {
		fctStack->push_back(proc->getMainFct());
		proc->addUsedFunction(proc->getMainFct());
		this->scjit->setCurrentProcess(proc);
		TRACE_2("Process:" << proc->getName() << "\n");
		while (!fctStack->empty()) {
			Function* F = fctStack->back();
			fctStack->pop_back();
			TRACE_3("Parsing Function : " << F->getName().str() << "\n");
			PRINT_3(F->dump());
			this->handleFctConstruct_and_GV(proc, F, fctStack);
		}
	}
	delete fctStack;
}
Esempio n. 20
0
/****************************************************************************
 * Name          : cpnd_ckpt_sec_get_create
 *
 * Description   : Function to Find the section in a checkpoint before create.
 *
 * Arguments     : CPND_CKPT_NODE *cp_node - Check point node.
 *               : SaCkptSectionIdT id - Section Identifier
 *                 
 * Return Values :  NULL/CPND_CKPT_SECTION_INFO
 *
 * Notes         : None.
 *****************************************************************************/
CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_get_create(CPND_CKPT_NODE *cp_node, SaCkptSectionIdT *id)
{
	CPND_CKPT_SECTION_INFO *pSecPtr = NULL;
	TRACE_ENTER();
	if (cp_node->replica_info.n_secs == 0) {
		TRACE_2("cpnd replica has no sections for ckpt_id:%llx",cp_node->ckpt_id);
		TRACE_LEAVE();
		return NULL;
	}
	pSecPtr = cp_node->replica_info.section_info;
	while (pSecPtr != NULL) {
		if ((pSecPtr->sec_id.idLen == id->idLen) && (memcmp(pSecPtr->sec_id.id, id->id, id->idLen) == 0)) {
			TRACE_LEAVE();
			return pSecPtr;
		}
		pSecPtr = pSecPtr->next;
	}
	TRACE_LEAVE();
	return NULL;
}
Esempio n. 21
0
static uns32 ntfa_mds_rcv(struct ncsmds_callback_info *mds_cb_info)
{
	ntfsv_msg_t *ntfsv_msg = (ntfsv_msg_t *)mds_cb_info->info.receive.i_msg;
	uns32 rc;

	pthread_mutex_lock(&ntfa_cb.cb_lock);

	/*this priority is later used in unsubscribe api to post messeges back to mailbox*/
	ntfsv_msg->info.cbk_info.mds_send_priority = mds_cb_info->info.receive.i_priority;

	/* process the message */
	rc = ntfa_ntfs_msg_proc(&ntfa_cb, ntfsv_msg, mds_cb_info->info.receive.i_priority);
	if (rc != NCSCC_RC_SUCCESS) {
		TRACE_2("ntfa_ntfs_msg_proc returned: %d", rc);
	}

	pthread_mutex_unlock(&ntfa_cb.cb_lock);

	return rc;
}
Esempio n. 22
0
File: server.c Progetto: raphui/rdb
int disconnectClient( int *socket )
{
    TRACE_2( SERVER , "disconnectClient()");

    int status = 0;


    if( close( *socket ) < 0 )
    {
        TRACE_ERROR( SERVER , "Cannot close client socket.");

        status = -ENOTSOCK;
    }
    else
    {
        TRACE_1( SERVER , "Client disconnect.");
    }

    return status;
}
Esempio n. 23
0
int disconnectClient( int *socket )
{
    TRACE_2( SERVERMANAGER , "disconnectClient()");

    int status = PC_SUCCESS;


    if( close( *socket ) < 0 )
    {
        TRACE_ERROR( SERVERMANAGER , "Cannot close client socket.");

        status = PC_ERROR;
    }
    else
    {
        TRACE_1( SERVERMANAGER , "Client disconnect.");
    }

    return status;
}
Esempio n. 24
0
/****************************************************************************
 * Name          : glnd_se_lib_destroy
 *
 * Description   : This is the function which destroy the GLND libarary.
 *
 * Arguments     : 
 *
 * Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE.
 *
 * Notes         : None.
 *****************************************************************************/
uint32_t glnd_se_lib_destroy()
{
	GLND_CB *glnd_cb;
	uint32_t rc = NCSCC_RC_FAILURE;
	TRACE_ENTER();

	/* take the handle */
	glnd_cb = (GLND_CB *)m_GLND_TAKE_GLND_CB;
	if (!glnd_cb) {
		LOG_ER("GLND cb take handle failed");
		goto end;
	}

	if ((rc = glnd_cb_destroy(glnd_cb)) != NCSCC_RC_SUCCESS) {
		TRACE_2("GLND cb destroy failed");
		rc= NCSCC_RC_FAILURE;
	}
end:
	TRACE_LEAVE2("%s return value %u", (rc == NCSCC_RC_SUCCESS)?"SUCCESS":"FAILURE", rc);
	return rc;
}
Esempio n. 25
0
/*******************************************************************************************
 * Name                   : cpd_a2s_ckpt_dest_add
 *
 * Description            : Function to add the destination of the already existing 
 *                          checkpoint
 *
 * Arguments              : CPD_CKPT_INFO_NODE - CPD Checkpoint info node
 *
 * Return Values          : None , Error message is logged
 *
 * Notes                  : None 
********************************************************************************************/
void cpd_a2s_ckpt_dest_add(CPD_CB *cb, CPD_CKPT_INFO_NODE *ckpt_node, MDS_DEST *dest)
{
	CPD_MBCSV_MSG cpd_msg;
	uint32_t rc = SA_AIS_OK;
	
	TRACE_ENTER();
	memset(&cpd_msg, '\0', sizeof(CPD_MBCSV_MSG));
	cpd_msg.type = CPD_A2S_MSG_CKPT_DEST_ADD;
	cpd_msg.info.dest_add.ckpt_id = ckpt_node->ckpt_id;
	cpd_msg.info.dest_add.mds_dest = *dest;

	/*  add the destination for the given checkpoint */
	/* send it to MBCSv */
	rc = cpd_mbcsv_async_update(cb, &cpd_msg);
	if (rc != SA_AIS_OK)
		TRACE_4("cpd A2S ckpt async update add failed for ckpt_id:%llx dest:%"PRIu64,ckpt_node->ckpt_id,*dest);
	else
		TRACE_2("cpd A2S ckpt async update success for ckpt_id:%llx dest:%"PRIu64,ckpt_node->ckpt_id,*dest);

	TRACE_LEAVE();
}
Esempio n. 26
0
uint8_t *read_ebml_data_binary(Bitstream_t *bitstr, EbmlElement_t *element,
                               FILE *xml, const char *name)
{
    TRACE_2(MKV, "read_ebml_data_binary2(%i bytes)", element->size);

    uint8_t *value = new uint8_t [element->size+1];
    if (value)
    {
        for (int i = 0; i < element->size; i++)
            value[i] = read_bits(bitstr, 8);
        value[element->size] = '\0';

        if (name)
        {
#if ENABLE_DEBUG
            TRACE_1(MKV, "* %s  = 0x", name);

            if (element->size > 1023)
                TRACE_1(MKV, "* %s  = (first 1024B) 0x", name);
            else
                TRACE_1(MKV, "* %s  = 0x", name);
            for (int i = 0; i < element->size && i < 1024; i++)
                printf("%02X", value[i]);
#endif // ENABLE_DEBUG

            if (xml)
            {
                if (element->size > 1023)
                    fprintf(xml, "  <%s>(first 1024B) 0x", name);
                else
                    fprintf(xml, "  <%s>0x", name);
                for (int i = 0; i < element->size && i < 1024; i++)
                    fprintf(xml, "%02X", value[i]);
                fprintf(xml, "</%s>\n", name);
            }
        }
    }

    return value;
}
Esempio n. 27
0
/****************************************************************************
 * Name          : gld_process_evt
 *
 * Description   : This is the function which is called when gld receives any
 *                 event
 *
 * Arguments     : evt  - Event that was posted to the GLD Mail box
 *
 * Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE
 *
 * Notes         : None.
 *****************************************************************************/
uint32_t gld_process_evt(GLSV_GLD_EVT *evt)
{
	GLSV_GLD_CB *gld_cb = evt->gld_cb;
	TRACE_ENTER2("Event type: %d", evt->evt_type);

	if (gld_cb->ha_state == SA_AMF_HA_ACTIVE) {
		if (gld_evt_dispatch_tbl[evt->evt_type] (evt) != NCSCC_RC_SUCCESS) {
			TRACE_2("Event processing failed");
		}
	}
	if (gld_cb->ha_state == SA_AMF_HA_STANDBY) {
		if (evt->evt_type == GLSV_GLD_EVT_GLND_DOWN || evt->evt_type == GLSV_GLD_EVT_RESTART_TIMEOUT) {
			if (gld_evt_dispatch_tbl[evt->evt_type] (evt) != NCSCC_RC_SUCCESS) {
				LOG_ER("Event processing failed");
			}
		}
	}

	gld_evt_destroy(evt);
	TRACE_LEAVE();
	return NCSCC_RC_SUCCESS;
}
Esempio n. 28
0
/****************************************************************************
  Name          : mqa_client_tree_destroy
 
  Description   : This routine destroys the MQA client tree.
 
  Arguments     : destroy_info - ptr to the destroy info
 
  Return Values : None
 
  Notes         : None
******************************************************************************/
static void mqa_client_tree_destroy(MQA_CB *mqa_cb)
{
	uint32_t rc = NCSCC_RC_SUCCESS;
	TRACE_ENTER();

	/* take the cb lock */
	if ((rc = m_NCS_LOCK(&mqa_cb->cb_lock, NCS_LOCK_WRITE)) != NCSCC_RC_SUCCESS) {
		TRACE_2("FAILURE: Client database Finalization Failed");
		return;
	}
	/* cleanup the client tree */
	mqa_client_tree_cleanup(mqa_cb);

	/* destroy the tree */
	ncs_patricia_tree_destroy(&mqa_cb->mqa_client_tree);

	/* giveup the cb lock */
	m_NCS_UNLOCK(&mqa_cb->cb_lock, NCS_LOCK_WRITE);

	TRACE_LEAVE();
	return;
}
Esempio n. 29
0
/****************************************************************************
  Name          : mqa_asapi_register
 
  Description   : This routine registers with ASAPi library.
 
  Arguments     : cb - MQA control block
 
  Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE
 
  Notes         : None
******************************************************************************/
static uint32_t mqa_asapi_register(MQA_CB *cb)
{
	ASAPi_OPR_INFO asapi_or;
	uint32_t rc = NCSCC_RC_SUCCESS;
	TRACE_ENTER();

	/* Register with ASAPi library */

	asapi_or.type = ASAPi_OPR_BIND;
	asapi_or.info.bind.i_indhdlr = mqa_asapi_msghandler;
	asapi_or.info.bind.i_mds_hdl = cb->mqa_mds_hdl;
	asapi_or.info.bind.i_mds_id = NCSMDS_SVC_ID_MQA;
	asapi_or.info.bind.i_my_id = NCS_SERVICE_ID_MQA;
	asapi_or.info.bind.i_mydest = cb->mqa_mds_dest;

	if ((rc = asapi_opr_hdlr(&asapi_or)) != NCSCC_RC_SUCCESS) {
		TRACE_2("FAILURE: ASAPi Bind Failed");
		return NCSCC_RC_FAILURE;
	}

	TRACE_LEAVE();
	return NCSCC_RC_SUCCESS;
}
Esempio n. 30
0
char *getTrackInfos( void )
{
    TRACE_2( PLAYERMANAGER , "getTrackInfo().");

    char *buff = ( char * )zmalloc( 512 * sizeof( char ) );

    LOCK_MUTEX( PLAYERMANAGER , &mutexSession );


    //If the return of sp_track_name is a empty string, then an error occured
    if( strcmp( sp_track_name( currentTrack ) , "" ) == 0 )
    {
        snprintf( buff , 512 , "Cannot get metadata from track.");
    }
    else
    {
        sprintf( buff , "%s , %s , %s" , sp_track_name( currentTrack ) , sp_artist_name( sp_track_artist( currentTrack , 0 ) ) , sp_album_name( sp_track_album( currentTrack ) ) );
    }

    UNLOCK_MUTEX( PLAYERMANAGER , &mutexSession );

    return buff;
}