RTPMPComponentVideo_PreflightMedia(
	RTPMPComponentVideoInstanceData **	inGlobals,
	OSType								inMediaType,
	SampleDescriptionHandle				inSampleDescription )
{
#pragma unused( inGlobals )
	
	ComponentResult			theResult;
	ImageDescriptionHandle	theDescription;
	
	
	theDescription = REINTERPRET_CAST( ImageDescriptionHandle )( inSampleDescription );
	
	if(
		inMediaType != VideoMediaType  ||
		( **theDescription ).cType != kComponentVideoDataFormat )
	{
		theResult = qtsUnsupportedDataTypeErr;
	}
	
	else if( ( **theDescription ).width <= 0  ||  ( **theDescription ).height <= 0 )
	{
		theResult = qtsUnsupportedFeatureErr;
	}
	
	else
	{
		theResult = noErr;
	}
	
	return( theResult );
}
示例#2
0
//
/// This callback is the default 'Dialog box procedure' of each page of our
/// property sheet....
//
INT_PTR CALLBACK
TPropertyPage::PropDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
  switch(msg) {
    case  WM_INITDIALOG: {
        // Attach C++ object with it's underlying handle if necessary
        //
        LPPROPSHEETPAGE pageInfo = REINTERPRET_CAST(LPPROPSHEETPAGE,lParam);
        InitHandle(hDlg, pageInfo);
      }
      break;

    case WM_NOTIFY: {
        TNotify& notifyInfo= *(REINTERPRET_CAST(TNotify*, lParam));
        if (notifyInfo.code<=(uint)PSN_FIRST && notifyInfo.code>=(uint)PSN_LAST){
          // Property sheet notifications require special handling
          // since the concept of ctlId is non-existent. We patch it
          // to the default PageID expected by the ObjectWindows
          // Property Page dispatchers
          //
          notifyInfo.idFrom = PropPageID;
          wParam = PropPageID;
        }
      }
      break;

    default:
      break;
  }
  return TDialog::StdDlgProc(hDlg, msg, wParam, lParam);
}
// -----------------------------------------------------------------------------
// CHttpConnHandler::SetConnectionInfoL
// ?implementation_description
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CHttpConnHandler::SetConnectionInfoL()
    {
    RStringPool strPool = iHttpSession.StringPool();

    // Remove first session properties just in case.
    RHTTPConnectionInfo connInfo = iHttpSession.ConnectionInfo();
    
    // Clear RConnection and Socket Server instances
    connInfo.RemoveProperty(strPool.StringF(HTTP::EHttpSocketServ,RHTTPSession::GetTable()));
    connInfo.RemoveProperty(strPool.StringF(HTTP::EHttpSocketConnection,RHTTPSession::GetTable()));
    
    // Clear the proxy settings
//    THTTPHdrVal proxyUsage(strPool.StringF(HTTP::EUseProxy,RHTTPSession::GetTable()));
    connInfo.RemoveProperty(strPool.StringF(HTTP::EProxyUsage,RHTTPSession::GetTable()));
    connInfo.RemoveProperty(strPool.StringF(HTTP::EProxyAddress,RHTTPSession::GetTable()));
    
    // RConnection and Socket Server
    connInfo.SetPropertyL ( strPool.StringF(HTTP::EHttpSocketServ, 
                                    RHTTPSession::GetTable()), 
                            THTTPHdrVal (iClientApp->Engine()->SocketServ().Handle()) );
    
    TInt connPtr1 = REINTERPRET_CAST(TInt, &iConnection);
    connInfo.SetPropertyL ( strPool.StringF(HTTP::EHttpSocketConnection, 
                            RHTTPSession::GetTable() ), THTTPHdrVal (connPtr1) );    
    }
RTPMPComponentVideo_Close(
	RTPMPComponentVideoInstanceData **	inGlobals,
	ComponentInstance					self )
{
#pragma unused( self )
	
	if( inGlobals )
	{
		if( ( **inGlobals ).itsBase )
			CloseComponent( ( **inGlobals ).itsBase );
		
		DisposeHandle( REINTERPRET_CAST( Handle )( inGlobals ) );
	}
	
	return( noErr );
}
示例#5
0
/** 
Constructor with a software or hardware bitmap.
Its type is initialised to EFbsBitmap or EHardwareBitmap accordingly.

@param aBitmap The bitmap which the object will access. 
*/
EXPORT_C TAcceleratedBitmapSpec::TAcceleratedBitmapSpec(CFbsBitmap* aBitmap)
	{
	RHardwareBitmap hwb(aBitmap->HardwareBitmapHandle());
	if(hwb.iHandle)
		{
		::new (this) TAcceleratedBitmapSpec(hwb);
		return;
		}
	iType = EFbsBitmap;
	iHandle = REINTERPRET_CAST(TInt,aBitmap);

	iLockStatus = EBitmapNeedsLocking;

	iSpare1 = 0;
	iSpare2 = 0;
	}
示例#6
0
AMInt32 SetSessionConnectionInfo(AMPVoid session)
	{
	REINTERPRET( RHTTPSession*, temp, session );
    // Set the sessions connection info...
    RStringPool strPool = temp->StringPool();
    RHTTPConnectionInfo connInfo = temp->ConnectionInfo();
    
    REINTERPRET( CNetworkAccessPoint*, NetworkAccessPoint, AMSocketIAPGet() );
    
    // ...to use our socket server and connection
    connInfo.SetPropertyL ( strPool.StringF(HTTP::EHttpSocketServ,
        RHTTPSession::GetTable() ), THTTPHdrVal (NetworkAccessPoint->GetRSocketServ().Handle()) );
    // ...to use our connection
    connInfo.SetPropertyL ( strPool.StringF(HTTP::EHttpSocketConnection,
        RHTTPSession::GetTable() ), 
        THTTPHdrVal (REINTERPRET_CAST(TInt, &(NetworkAccessPoint->GetRConnection()))) );
	}
void UPPayHttpConnection::SetupConnectionL()
{
	//		iTimer.After(iStatus,10); 
	//		SetActive();
	if ( iSocketConnection->OpenConnection())
	{
#ifdef F_ENCODE_URI
		if(iUriParser->Uri().Validate())
#else
		if (iUriParser.Validate())
#endif
		{
			RStringPool strPool = iSession.StringPool();
			RHTTPConnectionInfo connInfo = iSession.ConnectionInfo();
			TInt err = 0;
			//to use our socket server and connection
			TRAP(err,connInfo.SetPropertyL(strPool.StringF(HTTP::EHttpSocketServ, RHTTPSession::GetTable()),
					THTTPHdrVal(iSocketConnection->iSocketServ.Handle())));
			if (!err)
			{
				TRAP(err,connInfo.SetPropertyL(strPool.StringF(HTTP::EHttpSocketConnection, RHTTPSession::GetTable()),
						THTTPHdrVal(REINTERPRET_CAST(TInt, &(iSocketConnection->iConnection)))));
				if (!err)
				{
					TRAP(err,openConnection());
					if (!err)
					{
						return;
					}
					else
					{
						//CommonUtils::WriteLogL(_L("openConnection() false err = "), err);
					}
				}
			}

		}
	}
	//CommonUtils::WriteLogL(_L("OpenConnection false "), _L("EHttpError"));
	if (iObserver)
	{
		iObserver->StateChange(EHttpError);
	}
}
RTPMPComponentVideo_Open(
	RTPMPComponentVideoInstanceData **	inGlobals,
	ComponentInstance					self )
{
	ComponentResult		theResult = noErr;
	RTPMediaPacketizer	theBase;
	
	
	inGlobals =
		REINTERPRET_CAST( RTPMPComponentVideoInstanceData ** )(
			NewHandleClear( sizeof( **inGlobals ) ) );
	
	if( inGlobals )
	{
		( **inGlobals ).itself = self;
		( **inGlobals ).itsFinalDerivation = self;
		( **inGlobals ).itsInitialized = false;
		
		SetComponentInstanceStorage( self, REINTERPRET_CAST( Handle )( inGlobals ) );
		
		theResult =
			OpenADefaultComponent(
				kRTPMediaPacketizerType, kRTPBaseMediaPacketizerType, &theBase );
		
		if( theResult == noErr )
		{
			( **inGlobals ).itsBase = theBase;
			theResult = CallComponentTarget( ( **inGlobals ).itsBase, self );
		}
	}
	
	else
	{
		theResult = MemError();
		
		if( theResult == noErr )
			theResult = memFullErr;
	}
	
	return( theResult );
}
/**
 * CSymbianTransportAgent::ConstructL()
 * Second phase construction.
 */
