예제 #1
0
bool CTAPI_initCTAPI(CTAPI_logfunc_t _logfunc,const char *libname,unsigned short int portnum,unsigned short int _ctnum)
{
    CTAPI_logfunc=_logfunc;
    ctnum=_ctnum;
    
    char logmsg[300];
    
    // loading ctapi library
    handle=DLOPEN(libname);
    if (handle==NULL) {
        sprintf(logmsg,"dlopen: %s",DLERROR());
        CTAPI_log(logmsg);
        return false;
    }

    initfunc=(initfunc_t)(DLSYM(handle,"CT_init"));
    if (initfunc==0) {
        sprintf(logmsg,"dlsym CT_init: %s",DLERROR());
        CTAPI_log(logmsg);
        return false;
    }
    
    datafunc=(datafunc_t)(DLSYM(handle,"CT_data"));
    if (datafunc==NULL) {
        sprintf(logmsg,"dlsym CT_data: %s",DLERROR());
        CTAPI_log(logmsg);
        return false;
    }
    
    closefunc=(closefunc_t)(DLSYM(handle,"CT_close"));
    if (closefunc==NULL) {
        sprintf(logmsg,"dlsym CT_close %s",DLERROR());
        CTAPI_log(logmsg);
        return false;
    }
    
    CTAPI_log("loading lib ok");
    
    // initializing CTAPI lib
    signed char err=(*initfunc)(ctnum,portnum);
    if (err!=0) {
        sprintf(logmsg,"CT_init: %i (%s)",err,CTAPI_getErrorString(err));
        CTAPI_log(logmsg);
        return false;
    }
    
    CTAPI_log("initializing CTAPI ok");
    return true;
}
MNcdSearchOperation* CNcdNodeSearch::SearchL( MNcdLoadNodeOperationObserver& aObserver,
                                              MNcdSearchFilter& aSearchFilter )
    {
    DLTRACEIN((""));
    
    if ( aSearchFilter.Keywords().MdcaCount() < 1 )
        {
        DLERROR(("Error, no keywords in search!"));
        DASSERT( 0 );
        User::Leave( KErrArgument );
        }
    // make sure that search root is created
    CNcdSearchRootNodeProxy* searchRoot = &iNode.NodeManager().SearchRootNodeL();    
    CNcdLoadNodeOperationProxy* operation = iOperationManager.CreateLoadNodeOperationL( iNode,
        EFalse, // don't load children
        0, // pagesize, meaningless in this case
        0, // pagestart, meaningless in this case
        0, // depth, meaningless in this case
        ELoadStructure, // meaningless in this case
        &aSearchFilter );
    CleanupReleasePushL( *operation );
    // Search root is added as an observer here to make it
    // update once the op is complete. 
    operation->AddObserverL( searchRoot );
    operation->AddObserverL( &iNode );
    operation->AddObserverL( &aObserver );
    CleanupStack::Pop( operation );
    return operation;
    }
예제 #3
0
// ---------------------------------------------------------------------------
// ConstructL
// ---------------------------------------------------------------------------
void CNcdReportInstall::ConstructL( 
    const TDesC& aContentIdentifier,
    const CNcdNodeIdentifier& aMetadataId,
    const TDesC& aReportUri,
    const TDesC& aReportNamespace )
    {
    DLTRACEIN((""));
    BaseConstructL( aMetadataId );

    if ( !aReportUri.Length() || 
         !aReportNamespace.Length() )
        {
        DLERROR(("Either URI, report URI or report namespace is empty"));
        User::Leave( KErrArgument );
        }

    Attributes().SetAttributeL( 
        ENcdReportAttributeGenericId, 
        aContentIdentifier );

    Attributes().SetAttributeL( 
        ENcdReportAttributeReportUri, 
        aReportUri );

    Attributes().SetAttributeL( 
        ENcdReportAttributeReportNamespace, 
        aReportNamespace );

    DLTRACEOUT((""));
    }
// ---------------------------------------------------------------------------
// CreateOrGetStorageL
// ---------------------------------------------------------------------------
//
MNcdStorage& CNcdStorageManager::CreateOrGetStorageL( const TDesC& aClientUid, 
    const TDesC& aNamespace )
    {
    DLTRACEIN((""));
    MNcdStorage* storage = NULL;
    
    TRAPD( err,        
           storage =
           &StorageL( aClientUid, aNamespace ) );
    
    if ( err == KErrNotFound ) 
        {
        DLINFO(("Creating storage for the client"));
        storage = 
            &CreateStorageL( aClientUid, 
                             aNamespace );
        }
    else if ( err != KErrNone )
        {
        DLERROR(("Leaving: %i", err));
                
        User::Leave( err );   
        }
            

    DLTRACEOUT((""));
    return *storage;    
    }
