本文整理汇总了C++中QTSS_SetValue函数的典型用法代码示例。如果您正苦于以下问题:C++ QTSS_SetValue函数的具体用法?C++ QTSS_SetValue怎么用?C++ QTSS_SetValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QTSS_SetValue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StillFlushing
Bool16 StillFlushing(QTSS_Filter_Params* inParams,Bool16 flushing)
{
QTSS_Error err = QTSS_NoErr;
if (flushing)
{
err = QTSS_Flush(inParams->inRTSPRequest);
//qtss_printf("Flushing session=%"_U32BITARG_" QTSS_Flush err =%"_S32BITARG_"\n",sSessID,err);
}
if (err == QTSS_WouldBlock) // more to flush later
{
sFlushing = true;
(void) QTSS_SetValue(inParams->inRTSPRequest, sFlushingID, 0, (void*)&sFlushing, sFlushingLen);
err = QTSS_RequestEvent(inParams->inRTSPRequest, QTSS_WriteableEvent);
KeepSession(inParams->inRTSPRequest,true);
//qtss_printf("Flushing session=%"_U32BITARG_" QTSS_RequestEvent err =%"_S32BITARG_"\n",sSessID,err);
}
else
{
sFlushing = false;
(void) QTSS_SetValue(inParams->inRTSPRequest, sFlushingID, 0, (void*)&sFlushing, sFlushingLen);
KeepSession(inParams->inRTSPRequest,false);
if (flushing) // we were flushing so reset the LastRequestTime
{
sLastRequestTime = QTSS_Milliseconds();
//qtss_printf("Done Flushing session=%"_U32BITARG_"\n",sSessID);
return true;
}
}
return sFlushing;
}
示例2: sizeof
QTSS_Error QTSSModuleUtils::SendErrorResponseWithMessage( QTSS_RTSPRequestObject inRequest,
QTSS_RTSPStatusCode inStatusCode,
StrPtrLen* inErrorMessagePtr)
{
static Bool16 sFalse = false;
//set RTSP headers necessary for this error response message
(void)QTSS_SetValue(inRequest, qtssRTSPReqStatusCode, 0, &inStatusCode, sizeof(inStatusCode));
(void)QTSS_SetValue(inRequest, qtssRTSPReqRespKeepAlive, 0, &sFalse, sizeof(sFalse));
StrPtrLen theErrorMessage(NULL, 0);
if (sEnableRTSPErrorMsg)
{
Assert(inErrorMessagePtr != NULL);
//Assert(inErrorMessagePtr->Ptr != NULL);
//Assert(inErrorMessagePtr->Len != 0);
theErrorMessage.Set(inErrorMessagePtr->Ptr, inErrorMessagePtr->Len);
char buff[32];
qtss_sprintf(buff,"%"_U32BITARG_"",inErrorMessagePtr->Len);
(void)QTSS_AppendRTSPHeader(inRequest, qtssContentLengthHeader, buff, ::strlen(buff));
}
//send the response header. In all situations where errors could happen, we
//don't really care, cause there's nothing we can do anyway!
(void)QTSS_SendRTSPHeaders(inRequest);
//
// Now that we've formatted the message into the temporary buffer,
// write it out to the request stream and the Client Session object
(void)QTSS_Write(inRequest, theErrorMessage.Ptr, theErrorMessage.Len, NULL, 0);
(void)QTSS_SetValue(inRequest, qtssRTSPReqRespMsg, 0, theErrorMessage.Ptr, theErrorMessage.Len);
return QTSS_RequestFailed;
}
示例3: RereadPrefs
QTSS_Error RereadPrefs()
{
delete [] sVersionHeader;
sVersionHeader = QTSSModuleUtils::GetStringAttribute(sServer, "qtssSvrRTSPServerHeader", kDefaultHeader);
delete [] sIPAccessList;
sIPAccessList = QTSSModuleUtils::GetStringAttribute(sModulePrefs, "IPAccessList", sLocalLoopBackAddress);
sIPAccessListID = QTSSModuleUtils::GetAttrID(sModulePrefs, "IPAccessList");
QTSSModuleUtils::GetAttribute(sModulePrefs, "Authenticate", qtssAttrDataTypeBool16, &sAuthenticationEnabled, &sDefaultAuthenticationEnabled, sizeof(sAuthenticationEnabled));
QTSSModuleUtils::GetAttribute(sModulePrefs, "LocalAccessOnly", qtssAttrDataTypeBool16, &sLocalLoopBackOnlyEnabled, &sDefaultLocalLoopBackOnlyEnabled, sizeof(sLocalLoopBackOnlyEnabled));
QTSSModuleUtils::GetAttribute(sModulePrefs, "RequestTimeIntervalMilli", qtssAttrDataTypeUInt32, &sRequestTimeIntervalMilli, &sDefaultRequestTimeIntervalMilli, sizeof(sRequestTimeIntervalMilli));
QTSSModuleUtils::GetAttribute(sModulePrefs, "enable_remote_admin", qtssAttrDataTypeBool16, &sEnableRemoteAdmin, &sDefaultEnableRemoteAdmin, sizeof(sDefaultEnableRemoteAdmin));
QTSSModuleUtils::GetAttribute(sModulePrefs, "http_port", qtssAttrDataTypeUInt16, &sHttpPort, &sDefaultHttpPort, sizeof(sHttpPort));
delete [] sDocumentRoot;
sDocumentRoot = QTSSModuleUtils::GetStringAttribute(sModulePrefs, "document_root", sDefaultDocumentRoot);
delete [] sAdministratorGroup;
sAdministratorGroup = QTSSModuleUtils::GetStringAttribute(sModulePrefs, "AdministratorGroup", sDefaultAdministratorGroup);
if (sRequestTimeIntervalMilli > kMaxRequestTimeIntervalMilli)
{
sRequestTimeIntervalMilli = kMaxRequestTimeIntervalMilli;
}
(void)QTSS_SetValue(sModule, qtssModDesc, 0, sDesc, strlen(sDesc)+1);
(void)QTSS_SetValue(sModule, qtssModVersion, 0, &sVersion, sizeof(sVersion));
return QTSS_NoErr;
}
示例4: OpenFile
QTSS_Error OpenFile(QTSS_OpenFile_Params* inParams)
{
OSFileSource* theFileSource = NEW OSFileSource(inParams->inPath);
UInt64 theLength = theFileSource->GetLength();
//
// OSFileSource returns mod date as a time_t.
// This is the same as a QTSS_TimeVal, except the latter is in msec
QTSS_TimeVal theModDate = (QTSS_TimeVal)theFileSource->GetModDate();
theModDate *= 1000;
//
// Check to see if the file actually exists
if (theLength == 0)
{
delete theFileSource;
return QTSS_FileNotFound;
}
//
// Add this new file source object to the file object
QTSS_Error theErr = QTSS_SetValue(inParams->inFileObject, sOSFileSourceAttr, 0, &theFileSource, sizeof(theFileSource));
if (theErr != QTSS_NoErr)
{
delete theFileSource;
return QTSS_RequestFailed;
}
//
// If caller wants async I/O, at this point we should set up the EventContext
if (inParams->inFlags & qtssOpenFileAsync)
{
EventContext* theEventContext = NEW EventContext(EventContext::kInvalidFileDesc, Socket::GetEventThread());
theEventContext->InitNonBlocking(theFileSource->GetFD());
theErr = QTSS_SetValue(inParams->inFileObject, sEventContextAttr, 0, &theEventContext, sizeof(theEventContext));
if (theErr != QTSS_NoErr)
{
delete theFileSource;
delete theEventContext;
return QTSS_RequestFailed;
}
}
//
// Set up the other attribute values in the file object
(void)QTSS_SetValue(inParams->inFileObject, qtssFlObjLength, 0, &theLength, sizeof(theLength));
(void)QTSS_SetValue(inParams->inFileObject, qtssFlObjModDate, 0, &theModDate, sizeof(theModDate));
return QTSS_NoErr;
}
示例5: AuthorizeAdminRequest
QTSS_Error AuthorizeAdminRequest(QTSS_RTSPRequestObject request)
{
Bool16 allowed = false;
// get the resource path
// if the path does not match the admin path, don't handle the request
char* resourcePath = QTSSModuleUtils::GetLocalPath_Copy(request);
OSCharArrayDeleter resourcePathDeleter(resourcePath);
if(strcmp(sAuthResourceLocalPath, resourcePath) != 0)
return QTSS_NoErr;
// get the type of request
QTSS_ActionFlags action = QTSSModuleUtils::GetRequestActions(request);
if(!(action & qtssActionFlagsAdmin))
return QTSS_RequestFailed;
QTSS_UserProfileObject theUserProfile = QTSSModuleUtils::GetUserProfileObject(request);
if (NULL == theUserProfile)
return QTSS_RequestFailed;
(void) QTSS_SetValue(request,qtssRTSPReqURLRealm, 0, sAuthRealm, ::strlen(sAuthRealm));
// Authorize the user if the user belongs to the AdministratorGroup (this is an admin module pref)
UInt32 numGroups = 0;
char** groupsArray = QTSSModuleUtils::GetGroupsArray_Copy(theUserProfile, &numGroups);
if ((groupsArray != NULL) && (numGroups != 0))
{
UInt32 index = 0;
for (index = 0; index < numGroups; index++)
{
if(strcmp(sAdministratorGroup, groupsArray[index]) == 0)
{
allowed = true;
break;
}
}
// delete the memory allocated in QTSSModuleUtils::GetGroupsArray_Copy call
delete [] groupsArray;
}
if(!allowed)
{
if (QTSS_NoErr != QTSS_SetValue(request,qtssRTSPReqUserAllowed, 0, &allowed, sizeof(allowed)))
return QTSS_RequestFailed; // Bail on the request. The Server will handle the error
}
return QTSS_NoErr;
}
示例6: theContentLenParser
/*
Content报文读取与解析
同步进行报文处理,构造回复报文
*/
QTSS_Error CServiceSession::SetupRequest()
{
//解析请求报文
QTSS_Error theErr = fRequest->Parse();
if (theErr != QTSS_NoErr)
return QTSS_BadArgument;
QTSS_RTSPStatusCode statusCode = qtssSuccessOK;
char *body = NULL;
UInt32 bodySizeBytes = 0;
//获取具体Content json数据部分
//1、获取json部分长度
StrPtrLen* lengthPtr = fRequest->GetHeaderValue(httpContentLengthHeader);
StringParser theContentLenParser(lengthPtr);
theContentLenParser.ConsumeWhitespace();
UInt32 content_length = theContentLenParser.ConsumeInteger(NULL);
qtss_printf("ServiceSession read content-length:%d \n", content_length);
if (content_length <= 0) return QTSS_BadArgument;
//
// Check for the existence of 2 attributes in the request: a pointer to our buffer for
// the request body, and the current offset in that buffer. If these attributes exist,
// then we've already been here for this request. If they don't exist, add them.
UInt32 theBufferOffset = 0;
char* theRequestBody = NULL;
UInt32 theLen = 0;
theLen = sizeof(theRequestBody);
theErr = QTSS_GetValue(this, qtssEasySesContentBody, 0, &theRequestBody, &theLen);
if (theErr != QTSS_NoErr)
{
// First time we've been here for this request. Create a buffer for the content body and
// shove it in the request.
theRequestBody = NEW char[content_length + 1];
memset(theRequestBody,0,content_length + 1);
theLen = sizeof(theRequestBody);
theErr = QTSS_SetValue(this, qtssEasySesContentBody, 0, &theRequestBody, theLen);// SetValue creates an internal copy.
Assert(theErr == QTSS_NoErr);
// Also store the offset in the buffer
theLen = sizeof(theBufferOffset);
theErr = QTSS_SetValue(this, qtssEasySesContentBodyOffset, 0, &theBufferOffset, theLen);
Assert(theErr == QTSS_NoErr);
}
示例7: InitializeDictionaryItems
void InitializeDictionaryItems(QTSS_RTPStreamObject inStream)
{
UInt32* theValue = NULL;
UInt32 theValueLen = 0;
QTSS_Error theErr = QTSS_GetValuePtr(inStream, sNumLossesAboveTolAttr, 0, (void**)&theValue, &theValueLen);
if (theErr != QTSS_NoErr)
{
// The dictionary parameters haven't been initialized yet. Just set them all to 0.
(void)QTSS_SetValue(inStream, sNumLossesAboveTolAttr, 0, &theValueLen, sizeof(theValueLen));
(void)QTSS_SetValue(inStream, sNumLossesBelowTolAttr, 0, &theValueLen, sizeof(theValueLen));
(void)QTSS_SetValue(inStream, sNumWorsesAttr, 0, &theValueLen, sizeof(theValueLen));
}
}
示例8: DoPlay
QTSS_Error DoPlay(QTSS_StandardRTSP_Params* inParams, ReflectorSession* inSession)
{
QTSS_Error theErr = QTSS_NoErr;
UInt32 flags = 0;
UInt32 theLen = 0;
if (inSession == NULL) // it is a broadcast session so store the broadcast session.
return QTSS_RequestFailed;
else
{
UInt32 bitsPerSecond = inSession->GetBitRate();
(void)QTSS_SetValue(inParams->inClientSession, qtssCliSesMovieAverageBitRate, 0, &bitsPerSecond, sizeof(bitsPerSecond));
QTSS_Error theErr = QTSS_Play(inParams->inClientSession, inParams->inRTSPRequest, qtssPlayFlagsAppendServerInfo);
if (theErr != QTSS_NoErr)
return theErr;
}
OSRef* theRelaySessionRef = sClientSessionMap->Resolve(inSession->GetRef()->GetString());
if(theRelaySessionRef != NULL)
{
RTSPRelaySession* relaySes = (RTSPRelaySession*)theRelaySessionRef->GetObject();
QTSS_Error err = relaySes->Start();
sClientSessionMap->Release(theRelaySessionRef);
}
else
{
return QTSSModuleUtils::SendErrorResponse(inParams->inRTSPRequest, qtssServerInternal, 0);
}
(void)QTSS_SendStandardRTSPResponse(inParams->inRTSPRequest, inParams->inClientSession, flags);
return QTSS_NoErr;
}
示例9: IsAuthentic
Bool16 IsAuthentic(QTSS_Filter_Params* inParams,StringParser *fullRequestPtr)
{
Bool16 isAuthentic = false;
if (!sAuthenticationEnabled) // no authentication
{
isAuthentic = true;
}
else // must authenticate
{
StrPtrLen theClientIPAddressStr;
(void) QTSS_GetValuePtr(inParams->inRTSPSession, qtssRTSPSesRemoteAddrStr, 0, (void**)&theClientIPAddressStr.Ptr, &theClientIPAddressStr.Len);
Bool16 isLocal = IPComponentStr(&theClientIPAddressStr).IsLocal();
StrPtrLen authenticateName;
StrPtrLen authenticatePassword;
StrPtrLen authType;
Bool16 hasAuthentication = HasAuthentication(fullRequestPtr,&authenticateName,&authenticatePassword, &authType);
if (hasAuthentication)
{
if (authType.Equal(sAuthRef))
{
if (isLocal)
isAuthentic = OSXAuthenticate(&authenticatePassword);
}
else
isAuthentic = Authenticate(inParams->inRTSPRequest, &authenticateName,&authenticatePassword);
}
}
// if (isAuthentic)
// isAuthentic = AuthorizeAdminRequest(inParams->inRTSPRequest);
(void) QTSS_SetValue(inParams->inRTSPRequest, sAuthenticatedID, 0, (void*)&isAuthentic, sizeof(isAuthentic));
return isAuthentic;
}
示例10: IsRTSPSessionAuthenticated
/**
* For the given RTSP session, will return true if the client is already flagged
* as authenticated, false if they arent. if the value is not initialized, this
* method will intitialize it. This is used to ensure a session is only authenticated
* once.
*/
static Bool16 IsRTSPSessionAuthenticated(QTSS_RTSPSessionObject* theRTSPSession) {
printf("QTSSIcecastAuthModule::IsRTSPSessionAuthenticated method start\n");
Bool16* alreadyAuthenticated = false;
UInt32 theLen = 0;
QTSS_Error getAlreadyAuthError = QTSS_GetValuePtr(*theRTSPSession, attrRtspSessionAuthenticated, 0, (void**)&alreadyAuthenticated, &theLen);
//printf("QTSSIcecastAuthModule::IsRTSPSessionAuthenticated read value of already aythenticated: &i\n", alreadyAuthenticated);
if (getAlreadyAuthError == QTSS_ValueNotFound) {
// the value hasn't been set yet. initialize it to false, and return false.
// TODO - check how to set a default variable (if possible), so we don't have to rely on this.
Bool16 authenticated = false;
(void)QTSS_SetValue(*theRTSPSession, attrRtspSessionAuthenticated, 0, &authenticated, sizeof(authenticated));
// we had to initialize, so def. not logged in
return false;
}
else if (*alreadyAuthenticated) {
// we are already logged in
printf("QTSSIcecastAuthModule::IsRTSPSessionAuthenticated session already authenticated\n");
return true;
}
else if (!*alreadyAuthenticated && getAlreadyAuthError == QTSS_NoErr) {
// we are not authed and there was no error, to return
return false;
}
else {
//printf("QTSSIcecastAuthModule::RTSPFilter ERROR while looking up not logged in\n");
PrintQTSSError("QTSSIcecastAuthModule::IsRTSPSessionAuthenticated", "while looking up not logged in", getAlreadyAuthError);
return false;
}
}
示例11: StopServer
kern_return_t StopServer(int inMinutes)
{
//if time is -1, we're supposed to wait until all clients have disconnected
if (inMinutes == -1)
{
QTSS_ServerState theState = qtssRefusingConnectionsState;
(void)QTSS_SetValue(sServer, qtssSvrState, 0, &theState, sizeof(theState));
sGracefulShutdownInProgress = true;
}
else
{
//just set the server state to shutting down
QTSS_ServerState theShutDownState = qtssShuttingDownState;
(void)QTSS_SetValue(sServer, qtssSvrState, 0, &theShutDownState, sizeof(theShutDownState));
}
return SCNoError;
}
示例12: Initialize
QTSS_Error Initialize(QTSS_Initialize_Params* inParams)
{
// Setup module utils
QTSSModuleUtils::Initialize(inParams->inMessages, inParams->inServer, inParams->inErrorLogStream);
// Get the server object
sServer = inParams->inServer;
// Get our prefs object
sModule = inParams->inModule;
sModulePrefs = QTSSModuleUtils::GetModulePrefsObject(sModule);
// Set our version and description
(void)QTSS_SetValue(sModule, qtssModDesc, 0, sDescription, ::strlen(sDescription));
(void)QTSS_SetValue(sModule, qtssModVersion, 0, &sVersion, sizeof(sVersion));
RereadPrefs();
return QTSS_NoErr;
}
示例13: Authorize
QTSS_Error Authorize(QTSS_StandardRTSP_Params* inParams)
{
static Bool16 sTrue = true;
Bool16* isFirstRequest = NULL;
UInt32* theIPAddr = NULL;
UInt32 theLen = 0;
// Only do anything if this is the first request
(void)QTSS_GetValuePtr(inParams->inRTSPSession, sIsFirstRequestAttr, 0, (void**)&isFirstRequest, &theLen);
if (isFirstRequest != NULL)
return QTSS_NoErr;
// Get the IP address of this client.
(void)QTSS_GetValuePtr(inParams->inRTSPSession, qtssRTSPSesRemoteAddr, 0, (void**)&theIPAddr, &theLen);
if ((theIPAddr == NULL) || (theLen != sizeof(UInt32)))
{
Assert(0);
return QTSS_NoErr;
}
IPAddrTableKey theKey(*theIPAddr);
// This must be atomic
OSMutexLocker locker(sMutex);
// Check to see if this client currently has a connection open.
IPAddrTableElem* theElem = sHashTable->Map(&theKey);
if (theElem == NULL)
{
// Client doesn't have a connetion open currently. Create a map element,
// and add it into the map.
theElem = NEW IPAddrTableElem(*theIPAddr);
sHashTable->Add(theElem);
}
// Check to see if this client has too many connections open. If it does,
// return an error, otherwise, allow the connection and increment the
// refcount.
if (theElem->GetRefCount() >= sNumConnsPerIP)
return QTSSModuleUtils::SendErrorResponse(inParams->inRTSPRequest, qtssClientForbidden,
sTooManyConnectionsErr);
else
theElem->IncrementRefCount();
// Mark the request so we'll know subsequent ones aren't the first.
// Note that we only do this if we've successfully added this client to our map.
// That way, we only remove it in SessionClosing if we've added it.
(void)QTSS_SetValue(inParams->inRTSPSession, sIsFirstRequestAttr, 0, &sTrue, sizeof(sTrue));
return QTSS_NoErr;
}
示例14: QTSS_SetValue
void RTPSessionOutput::InitializeStreams()
{
UInt32 theLen = 0;
QTSS_RTPStreamObject* theStreamPtr = NULL;
UInt32 packetCountInitValue = 0;
for (SInt16 z = 0; QTSS_GetValuePtr(fClientSession, qtssCliSesStreamObjects, z, (void**)&theStreamPtr, &theLen) == QTSS_NoErr; z++)
{
(void) QTSS_SetValue(*theStreamPtr, sStreamPacketCountAttr, 0, &packetCountInitValue, sizeof(UInt32));
}
}
示例15: PostProcess
QTSS_Error PostProcess(QTSS_StandardRTSP_Params* inParams)
{
static UInt32 sZero = 0;
UInt32* theStatus = NULL;
UInt32 theLen = 0;
QTSS_Error theErr = QTSS_GetValuePtr(inParams->inRTSPRequest, qtssRTSPReqRealStatusCode, 0, (void**)&theStatus, &theLen);
if (theErr != QTSS_NoErr)
return theErr;
QTSS_CliSesClosingReason theReason = qtssCliSesCloseClientTeardown;
if ((*theStatus == 401) || (*theStatus == 403))
{
LogRequest(inParams->inClientSession, NULL, &theReason);
(void)QTSS_SetValue(inParams->inClientSession, sLoggedAuthorizationAttrID, 0, theStatus, sizeof(*theStatus));
}
else
(void)QTSS_SetValue(inParams->inClientSession, sLoggedAuthorizationAttrID, 0, &sZero, sizeof(sZero));
return theErr;
}