⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rephdr.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 2 页
字号:
/*
 * Copyright (C) Ericsson Mobile Communications AB, 2000.
 * Licensed to AU-System AB.
 * All rights reserved.
 *
 * This software is covered by the license agreement between
 * the end user and AU-System AB, and may be used and copied
 * only in accordance with the terms of the said agreement.
 *
 * Neither Ericsson Mobile Communications AB nor AU-System AB
 * assumes any responsibility or liability for any errors or inaccuracies in
 * this software, or any consequential, incidental or indirect damage arising
 * out of the use of the Generic WAP Client software.
 */

/*========================================================================

	WAP WTA Implementation Project

==========================================================================

	File: RepHdr.c

	Description:

	Author: Charlotte Ekl鰂, AU-System Radio AB

	Revision history:
  	Date    Rev  Sign  Comment
  	990722  PA1  CEF    First version
  	991202  PA2  CEF    Distributed for inspection
	991212	PA3	 CEF	Updated after inspection. 
	991212	PA4	 CEF	Updated with functions for garbage collection and 
						changes for the md5, etag and lastmod handling.

	991221	PA5	 JPR	Minor Corrections
	000103	PA6	 JPR	Minor Corrections
	000608	PA7	 CEF	Minor corrections done before new changes due to 
						WTA 1.2.1.
	000627	PA8	 CEF	Changes due to new attributes (useracceccability 
						and channelid) added in the channel DTD. 
	001011		ASPN	Lower-case filenames

=========================================================================*/

/* Private include statements */

#include "rephdr.h"
#include "chpars.h"
#include "repll.h"
#include "cmmnrsrc.h"
#include "waedef.h"
#include "wae_cmmn.h"
#include "hdrutil.h"
#include "url.h"
#include "wbxmldef.h"
#include "wbxmlelm.h"
#include "headdef.h"
#include "aapiwta.h"


typedef struct
{
	UINT32	iLLRepHId;
	UINT8	iStoredInRep;
	BYTE*	pbUrl;
	void*	pvResource;
	HEADERPARAMSTRUCT*	pHeaderParams;

} INSTALLRESSTRUCT, *pINSTALLRESSTRUCT;

typedef struct
{
	void* pvHeaderHandle;
	void* pvBodyData;
	UINT32 iBodyDataLength;

} CHANNELTYPE, *pCHANNELTYPE;

typedef struct
{
	UINT16	iWTAIFId;
	void*	pvChannelType;
	
} INSTALLREQSTRUCT, *pINSTALLREQSTRUCT;

typedef struct
{
	UINT32	iPId;

} INSTALLPID, *pINSTALLPID;

typedef struct
{
	UINT32	iLLRepHId;
	UINT32	iPId;
	INT8	iStoreflag;
	void*	pvRepContent;
	
} COMPACTLISTSTRUCT, *pCOMPACTLISTSTRUCT;

/*========================================================================
	INTERNAL FUNCTIONS
=========================================================================*/

/*========================================================================
	EXTERNAL FUNCTIONS
=========================================================================*/

/*========================================================================
	Functions called from several processes
=========================================================================*/

/*========================================================================
	Free_RepContent
==========================================================================
Purpose: Free the RepContent struct
Params:  pvRepContentStruct(IN)
Return:  void
=========================================================================*/
void Free_RepContent(void* pvRepContentStruct)
{
	pREPCONTENTSTRUCT pRepContentStruct;

	#ifdef WAE_DEBUG
	URL_DEBUG_PRINT("End Free_RepContent");
	#endif

	if (pvRepContentStruct != NULL){

		pRepContentStruct = ((REPCONTENTSTRUCT*)pvRepContentStruct);
		if (pRepContentStruct != NULL){	

			if ( ((pRepContentStruct)->Type) == CONTENTTYPE_CHANNEL ){

				DEALLOC(&((pRepContentStruct)->content.pChContentStruct->
					pwchTitle));
				DEALLOC(&((pRepContentStruct)->content.pChContentStruct->
					pwchAbstract));
				DEALLOC(&((pRepContentStruct)->content.pChContentStruct->
					pwchEventId));
				DEALLOC(&((pRepContentStruct)->content.pChContentStruct->
					pwchchannelid));
				DEALLOC(&((pRepContentStruct)->content.pChContentStruct->
					piAllResInChList)); 
				DEALLOC(&((pRepContentStruct)->content.pChContentStruct));

			}
			else{

				DEALLOC(&((pRepContentStruct)->content.pResContentStruct->
					pbUrl)); 
				DEALLOC(&((pRepContentStruct)->content.pResContentStruct->
					pbBodyData));
				DeleteHEADERDEF((pRepContentStruct)->content.pResContentStruct->
					pHeaderHandle);
				DEALLOC(&((pRepContentStruct)->content.pResContentStruct));

			}

			DEALLOC(&pvRepContentStruct);

		}
	}
} /* end of Free_RepContent */