void CSymbianTransportAgent::ConstructL(URL& /* aUrl */)
{
    
    // Open RHTTPSession with default protocol ("HTTP/TCP")
    // Note that RHTTPSession (and consequently the whole 
    // of HTTP) depends on the active scheduler; a scheduler 
    // must be installed when the session is opened and it 
    // must be running if a transaction is actually to do anything. 
    
    // Get the connection manager instance
    FConnection* connection = FConnection::getInstance();
    if (!connection) {
        LOG.error("TransportAgent: no active connection; exiting");
        setError(ERR_HTTP, "No active connection");
        return;
    }
    
    // Session is owned by FConnection!
    RSocketServ* socketServ = connection->getSession();
    RConnection* rConnection = connection->getConnection();
    // reuse active connection, please see:
    // http://wiki.forum.nokia.com/index.php/CS000825_-_Using_an_already_active_connection
    TInt err;
    TRAP( err, iHttpSession.OpenL() );
    User::LeaveIfError( err );

    // Set the session's connection info...
    RStringPool strPool = iHttpSession.StringPool();
    RHTTPConnectionInfo connInfo = iHttpSession.ConnectionInfo();
    // ...to use the socket server
    connInfo.SetPropertyL ( strPool.StringF(HTTP::EHttpSocketServ,RHTTPSession::GetTable() ),
                            THTTPHdrVal (socketServ->Handle()) );
    // ...to use the connection
    connInfo.SetPropertyL ( strPool.StringF(HTTP::EHttpSocketConnection,RHTTPSession::GetTable() ),
                            THTTPHdrVal (REINTERPRET_CAST(TInt, rConnection)) );
     
    // Create the nested active scheduler
    // please see » Symbian OS v9.1 » Symbian OS reference » C++ component
    // reference » Base E32 » CActiveSchedulerWait
    iASWait = new (ELeave) CActiveSchedulerWait();
}
示例#10
0
PtrC16* TResourceReaderImpl::ReadTPtrC16L()
	{
	assert(iCurrentPtr != NULL);
	const TUint8* currentPtr=iCurrentPtr;//TUint8 pointer is used, which means that the 
	
	//resource string length is limited to 255 characters max.
	const TInt unicodeLength=*currentPtr;
	++currentPtr;
	if (unicodeLength!=0)
		{
		if (REINTERPRET_CAST(TUint,currentPtr)&0x1)
			{
			// The resource compiler puts out a padding byte (arbitrarily 0xab)
			// to ensure the alignment of Unicode strings within each resource.
				if(*currentPtr!=0xab)
				{
					std::string errMsg= "Failed : Improper alignment of Unicode strings (0xab) within each resource.";
					throw CResourceFileException(errMsg);
				}
			++currentPtr;
			}
		}

	if (unicodeLength ==0)
	{
		MovePtrL(currentPtr);
		return NULL;
	}
	else
	{
		PtrC16* unicode = new PtrC16;
		unicode ->iMaxLength = unicodeLength;
		unicode ->iPtr = (TUint16*) currentPtr;

		currentPtr+=unicodeLength*sizeof(TText16);
		MovePtrL(currentPtr);
		return unicode;
	}
}
void CReconnectRequest::StartRequest()
	{

	TInt testNo = REINTERPRET_CAST(TInt, iAgent);
	
	switch (testNo)
		{
		case 300:
		case 900:
		case 1000:
			RequestComplete(KErrNone);
			break;
		case 400:
			RequestComplete(KErrDiskFull);
			break;
		case 800:
			iAsyncCb->CallBack();
			break;
		default:
			User::Invariant();
		}
	}
void CHttpController::ConstructL( RConnection& aConnection, RSocketServ& aSocketServ )
	{
	iPersistentHeaders = CHttpHeaders::NewL();
	iSession.OpenL();
	RHTTPConnectionInfo connectionInfo = iSession.ConnectionInfo();
	RStringPool pool = iSession.StringPool();

	connectionInfo.SetPropertyL( pool.StringF( HTTP::EHttpSocketServ, RHTTPSession::GetTable() ),
			THTTPHdrVal( aSocketServ.Handle() ) );

	TInt connectionPtr = REINTERPRET_CAST(TInt, &aConnection);
	connectionInfo.SetPropertyL( pool.StringF( HTTP::EHttpSocketConnection,
			RHTTPSession::GetTable() ), THTTPHdrVal( connectionPtr ) );
	iSession.FilterCollection().RemoveFilter( iSession.StringPool().StringF( HTTP::ERedirect,
			RHTTPSession::GetTable() ) );

	iTimeoutTimer = CPeriodic::NewL( CActive::EPriorityIdle );

	if ( !iOutputEncoder )
		{
		//default content encoder
		iOutputEncoder = CMultipartEncoder::NewL();
		}
	}
示例#13
0
TBool CConnectionManager::SetupConnection()
	{
		TInt iCurrentProfileId;    
		iBearerFilter = EApBearerTypeAllBearers;

		ASSERT(iRepository);

		// Check whether we are offline or online
		iRepository->Get(KProEngActiveProfile, iCurrentProfileId);
		
	    // Close the connection only if
	    // a) this is not the first time and
	    // b) the profile has changed and
	    // c) either the previous or the current profile is Offline (5 = Offline)
	    if (iPreviousProfileId != -1 && iPreviousProfileId != iCurrentProfileId &&
	            (iPreviousProfileId == EConnectionStatus::Disconnected || iCurrentProfileId == EConnectionStatus::Disconnected))
	    {
	        // Close and uninitialize
	        iConnectionSetup = EFalse;
	        iSessionHttp .Close();
	        iConnection  .Close();
	        iServerSocket.Close();
	    }

	    // Save current profile id
	    iPreviousProfileId = iCurrentProfileId;

	    // Try to find an existing connection. If connection has not been set up,
	    // iConnection is not initialized and FindExistingConnection() fails.
	    // Thus, in that case, finding must not be carried out.
	    if (iConnectionSetup && !FindExistingConnection())
	    {
	        iConnectionSetup = EFalse;
	    }

	    if (iConnectionSetup)
	    {
	        // Connection setup is done
	    	iNewConnection = EFalse;
	        return ETrue;
	    }

	    // Open RHTTPSession with default protocol ("HTTP/TCP")
	    iSessionHttp.OpenL();

	    // Install this class as the callback for authentication requests. When
	    // page requires authentication the framework calls GetCredentialsL to get
	    // user name and password.
	    InstallAuthenticationL(iSessionHttp);

	    // In offline, only WLAN connections are available
	    if (iCurrentProfileId == EConnectionStatus::Disconnected)
	    {
	        iBearerFilter = EApBearerTypeWLAN;
	    }

	    // Show IAP selection dialog
	    /*CActiveApDb* aDb = CActiveApDb::NewL();
	    CleanupStack::PushL(aDb);

	    CApSettingsHandler* settings = CApSettingsHandler::NewLC
	        (
	           *aDb
	         , ETrue
	         , EApSettingsSelListIsPopUp
	         , EApSettingsSelMenuSelectNormal
	         , KEApIspTypeAll
	         , iBearerFilter
	         , KEApSortNameAscending
	         , 0
	         , EVpnFilterBoth
	         , ETrue
	        );

	    TInt iapRet = settings->RunSettingsL(0, iSelectedConnectionId);
	    CleanupStack::PopAndDestroy(settings);
	    CleanupStack::PopAndDestroy(aDb);

	    if (iapRet != KApUiEventSelected)
	    {
	        // Exit no selection
	        User::Leave(KErrNotReady);
	    }
	    else*/

	    // open the IAP communications database 
		CCommsDatabase* commDB = CCommsDatabase::NewL(EDatabaseTypeIAP);
		CleanupStack::PushL(commDB);

		// initialize a view 
		CCommsDbConnectionPrefTableView* commDBView = 
		commDB->OpenConnectionPrefTableInRankOrderLC(ECommDbConnectionDirectionUnknown);

		// go to the first record 
		User::LeaveIfError(commDBView->GotoFirstRecord());

		CCommsDbConnectionPrefTableView::TCommDbIapBearer bearer;
		bearer.iBearerSet = iBearerFilter;
		
		// Declare a prefTableView Object.
		CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref;

		pref.iBearer = bearer;
		pref.iDirection = ECommDbConnectionDirectionOutgoing;
		
		// read the connection preferences 
		commDBView->ReadConnectionPreferenceL(pref);

		iSelectedConnectionId = pref.iBearer.iIapId; 
		
		// pop and destroy the IAP View 
		CleanupStack::PopAndDestroy(commDBView);

		// pop and destroy the database object
		CleanupStack::PopAndDestroy(commDB);

    	iNewConnection = ETrue;
    	
        // IAP Selected
        // Open socket server and start the connection
        User::LeaveIfError(iServerSocket.Connect(KESockDefaultMessageSlots));
        User::LeaveIfError(iConnection.Open(iServerSocket, KConnectionTypeDefault));
        // Now we have the iap Id. Use it to connect for the connection
        TCommDbConnPref connectPref;
        // Setup preferences 
        connectPref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
        // Sets the CommDb ID of the IAP to use for this connection
        connectPref.SetIapId(iSelectedConnectionId);
        // Sets direction
        connectPref.SetDirection(ECommDbConnectionDirectionOutgoing);
        
        connectPref.SetBearerSet(iBearerFilter);
        
        // Start connection
        User::LeaveIfError(iConnection.Start(connectPref));
        
        //TInt retval = iConnection.Start();
        //User::LeaveIfError(retval);
	        
        // Set the sessions connection info...
        RStringPool strPool = iSessionHttp.StringPool();
        RHTTPConnectionInfo connInfo = iSessionHttp.ConnectionInfo();
        // ...to use our socket server and connection
        connInfo.SetPropertyL(strPool.StringF(HTTP::EHttpSocketServ, RHTTPSession::GetTable()), THTTPHdrVal (iServerSocket.Handle()));
        // ...to use our connection
        connInfo.SetPropertyL(strPool.StringF(HTTP::EHttpSocketConnection, RHTTPSession::GetTable()), THTTPHdrVal (REINTERPRET_CAST(TInt, &(iConnection))));

        iConnectionSetup = ETrue;
	
	    return ETrue;
}
示例#14
0
// ----------------------------------------------------------------------------
// CClientEngine::SetupConnectionL()
//
// The method set the internet access point and connection setups.
// ----------------------------------------------------------------------------	
void CClientEngine::SetupConnectionL()
    {
    if( iConnectionSetupDone )
        return;
    
    iConnectionSetupDone = ETrue;
    //open socket server and start the connection
    User::LeaveIfError(iSocketServ.Connect());
    User::LeaveIfError(iConnection.Open(iSocketServ));
    
    TCommDbConnPref connectPref;
    TUint32 iapID;

    if(iSetIap == EFalse)
	{
    // open the IAP communications database 
	CCommsDatabase* commDB = CCommsDatabase::NewL(EDatabaseTypeIAP);
	CleanupStack::PushL(commDB);

	// initialize a view 
	CCommsDbConnectionPrefTableView* commDBView = 
	commDB->OpenConnectionPrefTableInRankOrderLC(ECommDbConnectionDirectionUnknown);

	// go to the first record 
	User::LeaveIfError(commDBView->GotoFirstRecord());

	// Declare a prefTableView Object.
	CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref;
	// read the connection preferences 
	commDBView->ReadConnectionPreferenceL(pref);

	iapID = pref.iBearer.iIapId;

	// pop and destroy the IAP View 
	CleanupStack::PopAndDestroy(commDBView);

	// pop and destroy the database object
	CleanupStack::PopAndDestroy(commDB);

	// setup preferences 
	connectPref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
	connectPref.SetDirection(ECommDbConnectionDirectionUnknown);
	connectPref.SetBearerSet(ECommDbBearerGPRS);
	//Sets the CommDb ID of the IAP to use for this connection
	connectPref.SetIapId(iapID);
	}else{
	connectPref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
	connectPref.SetDirection(ECommDbConnectionDirectionUnknown);
	connectPref.SetBearerSet(ECommDbBearerGPRS);
	//Sets the CommDb ID of the IAP to use for this connection
	connectPref.SetIapId(iIapId);
	}
    
    User::LeaveIfError(iConnection.Start(connectPref));
	
    //set the sessions connection info
    RStringPool strPool = iSession.StringPool();
    RHTTPConnectionInfo connInfo = iSession.ConnectionInfo();
    
    //to use our socket server and connection
    connInfo.SetPropertyL ( strPool.StringF(HTTP::EHttpSocketServ,
        RHTTPSession::GetTable() ), THTTPHdrVal (iSocketServ.Handle()) );

    connInfo.SetPropertyL ( strPool.StringF(HTTP::EHttpSocketConnection,
        RHTTPSession::GetTable() ), 
        THTTPHdrVal (REINTERPRET_CAST(TInt, &(iConnection))) );
    }