MNcdLoadNodeOperation* CNcdSearchNodeBundleProxy::LoadChildrenL( TInt aIndex, 
                                                           TInt aSize,
                                                           TNcdChildLoadMode aMode,
                                                           MNcdLoadNodeOperationObserver& aObserver )
    {
    DLTRACEIN((("this: %X"), this));
    DASSERT( iSearchFilter );
        
    if( aSize < 1 || aIndex < 0 || ( aMode == ELoadMetadata && aIndex + aSize > ChildCount() ))
        {
        // Nothing to be done 
        DLERROR(( "Argument error. ChildCount: %d Given index: %d, size: %d",
                  ChildCount(), aIndex, aSize ));
        DASSERT( EFalse );
        User::Leave( KErrArgument );
        }

    DLTRACE(( _L("Node: %S, %S"), &Namespace(), &Id() ));

    // Search bundle may contain transparent stuff, so use server child count for loading
    // to get correct indexing on server side.
    return CNcdSearchNodeFolderProxy::LoadChildrenL( 
        0,
        ServerChildCount(),
        aMode,
        aObserver );
    }
MNcdNode* CNcdSearchNodeBundleProxy::ChildL( TInt aIndex )
    {
    DLTRACEIN(( _L("This parent: %S, %S"), &Namespace(), &Id() ));

           
    if ( aIndex < 0 || aIndex >= iChildren.Count() )
        {
        // Nothing to be done 
        DLERROR(( "Index error. child count: %d Given index: %d", 
                  iChildren.Count(), aIndex ));
        DASSERT( EFalse );
        User::Leave( KErrArgument );
        }
        
    const CNcdNodeIdentifier* child = &iChildren[aIndex]->Identifier();
        
    MNcdNode* node( NULL );
    
    TRAPD( err, node = &NodeManager().NodeL( *child ) );
    
    if ( err == KErrNotFound ) 
        {
        return NULL;
        }
        
    User::LeaveIfError( err );
    
    // Increase the reference counter by one
    node->AddRef();
    
    DLTRACEOUT((""));

    return node;
    }
void CNcdTopLevelParser::OnContentL(const TDesC8& aBytes, TInt aErrorCode)
    {
    DLTRACEIN((""));
    // Error code checks need only be done in the top level parser,
    // all calls come through it.
    if( aErrorCode != KErrNone )
        {
        DLERROR(("%d",aErrorCode));
        iObservers->ParserObserver()->ParseError( aErrorCode );
        return;
        }

    if( iSubParser )
        {
        // Is this correct? if the content comes in chunks and a middle chunck
        // is dismissed due to this check, then an error probably occurs.
        if( /*NcdProtocolUtils::IsWhitespace( aBytes )*/false )
            {
//             DLINFO(("Skipping %db whitespace content",aBytes.Length()));
            }
        else if( iSubParser )
            {
            iSubParser->OnContentL( aBytes, aErrorCode );
            }
        }
    else
        {
        DLWARNING(("Ignoring %d bytes content",aBytes.Length()));
        }
    }
// ---------------------------------------------------------------------------
// Request completed
// ---------------------------------------------------------------------------
//	
void CCatalogsHttpTransaction::RequestCompleted( TInt aError )
    {
    DLTRACEIN( ("Error: %d", aError ) );
    DASSERT( iObserver );
    AddRef();

    SetTransferring( EFalse );
    if ( aError != KErrNone ) 
        {
        iOwner.ConnectionManager().ReportConnectionError( 
            iConfig->ConnectionMethod(),
            aError );
        }
    
    // If reference count is 1, then the operation has already been 
    // cancelled/released
    if ( iRefCount > 1 )
        {        
        TRAPD( err, DoRequestCompletedL( aError ) );
        if ( err != KErrNone ) 
            {
            DLERROR(("DoRequestCompletedL leaved with: %d", err));
            // Symbian error codes
            iObserver->HandleHttpError( *this, TCatalogsHttpError( 
                ECatalogsHttpErrorGeneral, err) );            
            }
        }

    Release();
    DLTRACEOUT((""));    
    }
void CNcdNodeFolderLink::InternalizeL( const MNcdPreminetProtocolEntityRef& aData,
                                       const CNcdNodeIdentifier& aParentIdentifier,
                                       const CNcdNodeIdentifier& aRequestParentIdentifier,
                                       const TUid& aClientUid )
    {
    DLTRACEIN((""));

    if( aData.Type() != MNcdPreminetProtocolEntityRef::EFolderRef )
        {
        DLERROR(("Wrong type"));
        DASSERT( EFalse );
        // The data should be for the folder
        User::Leave( KErrArgument );
        }
    
    // First internalize parent stuff
    CNcdNodeLink::InternalizeL( 
        aData, aParentIdentifier, aRequestParentIdentifier, aClientUid );

    // Safe to cast because the type was checked in the beginning
    // of this function.
    const MNcdPreminetProtocolFolderRef& castedData =
        static_cast<const MNcdPreminetProtocolFolderRef&>( aData );
        
    if( castedData.Count() != MNcdPreminetProtocolFolderRef::KValueNotSet )
        {
        DLTRACE(("Child count set -> change it, previous count: %d new count: %d",
            iExpectedChildrenCount, castedData.Count() ));
        iExpectedChildrenCount = castedData.Count();
        }

    DLTRACEOUT((""));
    }
void CNcdNodePreview::ReceiveMessage( MCatalogsBaseMessage* aMessage,
                                  TInt aFunctionNumber )
    {
    DLTRACEIN((""));    

    DASSERT( aMessage );
    
    // Now, we can be sure that rest of the time iMessage exists.
    // This member variable is set for the CounterPartLost function.
    iMessage = aMessage;
    
    TInt trapError( KErrNone );
    
    // Check which function is called by the proxy side object.
    // Function number are located in ncdnodefunctinoids.h file.
    switch( aFunctionNumber )
        {
        case NcdNodeFunctionIds::ENcdInternalize:
            // Internalize the proxy side according to the data
            // of this object.
            TRAP( trapError, InternalizeRequestL( *aMessage ) );
            break;

        case NcdNodeFunctionIds::ENcdPreviewOpenFile:
            TRAP( trapError, OpenPreviewFileL( *aMessage ) );
            break;
        
        case NcdNodeFunctionIds::ENcdRelease:
            // The proxy does not want to use this object anymore.
            // So, release the handle from the session.
            ReleaseRequest( *aMessage );
            break;
                    
        case NcdNodeFunctionIds::ENcdIsPreviewLoaded:
            TRAP( trapError, IsPreviewLoadedL( *aMessage ));
            break;
        
        default:
            DLERROR(("Unidentified function request"));
            DASSERT( EFalse );
            break;
        }

    if ( trapError != KErrNone )
        {
        // Because something went wrong, the complete has not been
        // yet called for the message.
        // So, inform the client about the error if the
        // message is still available.
        aMessage->CompleteAndRelease( trapError );
        }

    // Because the message should not be used after this, set it NULL.
    // So, CounterPartLost function will know that no messages are
    // waiting the response at the moment.
    iMessage = NULL;        
    
    DLTRACEOUT((""));
    }
void CNcdNodeContentInfoProxy::InternalizeL()
    {
    DLTRACEIN((""));

    HBufC8* data( NULL );
        
    // Because we do not know the exact size of the data, use
    // the alloc method, which creates the buffer of the right size
    // and sets the pointer to point to the created buffer.
    // Get all the data that is necessary to internalize this object
    // from the server side.
    TInt error(
        ClientServerSession().
        SendSyncAlloc( NcdNodeFunctionIds::ENcdInternalize,
                       KNullDesC8,
                       data,
                       Handle(),
                       0 ) );

    if ( error == KNcdErrorObsolete )
        {
        DLINFO(("Content info was obsolete"));
        // Remove interfaces implemented by this class from the top parent interface list.
        // So, the interface list is up to date after this object is removed
        // from its top parent.
        RemoveInterface( MNcdNodeContentInfo::KInterfaceUid );
        // Remove from the parent
        RemoveFromParent();
        // Now update the interface for this object just in case somebody needs it.
        // Register the interface
        MNcdNodeContentInfo* interface( this );
        AddInterfaceL( 
            CCatalogsInterfaceIdentifier::NewL( interface, this, MNcdNodeContentInfo::KInterfaceUid ) );
        }

    // If error occurred during data transfer, leave here and forward the error.
    User::LeaveIfError( error );

    if ( data == NULL )
        {
        DLERROR((""));
        User::Leave(  KErrNotFound );
        }

     CleanupStack::PushL( data );

     // Read the data from the stream and insert it to the memeber variables
     RDesReadStream stream( *data );
     CleanupClosePushL( stream );
    
     InternalizeDataL( stream );
    
     // Closes the stream
     CleanupStack::PopAndDestroy( &stream ); 
     CleanupStack::PopAndDestroy( data );

    DLTRACEOUT((""));    
    }
TInt CCatalogsHttpDownloadManager::RunError( TInt aError )
{
    DLTRACEIN(("aError: %d", aError));
    (void) aError;

    DLERROR(( "Trying to cancel all downloads" ));
    NotifyCancelAll();

    return KErrNone;
}
// ---------------------------------------------------------------------------
// From MNcdFileDownloadOperation
// 
// ---------------------------------------------------------------------------
//
void CNcdFileDownloadOperationProxy::ResumeL()
    {
    DLTRACEIN(( "" ));
    HBufC8* data = NULL;
    TState state = OperationStateL();

    // Check that the operation is in a resumable state    
    if ( state == EStateCancelled ) 
        {
        DLERROR(("Cannot resume! Operation has been cancelled. Leaving"));
        User::Leave( KErrCancel );
        }
        
    if ( ( state != EStateStopped && state != EStateRunning ) || !iIsPaused )
        {     
        DLTRACEOUT(("Operation complete or other unresumable state"));   
        return;
        }
    
    ClientServerSession().SendSyncAlloc( ENCDOperationFunctionResume,
        KNullDesC8(),
        data,
        Handle(),
        0 );
        
    if ( data ) 
        {
        DLTRACE(("Received progress information"));
        RDesReadStream stream( *data );
        CleanupStack::PushL( data );
        CleanupClosePushL( stream );

        // Just read the completionId from the stream
        stream.ReadInt32L();
        
        TNcdSendableProgress progress;
        // Read progress info
        
        progress.InternalizeL( stream );
        // Update paused-state
        iIsPaused = ( progress.iState == ENcdDownloadPaused );
            
        DLTRACE(("Sending continue message"));
        if ( progress.iState == KNcdDownloadContinueMessageRequired  )
            {
            SendContinueMessageL();
            }        
        
        CleanupStack::PopAndDestroy( 2, data ); // stream, data        
        }
                
    SetState( EStateRunning );     
    DLTRACEOUT(( "" ));
    
    }
MNcdNode* CNcdNodeFolderProxy::ChildL( TInt aIndex )
    {
    DLTRACEIN(( _L("This parent: %S, %S"), &Namespace(), &Id(), aIndex ));
    DLINFO(("aIndex = %d, expected childcount= %d, real child count = %d",
        aIndex, iExpectedChildCount, iChildren.Count() ));
        
    if ( aIndex < 0 || aIndex >= iExpectedChildCount )
        {
        // Nothing to be done 
        DLERROR(( "Index error. expected child count: %d Given index: %d", 
                  iExpectedChildCount, aIndex ));
        DASSERT( EFalse );
        User::Leave( KErrArgument );   
        }
        
    // search for a child with given index
    const CNcdNodeIdentifier* child = NULL;
    for( TInt i = 0 ; i < iChildren.Count() ; i++ )
        {
        if ( iChildren[i]->Index() == aIndex )
            {
            child = &iChildren[i]->Identifier();
            }
        else if ( iChildren[i]->Index() > aIndex )
            {
            // no sense in searching further
            break;
            }
        }

    if( child == NULL )
        {
        return NULL;
        }
    
    MNcdNode* node( NULL );
    
    TRAPD( err, node = &NodeManager().NodeL( *child ) );    

    if ( err == KErrNotFound ) 
        {
        return NULL;
        }

    User::LeaveIfError( err );
    
    // Increase the reference counter by one
    node->AddRef();
    
    DLTRACEOUT((""));

    return node;
    }
MNcdLoadNodeOperation* CNcdSearchNodeFolderProxy::LoadChildrenL( TInt aIndex, 
                                                           TInt aSize,
                                                           TNcdChildLoadMode aMode,
                                                           MNcdLoadNodeOperationObserver& aObserver )
    {
    DLTRACEIN((("this: %X"), this));
    DASSERT( iSearchFilter );
    
    if( aSize < 1 || aIndex < 0 || ( aMode == ELoadMetadata && aIndex + aSize > ChildCount() ))
        {
        // Nothing to be done 
        DLERROR(( "Argument error. ChildCount: %d Given index: %d, size: %d",
                  ChildCount(), aIndex, aSize ));
        DASSERT( EFalse );
        User::Leave( KErrArgument );
        }

    DLTRACE(( _L("Node: %S, %S"), &Namespace(), &Id() ));

    #ifdef CATALOGS_BUILD_CONFIG_DEBUG    
    const MDesCArray& keywords = iSearchFilter->Keywords();
    DLINFO(("Search filter: "));
    for ( TInt i = 0; i < keywords.MdcaCount(); i++ ) 
        {
        DLINFO((_L("%S"), &keywords.MdcaPoint( i ) ));
        }
    #endif
        
    CNcdLoadNodeOperationProxy* operation = 
        OperationManager().CreateLoadNodeOperationL( *this,
            ETrue, // load children
            aSize, 
            aIndex,
            1,
            aMode,
            iSearchFilter );

    if( operation == NULL )
        {
        DLTRACEOUT(("NULL"));     
        return NULL;
        }

    CleanupReleasePushL( *operation );
    operation->AddObserverL( this );
    operation->AddObserverL( &aObserver );
    CleanupStack::Pop( operation );
    
    DLTRACEOUT((""));

    return operation;
    }
예제 #16
0
TBool CNcdNodeFolder::InsertChildL( 
    const CNcdNodeIdentifier& aNodeIdentifier,
    TInt aIndex,
    TBool aTransparent,
    CNcdNodeFactory::TNcdNodeType aNodeType )
    {
    DLTRACEIN(( _L("this: %X, Parent ns, id: %S, %S, Child ns, id: %S, %S, aIndex: %d, childCount: %d"),
        this, &Identifier().NodeNameSpace(), &Identifier().NodeId(),
        &aNodeIdentifier.NodeNameSpace(), &aNodeIdentifier.NodeId(),
        aIndex, iChildren.Count() ));
               
    DPROFILING_BEGIN( x );
    if ( aIndex < 0 || aIndex > iChildren.Count() )
        {
        // For debugging purposes
        DLERROR(("Wrong child index"));
        DASSERT( EFalse );
        
        User::Leave( KErrArgument );
        }
    
    CNcdChildEntity* childEntity = CNcdChildEntity::NewLC( 
        aIndex,
        aNodeIdentifier,
        aTransparent,
        aNodeType );
    if( aIndex == iChildren.Count() )
        {
        // last index, append
        DLTRACE(("Appending"));
        iChildren.AppendL( childEntity );
        }
    else
        {
        DLTRACE(("Inserting"));
        iChildren.InsertL( childEntity, aIndex );
        }    
    CleanupStack::Pop( childEntity );    

    #ifdef CATALOGS_BUILD_CONFIG_DEBUG
    for( TInt i = 0 ; i < iChildren.Count() ; i++ )
        {
        DLINFO(( _L("Child: index: %d, real index: %d, id: %S, ns: %S "),
            i, iChildren[i]->Index(), &iChildren[i]->Identifier().NodeId(),
            &iChildren[i]->Identifier().NodeNameSpace() ));
        }
    #endif

    DPROFILING_END( x );
    return ETrue;
    }
// ---------------------------------------------------------------------------
// 
// ---------------------------------------------------------------------------
//
void CNcdSendHttpRequestOperation::HandleStateL()
    {
    switch ( iOperationState ) 
        {
        case EStateRunning: 
            {
            DLTRACE(("Creating request"));
            DASSERT( iRequest );            
            iTransaction = iAdapter->CreateTransactionL( 
                *iUri,
                *iRequest,
                *this );
            
            iTransaction->Config().SetConnectionMethod( 
                iConnectionMethod );
                
            TInt err = iTransaction->Start();
            if ( err != KErrNone ) 
                {
                DLERROR(("Start failed with %d", err));
                iTransaction->Cancel();
                iTransaction = NULL;
                User::Leave( err );
                }
                        
            break;
            }
            
        case EStateComplete:
            {
            // Returns false if there was no error
            if ( !HandleError( iError ) ) 
                {
                DLTRACE(("Completing the operation"));                
                CNcdBaseOperation::CompleteMessage( 
                    iPendingMessage,
                    ENCDOperationMessageCompletionComplete, 
                    iProgress,
                    KErrNone );
                
                }
            break;
            }
        
        default: 
            {
            DASSERT( 0 );
            }
        }
    
    }
예제 #18
0
/**
 * UNUSED
 * This function opens a handle on the specified library in order to load symbols from it.
 * It is just a wrapper over dlopen(), but provides some logs in case of error.
 *
 * The returned pointer can be used to load a symbol from the library, using the freerdp_get_library_symbol() call.
 * The returned pointer should be closed using the freerdp_close_library() call.
 *
 * @see freerdp_get_library_symbol
 * @see freerdp_close_library
 *
 * @param file [IN]		- library name
 * @return Pointer to the loaded library. NULL if an error occurs.
 */
void* freerdp_open_library(const char* file)
{
	void* library;

	library = DLOPEN(file);

	if (library == NULL)
	{
		printf("freerdp_load_library: failed to open %s: %s\n", file, DLERROR());
		return NULL;
	}

	return library;
}
예제 #19
0
/**
 * UNUSED
 * This function retrieves a pointer to the specified symbol from the given (loaded) library.
 * It is a wrapper over the dlsym() function, but provides some logs in case of error.
 *
 * @see freerdp_open_library
 * @see freerdp_close_library
 *
 * @param library [IN]		- a valid pointer to the opened library.
 * 							  This pointer should come from a successful call to freerdp_open_library()
 * @param name [IN]			- name of the symbol that must be loaded
 *
 * @return A pointer to the loaded symbol. NULL if an error occured.
 */
void* freerdp_get_library_symbol(void* library, const char* name)
{
	void* symbol;

	symbol = DLSYM(library, name);

	if (symbol == NULL)
	{
		printf("freerdp_get_library_symbol: failed to load %s: %s\n", name, DLERROR());
		return NULL;
	}

	return symbol;
}
예제 #20
0
const CNcdNodeIdentifier& CNcdBundleFolder::ChildByServerIndexL( TInt aIndex ) const
    {
    DLTRACEIN((""));    
    // bundle folders's child count is always the number of children in the child array
    // because, contrary to regular folders, bundle folder doesn't have an expected child count
    if ( aIndex < 0 || aIndex >= ChildArray().Count() )
        {
        // For debugging purposes
        DLERROR(("Wrong child index: %d, count: %d", aIndex, ChildArray().Count() ));
        DASSERT( EFalse );
        User::Leave( KErrArgument );
        }
    return ChildArray()[aIndex]->Identifier();
    }
MNcdLoadNodeOperation* CNcdNodeFolderProxy::LoadChildrenL( TInt aIndex, 
                                                           TInt aSize,
                                                           TNcdChildLoadMode aMode,
                                                           MNcdLoadNodeOperationObserver& aObserver )
    {
    DLTRACEIN(("aIndex: %d, aSize: %d, expected child count: %d, load mode: %d",
        aIndex, aSize, iExpectedChildCount, aMode ));

    if ( aSize < 1 
         || aIndex < 0 
         || ( aMode == ELoadMetadata 
              && aSize != KMaxTInt 
              && aIndex + aSize > ChildCount() ) )
        {
        // Nothing to be done 
        DLERROR(( "Argument error. ChildCount: %d Given index: %d, size: %d",
                  ChildCount(), aIndex, aSize ));
        User::Leave( KErrArgument );
        }

    if ( aSize == KMaxTInt )
        {
        // Because aSize is KMaxTInt, reduce it by the aIndex value.
        // This way we will not have possible overload if aIndex is later added
        // to the aSize value. It does not really matter what the aSize value is
        // after this. KMaxTInt is so great value, that in all the cases the server
        // request should give all the required items.
        aSize -= aIndex;
        DLINFO(("aSize was KMaxTInt. Reduced by index: %d", aSize));
        }

    DLTRACE(( _L("Node: %S, %S"), &Namespace(), &Id() ));
    
    CNcdLoadNodeOperationProxy* operation = 
        OperationManager().CreateLoadNodeOperationL( 
            *this, ETrue, aSize, aIndex, 1, aMode );

    if ( !operation )
        {
        DLTRACEOUT(("NULL"));     
        return NULL;
        }

    operation->AddObserverL( this );
    operation->AddObserverL( &aObserver );

    DLTRACEOUT((""));        

    return operation;
    }
예제 #22
0
/**
 * This function will load the specified library, retrieve the specified symbol in it, and return a pointer to it.
 * It is used in freerdp_load_plugin() and freerdp_load_channel_plugin().
 * It seems there is no way to unload the library once this call is made. Now since this is used for plugins,
 * we probably don't need to take care of unloading them, as it will be done only at shutdown.
 *
 * @param file [IN]	- library name
 * @param name [IN]	- symbol name to find in the library
 *
 * @return pointer to the referenced symbol. NULL if an error occured.
 */
void* freerdp_load_library_symbol(const char* file, const char* name)
{
	void* library;
	void* symbol;

	library = DLOPEN(file);

	if (library == NULL)
	{
		printf("freerdp_load_library_symbol: failed to open %s: %s\n", file, DLERROR());
		return NULL;
	}

	symbol = DLSYM(library, name);

	if (symbol == NULL)
	{
		printf("freerdp_load_library_symbol: failed to load %s: %s\n", file, DLERROR());
		return NULL;
	}

	return symbol;
}
예제 #23
0
const CNcdNodeIdentifier& CNcdSearchRootNode::ChildByServerIndexL( TInt aIndex ) const
    {
    DLTRACEIN((""));
    
    if ( aIndex < 0 || aIndex >= ChildArray().Count() )
        {
        // For debugging purposes
        DLERROR(("Wrong child index"));
        DASSERT( EFalse );
        User::Leave( KErrArgument );
        }
        
    return ChildArray()[aIndex]->Identifier();
    }
void CCatalogsHttpTransaction::NotifyObserver()
    {
    DLTRACEIN((""));
    if ( iObserver ) 
        {        
        TRAPD( err, iObserver->HandleHttpEventL( *this, iState ) );
        if ( err != KErrNone ) 
            {
            DLERROR(("Observer's HandleHttpEventL leaved with: %d", err));
            // Symbian error codes
            iObserver->HandleHttpError( *this, TCatalogsHttpError( 
                ECatalogsHttpErrorGeneral, err) );            
            }
        }
    }
예제 #25
0
void CNcdTopLevelParser::OnEndElementL(const Xml::RTagInfo& aElement, TInt aErrorCode) 
    {
    DLTRACE((""));

    // Error code checks need only be done in the top level parser,
    // all calls come through it.
    if( aErrorCode != KErrNone )
        {
        DLERROR(("%d",aErrorCode));
        iObservers->ParserObserver()->ParseError( aErrorCode );
        return;
        }
   
    CNcdSubParser::OnEndElementL( aElement, aErrorCode );
    }
예제 #26
0
void CNcdTopLevelParser::OnStartElementL( const Xml::RTagInfo& aElement, 
                                          const Xml::RAttributeArray& aAttributes, 
                                          TInt aErrorCode ) 
    {

    CNcdSubParser::OnStartElementL( aElement, aAttributes, aErrorCode );

    DLTRACEIN((""));

    // Error code checks need only be done in the top level parser,
    // all calls come through it.
    if( aErrorCode != KErrNone )
        {
        DLERROR(("%d",aErrorCode));
        iObservers->ParserObserver()->ParseError( aErrorCode );
        return;
        }

    TPtrC8 tag( aElement.LocalName().DesC() );
    // Here we handle the tag. If we don't know how to do it, try to create a subparser.

    if( iSubParser == 0 )
        {
        DLTRACE(("start tag=%S",&tag));
        if ( tag == KTagPreminetResponse )
            {
            iSubParser = CNcdPreminetProtocolResponseParser::NewL( *iObservers, *this, iDepth+1, 
                                                                   aElement, aAttributes );
            }
        else if ( tag == KTagConfigurationResponse )
            {
            iSubParser = CNcdConfigurationProtocolResponseParser::NewL( *iObservers, *this, iDepth+1, 
                                                                        aElement, aAttributes );
            }
        else
            {
            iSubParser = CNcdUnknownParser::NewL( *iObservers, *this, iDepth+1, 
                                                  aElement, aAttributes );
            }
        } 

    else
        {
        // Using old subparser
        iSubParser->OnStartElementL( aElement, aAttributes, aErrorCode );
        }

    }