/*========================================================================
	Functions called from the process RepH_ME
=========================================================================*/

/*========================================================================
	ME_Free_RepContentStructResource
==========================================================================
Purpose: Remove the Resource RepContentStruct. If the parameter boolStatus 
		 is set to FALSE the pHeaderHandle and pbBodyData will not be 
		 deleted. Used when a resource is fetched from the Repository 
		 memory. The pHeaderHandle and pbBodyData will be sent 
		 in the SDL struct type ResponseStruct.
Params:  pvRepContentStruct(IN) and boolStatus(IN).
Return:  void
=========================================================================*/
void Free_RepContentStructResource(void* pvRepContentStruct, BOOL 
									  boolStatus)
{
	pREPCONTENTSTRUCT pRepContentStruct;

	#ifdef WAE_DEBUG
	URL_DEBUG_PRINT("End ME_Free_RepContentStructResource");
	#endif

	if (pvRepContentStruct != NULL)
	{
		pRepContentStruct = ((REPCONTENTSTRUCT*)pvRepContentStruct);
		if (pRepContentStruct != NULL)
		{	

			if (boolStatus) {

				DEALLOC(&((pRepContentStruct->content.pResContentStruct)->
					pbBodyData));
				DeleteHEADERDEF((pRepContentStruct)->content.pResContentStruct->
					pHeaderHandle);
				DEALLOC(&((pRepContentStruct->content.pResContentStruct)->
					pbUrl));
			}
			DEALLOC(&((pRepContentStruct)->content.pResContentStruct));
			DEALLOC(&pvRepContentStruct);
		}
	}
} /* end of ME_Free_RepContentStructResource */

/*========================================================================
	ME_CompareString
==========================================================================
Purpose: Compares two strings.
Params:	 pwch1(IN) and pwch2(IN).
Return:	 TRUE if the two string are equal, FAlSE otherwise.
=========================================================================*/
BOOL ME_CompareString(WCHAR* pwch1, WCHAR* pwch2)
{
	UINT16 istrlength;

	if ( (pwch1 != NULL) && (pwch2 != NULL) ) {

		istrlength = STRINGLENGTH(pwch1);

		if (istrlength == (STRINGLENGTH(pwch2)))

			if ( COMPARESTRINGN(pwch1, pwch2, istrlength) == 0 )
				return TRUE;
	}
	return FALSE;
} /* end of ME_CompareString */

/*========================================================================
	RepCh_List functions, each element stores information ( EventId, 
	LLRepHId and the LLRepHId to the first resource )about a channel 
	stored in the repository. The list is used at either a 'Control of 
	global binding' request or at a request from WSPIF.
=========================================================================*/

/*========================================================================
	ME_RepCh_List_Add
==========================================================================
Purpose: Create a new element (REPCHSTRUCT*) and add it to the Repository 
		 Channels List.
Params:  pvRepChList(IN), pvEventId(IN), iLLRepHId(IN), 
		 iLLRepHIdToFirstRes(IN) and iStatus(IN).
Return:  TRUE if ok, otherwise FALSE.
=========================================================================*/
BOOL ME_RepCh_List_Add( void* pvRepChList, void* pvEventId, 
						void* pvchannelid, UINT32 iLLRepHId, 
						UINT32 iLLRepHIdToFirstRes)
{
	REPCHSTRUCT* pRepChStruct = NULL;

#ifdef WAE_DEBUG
	URL_DEBUG_PRINT("Start RepCh_List_Add");
#endif

	if( pvRepChList != NULL ){

		pRepChStruct = NEWSTRUCT(REPCHSTRUCT);

		if( pRepChStruct != NULL ){

			pRepChStruct->pchEventId = (WCHAR*)pvEventId;
			pRepChStruct->pchchannelid = (WCHAR*)pvchannelid;
			pRepChStruct->iLLRepHId = iLLRepHId;
			pRepChStruct->iLLRepHIdToFirstRes = iLLRepHIdToFirstRes;

			return SDL_AddElementLast( pvRepChList, 0, (void*)pRepChStruct );
		}
	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -