当前位置: 首页>>代码示例>>C++>>正文


C++ QTSSModule::CallDispatch方法代码示例

本文整理汇总了C++中QTSSModule::CallDispatch方法的典型用法代码示例。如果您正苦于以下问题:C++ QTSSModule::CallDispatch方法的具体用法?C++ QTSSModule::CallDispatch怎么用?C++ QTSSModule::CallDispatch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QTSSModule的用法示例。


在下文中一共展示了QTSSModule::CallDispatch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetValueComplete

void QTSServerInterface::SetValueComplete(UInt32 inAttrIndex, QTSSDictionaryMap* inMap,
							UInt32 inValueIndex, void* inNewValue, UInt32 inNewValueLen)
{
    if (inAttrIndex == qtssSvrState)
    {
        Assert(inNewValueLen == sizeof(QTSS_ServerState));
        
        //
        // Invoke the server state change role
        QTSS_RoleParams theParams;
        theParams.stateChangeParams.inNewState = *(QTSS_ServerState*)inNewValue;
        
        static QTSS_ModuleState sStateChangeState = { NULL, 0, NULL, false };
        if (OSThread::GetCurrent() == NULL)
            OSThread::SetMainThreadData(&sStateChangeState);
        else
            OSThread::GetCurrent()->SetThreadData(&sStateChangeState);

        UInt32 numModules = QTSServerInterface::GetNumModulesInRole(QTSSModule::kStateChangeRole);
        {
            for (UInt32 theCurrentModule = 0; theCurrentModule < numModules; theCurrentModule++)
            {  
                QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kStateChangeRole, theCurrentModule);
                (void)theModule->CallDispatch(QTSS_StateChange_Role, &theParams);
            }
        }

        //
        // Make sure to clear out the thread data
        if (OSThread::GetCurrent() == NULL)
            OSThread::SetMainThreadData(NULL);
        else
            OSThread::GetCurrent()->SetThreadData(NULL);
    }
}
开发者ID:Junotja,项目名称:EasyDarwin,代码行数:35,代码来源:QTSServerInterface.cpp

示例2: Run

SInt64 ReflectorSessionCheckTask::Run()
{
	OSRefTable* reflectorSessionMap = QTSServerInterface::GetServer()->GetReflectorSessionMap();

	OSMutexLocker locker(reflectorSessionMap->GetMutex());

	SInt64 sNowTime = OS::Milliseconds();
	for (OSRefHashTableIter theIter(reflectorSessionMap->GetHashTable()); !theIter.IsDone(); theIter.Next())
	{
		OSRef* theRef = theIter.GetCurrent();
		ReflectorSession* theSession = (ReflectorSession*)theRef->GetObject();

		SInt64  sCreateTime = theSession->GetInitTimeMS();
		if( (theSession->GetNumOutputs() == 0) && (sNowTime-sCreateTime >= 20*1000) )
		{
			QTSS_RoleParams theParams;
			theParams.easyFreeStreamParams.inStreamName = theSession->GetStreamName();
			UInt32 numModules = QTSServerInterface::GetNumModulesInRole(QTSSModule::kEasyCMSFreeStreamRole);
			for ( UInt32 currentModule=0;currentModule < numModules; currentModule++)
			{			
				qtss_printf("没有客户端观看当前转发媒体\n");
				QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kEasyCMSFreeStreamRole, currentModule);
				(void)theModule->CallDispatch(Easy_CMSFreeStream_Role, &theParams);
			}
		}
	}  
	return 30*1000;//30s
}
开发者ID:435420057,项目名称:EasyDarwin,代码行数:28,代码来源:EasyCMSModule.cpp

示例3: DoInitRole

