// ----------------------------------------------------------------------------
// CSIPProfileSIMRecord::FindSIPSchema
// ----------------------------------------------------------------------------
//
TPtrC8 CSIPProfileSIMRecord::RemoveSIPSchemaL( const TDesC8& aValue )
    {
    __ASSERT_ALWAYS (aValue.Length() > 0, User::Leave(KErrArgument));

	_LIT8(KSIPAndColon, "sip:");
	_LIT8(KSIPSAndColon, "sips:");

	TPtrC8 schemeAndColon;
	TInt sipSchemePos = aValue.FindF(KSIPAndColon);
	if (sipSchemePos < 0)
		{
		TInt sipsSchemePos = aValue.FindF(KSIPSAndColon);
		if (sipsSchemePos != 0) 
            {
            User::Leave (KErrArgument);
            }
		schemeAndColon.Set(KSIPSAndColon);
		}
	else
		{
		if (sipSchemePos != 0) 
            {
            User::Leave (KErrArgument);
            }
		schemeAndColon.Set(KSIPAndColon);
		}
	TPtrC8 remainder(aValue.Mid(schemeAndColon.Length()));
	return remainder;
    }    
Example #2
0
TBool CApaDRMRecognizer::RecognizeRoapTrigger( const TDesC8& aBuffer )
{
        if ( aBuffer.FindF( KRoapTriggerElement() ) != KErrNotFound
             || aBuffer.FindF( KRoapTriggerElement2() ) != KErrNotFound )
        {
            iConfidence = ECertain;
            iDataType=TDataType( KRoapTriggerType() );
            return ETrue;
        }
    return EFalse;
}
void TaggedDataParser::ConvertTextToUidL(const TDesC8& aData, TUid& aUid)
	{
	// Make sure aData is in the correct format - "0x12345678"
	_LIT8(K0x, "0x");
	_LIT8(K0X, "0X");
	if ((aData.Length() == 10) && ((aData.FindF(K0x) == 0) || (aData.FindF(K0X) == 0)))
		{
		// only take the right 8 characters (ie discard the "0x")
		TLex8 lex(aData.Right(8));
		TUint32 value = 0;
		User::LeaveIfError(lex.Val(value, EHex));
		aUid.iUid = value;
		}
	else
		User::Leave(KErrCorrupt);
	}
void TaggedDataParser::ConvertTextToTUintL(const TDesC8& aData, TUint& aUint)
	{
	// Determine whether hex or decimal then parse as such
	_LIT8(K0x, "0x");
	_LIT8(K0X, "0X");
	if (((aData.FindF(K0x) == 0) || (aData.FindF(K0X) == 0)) && (aData.Length() >= 3))
		{
		// only take the characters after "0x"
		TLex8 lex(aData.Right(aData.Length()-2));
		TUint32 value = 0;
		User::LeaveIfError(lex.Val(value, EHex));
		aUint = value;
		}
	else if (aData.Length() > 0)
		{
		TLex8 lex(aData.Right(aData.Length()));
		TUint32 value = 0;
		User::LeaveIfError(lex.Val(value, EDecimal));
		aUint = value;
		}
	else
		User::Leave(KErrCorrupt);
	}
Example #5
0
/*
Attempts to recognize the data type, given the filename and data buffer.
*/
void CExampleNewRecognizer::DoRecognizeL(const TDesC& aName, const TDesC8& aBuffer)
	{
	_LIT8(KExampleData, "example");
	_LIT(KDotExample, ".Example");

	TParse parse;
	parse.Set(aName,NULL,NULL);
	TPtrC ext=parse.Ext(); // extract the extension from the filename

	if (ext.CompareF(KDotExample)==0 && aBuffer.FindF(KExampleData)!=KErrNotFound)
		{
		iConfidence=ECertain;
		iDataType=TDataType(KExampleTextMimeType);
		}
    }
Example #6
0
/**
 *  @brief SOCKET连接建立后,发送POST请求
 *
 * SOCKET连接建立后,发送POST请求
 *
 *  @param iSockId        socket请求的id值
 *  @param sContentType   发送请求的类型
 *  @param sBuf   发送POST请求附带的请求信息
 *  @return void 
 */
