本文整理汇总了C++中qtss_printf函数的典型用法代码示例。如果您正苦于以下问题:C++ qtss_printf函数的具体用法?C++ qtss_printf怎么用?C++ qtss_printf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qtss_printf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qtss_printf
OS_Error HTTPClientSocket::Read(void* inBuffer, const UInt32 inLength, UInt32* outRcvLen)
{
//
// Bring up the GET connection if we need to
if (!fGetSocket.IsConnected())
{
#if CLIENT_SOCKET_DEBUG
qtss_printf("HTTPClientSocket::Read: Sending GET\n");
#endif
qtss_sprintf(fSendBuffer.Ptr, "GET %s HTTP/1.0\r\nX-SessionCookie: %" _U32BITARG_ "\r\nAccept: application/x-rtsp-rtp-interleaved\r\nUser-Agent: QTSS/2.0\r\n\r\n", fURL.Ptr, fCookie);
fSendBuffer.Len = ::strlen(fSendBuffer.Ptr);
Assert(fSentLength == 0);
}
OS_Error theErr = this->Connect(&fGetSocket);
if (theErr != OS_NoErr)
return theErr;
if (fSendBuffer.Len > 0)
{
theErr = this->SendSendBuffer(&fGetSocket);
if (theErr != OS_NoErr)
return theErr;
fSentLength = 1; // So we know to execute the receive code below.
}
// We are done sending the GET. If we need to receive the GET response, do that here
if (fSentLength > 0)
{
*outRcvLen = 0;
do
{
// Loop, trying to receive the entire response.
theErr = fGetSocket.Read(&fSendBuffer.Ptr[fGetReceived], kSendBufferLen - fGetReceived, outRcvLen);
fGetReceived += *outRcvLen;
// Check to see if we've gotten a \r\n\r\n. If we have, then we've received
// the entire GET
fSendBuffer.Ptr[fGetReceived] = '\0';
char* theGetEnd = ::strstr(fSendBuffer.Ptr, "\r\n\r\n");
if (theGetEnd != NULL)
{
// We got the entire GET response, so we are ready to move onto
// real RTSP response data. First skip past the \r\n\r\n
theGetEnd += 4;
#if CLIENT_SOCKET_DEBUG
qtss_printf("HTTPClientSocket::Read: Received GET response\n");
#endif
// Whatever remains is part of an RTSP request, so move that to
// the beginning of the buffer and blow away the GET
*outRcvLen = fGetReceived - (theGetEnd - fSendBuffer.Ptr);
::memcpy(inBuffer, theGetEnd, *outRcvLen);
fGetReceived = fSentLength = 0;
return OS_NoErr;
}
Assert(fGetReceived < inLength);
} while (*outRcvLen > 0);
#if CLIENT_SOCKET_DEBUG
qtss_printf("HTTPClientSocket::Read: Waiting for GET response\n");
#endif
// Message wasn't entirely received. Caller should wait for a read event on the GET socket
Assert(theErr != OS_NoErr);
fSocketP = &fGetSocket;
fEventMask = EV_RE;
return theErr;
}
theErr = fGetSocket.Read(&((char*)inBuffer)[fGetReceived], inLength - fGetReceived, outRcvLen);
if (theErr != OS_NoErr)
{
#if CLIENT_SOCKET_DEBUG
//qtss_printf("HTTPClientSocket::Read: Waiting for data\n");
#endif
fSocketP = &fGetSocket;
fEventMask = EV_RE;
}
#if CLIENT_SOCKET_DEBUG
//else
//qtss_printf("HTTPClientSocket::Read: Got some data\n");
#endif
return theErr;
}
示例2: main
int main(int argc, char * argv[])
{
extern char* optarg;//命令参数,例如执行:CMS.exe -d -v
int ch;
char* theXMLFilePath = "./config.xml";
Bool16 notAService = false;
Bool16 theXMLPrefsExist = true;
Bool16 dontFork = false;
#if _DEBUG
char* compileType = "Compile_Flags/_DEBUG; ";
#else
char* compileType = "Compile_Flags/_RELEASE;";
#endif
qtss_printf("%s/%s ( Build/%s; Platform/%s; %s%s) Built on: %s\n",
QTSServerInterface::GetServerName().Ptr,
QTSServerInterface::GetServerVersion().Ptr,
QTSServerInterface::GetServerBuild().Ptr,
QTSServerInterface::GetServerPlatform().Ptr,
compileType,
QTSServerInterface::GetServerComment().Ptr,
QTSServerInterface::GetServerBuildDate().Ptr);
while ((ch = getopt(argc,argv, "vdp:c:irsS:I")) != EOF) //opt: means requires option
{
switch(ch)
{
case 'v':
qtss_printf("%s/%s ( Build/%s; Platform/%s; %s%s) Built on: %s\n",
QTSServerInterface::GetServerName().Ptr,
QTSServerInterface::GetServerVersion().Ptr,
QTSServerInterface::GetServerBuild().Ptr,
QTSServerInterface::GetServerPlatform().Ptr,
compileType,
QTSServerInterface::GetServerComment().Ptr,
QTSServerInterface::GetServerBuildDate().Ptr);
qtss_printf("usage: %s [ -d | -p port | -v | -c /myconfigpath.xml | -S numseconds | -I | -h ]\n", QTSServerInterface::GetServerName().Ptr);
qtss_printf("-d: Don't run as a Win32 Service\n");
qtss_printf("-p 60000: Specify the default listening port of the server\n");
qtss_printf("-c c:\\myconfigpath.xml: Specify a config file path\n");
qtss_printf("-i: Install the CMS service\n");
qtss_printf("-r: Remove the CMS service\n");
qtss_printf("-s: Start the CMS service\n");
qtss_printf("-S n: Display server stats in the console every \"n\" seconds\n");
qtss_printf("-I: Start the server in the idle state\n");
break;
case 'd':
notAService = true;
break;
case 'p':
Assert(optarg != NULL);// this means we didn't declare getopt options correctly or there is a bug in getopt.
sPort = ::atoi(optarg);
break;
case 'c':
Assert(optarg != NULL);// this means we didn't declare getopt options correctly or there is a bug in getopt.
theXMLFilePath = optarg;
break;
case 'S':
Assert(optarg != NULL);// this means we didn't declare getopt options correctly or there is a bug in getopt.
sStatsUpdateInterval = ::atoi(optarg);
break;
case 'i':
qtss_printf("Installing the CMS Server service...\n");
::InstallService("CMS");
qtss_printf("Starting the CMS Server service...\n");
::RunAsService("CMS");
::exit(0);
break;
case 'r':
qtss_printf("Removing the CMS Server service...\n");
::RemoveService("CMS");
::exit(0);
case 's':
qtss_printf("Starting the CMS Server service...\n");
::RunAsService("CMS");
::exit(0);
case 'I':
sInitialState = qtssIdleState;
break;
default:
break;
}
}
//检测软件是否过期
QTSSExpirationDate::PrintExpirationDate();
if (QTSSExpirationDate::IsSoftwareExpired())
{
qtss_printf("CMS Server Has Expired\n");
::exit(0);
}
//读取xml配置文件
sXMLParser = new XMLPrefsParser(theXMLFilePath);
//检测xml文件是否是以目录形式存在
//.........这里部分代码省略.........
示例3: qtss_printf
void QTSSExpirationDate::PrintExpirationDate()
{
if (sIsExpirationEnabled)
qtss_printf("Software expires on: %s\n", sExpirationDate);
}
示例4: while
//.........这里部分代码省略.........
Assert(fEncodedBytesRemaining < 4);
}
else
fRequest.Len += newOffset;
Assert(fRequest.Len < kRequestBufferSizeInBytes);
fCurOffset += newOffset;
}
Assert(newOffset > 0);
// See if this is an interleaved data packet
if ('$' == *(fRequest.Ptr))
{
if (fRequest.Len < 4)
continue;
UInt16* dataLenP = (UInt16*)fRequest.Ptr;
UInt32 interleavedPacketLen = ntohs(dataLenP[1]) + 4;
if (interleavedPacketLen > fRequest.Len)
continue;
//put back any data that is not part of the header
fRetreatBytes += fRequest.Len - interleavedPacketLen;
fRequest.Len = interleavedPacketLen;
fRequestPtr = &fRequest;
fIsDataPacket = true;
return QTSS_RequestArrived;
}
fIsDataPacket = false;
if (fPrintRTSP)
{
DateBuffer theDate;
DateTranslator::UpdateDateBuffer(&theDate, 0); // get the current GMT date and time
qtss_printf("\n\n#C->S:\n#time: ms=%lu date=%s\n", (UInt32) OS::StartTimeMilli_Int(), theDate.GetDateBuffer());
if (fSocket != NULL)
{
UInt16 serverPort = fSocket->GetLocalPort();
UInt16 clientPort = fSocket->GetRemotePort();
StrPtrLen* theLocalAddrStr = fSocket->GetLocalAddrStr();
StrPtrLen* theRemoteAddrStr = fSocket->GetRemoteAddrStr();
if (theLocalAddrStr != NULL)
{ qtss_printf("#server: ip="); theLocalAddrStr->PrintStr(); qtss_printf(" port=%u\n" , serverPort );
}
else
{ qtss_printf("#server: ip=NULL port=%u\n" , serverPort );
}
if (theRemoteAddrStr != NULL)
{ qtss_printf("#client: ip="); theRemoteAddrStr->PrintStr(); qtss_printf(" port=%u\n" , clientPort );
}
else
{ qtss_printf("#client: ip=NULL port=%u\n" , clientPort );
}
}
StrPtrLen str(fRequest);
str.PrintStrEOL("\n\r\n", "\n");// print the request but stop on \n\r\n and add a \n afterwards.
}
//use a StringParser object to search for a double EOL, which signifies the end of
//the header.
Bool16 weAreDone = false;
StringParser headerParser(&fRequest);
示例5: atomic_or
void Task::Signal(EventFlags events)
{
if (!this->Valid())
return;
//Fancy no mutex implementation. We atomically mask the new events into
//the event mask. Because atomic_or returns the old state of the mask,
//we only schedule this task once.
events |= kAlive;
EventFlags oldEvents = atomic_or(&fEvents, events);
if ((!(oldEvents & kAlive)) && (TaskThreadPool::sNumTaskThreads > 0))
{
if (fDefaultThread != NULL && fUseThisThread == NULL)
fUseThisThread = fDefaultThread;
if (fUseThisThread != NULL)// Task needs to be placed on a particular thread.
{
if (TASK_DEBUG)
{
if (fTaskName[0] == 0) ::strcpy(fTaskName, " _Corrupt_Task");
qtss_printf("Task::Signal EnQueue TaskName=%s fUseThisThread=%p q_elem=%p enclosing=%p\n", fTaskName, (void *)fUseThisThread, (void *)&fTaskQueueElem, (void *) this);
if (TaskThreadPool::sTaskThreadArray[0] == fUseThisThread) qtss_printf("Task::Signal RTSP Thread running TaskName=%s \n", fTaskName);
}
fUseThisThread->fTaskQueue.EnQueue(&fTaskQueueElem);
}
else
{
//find a thread to put this task on
unsigned int theThreadIndex = atomic_add((unsigned int *)pickerToUse, 1);
if (&Task::sShortTaskThreadPicker == pickerToUse)
{
theThreadIndex %= TaskThreadPool::sNumShortTaskThreads;
if (TASK_DEBUG) qtss_printf("Task::Signal EnQueue TaskName=%s using Task::sShortTaskThreadPicker=%u numShortTaskThreads=%" _U32BITARG_ " short task range=[0-%" _U32BITARG_ "] thread index =%u \n", fTaskName, Task::sShortTaskThreadPicker, TaskThreadPool::sNumShortTaskThreads, TaskThreadPool::sNumShortTaskThreads - 1, theThreadIndex);
}
else if (&Task::sBlockingTaskThreadPicker == pickerToUse)
{
theThreadIndex %= TaskThreadPool::sNumBlockingTaskThreads;
theThreadIndex += TaskThreadPool::sNumShortTaskThreads; //don't pick from lower non-blocking (short task) threads.
if (TASK_DEBUG) qtss_printf("Task::Signal EnQueue TaskName=%s using Task::sBlockingTaskThreadPicker=%u numBlockingThreads=%" _U32BITARG_ " blocking thread range=[%" _U32BITARG_ "-%" _U32BITARG_ "] thread index =%u \n", fTaskName, Task::sBlockingTaskThreadPicker, TaskThreadPool::sNumBlockingTaskThreads, TaskThreadPool::sNumShortTaskThreads, TaskThreadPool::sNumBlockingTaskThreads + TaskThreadPool::sNumShortTaskThreads - 1, theThreadIndex);
}
else
{
if (TASK_DEBUG) if (fTaskName[0] == 0) ::strcpy(fTaskName, " _Corrupt_Task");
return;
}
if (TASK_DEBUG) if (fTaskName[0] == 0) ::strcpy(fTaskName, " _Corrupt_Task");
if (TASK_DEBUG) qtss_printf("Task::Signal EnQueue B TaskName=%s theThreadIndex=%u thread=%p fTaskQueue.GetLength(%" _U32BITARG_ ") q_elem=%p enclosing=%p\n", fTaskName, theThreadIndex, (void *)TaskThreadPool::sTaskThreadArray[theThreadIndex], TaskThreadPool::sTaskThreadArray[theThreadIndex]->fTaskQueue.GetQueue()->GetLength(), (void *)&fTaskQueueElem, (void *) this);
TaskThreadPool::sTaskThreadArray[theThreadIndex]->fTaskQueue.EnQueue(&fTaskQueueElem);
if (TASK_DEBUG) qtss_printf("Task::Signal EnQueue A TaskName=%s theThreadIndex=%u thread=%p fTaskQueue.GetLength(%" _U32BITARG_ ") q_elem=%p enclosing=%p\n", fTaskName, theThreadIndex, (void *)TaskThreadPool::sTaskThreadArray[theThreadIndex], TaskThreadPool::sTaskThreadArray[theThreadIndex]->fTaskQueue.GetQueue()->GetLength(), (void *)&fTaskQueueElem, (void *) this);
}
}
else
if (TASK_DEBUG) qtss_printf("Task::Signal Sent to dead TaskName=%s q_elem=%p enclosing=%p\n", fTaskName, (void *)&fTaskQueueElem, (void *) this);
}
示例6: PrintStatus
void PrintStatus(Bool16 printHeader)
{
char* thePrefStr = NULL;
UInt32 theLen = 0;
if ( printHeader )
{
qtss_printf(" RTP-Conns RTSP-Conns HTTP-Conns kBits/Sec Pkts/Sec TotConn TotBytes TotPktsLost Time\n");
}
(void)QTSS_GetValueAsString(sServer, qtssRTPSvrCurConn, 0, &thePrefStr);
qtss_printf( "%11s", thePrefStr);
delete [] thePrefStr; thePrefStr = NULL;
(void)QTSS_GetValueAsString(sServer, qtssRTSPCurrentSessionCount, 0, &thePrefStr);
qtss_printf( "%11s", thePrefStr);
delete [] thePrefStr; thePrefStr = NULL;
(void)QTSS_GetValueAsString(sServer, qtssRTSPHTTPCurrentSessionCount, 0, &thePrefStr);
qtss_printf( "%11s", thePrefStr);
delete [] thePrefStr; thePrefStr = NULL;
UInt32 curBandwidth = 0;
theLen = sizeof(curBandwidth);
(void)QTSS_GetValue(sServer, qtssRTPSvrCurBandwidth, 0, &curBandwidth, &theLen);
qtss_printf("%11"_U32BITARG_, curBandwidth/1024);
(void)QTSS_GetValueAsString(sServer, qtssRTPSvrCurPackets, 0, &thePrefStr);
qtss_printf( "%11s", thePrefStr);
delete [] thePrefStr; thePrefStr = NULL;
(void)QTSS_GetValueAsString(sServer, qtssRTPSvrTotalConn, 0, &thePrefStr);
qtss_printf( "%11s", thePrefStr);
delete [] thePrefStr; thePrefStr = NULL;
UInt64 totalBytes = sServer->GetTotalRTPBytes();
char displayBuff[32] = "";
FormattedTotalBytesBuffer(displayBuff, sizeof(displayBuff),totalBytes);
qtss_printf( "%17s", displayBuff);
qtss_printf( "%11"_64BITARG_"u", sServer->GetTotalRTPPacketsLost());
char theDateBuffer[QTSSRollingLog::kMaxDateBufferSizeInBytes];
(void) QTSSRollingLog::FormatDate(theDateBuffer, false);
qtss_printf( "%25s",theDateBuffer);
qtss_printf( "\n");
}
示例7: fSocket
BroadcasterSession::BroadcasterSession( UInt32 inAddr, UInt16 inPort, char* inURL,
BroadcasterType inClientType,
UInt32 inDurationInSec, UInt32 inStartPlayTimeInSec,
UInt32 inRTCPIntervalInSec, UInt32 inOptionsIntervalInSec,
UInt32 inHTTPCookie, Bool16 inAppendJunkData, UInt32 inReadInterval,
UInt32 inSockRcvBufSize,
StrPtrLen *sdpSPLPtr,
char *namePtr,
char *passwordPtr,
Bool16 deepDebug,
Bool16 burst)
: fSocket(NULL),
fRTSPClient(NULL),
fTimeoutTask(NULL, kIdleTimeoutInMsec),
fDurationInSec(inDurationInSec),
fStartPlayTimeInSec(inStartPlayTimeInSec),
fRTCPIntervalInSec(inRTCPIntervalInSec),
fOptionsIntervalInSec(inOptionsIntervalInSec),
fState(kSendingAnnounce),
fDeathState(kSendingAnnounce),
fDeathReason(kDiedNormally),
fNumSetups(0),
fUDPSocketArray(NULL),
fPlayTime(0),
fTotalPlayTime(0),
fLastRTCPTime(0),
fTeardownImmediately(false),
fAppendJunk(inAppendJunkData),
fReadInterval(inReadInterval),
fSockRcvBufSize(inSockRcvBufSize),
fBurst(burst),
fBurstTime(10),
fStats(NULL),
fPacketLen(0),
fChannel(0)
// fPacket(NULL)
{
fTimeoutTask.SetTask(this);
StrPtrLen theURL(inURL);
fSDPParser.Parse(sdpSPLPtr->Ptr, sdpSPLPtr->Len);
if (fBurst && deepDebug)
printf("Burst Mode enabled: broadcast will be delayed for %"_U32BITARG_" seconds before starting\n", fBurstTime);
#if BROADCAST_SESSION_DEBUG
qtss_printf("Connecting to: %s, port %d\n", inURL, inPort);
#endif
//
// Construct the appropriate ClientSocket type depending on what type of client we are supposed to be
switch (inClientType)
{
case kRTSPUDPBroadcasterType:
{
fControlType = kRawRTSPControlType;
fTransportType = kUDPTransportType;
fSocket = NEW TCPClientSocket(Socket::kNonBlockingSocketType);
break;
}
case kRTSPTCPBroadcasterType:
{
fControlType = kRawRTSPControlType;
fTransportType = kTCPTransportType;
fSocket = NEW TCPClientSocket(Socket::kNonBlockingSocketType);
break;
}
case kRTSPHTTPBroadcasterType:
{
fControlType = kRTSPHTTPControlType;
fTransportType = kTCPTransportType;
fSocket = NEW HTTPClientSocket(theURL, inHTTPCookie, Socket::kNonBlockingSocketType);
break;
}
case kRTSPHTTPDropPostBroadcasterType:
{
fControlType = kRTSPHTTPDropPostControlType;
fTransportType = kTCPTransportType;
fSocket = NEW HTTPClientSocket(theURL, inHTTPCookie, Socket::kNonBlockingSocketType);
break;
}
case kRTSPReliableUDPBroadcasterType:
{
Assert(0);
break;
}
default:
{
qtss_printf("BroadcasterSession: Attempt to create unsupported client type.\n");
::exit(-1);
}
}
fSocket->Set(inAddr, inPort);
fSocket->GetSocket()->SetTask(this);
int sndBufSize = 32 * 1024;
//.........这里部分代码省略.........
示例8: CallAuthorizeSession
static Bool16 CallAuthorizeSession(QTSS_ClientSessionObject* theClientSession, QTSS_RTSPSessionObject* theRTSPSession,
QTSS_RTSPRequestObject* theRTSPRequest, char* username, char* password) {
qtss_printf("QTSSIcecastAuthModule::CallAuthorizeSession called\n");
//{ :action => "listener_add", :server => "server", :port => "8000", :client => "sessionidone",
// :mount => "somemount.sdp", :user => "lstoll", :pass => @working_hash, :ip => "127.0.0.1", :agent => "RSPEC"}
// generate the client session id (and save in client) format <start time millis>-<rtsp session id>
char ice_sessid[128];
QTSS_TimeVal clientSessCreateTime = NULL;
UInt32 createTimeLen = sizeof (clientSessCreateTime);
QTSS_GetValue(*theClientSession, qtssCliSesCreateTimeInMsec, 0, (void*) & clientSessCreateTime, &createTimeLen);
char* qtssRTSPSesIDString = NULL;
(void) QTSS_GetValueAsString(*theRTSPSession, qtssRTSPSesID, 0, &qtssRTSPSesIDString);
sprintf(ice_sessid, "%lld-%s", clientSessCreateTime, qtssRTSPSesIDString);
printf("QTSSIcecastAuthModule::CallAuthorizeSession generated session id: %s\n", ice_sessid);
(void) QTSS_SetValue(*theClientSession, attrClientSessionFullSessionID, 0, &ice_sessid, sizeof (ice_sessid));
// get the user agent
char* userAgentString = NULL;
(void) QTSS_GetValueAsString(*theClientSession, qtssCliSesFirstUserAgent, 0, &userAgentString);
printf("QTSSIcecastAuthModule::CallAuthorizeSession: request user agent: %s\n", userAgentString);
// get the client IP address
char remoteAddress[20] = {0};
StrPtrLen theClientIPAddressStr(remoteAddress,sizeof(remoteAddress));
(void)QTSS_GetValue(*theRTSPSession, qtssRTSPSesRemoteAddrStr, 0, (void*)theClientIPAddressStr.Ptr, &theClientIPAddressStr.Len);
// get the mount point
char mountPoint[128] = {0};
StrPtrLen mountPointStr(mountPoint,sizeof(mountPoint));
(void)QTSS_GetValue(*theRTSPRequest, qtssRTSPReqURI, 0, (void*)mountPointStr.Ptr, &mountPointStr.Len);
printf("QTSSIcecastAuthModule::CallAuthorizeSession: mount point: %s\n", mountPoint);
// and set it in the client for use on session end
(void) QTSS_SetValue(*theClientSession, attrClientSessionMountPoint, 0, mountPointStr.Ptr, mountPointStr.Len);
char postdata[512];
qtss_sprintf(postdata, "action=listener_add&server=%s&port=554&client=%s&mount=%s&user=%s&pass=%s&ip=%s&agent%s",
hostname, ice_sessid, mountPoint, username, password, remoteAddress, userAgentString);
printf("QTSSIcecastAuthModule::CallAuthorizeSession: generated postdata: %s\n", postdata);
printf("QTSSIcecastAuthModule::CallAuthorizeSession: i would post this to: %s\n", sStartSessionEndpoint);
return true;
//
// CURL *easyhandle = NULL;
// easyhandle = curl_easy_init();
// CURLcode curl_code;
//
//
// curl_easy_setopt(easyhandle, CURLOPT_POSTFIELDS, postdata);
// curl_easy_setopt(easyhandle, CURLOPT_URL, "http://posthere.com/");
// curl_easy_perform(easyhandle); /* post away! */
//
// long http_code = 0;
// curl_easy_getinfo(easyhandle, CURLINFO_HTTP_CODE, &http_code);
// if (http_code == 200 && curl_code != CURLE_ABORTED_BY_CALLBACK) {
// // the call to the remote server was OK. pass.
// return true;
// } else {
// return false;
// }
// return false;
}
示例9: qtss_printf
void EasyCameraSource::doStopGettingFrames()
{
qtss_printf("doStopGettingFrames()\n");
netDevStopStream();
}
示例10: RTSPFilter
/*
* This method is called because it is the only one that gets the full URL params, to capture
* the username and password. We don't have access to the client session here, so save
* the user and pass in the session for later. This is called BEFORE PostProcess
*/
QTSS_Error RTSPFilter(QTSS_StandardRTSP_Params* inParams) {
QTSS_Error theErr = QTSS_NoErr;
QTSS_RTSPRequestObject theRTSPRequest = inParams->inRTSPRequest;
QTSS_RTSPSessionObject theRTSPSession = inParams->inRTSPSession;
// FAIL - can't do this here. need to finally move the auth to preprocess, and use this
// just for param capture.
// On the flip site, it seems that everything is really early here - if query params
// don't work, can embed them in the URL path, extract here, and rewrite the URL in the request
// and it should work fine. this could be handy if proxy's become an issue, because each request
// would have a unique path.
// // see if the method is bypassable. if it is, skip processing
// qtss_printf("QTSSIcecastAuthModule::RTSPFilter: about to check if the method is bypassable\n");
// if (IsRequestMethodBypassable(&theRTSPRequest)) return QTSS_NoErr;
// see if the client is in the bypass list. if they are, skip all processing
if (IsClientInBypassList(&theRTSPSession)) return QTSS_NoErr;
// check to see if the session is already auth'd. If it is, skip processing
if (IsRTSPSessionAuthenticated(&theRTSPSession)) {
printf("QTSSIcecastAuthModule::RTSPFilter RTSP session is authenticated, do nothing.\n");
return QTSS_NoErr; // we are authenticated, don't do anything
}
char* qtssRTSPSesIDString = NULL;
(void) QTSS_GetValueAsString(theRTSPSession, qtssRTSPSesID, 0, &qtssRTSPSesIDString);
printf("QTSSIcecastAuthModule::RTSPFilter session qtssRTSPSesID: %s\n", qtssRTSPSesIDString);
char* qtssRTSPReqFullRequestString = NULL;
(void)QTSS_GetValueAsString(theRTSPRequest, qtssRTSPReqFullRequest, 0, &qtssRTSPReqFullRequestString);
qtss_printf("QTSSIcecastAuthModule::RTSPFilter: request qtssRTSPReqFullRequest: %s\n", qtssRTSPReqFullRequestString);
/* will want to modify this for proper tokenization, but it works for now */
char username[255];
bool usernameset = false;
char password[255];
bool passwordset = false;
Bool16 requiredAuthParametersProvided = false;
if(index(qtssRTSPReqFullRequestString, '?')){
char buf[512];
snprintf(buf, 512, qtssRTSPReqFullRequestString);
char* queryString;
char* progress1;
// split off everything after the first line, we don't need it.
queryString = ::strtok_r(buf, "\n", &progress1);
// split around the ?, ignore the first part
::strtok_r(buf, "?", &progress1);
// get the second part of the previous split
queryString = ::strtok_r(NULL, "?", &progress1);
// split working around the space
queryString = ::strtok_r(queryString, " ", &progress1);
//printf("queryString: %s\n", queryString);
// we should now have our url
char* tmp = strtok(queryString, "=&");
int iters;
for (iters=0; (tmp != NULL); iters++)
{
char name[255]; // I'm asking for a buffer overflow, aren't I? TODO - check this.
if ((iters % 2) != 1) {
// even - its a name. this will always be 'first'
strcpy(name, tmp);
//printf("name: %s\n", tmp);
}
else {
// non-even, its a value. this will always come second
//printf("value: %s\n", tmp);
if (strcmp(name, "u") == 0) {
// this value is the username
//printf("name is currently: %s. username being set to %s\n", name, tmp);
strcpy(username, tmp);
usernameset = true;
}
else if (strcmp(name, "p") == 0) {
// this value is the username
//printf("name is currently: %s. password being set to %s\n", name, tmp);
strcpy(password, tmp);
passwordset = true;
}
}
tmp = strtok(NULL, "=&");
}
//printf("username: %s, password: %s\n\n", username, password);
//.........这里部分代码省略.........
示例11: RTSPPreProcess
/*
* This method is used to capture the full session ID details, and to reject the session.
* The username and password from the query string can't be grabbed here, we need to
* do that in the Filter. This is called AFTER Filter
*/
QTSS_Error RTSPPreProcess(QTSS_StandardRTSP_Params* inParams) {
QTSS_Error theErr = QTSS_NoErr;
QTSS_RTSPRequestObject theRTSPRequest = inParams->inRTSPRequest;
QTSS_RTSPSessionObject theRTSPSession = inParams->inRTSPSession;
QTSS_RTSPHeaderObject theRTSPHeader = inParams->inRTSPHeaders;
QTSS_ClientSessionObject theClientSession = inParams->inClientSession;
Bool16 sessionValid = false;
// see if the method is bypassable. if it is, skip processing
qtss_printf("QTSSIcecastAuthModule::RTSPPreProcess: about to check if the method is bypassable\n");
if (IsRequestMethodBypassable(&theRTSPRequest)) return QTSS_NoErr;
// see if the client is in the bypass list. if they are, skip all processing
if (IsClientInBypassList(&theRTSPSession)) return QTSS_NoErr;
// check to see if the session is already auth'd. If it is, skip processing
if (IsRTSPSessionAuthenticated(&theRTSPSession)) {
printf("QTSSIcecastAuthModule::RTSPPreProcess RTSP session is authenticated, do nothing.\n");
return QTSS_NoErr; // we are authenticated, don't do anything
}
char* providedUsername = NULL;
(void)QTSS_GetValueAsString(theRTSPSession, attrRtspSessionProvidedUsername, 0, &providedUsername);
printf("QTSSIcecastAuthModule::RTSPPreProcess: Provided username extracted from session: %s\n", providedUsername);
char* providedPassword = NULL;
(void)QTSS_GetValueAsString(theRTSPSession, attrRtspSessionProvidedPassword, 0, &providedPassword);
printf("QTSSIcecastAuthModule::RTSPPreProcess: Provided password extracted from session: %s\n", providedPassword);
// check to see if the username and password have been provided. If they are, process. if not
// do nothing, we will default to an invalid session
if (providedUsername != NULL && providedPassword != NULL) {
printf("QTSSIcecastAuthModule::RTSPPreProcess: about to call authorize session\n");
// if we get to this point we have credentials that need to be validated, so validate them.
sessionValid = CallAuthorizeSession(&theClientSession, &theRTSPSession, &theRTSPRequest, providedUsername, providedPassword);
// request, qtssRTSPReqFilePath - the mount point (?)
// request, qtssRTSPReqURI - the request URI (query params parsed from here?)
// request, qtssRTSPReqAbsoluteURL - the request url with RTSP.
// request, qtssRTSPReqFullRequest - the full request
// session, qtssRTSPSesID - the session id
// note - QTSS_GetValueAsString is the least efficent method - should move to one of the more efficent methods.
//
// char* qtssRTSPReqFilePathString = NULL;
// (void)QTSS_GetValueAsString(theRTSPRequest, qtssRTSPReqFilePath, 0, &qtssRTSPReqFilePathString);
// printf("QTSSIcecastAuthModule::RTSPPreProcess: request qtssRTSPReqFilePath: %s\n", qtssRTSPReqFilePathString);
//
// char* qtssRTSPReqURIString = NULL;
// (void)QTSS_GetValueAsString(theRTSPRequest, qtssRTSPReqURI, 0, &qtssRTSPReqURIString);
// printf("QTSSIcecastAuthModule::RTSPPreProcess: request qtssRTSPReqURI: %s\n", qtssRTSPReqURIString);
//
// char* qtssRTSPReqAbsoluteURLString = NULL;
// (void)QTSS_GetValueAsString(theRTSPRequest, qtssRTSPReqAbsoluteURL, 0, &qtssRTSPReqAbsoluteURLString);
// printf("QTSSIcecastAuthModule::RTSPPreProcess: request qtssRTSPReqAbsoluteURL: %s\n", qtssRTSPReqAbsoluteURLString);
// //QTSS_Delete(qtssRTSPReqFilePathString);
// QTSS_Delete(qtssRTSPReqURIString);
// //QTSS_Delete(qtssRTSPReqAbsoluteURLString);
// QTSS_Delete(qtssRTSPSesIDString);
}
else {
printf("QTSSIcecastAuthModule::RTSPPreProcess: username and/or password are NULL\n");
}
// set the auth status on the RTSP session
(void)QTSS_SetValue(theRTSPSession, attrRtspSessionAuthenticated, 0, &sessionValid, sizeof(sessionValid));
if (sessionValid) {
// valid session, return
return QTSS_NoErr;
}
else {
// not a valid session, error
char* accessDeniedMessage = "Access DENIED";
StrPtrLen accessDeniedMessageStr(accessDeniedMessage,sizeof(accessDeniedMessage));
(void)QTSSModuleUtils::SendErrorResponseWithMessage(theRTSPRequest, qtssClientForbidden, &accessDeniedMessageStr);
return QTSS_NoErr;
//.........这里部分代码省略.........
示例12: Register
QTSS_Error Register()
{
QTSS_Error theErr;
// Do role & attribute setup
// for when the server starts
theErr = QTSS_AddRole(QTSS_Initialize_Role);
//PrintQTSSError("QTSSIcecastAuthModule::Register", "register for initialize role", theErr);
// for when asked to re-read the prefs file
qtss_printf("QTSSIcecastAuthModule::Register about to register for reread prefs role\n");
(void)QTSS_AddRole(QTSS_RereadPrefs_Role);
qtss_printf("QTSSIcecastAuthModule::Register after register for reread prefs role, about to register for filter\n");
// can't find doc on these - apparently deprecated as of v3??
//(void)QTSS_AddRole(QTSS_RTSPAuthenticate_Role);
//(void)QTSS_AddRole(QTSS_RTSPAuthorize_Role);
// the earliest call on a RTSP request - needed to get the full query including
// query params.
(void)QTSS_AddRole(QTSS_RTSPFilter_Role);
// called to pre-process a RTSP request - has full client info, including timestamp
// for completely unique session ID's (rather then the increment)
(void)QTSS_AddRole(QTSS_RTSPPreProcessor_Role);
// the shutdown role, for cleanup stuff
(void)QTSS_AddRole(QTSS_Shutdown_Role);
// The client close role, to send the end message
(void)QTSS_AddRole(QTSS_ClientSessionClosing_Role);
qtss_printf("QTSSIcecastAuthModule::Register all roles registered, about to register attributes\n");
// add the attribute to hold the username when provided
(void)QTSS_AddStaticAttribute(qtssRTSPSessionObjectType,
"ProvidedUsername", NULL, qtssAttrDataTypeCharArray);
(void)QTSS_IDForAttr(qtssRTSPSessionObjectType, "ProvidedUsername", &attrRtspSessionProvidedUsername);
// add the attribute to hold the username when provided
(void)QTSS_AddStaticAttribute(qtssRTSPSessionObjectType,
"ProvidedPassword", NULL, qtssAttrDataTypeCharArray);
(void)QTSS_IDForAttr(qtssRTSPSessionObjectType, "ProvidedPassword", &attrRtspSessionProvidedPassword);
// add the attribute that holds the flag to show if the session has been authenticated
// we check this first, if the session is authenticated we can skip everything
theErr = QTSS_AddStaticAttribute(qtssRTSPSessionObjectType,
"SessionAuthenticated", NULL, qtssAttrDataTypeBool16);
//PrintQTSSError("QTSSIcecastAuthModule::Register", "add session authenticated attribute to rtsp session", theErr);
theErr = QTSS_IDForAttr(qtssRTSPSessionObjectType, "SessionAuthenticated", &attrRtspSessionAuthenticated);
//PrintQTSSError("QTSSIcecastAuthModule::Register", "get ID for session authenticated attribute on rtsp session", theErr);
// add to hold the 'full' session ID on the RTSP Session (start time millis CONCAT sever session id, to ensure uniqueness)
(void)QTSS_AddStaticAttribute(qtssClientSessionObjectType,
"FullSessionID", NULL, qtssAttrDataTypeCharArray);
(void)QTSS_IDForAttr(qtssClientSessionObjectType, "FullSessionID", &attrClientSessionFullSessionID);
// the mount point needs to be stashed in the client session, for reporting on teardown
(void)QTSS_AddStaticAttribute(qtssClientSessionObjectType,
"MountPoint", NULL, qtssAttrDataTypeCharArray);
(void)QTSS_IDForAttr(qtssClientSessionObjectType, "MountPoint", &attrClientSessionMountPoint);
qtss_printf("QTSSIcecastAuthModule::Register end of method\n");
return QTSS_NoErr; // need to return. should do something with any errors captured above.
}
示例13: theContentLenParser
//
// 解析HTTPRequest对象fRequest报文
QTSS_Error EasyCMSSession::ProcessRequest()
{
if(NULL == fRequest) return QTSS_BadArgument;
//解析HTTPRequest报文
QTSS_Error theErr = fRequest->Parse();
if (theErr != QTSS_NoErr) return QTSS_BadArgument;
//获取具体Content json数据部分
StrPtrLen* lengthPtr = fRequest->GetHeaderValue(httpContentLengthHeader);
StringParser theContentLenParser(lengthPtr);
theContentLenParser.ConsumeWhitespace();
UInt32 content_length = theContentLenParser.ConsumeInteger(NULL);
if (content_length)
{
qtss_printf("EasyCMSSession::ProcessRequest read content-length:%d \n", content_length);
// 检查content的fContentBuffer和fContentBufferOffset是否有值存在,如果存在,说明我们已经开始
// 进行content请求处理,如果不存在,我们需要创建并初始化fContentBuffer和fContentBufferOffset
if (fContentBuffer == NULL)
{
fContentBuffer = NEW char[content_length + 1];
memset(fContentBuffer,0,content_length + 1);
fContentBufferOffset = 0;
}
UInt32 theLen = 0;
// 读取HTTP Content报文数据
theErr = fInputStream.Read(fContentBuffer + fContentBufferOffset, content_length - fContentBufferOffset, &theLen);
Assert(theErr != QTSS_BadArgument);
if (theErr == QTSS_RequestFailed)
{
OSCharArrayDeleter charArrayPathDeleter(fContentBuffer);
fContentBufferOffset = 0;
fContentBuffer = NULL;
return QTSS_RequestFailed;
}
qtss_printf("EasyCMSSession::ProcessRequest() Add Len:%d \n", theLen);
if ((theErr == QTSS_WouldBlock) || (theLen < ( content_length - fContentBufferOffset)))
{
//
// Update our offset in the buffer
fContentBufferOffset += theLen;
Assert(theErr == QTSS_NoErr);
return QTSS_WouldBlock;
}
Assert(theErr == QTSS_NoErr);
// 处理完成报文后会自动进行Delete处理
OSCharArrayDeleter charArrayPathDeleter(fContentBuffer);
EasyProtocol protocol(fContentBuffer);
int nNetMsg = protocol.GetMessageType();
switch (nNetMsg)
{
case MSG_DEV_CMS_REGISTER_RSP:
//{
// EasyDarwinRegisterRSP rsp_parse(fContentBuffer);
// qtss_printf("session id = %s\n", rsp_parse.GetBodyValue("SessionID").c_str());
// qtss_printf("device serial = %s\n", rsp_parse.GetBodyValue("DeviceSerial").c_str());
//}
break;
case MSG_CMS_DEV_STREAM_START_REQ:
{
//EasyDarwinDeviceStreamReq startStreamReq(fContentBuffer);
//qtss_printf("DeviceSerial = %s\n", startStreamReq.GetBodyValue("DeviceSerial").c_str());
//qtss_printf("CameraSerial = %s\n", startStreamReq.GetBodyValue("CameraSerial").c_str());
//qtss_printf("DssIP = %s\n", startStreamReq.GetBodyValue("DssIP").c_str());
//char szIP[16] = {0,};
//strcpy(szIP, (char*)startStreamReq.GetBodyValue("DssIP").c_str());
//qtss_printf("szIP = %s\n", szIP);
//char *ip = (char*)startStreamReq.GetBodyValue("DssIP").c_str();
//qtss_printf("ip = %s\n", ip);
//QTSS_RoleParams packetParams;
//memset(&packetParams, 0x00, sizeof(QTSS_RoleParams));
//strcpy(packetParams.easyNVRParams.inNVRSerialNumber, (char*)sEasy_Serial);
//strcpy(packetParams.easyNVRParams.inDeviceSerial, (char*)startStreamReq.GetBodyValue("DeviceSerial").c_str());
//strcpy(packetParams.easyNVRParams.inCameraSerial, (char*)startStreamReq.GetBodyValue("CameraSerial").c_str());
//packetParams.easyNVRParams.inStreamID = atoi(startStreamReq.GetBodyValue("StreamID").c_str());
//strcpy(packetParams.easyNVRParams.inProtocol, (char*)startStreamReq.GetBodyValue("Protocol").c_str());
//strcpy(packetParams.easyNVRParams.inDssIP, (char*)startStreamReq.GetBodyValue("DssIP").c_str());
//packetParams.easyNVRParams.inDssPort =atoi(startStreamReq.GetBodyValue("DssPort").c_str());
//QTSS_Error errCode = QTSS_NoErr;
//UInt32 fCurrentModule=0;
//UInt32 numModules = QTSServerInterface::GetNumModulesInRole(QTSSModule::kStartStreamRole);
//for (; fCurrentModule < numModules; fCurrentModule++)
//{
// QTSSModule* theModule = QTSServerInterface::GetModule(QTSSModule::kStartStreamRole, fCurrentModule);
// errCode = theModule->CallDispatch(Easy_NVRStartStream_Role, &packetParams);
//.........这里部分代码省略.........
示例14: qtss_printf
SInt64 EasyCMSSession::Run()
{
OS_Error theErr = OS_NoErr;
EventFlags events = this->GetEvents();
if(events & Task::kKillEvent)
{
qtss_printf("kill event but not handle it!\n");
}
while(1)
{
switch (fState)
{
case kIdle://空闲
{
qtss_printf("kIdle state \n");
if(!IsConnected())
{
// TCPSocket未连接的情况,首先进行登录连接
Login();
}
else
{
// TCPSocket已连接的情况下区分具体事件类型
if(events & Task::kStartEvent)
{
// CMSSession掉线,重新进行上线动作
if(kSessionOffline == fSessionStatus)
Login();
}
if(events & Task::kReadEvent)
{
// 对已连接的TCP进行消息读取
fState = kReadingRequest;
}
if(events & Task::kTimeoutEvent)
{
// 保活时间到,需要发送保活报文
Login();
}
}
// 如果有消息需要发送则进入发送流程
if (fOutputStream.GetBytesWritten() > 0)
{
fState = kSendingResponse;
}
if(kIdle == fState) return 0;
break;
}
case kReadingRequest:
{
qtss_printf("kReadingRequest state \n");
// 读取锁,已经在处理一个报文包时,不进行新网络报文的读取和处理
OSMutexLocker readMutexLocker(&fReadMutex);
// 网络请求报文存储在fInputStream中
if ((theErr = fInputStream.ReadRequest()) == QTSS_NoErr)
{
//如果RequestStream返回QTSS_NoErr,就表示已经读取了目前所到达的网络数据
//但,还不能构成一个整体报文,还要继续等待读取...
fSocket->GetSocket()->SetTask(this);
fSocket->GetSocket()->RequestEvent(EV_RE);
return 0;
}
if ((theErr != QTSS_RequestArrived) && (theErr != E2BIG) && (theErr != QTSS_BadArgument))
{
//Any other error implies that the input connection has gone away.
// We should only kill the whole session if we aren't doing HTTP.
// (If we are doing HTTP, the POST connection can go away)
Assert(theErr > 0);
// If we've gotten here, this must be an HTTP session with
// a dead input connection. If that's the case, we should
// clean up immediately so as to not have an open socket
// needlessly lingering around, taking up space.
Assert(!fSocket->GetSocket()->IsConnected());
this->ResetClientSocket();
return 0;
}
fState = kProcessingRequest;
break;
}
case kProcessingRequest:
{
qtss_printf("kProcessingRequest state \n");
// 处理网络报文
Assert( fInputStream.GetRequestBuffer() );
Assert(fRequest == NULL);
// 根据具体请求报文构造HTTPRequest请求类
fRequest = NEW HTTPRequest(&sServiceStr, fInputStream.GetRequestBuffer());
//.........这里部分代码省略.........
示例15: if
QTSS_Error QTAccessFile::AuthorizeRequest(QTSS_StandardRTSP_Params* inParams, Bool16 allowNoAccessFiles, QTSS_ActionFlags noAction, QTSS_ActionFlags authorizeAction, Bool16 *outAuthorizedPtr, Bool16 *outAllowAnyUserPtr)
{
if ( (NULL == inParams) || (NULL == inParams->inRTSPRequest) || (NULL == outAllowAnyUserPtr) || (NULL == outAuthorizedPtr) )
return QTSS_RequestFailed;
*outAllowAnyUserPtr = false;
*outAuthorizedPtr = false;
QTSS_RTSPRequestObject theRTSPRequest = inParams->inRTSPRequest;
// get the type of request
// Don't touch write requests
QTSS_ActionFlags action = QTSSModuleUtils::GetRequestActions(theRTSPRequest);
if(action == qtssActionFlagsNoFlags)
return QTSS_RequestFailed;
if( (action & noAction) != 0)
return QTSS_NoErr; // we don't handle
//get the local file path
char* pathBuffStr = QTSSModuleUtils::GetLocalPath_Copy(theRTSPRequest);
OSCharArrayDeleter pathBuffDeleter(pathBuffStr);
if (NULL == pathBuffStr)
return QTSS_RequestFailed;
//get the root movie directory
char* movieRootDirStr = QTSSModuleUtils::GetMoviesRootDir_Copy(theRTSPRequest);
OSCharArrayDeleter movieRootDeleter(movieRootDirStr);
if (NULL == movieRootDirStr)
return QTSS_RequestFailed;
QTSS_UserProfileObject theUserProfile = QTSSModuleUtils::GetUserProfileObject(theRTSPRequest);
if (NULL == theUserProfile)
return QTSS_RequestFailed;
char* accessFilePath = QTAccessFile::GetAccessFile_Copy(movieRootDirStr, pathBuffStr);
OSCharArrayDeleter accessFilePathDeleter(accessFilePath);
char* username = QTSSModuleUtils::GetUserName_Copy(theUserProfile);
OSCharArrayDeleter usernameDeleter(username);
UInt32 numGroups = 0;
char** groupCharPtrArray = QTSSModuleUtils::GetGroupsArray_Copy(theUserProfile, &numGroups);
OSCharPointerArrayDeleter groupCharPtrArrayDeleter(groupCharPtrArray);
StrPtrLen accessFileBuf;
(void)QTSSModuleUtils::ReadEntireFile(accessFilePath, &accessFileBuf);
OSCharArrayDeleter accessFileBufDeleter(accessFileBuf.Ptr);
if (accessFileBuf.Len == 0 && !allowNoAccessFiles)
{ accessFileBuf.Set(sAccessValidUser);
if (DEBUG_QTACCESS)
qtss_printf("QTAccessFile::AuthorizeRequest SET Accessfile valid user for no accessfile %s\n", sAccessValidUser);
}
if (accessFileBuf.Len == 0 && allowNoAccessFiles)
{ accessFileBuf.Set(sAccessAnyUser);
if (DEBUG_QTACCESS)
qtss_printf("QTAccessFile::AuthorizeRequest SET Accessfile any user for no access file %s\n", sAccessAnyUser);
}
char realmName[kBuffLen] = { 0 };
StrPtrLen realmNameStr(realmName,kBuffLen -1);
//check if this user is allowed to see this movie
Bool16 allowRequest = this->AccessAllowed(username, groupCharPtrArray, numGroups, &accessFileBuf, authorizeAction,&realmNameStr, outAllowAnyUserPtr );
debug_printf("accessFile.AccessAllowed for user=%s returned %d\n", username, allowRequest);
// Get the auth scheme
QTSS_AuthScheme theAuthScheme = qtssAuthNone;
UInt32 len = sizeof(theAuthScheme);
QTSS_Error theErr = QTSS_GetValue(theRTSPRequest, qtssRTSPReqAuthScheme, 0, (void*)&theAuthScheme, &len);
Assert(len == sizeof(theAuthScheme));
if(theErr != QTSS_NoErr)
return theErr;
// If auth scheme is basic and the realm is present in the access file, use it
if((theAuthScheme == qtssAuthBasic) && (realmNameStr.Ptr[0] != '\0')) //set the realm if we have one
(void) QTSS_SetValue(theRTSPRequest,qtssRTSPReqURLRealm, 0, realmNameStr.Ptr, ::strlen(realmNameStr.Ptr));
else // if auth scheme is basic and no realm is present, or if the auth scheme is digest, use the realm from the users file
{
char* userRealm = NULL;
(void) QTSS_GetValueAsString(theUserProfile, qtssUserRealm, 0, &userRealm);
if(userRealm != NULL)
{
OSCharArrayDeleter userRealmDeleter(userRealm);
(void) QTSS_SetValue(theRTSPRequest,qtssRTSPReqURLRealm, 0, userRealm, ::strlen(userRealm));
}
}
*outAuthorizedPtr = allowRequest;
Bool16 founduser = this->HaveUser(username, NULL);
Bool16 authContinue = true;
char nameBuff[256];
StrPtrLen reqNameStr(nameBuff, kBuffLen);
StrPtrLen profileNameStr(username);
theErr = QTSS_GetValue (theRTSPRequest,qtssRTSPReqUserName,0, (void *) reqNameStr.Ptr, &reqNameStr.Len);
//.........这里部分代码省略.........