void QTSServer::DoInitRole()
{
    QTSS_RoleParams theInitParams;
    theInitParams.initParams.inServer =         this;
    theInitParams.initParams.inPrefs =          fSrvrPrefs;
    theInitParams.initParams.inMessages =       fSrvrMessages;
    theInitParams.initParams.inErrorLogStream = &sErrorLogStream;
        
    QTSS_ModuleState theModuleState;
    theModuleState.curRole = QTSS_Initialize_Role;
    theModuleState.curTask = NULL;
    OSThread::SetMainThreadData(&theModuleState);
	
    for (UInt32 x = 0; x < QTSServerInterface::GetNumModulesInRole(QTSSModule::kInitializeRole); x++)
    {
        QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kInitializeRole, x);
        theInitParams.initParams.inModule = theModule;
        theModuleState.curModule = theModule;
        QTSS_Error theErr = theModule->CallDispatch(QTSS_Initialize_Role, &theInitParams);

        if (theErr != QTSS_NoErr)
        {
            // If the module reports an error when initializing itself,
            // delete the module and pretend it was never there.
            QTSSModuleUtils::LogError(qtssWarningVerbosity, qtssMsgInitFailed, theErr,
                                            theModule->GetValue(qtssModName)->Ptr);
                                            
            sModuleQueue.Remove(theModule->GetQueueElem());
            delete theModule;
        }
    }

    OSThread::SetMainThreadData(NULL);
}
开发者ID:271845221,项目名称:EasyDarwin,代码行数:34,代码来源:QTSServer.cpp

示例4: DelRedisLive

void ReflectorSession::DelRedisLive()
{
	QTSS_RoleParams theParams;
	theParams.easyStreamInfoParams.inStreamName = fSessionName.Ptr;
	theParams.easyStreamInfoParams.inChannel = fChannelNum;
	theParams.easyStreamInfoParams.inAction = easyRedisActionDelete;
	UInt32 numModules = QTSServerInterface::GetNumModulesInRole(QTSSModule::kRedisUpdateStreamInfoRole);
	for (UInt32 currentModule = 0; currentModule < numModules; currentModule++)
	{
		qtss_printf("从redis中删除推流名称%s\n", fSourceID.Ptr);
		QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kRedisUpdateStreamInfoRole, currentModule);
		(void)theModule->CallDispatch(Easy_RedisUpdateStreamInfo_Role, &theParams);
	}
}
开发者ID:dreamsxin,项目名称:EasyDarwin,代码行数:14,代码来源:ReflectorSession.cpp

示例5: stopPushStream

void EasyCMSSession::stopPushStream()
{
	QTSS_RoleParams params;

	QTSS_Error errCode = QTSS_NoErr;
	UInt32 fCurrentModule = 0;
	UInt32 numModules = QTSServerInterface::GetNumModulesInRole(QTSSModule::kStopStreamRole);
	for (; fCurrentModule < numModules; ++fCurrentModule)
	{
		QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kStopStreamRole, fCurrentModule);
		errCode = theModule->CallDispatch(Easy_StopStream_Role, &params);
	}
	fCurrentModule = 0;
}
开发者ID:435420057,项目名称:EasyDarwin,代码行数:14,代码来源:EasyCMSSession.cpp

示例6: Run

SInt64 EasyCameraSource::Run()
{
	QTSS_Error theErr = QTSS_NoErr;
	EventFlags events = this->GetEvents();

	if(events & Task::kTimeoutEvent)
	{
		//向设备获取快照数据
		//unsigned char *sData = (unsigned char*)malloc(EASY_SNAP_BUFFER_SIZE);
		unsigned char *sData = new unsigned char[EASY_SNAP_BUFFER_SIZE];
		int snapBufLen = 0;

		do{
			//如果获取到摄像机快照数据,Base64编码/发送
			if (!getSnapData(sData, EASY_SNAP_BUFFER_SIZE, &snapBufLen))
			{
				//未获取到数据
				qtss_printf("EasyCameraSource::Run::GetSnapData() => Get Snap Data Fail \n");
				theErr = QTSS_ValueNotFound;
				break;
			}

			QTSS_RoleParams params;
			params.postSnapParams.snapLen = snapBufLen;
			params.postSnapParams.snapPtr = sData;
			params.postSnapParams.snapType = EASY_SNAP_TYPE_JPEG;
			UInt32 fCurrentModule = 0;
			UInt32 numModules = QTSServerInterface::GetNumModulesInRole(QTSSModule::kPostSnapRole);
			for (; fCurrentModule < numModules; fCurrentModule++)
			{
				qtss_printf("EasyCameraSource::Run::kPostSnapRole\n");
				QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kPostSnapRole, fCurrentModule);
				(void)theModule->CallDispatch(Easy_PostSnap_Role, &params);	
				break;
			}
			break;

		}while(0);

		//free((void*)sData);
		delete []sData;
		sData = NULL;

		fTimeoutTask->RefreshTimeout();
	}

	return 0;
}
开发者ID:271845221,项目名称:EasyDarwin,代码行数:48,代码来源:EasyCameraSource.cpp

示例7: Easy_StopHLSession

QTSS_Error QTSSCallbacks::Easy_StopHLSession(const char* inSessionName)
{
	QTSS_RoleParams packetParams;
	packetParams.easyHLSCloseParams.inStreamName = (char*)inSessionName;

	UInt32 fCurrentModule = 0;
	UInt32 numModules = QTSServerInterface::GetNumModulesInRole(QTSSModule::kEasyHLSCloseRole);
	for (; fCurrentModule < numModules; fCurrentModule++)
	{
		QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kEasyHLSCloseRole, fCurrentModule);
		(void)theModule->CallDispatch(Easy_HLSClose_Role, &packetParams);
		return QTSS_NoErr;
	}
	
	return QTSS_RequestFailed;
}
开发者ID:bensonX,项目名称:EasyDarwin,代码行数:16,代码来源:QTSSCallbacks.cpp

示例8: DoInitRole

void QTSServer::DoInitRole()
{
    QTSS_RoleParams theInitParams;
    theInitParams.initParams.inServer =         this;
    theInitParams.initParams.inPrefs =          fSrvrPrefs;
    theInitParams.initParams.inMessages =       fSrvrMessages;
    theInitParams.initParams.inErrorLogStream = &sErrorLogStream;
        
    QTSS_ModuleState theModuleState;
    theModuleState.curRole = QTSS_Initialize_Role;
    theModuleState.curTask = NULL;
    OSThread::SetMainThreadData(&theModuleState);

    //
    // Add the OPTIONS method as the one method the server handles by default (it handles
    // it internally). Modules that handle other RTSP methods will add 
    QTSS_RTSPMethod theOptionsMethod = qtssOptionsMethod;
    (void)this->SetValue(qtssSvrHandledMethods, 0, &theOptionsMethod, sizeof(theOptionsMethod));


// For now just disable the SetParameter to be compatible with Real.  It should really be removed only for clients that have problems with their SetParameter implementations like (Real Players).
// At the moment it isn't necesary to add the option.
//   QTSS_RTSPMethod	theSetParameterMethod = qtssSetParameterMethod;
//    (void)this->SetValue(qtssSvrHandledMethods, 0, &theSetParameterMethod, sizeof(theSetParameterMethod));
	
    for (UInt32 x = 0; x < QTSServerInterface::GetNumModulesInRole(QTSSModule::kInitializeRole); x++)
    {
        QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kInitializeRole, x);
        theInitParams.initParams.inModule = theModule;
        theModuleState.curModule = theModule;
        QTSS_Error theErr = theModule->CallDispatch(QTSS_Initialize_Role, &theInitParams);

        if (theErr != QTSS_NoErr)
        {
            // If the module reports an error when initializing itself,
            // delete the module and pretend it was never there.
            QTSSModuleUtils::LogError(qtssWarningVerbosity, qtssMsgInitFailed, theErr,
                                            theModule->GetValue(qtssModName)->Ptr);
                                            
            sModuleQueue.Remove(theModule->GetQueueElem());
            delete theModule;
        }
    }

    OSThread::SetMainThreadData(NULL);
}
开发者ID:hntao,项目名称:EasyCamera,代码行数:46,代码来源:QTSServer.cpp

示例9: SetSessionName

QTSS_Error ReflectorSession::SetSessionName()
{
	if (fSourceID.Len > 0)
	{
		QTSS_RoleParams theParams;
		theParams.easyStreamInfoParams.inStreamName = fSessionName.Ptr;
		theParams.easyStreamInfoParams.inChannel = fChannelNum;
		theParams.easyStreamInfoParams.inNumOutputs = fNumOutputs;
		theParams.easyStreamInfoParams.inAction = easyRedisActionSet;
		auto numModules = QTSServerInterface::GetNumModulesInRole(QTSSModule::kRedisUpdateStreamInfoRole);
		for (UInt32 currentModule = 0; currentModule < numModules; currentModule++)
		{
			QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kRedisUpdateStreamInfoRole, currentModule);
			(void)theModule->CallDispatch(Easy_RedisUpdateStreamInfo_Role, &theParams);
		}
	}
	return QTSS_NoErr;
}
开发者ID:dreamsxin,项目名称:EasyDarwin,代码行数:18,代码来源:ReflectorSession.cpp

示例10: Easy_ListRecordFiles

QTSS_Error QTSSCallbacks::Easy_ListRecordFiles(const char* inSessionName, const char* inBeginTime, const char* inEndTime, vector<string> *outRecordFiles)
{
	QTSS_RoleParams packetParams;
	packetParams.easyRecordListParams.inStreamName = (char*)inSessionName;
	packetParams.easyRecordListParams.inBeginTime = (char*)inBeginTime;
	packetParams.easyRecordListParams.inEndTime = (char*)inEndTime;
	packetParams.easyRecordListParams.outRecords = outRecordFiles;

	UInt32 fCurrentModule = 0;
	UInt32 numModules = QTSServerInterface::GetNumModulesInRole(QTSSModule::kRecordListRole);
	for (; fCurrentModule < numModules; fCurrentModule++)
	{
		QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kRecordListRole, fCurrentModule);
		(void)theModule->CallDispatch(Easy_RecordList_Role, &packetParams);
		return QTSS_NoErr;
	}
	return QTSS_RequestFailed;
}
开发者ID:EricChen2013,项目名称:EasyRMS,代码行数:18,代码来源:QTSSCallbacks.cpp

示例11: Easy_StartHLSession

QTSS_Error QTSSCallbacks::Easy_StartHLSession(const char* inSessionName, const char* inURL, UInt32 inTimeout, char* outURL)
{
	QTSS_RoleParams params;
	params.easyHLSOpenParams.inStreamName = (char*)inSessionName;
	params.easyHLSOpenParams.inRTSPUrl = (char*)inURL;
	params.easyHLSOpenParams.inTimeout = inTimeout;
	params.easyHLSOpenParams.outHLSUrl = outURL;

	UInt32 fCurrentModule = 0;
	UInt32 numModules = QTSServerInterface::GetNumModulesInRole(QTSSModule::kEasyHLSOpenRole);
	for (; fCurrentModule < numModules; fCurrentModule++)
	{
		QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kEasyHLSOpenRole, fCurrentModule);
		(void)theModule->CallDispatch(Easy_HLSOpen_Role, &params);	
		return QTSS_NoErr;
	}
	
	return QTSS_RequestFailed;
}
开发者ID:bensonX,项目名称:EasyDarwin,代码行数:19,代码来源:QTSSCallbacks.cpp

示例12: UnRegDevSession