示例#15
0
void CVwsSession::EnableServerEventTimeOut(const RMessage2& aMessage)
	{
	iServer.EnableServerEventTimeOut(TBool(REINTERPRET_CAST(TInt32,aMessage.Ptr0())));
	}
示例#16
0
void CVwsSession::SetServerEventTimeOut(const RMessage2& aMessage)
	{
	iServer.SetServerEventTimeOut(TTimeIntervalMicroSeconds32(REINTERPRET_CAST(TInt32,aMessage.Ptr0())));
	}
示例#17
0
TBool CConnectionManager::SetupConnection()
	{
		TInt iCurrentProfileId;    
		iBearerFilter = EApBearerTypeAllBearers;

		ASSERT(iRepository);

		// Check whether we are offline or online
		iRepository->Get(KProEngActiveProfile, iCurrentProfileId);
		
	    // Close the connection only if
	    // a) this is not the first time and
	    // b) the profile has changed and
	    // c) either the previous or the current profile is Offline (5 = Offline)
	    if (iPreviousProfileId != -1 && iPreviousProfileId != iCurrentProfileId &&
	            (iPreviousProfileId == EConnectionStatus::Disconnected || iCurrentProfileId == EConnectionStatus::Disconnected))
	    {
	        // Close and uninitialize
	        iConnectionSetup = EFalse;
	        iSessionHttp .Close();
	        iConnection  .Close();
	        iServerSocket.Close();
	    }

	    // Save current profile id
	    iPreviousProfileId = iCurrentProfileId;

	    // Try to find an existing connection. If connection has not been set up,
	    // iConnection is not initialized and FindExistingConnection() fails.
	    // Thus, in that case, finding must not be carried out.
	    if (iConnectionSetup && !FindExistingConnection())
	    {
	        iConnectionSetup = EFalse;
	    }

	    if (iConnectionSetup)
	    {
	        // Connection setup is done
	    	iNewConnection = EFalse;
	        return ETrue;
	    }

	    // Open RHTTPSession with default protocol ("HTTP/TCP")
	    iSessionHttp.OpenL();

	    // Install this class as the callback for authentication requests. When
	    // page requires authentication the framework calls GetCredentialsL to get
	    // user name and password.
	    InstallAuthenticationL(iSessionHttp);

	    // In offline, only WLAN connections are available
	    if (iCurrentProfileId == EConnectionStatus::Disconnected)
	    {
	        iBearerFilter = EApBearerTypeWLAN;
	    }


	    // Show IAP selection dialog
	    if ( gSelectedConnectionId == -1 )
	    	gSelectedConnectionId = SelectIAP();
	    
	    iSelectedConnectionId =  gSelectedConnectionId;
	    
    	iNewConnection = ETrue;
    	
        // IAP Selected
        // Open socket server and start the connection
        User::LeaveIfError(iServerSocket.Connect(KESockDefaultMessageSlots));
        User::LeaveIfError(iConnection.Open(iServerSocket, KConnectionTypeDefault));
        // Now we have the iap Id. Use it to connect for the connection
        TCommDbConnPref connectPref;
		// Setup preferences 
		connectPref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
		
		// Sets the CommDb ID of the IAP to use for this connection
        connectPref.SetIapId(iSelectedConnectionId);
        // Sets direction
        connectPref.SetDirection(ECommDbConnectionDirectionOutgoing);
        
        connectPref.SetBearerSet(iBearerFilter);
        
        // Start connection
        User::LeaveIfError(iConnection.Start(connectPref));
        
        //TInt retval = iConnection.Start();
        //User::LeaveIfError(retval);
	        
        // Set the sessions connection info...
        RStringPool strPool = iSessionHttp.StringPool();
        RHTTPConnectionInfo connInfo = iSessionHttp.ConnectionInfo();
        // ...to use our socket server and connection
        connInfo.SetPropertyL(strPool.StringF(HTTP::EHttpSocketServ, RHTTPSession::GetTable()), THTTPHdrVal (iServerSocket.Handle()));
        // ...to use our connection
        connInfo.SetPropertyL(strPool.StringF(HTTP::EHttpSocketConnection, RHTTPSession::GetTable()), THTTPHdrVal (REINTERPRET_CAST(TInt, &(iConnection))));

        iConnectionSetup = ETrue;
	
	    return ETrue;
}
示例#18
0
// ---------------------------------------------------------
// CMmsSession::OpenL
// ---------------------------------------------------------
//
EXPORT_C void CMmsSession::OpenL( 
    const TDesC8& aProxyAddress,
    const TBool aUseProxy,  
    const TInt32 aMaxReceiveSize,
    const TInt32 aMaxSendSize,
    TRequestStatus& aStatus )
    {
    LOG( _L("CMmsSession::OpenL") );
    __ASSERT_DEBUG( iSessionStatus == ESessionIdle, gPanic( EMmsAlreadyBusy ) );

    iError = KErrNone;
    iRequestStatus = &aStatus;

    // 
    // Setting max send/receive sizes. 0 means not limited.
    // Values always come from CMmsSettings.
    // 
    iMaxReceiveSize = aMaxReceiveSize;
    iMaxSendSize = aMaxSendSize;
  
    // Get pointer HTTP session headers
    iSessionHeaders = iHTTPSession.RequestSessionHeadersL();
    iHeadersCreated = ETrue;

    // Check if we are connected already
    if ( iConnected )
        {
        aStatus = KRequestPending;                             
        User::RequestComplete( iRequestStatus, KMmsErrorSessionAlreadyOpen );
        }
    else 
        {

        // set the session properties
        // the handle comes from iHTTP session. I think we should not close it.
        RStringPool strPool = iHTTPSession.StringPool();
        RHTTPConnectionInfo connInfo = iHTTPSession.ConnectionInfo();
        connInfo.SetPropertyL( strPool.StringF( HTTP::EHttpSocketServ, RHTTPSession::GetTable() ),
            THTTPHdrVal( iSocketServ->Handle() ) );
        TInt connPtr = REINTERPRET_CAST( TInt, iConnection );
        connInfo.SetPropertyL(
            strPool.StringF( HTTP::EHttpSocketConnection, RHTTPSession::GetTable() ),
            THTTPHdrVal( connPtr ) );

        // Add proxy usage if requested
        if ( aUseProxy )
            {
            THTTPHdrVal proxyUsage( strPool.StringF( HTTP::EUseProxy, RHTTPSession::GetTable() ) );
            connInfo.SetPropertyL(
                strPool.StringF( HTTP::EProxyUsage, RHTTPSession::GetTable() ), proxyUsage );
        
            RStringF proxyString = strPool.OpenFStringL( aProxyAddress );
            CleanupClosePushL( proxyString );
            THTTPHdrVal proxyAddr( proxyString );
            connInfo.SetPropertyL(
                strPool.StringF( HTTP::EProxyAddress, RHTTPSession::GetTable() ), proxyAddr );
            CleanupStack::PopAndDestroy( &proxyString );
            }
            
		// Install MMS X-id header filter if required
    	FeatureManager::InitializeLibL();
    	if ( FeatureManager::FeatureSupported( KFeatureIdMmsXidHeaderHttpFilter ) )  
	        {
	        // Install the MMS X-id header filter explicitly, since only MMS requires this filter.
			const TUid KHttpFilterMmsXidHeaderImplementationUid = { 0x1020738D };
			CEComFilter::InstallFilterL(iHTTPSession, KHttpFilterMmsXidHeaderImplementationUid);
	        }
    	FeatureManager::UnInitializeLib();
    	
        // Install UAProf filter
        TInt error = KErrNotFound;
        TRAP( error, CHttpUAProfFilterInterface::InstallFilterL( iHTTPSession ) );
        if ( error != KErrNone )
            {
            LOG2( _L("ERROR: UAProf filter left with code %d. Using hardcoded UserAgent string.."), error );
            
            // Manually set UA string
            SetFixedUserAgentL();

            // UserAgent header must be added always - either hard coded string or string from ini file
            SetHeaderL( iSessionHeaders, HTTP::EUserAgent, iUserAgent->Des() );

            // Add UAProf if available
            if ( iUaProf && iUaProf->Length() > 0 )
                {
                RStringF tempString = strPool.OpenFStringL( iUaProf->Des() );
                CleanupClosePushL( tempString );
                RStringF tempString2 = strPool.OpenFStringL( KXProfile );
                CleanupClosePushL( tempString2 );
                iSessionHeaders.SetFieldL( tempString2, tempString );
                CleanupStack::PopAndDestroy( &tempString2 );
                CleanupStack::PopAndDestroy( &tempString );
                }
            }

        // Accept headers moved to transaction as global filter overrides
        // session headers

        // HTTP session, no need for separate connect procedure
        iConnected = ETrue;
        // We may or may not get
        iHTTPSession.SetSessionEventCallback( this );
        aStatus = KRequestPending;
        User::RequestComplete( iRequestStatus, KErrNone );
        }
    }