void CNcdNodeFolderProxy::InternalizeNodeDataL( RReadStream& aStream )
    {
    DLTRACEIN((""));
    
    // First internalize parent data
    CNcdNodeProxy::InternalizeNodeDataL( aStream );

    // Get the children data here.

    DLTRACE(("Handle children"));

    // Clear the buffer because new childs will be appended
    iChildren.ResetAndDestroy();
    
    TInt childrenCount( aStream.ReadInt32L() );
    DLTRACE(("Children: %d", childrenCount ));

    TInt classObjectType( NcdNodeClassIds::ENcdNullObjectClassId );

    for ( TInt i = 0; i < childrenCount; ++i )
        {
        // This is safe casting because enum is same as TInt
        classObjectType = 
            static_cast<NcdNodeClassIds::TNcdNodeClassId>(aStream.ReadInt32L());
        if ( NcdNodeClassIds::ENcdChildEntityClassId == classObjectType )
            {
            CNcdChildEntity* childEntity = CNcdChildEntity::NewLC( aStream );
            iChildren.AppendL( childEntity );
            CleanupStack::Pop( childEntity );            
            DLINFO((_L("Added child, id: %S, array index: %d, real index: %d"),
            &childEntity->Identifier().NodeId(), i, childEntity->Index() ));
            }
        else
            {
            // For debug purposes
            DLERROR(("Wrong class id"));
            DASSERT( EFalse );

            // Wrong kind of class object info
            User::Leave( KErrCorrupt );
            }
        }
        
    // Show node info here, after the internalization has been done.        
    DLTRACEOUT(( _L("Node: %S, %S, %d"), 
                 &Namespace(), &Id(), NodeIdentifier().ClientUid().iUid ));
    }
void CNcdNodeContentInfoProxy::InternalizeDataL( RReadStream& aStream )
    {
    DLTRACEIN((""));

    // First read the class id. Because, it is the first thing in the stream.
    TInt classId( aStream.ReadInt32L() );
    
    if ( classId != NcdNodeClassIds::ENcdNodeContentInfoClassId )
        {
        // classId is not recognized
        DLERROR(("Class id was not recognized!"));
        // For testing purposes assert here
        DASSERT( EFalse );
        
        // Otherwise leave is adequate
        User::Leave( KErrCorrupt );
        }

    iPurpose = aStream.ReadUint16L();
    DLINFO(( "Purpose: %u", iPurpose ));
    
    InternalizeDesL( iMimeType, aStream );    
    DLINFO(( _L("Mime: %S"), iMimeType ));
    
    //The Internalization here must be consistant with the externalization in CNcdNodeContentInfo
    if ( iMimeType->Compare( KMimeTypeMatchWidget ) == 0 )
        {
        //widget
        InternalizeDesL( iIdentifier, aStream );
        }
    else
        {
        //sis
        iUid.iUid = aStream.ReadInt32L();   
        DLINFO(( "Uid: %x", iUid.iUid )); 
        }
   
    InternalizeDesL( iVersion, aStream );    
    DLINFO(( _L("Version: %S"), iVersion ));

    iSize = aStream.ReadInt32L();
    DLINFO(( _L("Size: %d"), iSize ));
    
    DLTRACEOUT((""));
    }
예제 #29
0
/**
 * UNUSED
 * This function closes a library handle that was previously opened by freerdp_open_library().
 * It is a wrapper over dlclose(), but provides logs in case of error.
 *
 * @see freerdp_open_library
 * @see freerdp_get_library_symbol
 *
 * @return true if the close succeeded. false otherwise.
 */
boolean freerdp_close_library(void* library)
{
	int status;

	status = DLCLOSE(library);

#ifdef _WIN32
	if (status != 0)
#else
	if (status == 0)
#endif
	{
		printf("freerdp_free_library: failed to close: %s\n", DLERROR());
		return false;
	}

	return true;
}
예제 #30
0
void CNcdNodeItemLink::InternalizeL( const MNcdPreminetProtocolEntityRef& aData,
                                     const CNcdNodeIdentifier& aParentIdentifier,
                                     const CNcdNodeIdentifier& aRequestParentIdentifier,
                                     const TUid& aClientUid )
    {
    DLTRACEIN((""));
    if( aData.Type() != MNcdPreminetProtocolEntityRef::EItemRef )
        {
        // The data should be for the item
        DLERROR(("Wrong type"));
        DASSERT( EFalse );
        User::Leave( KErrArgument );
        }
    
    // Let the parent do its internalizing
    CNcdNodeLink::InternalizeL( 
        aData, aParentIdentifier, aRequestParentIdentifier, aClientUid );
    DLTRACEOUT((""));
    }