void HTTPSessionInterface::UnRegDevSession()
{
	if (fAuthenticated)
	{
		char msgStr[512];
		qtss_snprintf(msgStr, sizeof(msgStr), "Device unregister,Device_serial[%s]\n", fDevice.serial_.c_str());
		QTSServerInterface::LogError(qtssMessageVerbosity, msgStr);

		QTSServerInterface::GetServer()->GetDeviceSessionMap()->UnRegister(fDevice.serial_);//add
		//在redis上删除设备
		//QTSServerInterface::GetServer()->RedisDelDevName(fDevice.serial_.c_str());

		QTSS_RoleParams theParams;
		theParams.StreamNameParams.inStreamName = (char *)(fDevice.serial_.c_str());
		UInt32 numModules = QTSServerInterface::GetNumModulesInRole(QTSSModule::kDelDevNameRole);
		for ( UInt32 currentModule=0;currentModule < numModules; currentModule++)
		{
			QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kDelDevNameRole, currentModule);
			(void)theModule->CallDispatch(QTSS_DelDevName_Role, &theParams);
		}
	}
}
开发者ID:271845221,项目名称:EasyDarwin,代码行数:22,代码来源:HTTPSessionInterface.cpp

示例13: UnRegDevSession

void HTTPSessionInterface::UnRegDevSession() const
{
    if (fAuthenticated)
    {
        char msgStr[512];
        qtss_snprintf(msgStr, sizeof(msgStr), "Device unregister£¬Device_serial[%s]\n", device_->serial_.c_str());
        QTSServerInterface::LogError(qtssMessageVerbosity, msgStr);

        QTSServerInterface::GetServer()->GetDeviceSessionMap()->UnRegister(device_->serial_);//add
        //ÔÚredisÉÏɾ³ýÉ豸
        //QTSServerInterface::GetServer()->RedisDelDevice(fDevice.serial_.c_str());

        QTSS_RoleParams theParams;
		theParams.DeviceInfoParams.serial_ = new char[64];
		strncpy(theParams.DeviceInfoParams.serial_, device_->serial_.c_str(), device_->serial_.size() + 1);
        UInt32 numModules = QTSServerInterface::GetNumModulesInRole(QTSSModule::kRedisDelDeviceRole);
        for (UInt32 currentModule = 0; currentModule < numModules; currentModule++)
        {
            QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kRedisDelDeviceRole, currentModule);
            (void)theModule->CallDispatch(Easy_RedisDelDevice_Role, &theParams);
        }
		delete[] theParams.DeviceInfoParams.serial_;
    }
}
开发者ID:dreamsxin,项目名称:EasyDarwin,代码行数:24,代码来源:HTTPSessionInterface.cpp

示例14: debug_printf