RTPMPComponentVideo_GetInfo(
	RTPMPComponentVideoInstanceData **	inGlobals,
	OSType								inSelector,
	void *								ioParams )
{
	ComponentResult				theError = noErr;
	RTPMPPayloadTypeParams *	thePayloadInfo;
	Str255						theEncodingName;
	
	
	switch( inSelector )
	{
		case kRTPMPPayloadTypeInfo:
			thePayloadInfo = STATIC_CAST( RTPMPPayloadTypeParams * )( ioParams );
			thePayloadInfo->flags = kRTPPayloadTypeDynamicFlag;
			thePayloadInfo->payloadNumber = kRTPPayload_Unknown;
			
			theError =
				GetComponentIndString(
					REINTERPRET_CAST( Component )( ( **inGlobals ).itself ),
					theEncodingName, kRTPMPComponentVideoStringListResource,
					kRTPMPComponentVideoProtocolEncodingString );
			
			if( !theError )
			{
				if( thePayloadInfo->nameLength < ( theEncodingName[ 0 ] + 1 ) )
				{
					theError = paramErr;
				}
				
				else
				{
					BlockMoveData(
						&theEncodingName[ 1 ], thePayloadInfo->payloadName,
						theEncodingName[ 0 ] );
					
					thePayloadInfo->payloadName[ theEncodingName[ 0 ] ] = '\0';
				}
				
				thePayloadInfo->nameLength = theEncodingName[ 0 ] + 1;
			}
		break;
		
		
		case kRTPMPRTPTimeScaleInfo:
			*STATIC_CAST( TimeScale * )( ioParams ) = kComponentVideoRTPTimeScale;
		break;
		
		
		case kRTPMPMinPayloadSize:
			*STATIC_CAST( UInt32 * )( ioParams ) = sizeof( ComponentVideoPayload );
		break;
		
		
		case kRTPMPPayloadNameInfo:
			theError =
				GetComponentIndString(
					REINTERPRET_CAST( Component )( ( **inGlobals ).itself ),
					STATIC_CAST( StringPtr )( ioParams ),
					kRTPMPComponentVideoStringListResource,
					kRTPMPComponentVideoHIEncodingString );
		break;
		
		
		case kRTPMPRequiredSampleDescriptionInfo:
		case kRTPMPMinPacketDuration:
		case kRTPMPSuggestedRepeatPktCountInfo:
		case kRTPMPSuggestedRepeatPktSpacingInfo:
		case kRTPMPMaxPartialSampleSizeInfo:
		case kRTPMPPreferredBufferDelayInfo:
		default:
			theError =
				RTPMPGetInfo( ( **inGlobals ).itsBase, inSelector, ioParams );
		break;
	}
	
	return( theError );
}
示例#20
0
CResourceManager::EHttpSessionState CResourceManager::OpenHttpSessionIfNeededL(void* aKernel)
{
    if (!m_IAPSeted || !m_IAPReady) {
        ((CNBrKernel*)aKernel)->RequestAP();

        if (!m_IAPSeted)
            return ENotSetIAP;

        if (m_IAPSeted && !m_IAPReady)
            return ENotReady;
    }

    if (!m_sessionRunning) {

        m_httpSession.OpenL(KHttpProtString);
        m_sessionRunning = true;

        RStringPool strP = m_httpSession.StringPool();
        const TStringTable& stringTable = RHTTPSession::GetTable();
        RHTTPConnectionInfo connInfo = m_httpSession.ConnectionInfo();

        if (m_bUseOutNetSettting) {
            // 使用外壳提供的连接
            if (iSocketServ)
                connInfo.SetPropertyL(
                    strP.StringF(HTTP::EHttpSocketServ, RHTTPSession::GetTable()),
                    THTTPHdrVal(iSocketServ->Handle()) );
            if (iConnection)
                connInfo.SetPropertyL(
                    strP.StringF(HTTP::EHttpSocketConnection, RHTTPSession::GetTable()),
                    THTTPHdrVal(REINTERPRET_CAST(TInt, iConnection)) );
        }
        else {
            // 使用内部连接
            connInfo.SetPropertyL(
                strP.StringF(HTTP::EHttpSocketServ, RHTTPSession::GetTable()),
                THTTPHdrVal(m_socketServ.Handle()));

            connInfo.SetPropertyL(
                strP.StringF(HTTP::EHttpSocketConnection, RHTTPSession::GetTable()),
                THTTPHdrVal(REINTERPRET_CAST(TInt, &(m_connection))));
        }

        if (m_isWap) {
            RStringF iPrxAddr = strP.OpenFStringL(KHttpProxy);
            CleanupClosePushL(iPrxAddr);

            THTTPHdrVal iPrxUsage(strP.StringF(HTTP::EUseProxy, RHTTPSession::GetTable()));
            connInfo.SetPropertyL(strP.StringF(HTTP::EProxyUsage, RHTTPSession::GetTable()), iPrxUsage);
            connInfo.SetPropertyL(strP.StringF(HTTP::EProxyAddress, RHTTPSession::GetTable()), iPrxAddr);
            CleanupStack::PopAndDestroy();
        }

        // set shutdown
        THTTPHdrVal immediateShutdown = strP.StringF(HTTP::ESocketShutdownImmediate, stringTable);
        connInfo.SetPropertyL(strP.StringF(HTTP::ESocketShutdownMode, stringTable), immediateShutdown);
        
//        // set pipelining
//        RStringF maxConnection = strP.StringF(HTTP::EMaxNumTransportHandlers, stringTable);
//        connInfo.SetPropertyL(maxConnection, THTTPHdrVal(KHttpMaxConnectionNum));
//
//        RStringF maxToPipeline = strP.StringF(HTTP::EMaxNumTransactionsToPipeline, stringTable);
//        connInfo.SetPropertyL(maxToPipeline, THTTPHdrVal(KHttpMaxTransactionNumPerConnection));

//        // Set optimal pipelining
//        RStringF strOptimalPipelineVal = strP.StringF(HTTP::EHttpEnableOptimalPipelining, RHTTPSession::GetTable());
//        connInfo.SetPropertyL(strP.StringF(HTTP::EHttpOptimalPipelining, RHTTPSession::GetTable()), strOptimalPipelineVal);

        // set HTTP receive Buffer Size property
//        RStringF receiveBuffSize = strP.StringF(HTTP::ERecvBufferSize, stringTable);
//        connInfo.SetPropertyL(receiveBuffSize, THTTPHdrVal(KHttpReceiveBuffSize));

//        // set HTTP batching enable
//        THTTPHdrVal batchingSupport(strP.StringF(HTTP::EEnableBatching, RHTTPSession::GetTable()));
//        connInfo.SetPropertyL(strP.StringF(HTTP::EHttpBatching, RHTTPSession::GetTable()), batchingSupport);

//        // set HTTP batching Buffer Size property
//        RStringF batchingBuffSize = strP.StringF(HTTP::EBatchingBufferSize, stringTable);
//        connInfo.SetPropertyL(batchingBuffSize, THTTPHdrVal(KHttpBatchingBuffSize));
        
        RHTTPFilterCollection filtColl = m_httpSession.FilterCollection();
        RStringF filterName = m_httpSession.StringPool().StringF(HTTP::ERedirect,RHTTPSession::GetTable());
        filtColl.RemoveFilter(filterName);
    }

    return EReady;
}
static
ComponentResult
__UpdateSampleDescription(
	RTPMPComponentVideoInstanceData **	inGlobals,
	const RTPMPSampleDataParams *		inSampleData )
{
	ComponentResult			theError = noErr;
	SInt32					theFlags;
	ImageDescriptionHandle	theDescription;
	
	
	/*	Check the SampleDescription if it is the first description or if the cached
		sample description seed doesn't match the current seed. */
	
	if(
		!ComponentVideoPayloadHasDescription( &( **inGlobals ).itsPayloadHeader )  ||
		( **inGlobals ).itsSampleDescriptionSeed != inSampleData->sampleDescSeed )
	{
		theDescription =
			REINTERPRET_CAST( ImageDescriptionHandle )( inSampleData->sampleDescription );
		
		
		/* Only update if the differences in the new SampleDescription are pertinent. */
		
		if(
			ComponentVideoPayloadWidth( &( **inGlobals ).itsPayloadHeader ) !=
				( **theDescription ).width  ||
			ComponentVideoPayloadHeight( &( **inGlobals ).itsPayloadHeader ) !=
				( **theDescription ).height )
		{
			/*	If the RTPMPSetSampleData() implementation queues data, then any
				queued sample data, which uses the obsolete SampleDescription, must
				be flushed before updating to the new SampleDescription. */
			
			theError = RTPMPFlush( ( **inGlobals ).itsFinalDerivation, 0, &theFlags );
			
			if( !theError )
			{
				/*	Update the payload description that the packetizer includes in
					some network packets. */
				
				ComponentVideoPayloadSetDescription(
					&( **inGlobals ).itsPayloadHeader, ( **theDescription ).width,
					( **theDescription ).height );
				
				
				/*	Update data sizes the packetizer uses to construct network
					packets. */
				
				__UpdateDataSizes( inGlobals );
			}
		}
		
		
		/*	Update the cached sample description seed to indicate that the
			packetizer state is now consistent with the new SampleDescription. */
		
		if( !theError )
			( **inGlobals ).itsSampleDescriptionSeed = inSampleData->sampleDescSeed;
	}
	
	return( theError );
}