void* RTSPRequestInterface::GetFileName(QTSSDictionary* inRequest, UInt32* /*outLen*/) { // This function always gets called RTSPRequestInterface* theRequest = (RTSPRequestInterface*)inRequest; theRequest->SetVal(qtssRTSPReqFileName, theRequest->GetValue(qtssRTSPReqFilePath)); StrPtrLen* theFileNameParam = theRequest->GetValue(qtssRTSPReqFileName); //paranoid check if (theFileNameParam->Len == 0) return theFileNameParam; //walk back in the file name until we hit a / SInt32 x = theFileNameParam->Len - 1; for (; x > 0; x--) if (theFileNameParam->Ptr[x] == kPathDelimiterChar) break; //once we do, make the tempPtr point to the next character after the slash, //and adjust the length accordingly if (theFileNameParam->Ptr[x] == kPathDelimiterChar ) { theFileNameParam->Ptr = (&theFileNameParam->Ptr[x]) + 1; theFileNameParam->Len -= (x + 1); } return NULL; }
//param retrieval functions described in .h file void* RTSPRequestInterface::GetAbsTruncatedPath(QTSSDictionary* inRequest, UInt32* /*outLen*/) { // This function gets called only once RTSPRequestInterface* theRequest = (RTSPRequestInterface*)inRequest; theRequest->SetVal(qtssRTSPReqTruncAbsoluteURL, theRequest->GetValue(qtssRTSPReqAbsoluteURL)); //Adjust the length to truncate off the last file in the path StrPtrLen* theAbsTruncPathParam = theRequest->GetValue(qtssRTSPReqTruncAbsoluteURL); theAbsTruncPathParam->Len--; while (theAbsTruncPathParam->Ptr[theAbsTruncPathParam->Len] != kPathDelimiterChar) theAbsTruncPathParam->Len--; return NULL; }
void* RTSPRequestInterface::GetTruncatedPath(QTSSDictionary* inRequest, UInt32* /*outLen*/) { // This function always gets called RTSPRequestInterface* theRequest = (RTSPRequestInterface*)inRequest; theRequest->SetVal(qtssRTSPReqFilePathTrunc, theRequest->GetValue(qtssRTSPReqFilePath)); //Adjust the length to truncate off the last file in the path StrPtrLen* theTruncPathParam = theRequest->GetValue(qtssRTSPReqFilePathTrunc); if (theTruncPathParam->Len > 0) { theTruncPathParam->Len--; while ( (theTruncPathParam->Len != 0) && (theTruncPathParam->Ptr[theTruncPathParam->Len] != kPathDelimiterChar) ) theTruncPathParam->Len--; } return NULL; }
void* RTSPRequestInterface::GetFileDigit(QTSSDictionary* inRequest, UInt32* /*outLen*/) { // This function always gets called RTSPRequestInterface* theRequest = (RTSPRequestInterface*)inRequest; theRequest->SetVal(qtssRTSPReqFileDigit, theRequest->GetValue(qtssRTSPReqFilePath)); StrPtrLen* theFileDigit = theRequest->GetValue(qtssRTSPReqFileDigit); UInt32 theFilePathLen = theRequest->GetValue(qtssRTSPReqFilePath)->Len; theFileDigit->Ptr += theFilePathLen - 1; theFileDigit->Len = 0; while ((StringParser::sDigitMask[(unsigned int) *(*theFileDigit).Ptr] != '\0') && (theFileDigit->Len <= theFilePathLen)) { theFileDigit->Ptr--; theFileDigit->Len++; } //termination condition means that we aren't actually on a digit right now. //Move pointer back onto the digit theFileDigit->Ptr++; return NULL; }