QTSS_Error	QTSSCallbacks::QTSS_Authorize(QTSS_RTSPRequestObject inAuthRequestObject, char** outAuthRealm, Bool16* outAuthUserAllowed)
{
    RTSPRequestInterface* request = (RTSPRequestInterface *) inAuthRequestObject;
    if (request == NULL)
        return QTSS_BadArgument;
            
    // Because this is a role being executed from inside a callback, we need to
    // make sure that QTSS_RequestEvent will not work.
    Task* curTask = NULL;
    QTSS_ModuleState* theState = (QTSS_ModuleState*)OSThread::GetMainThreadData();
    if (OSThread::GetCurrent() != NULL)
        theState = (QTSS_ModuleState*)OSThread::GetCurrent()->GetThreadData();
        
    if (theState != NULL)
        curTask = theState->curTask;
        
    QTSS_RoleParams theParams;
    theParams.rtspRequestParams.inRTSPSession = NULL;
    theParams.rtspRequestParams.inRTSPRequest = request;
    theParams.rtspRequestParams.inClientSession = NULL;

    QTSS_Error theErr = QTSS_RequestFailed;
    UInt32 x = 0;
    UInt32 numModules = QTSServerInterface::GetNumModulesInRole(QTSSModule::kRTSPAuthRole);
    QTSSModule* theModulePtr = NULL;
    Bool16 		allowedDefault =  QTSServerInterface::GetServer()->GetPrefs()->GetAllowGuestDefault();
    *outAuthUserAllowed = allowedDefault;
    Bool16      allowed = allowedDefault; //server pref?
    Bool16      hasUser = false; 
    Bool16      handled = false;
    
    
    // Call all the modules that are registered for the RTSP Authorize Role 
    
    for ( ; x < numModules; x++)
    {
        request->SetAllowed(true);  
        request->SetHasUser(false);
        request->SetAuthHandled(false);
    
        debug_printf(" QTSSCallbacks::QTSS_Authorize calling module module = %lu numModules=%lu\n", x,numModules);
        theModulePtr = QTSServerInterface::GetModule(QTSSModule::kRTSPAuthRole, x);
        theErr =  QTSS_NoErr;
        if (theModulePtr)
        {       
            if (__QTSSCALLBACKS_DEBUG__)
                theModulePtr->GetValue(qtssModName)->PrintStr("QTSSModule::CallDispatch ENTER module=", "\n");
           
            theErr = theModulePtr->CallDispatch(QTSS_RTSPAuthorize_Role, &theParams);
            debug_printf(" QTSSCallbacks::QTSS_Authorize calling module module = %lu numModules=%lu ModuleError=%ld\n", x,numModules, theErr);
        }
        else
        {    debug_printf(" QTSSCallbacks::QTSS_Authorize calling module module = %lu is NULL! numModules=%lu\n", x,numModules);
             continue;
        }

        allowed = request->GetAllowed();
        hasUser = request->GetHasUser();
        handled = request->GetAuthHandled();
        debug_printf("QTSSCallbacks::QTSS_Authorize allowedDefault =%d allowed= %d hasUser = %d handled=%d \n",allowedDefault, allowed,hasUser, handled);
    
        *outAuthUserAllowed = allowed;    
        //notes:
        //if (allowed && !handled)  break; //old module               
        //if (!allowed && handled) /new module handled the request but not authorized keep trying
        //if (allowed && handled) //new module allowed but keep trying in case someone denies.
            
        if (!allowed && !handled)  //old module break on !allowed
        {   
            debug_printf("RTSPSession.cpp::Run(kAuthorizingRequest)  skipping other modules fCurrentModule = %lu numModules=%lu\n", x,numModules);
            break;
        }
    }
    
    // outAuthRealm is set to the realm that is given by the module that has denied authentication
    StrPtrLen* realm = request->GetValue(qtssRTSPReqURLRealm);
    *outAuthRealm = realm->GetAsCString();
    
    return theErr;
}
开发者ID:bensonX,项目名称:EasyDarwin,代码行数:80,代码来源:QTSSCallbacks.cpp

示例15: QTSS_Authenticate

QTSS_Error  QTSSCallbacks::QTSS_Authenticate(const char* inAuthUserName, const char* inAuthResourceLocalPath, const char* inAuthMoviesDir, QTSS_ActionFlags inAuthRequestAction, QTSS_AuthScheme inAuthScheme, QTSS_RTSPRequestObject ioAuthRequestObject)
{
    if((inAuthUserName == NULL) || (inAuthResourceLocalPath == NULL) || (inAuthMoviesDir == NULL) || (ioAuthRequestObject == NULL)) 
        return QTSS_BadArgument;
    if(inAuthRequestAction == qtssActionFlagsNoFlags)
        return QTSS_BadArgument;
    if(inAuthScheme == qtssAuthNone)
        return QTSS_BadArgument;

    // First create a RTSPRequestInterface object 
    // There is no session attached to it, so just pass in NULL for the RTSPSession
    RTSPRequestInterface *request =  (RTSPRequestInterface *) ioAuthRequestObject;
    // Set all the attributes required by the authentication module, using the input values
    (void) request->SetValue(qtssRTSPReqUserName, 0,  inAuthUserName , ::strlen(inAuthUserName), QTSSDictionary::kDontObeyReadOnly);
    (void) request->SetValue(qtssRTSPReqLocalPath, 0,  inAuthResourceLocalPath , ::strlen(inAuthResourceLocalPath), QTSSDictionary::kDontObeyReadOnly);
    (void) request->SetValue(qtssRTSPReqRootDir, 0,  inAuthMoviesDir , ::strlen(inAuthMoviesDir), QTSSDictionary::kNoFlags);
    (void) request->SetValue(qtssRTSPReqAction, 0,  (const void *)&inAuthRequestAction , sizeof(QTSS_ActionFlags), QTSSDictionary::kNoFlags);
    (void) request->SetValue(qtssRTSPReqAuthScheme, 0,  (const void *)&inAuthScheme , sizeof(QTSS_AuthScheme), QTSSDictionary::kDontObeyReadOnly);
    QTSSUserProfile *profile = request->GetUserProfile();
    (void) profile->SetValue(qtssUserName, 0, inAuthUserName, ::strlen(inAuthUserName), QTSSDictionary::kDontObeyReadOnly);
    
    
    // Because this is a role being executed from inside a callback, we need to
    // make sure that QTSS_RequestEvent will not work.
    Task* curTask = NULL;
    QTSS_ModuleState* theState = (QTSS_ModuleState*)OSThread::GetMainThreadData();
    if (OSThread::GetCurrent() != NULL)
        theState = (QTSS_ModuleState*)OSThread::GetCurrent()->GetThreadData();
        
    if (theState != NULL)
        curTask = theState->curTask;
    
    // Setup the authentication param block
    QTSS_RoleParams theAuthenticationParams;
    theAuthenticationParams.rtspAthnParams.inRTSPRequest = request;
            
    QTSS_Error theErr = QTSS_RequestFailed;
    
    UInt32 x = 0;
    UInt32 numModules = QTSServerInterface::GetNumModulesInRole(QTSSModule::kRTSPAthnRole);
    QTSSModule* theModulePtr = NULL;
    Bool16 allowedDefault = QTSServerInterface::GetServer()->GetPrefs()->GetAllowGuestDefault();
    Bool16 allowed = allowedDefault; //server pref?
    Bool16 hasUser = false; 
    Bool16 handled = false;
    
    
    // Call all the modules that are registered for the RTSP Authorize Role 
    for ( ; x < numModules; x++)
    {
        request->SetAllowed(allowedDefault);  
        request->SetHasUser(false);
        request->SetAuthHandled(false);
    
        debug_printf(" QTSSCallbacks::QTSS_Authenticate calling module module = %lu numModules=%lu\n", x,numModules);
        theModulePtr = QTSServerInterface::GetModule(QTSSModule::kRTSPAthnRole, x);
        theErr =  QTSS_NoErr;
        if (theModulePtr)
        {    
            theErr = theModulePtr->CallDispatch(QTSS_RTSPAuthenticate_Role, &theAuthenticationParams);
            debug_printf(" QTSSCallbacks::QTSS_Authorize calling module module = %lu numModules=%lu ModuleError=%ld\n", x,numModules, theErr);
        }
        else
        {   
            debug_printf(" QTSSCallbacks::QTSS_Authorize calling module module = %lu is NULL! numModules=%lu\n", x,numModules);
            continue;
        }
        allowed = request->GetAllowed();
        hasUser = request->GetHasUser();
        handled = request->GetAuthHandled();
        debug_printf("QTSSCallbacks::QTSS_Authenticate allowedDefault =%d allowed= %d hasUser = %d handled=%d \n",allowedDefault, allowed,hasUser, handled);
      
                  
        if (hasUser || handled ) //See RTSPSession.cpp::Run state=kAuthenticatingRequest
        {   
            debug_printf(" QTSSCallbacks::QTSS_Authenticate skipping other modules fCurrentModule = %lu numModules=%lu\n", x,numModules);
            break;
        }
    }

    
    // Reset the curTask to what it was before this role started
    if (theState != NULL)
        theState->curTask = curTask;

    return theErr;
}
开发者ID:bensonX,项目名称:EasyDarwin,代码行数:87,代码来源:QTSSCallbacks.cpp


注:本文中的QTSSModule::CallDispatch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。