void CSocketEngine::SendDataPost(TInt iSockId,const TDesC8& aContentType,const TDesC8& sBuf){
  
  iSockId=0;
  iStatus=1;
  iData1.Zero();
  
  //开始打包HTTP请求头信息

  iData1.Copy(_L8("POST "));
  iData1.Append(iAddress);
  iData1.Append(_L8(" HTTP/1.1"));
  
  if(iIsRangeDown) iData1.AppendFormat(_L8("\r\nRange: bytes=%d-%d"),iRangeBegin,iRangeEnd);
  iData1.Append(_L8("\r\n"));
  
  //如果是走网关,则通过移动网关10.0.0.172连接网络
  if(IsPassWGW){
    iData1.Append(_L8("Host:10.0.0.172:80\r\n"));
    iData1.Append(_L8("X-Online-Host:"));
    iData1.Append(iHostName);
    iData1.Append(_L8("\r\n"));
    
  }else{
    iData1.Append(_L8("Host: "));
    iData1.Append(iHostName);
    iData1.Append(_L8("\r\n"));
  }

  if(aContentType.FindF(_L8("post900"))>=0){
    iData1.Append(_L8("Accept: */*, application/vnd.wap.mms-message, application/vnd.wap.sic"));
    iData1.Append(_L8("Accept-Charset: iso-8859-1, utf-8; q=0.7, *; q=0.7"));
  }else{
    iData1.Append(_L8("Accept: text/html, application/vnd.wap.xhtml+xml, application/xhtml+xml, text/css, multipart/mixed, text/vnd.wap.wml, application/vnd.wap.wmlc, application/vnd.wap.wmlscriptc, application/java-archive, application/java, application/x-java-archive, text/vnd.sun.j2me.app-descriptor, application/vnd.oma.drm.message, application/vnd.oma.drm.content, application/vnd.wap.mms-message, application/vnd.wap.sic, text/x-co-desc, application/vnd.oma.dd+xml, text/javascript, */*, text/x-vcard, text/x-vcalendar, image/gif, image/vnd.wap.wbmp\r\n"));
    iData1.Append(_L8("Accept-Charset: iso-8859-1, utf-8, iso-10646-ucs-2; q=0.6\r\n"));
  }

  //不需要设定encoding,090417 yang
  //iData1.Append(_L8("Accept-Encoding: gzip,deflate,identity;q=0.9\r\n"));
  iData1.Append(_L8("Accept-Language: zh-cn, zh\r\n"));
  
  if(iUserAgent.Length()){
    iData1.Append(_L8("User-Agent: "));
    iData1.Append(iUserAgent);
    iData1.Append(_L8("\r\n"));
  }

  if(iCookie&&iCookie->Length()){
    //iData1.Append(_L8("Cookie: "));
    iData1.Append(*iCookie);
    //iData1.Append(_L8("\r\n"));
  }

  if(iReferer&&iReferer->Length()){
    iData1.Append(_L8("Referer: "));
    iData1.Append(*iReferer);
    iData1.Append(_L8("\r\n"));
  }

  iData1.Append(_L8("Content-Length: "));
  TInt len=sBuf.Size();
  iData1.AppendNum(len);
  iData1.Append(_L8("\r\n"));
  
  if(aContentType.FindF(_L8("post900"))>=0){
    iData1.Append(_L8("Content-Type: text/plain"));
    iData1.Append(_L8("x-wap-profile: http://nds1.nds.nokia.com/uaprof/N3250r100.xml"));
  }else{
    iData1.Append(_L8("Content-Type: application/x-www-form-urlencoded\r\n"));
  }

  iData1.Append(_L8("Connection: close\r\n"));
  iData1.Append(_L8("\r\n"));
  Log(_L8("Http(post) header:"));
  Log(iData1);
  HBufC8* buf=HBufC8::NewL(iData1.Length()+sBuf.Length()+128);
  buf->Des().Copy(iData1);
  buf->Des().Append(sBuf);
  iSocket.Write(*buf,iStatus);
  delete buf;
  SetStatus(EWritting);
  SetActive();
}