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

📄 header.h

📁 是一个手机功能的模拟程序
💻 H
📖 第 1 页 / 共 3 页
字号:
/*
 * 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.
 */
#ifndef _Header_H
#define _Header_H
/*========================================================================

	WAP Implementation Project

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

	File: Header.H

	Description:

	Author: Ingmar Persson, AU-System Radio AB

	Revision history:
  	Date    Rev  Sign  Comment
  	980917  PA1  IPN    First version
	990624       IPN    Latest version

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

/* Private include statements */

#include "wipprdct.h"
#include "cmmnrsrc.h"
#include "headdef.h"
#include "wipdb.h"

#if defined XSCT_CMICRO
    #include "ml_typw.h"
#else
    #include "scttypes.h"
#endif

#include "glbldecl.h"

#ifdef CONFIG_PUSH
/*************************/
/* Push Multipart values */
/*************************/
	#define No_Multipart 0
	#define Multipart_Mixed 1
	#define Multipart_Related 2
	#define Multipart_Alternative 3
/*************************/
/* Connectivity value (used at the same place as the Multipart values) */
/*************************/
	#define Connectivity 4
#endif

/***********************/
/* Debug stuff         */
/***********************/

#ifdef WAE_DEBUG
    #if defined XSCT_CMICRO || defined NOT_USING_SDL
      #define URL_DEBUG_PRINT(a)         printf(a)
    #else
      #define URL_DEBUG_PRINT(a)         xTraceAlg(a)
    #endif
#endif


/* --- Internall CacheDirectives --- */
#define CACHE_CONTENT			0
#define UPDATE_CACHE_CONTENT	1
#define NOT_CACHE_CONTENT		2
/* --- Internall CacheDirectives --- */

#define ENCODING_VERSION_1_2	0x12
#define ENCODING_VERSION_1_3	0x13
#define ENCODING_VERSION_1_4	0x14

#define TR_LIST_WAIT_FOR_CHANNEL	1
#define TR_LIST_WAIT_FOR_E2E		2


#define SKT_CLIENT_HELLO	1
#define SKT_SERVER_HELLO	2
#define SKT_KEY_EXCHANGE	3
#define SKT_FINISHED		4

#define SKT_PORT_NR				"9091"
#define SKT_CONTENTTYPE_WML		"application/vnd.wap.skt_e2e_wml"
#define SKT_CONTENTTYPE_WMLS	"application/vnd.wap.skt_e2e_wmls"

typedef struct
{
	BYTE*	pbAccept;
	BYTE*	pbProxyCredentials;
	int		iProxyCredentialsLength;
	BYTE*	pbLanguage;
	UINT8	iLanguage_Length;
} UASETTINGS, *pUASETTINGS;

typedef struct
{
	int		iStackMode;
	int		iActiveBearer;
	int		iClientPort;
	BYTE*	pbUDP_CLIENT_IP;
	UINT8	pbUDP_CLIENT_IP_LEN;
	BYTE*	pbUDP_GW_IP;
	UINT8	pbUDP_GW_IP_LEN;
	BYTE*	pbSMS_CENTER;
	UINT8	pbSMS_CENTER_LEN;
	BYTE*	pbSMS_GW;
	UINT8	pbSMS_GW_LEN;
	BYTE*	pbUSSD_CENTER;
	UINT8	pbUSSD_CENTER_LEN;
	int		iUSSD_SC_TYPE;
	BYTE*	pbUSSD_SC;
	UINT8	pbUSSD_SC_LEN;
    UINT16	iTimeOut;
} NETWORKSTRUCT, *pNETWORKSTRUCT;

NETWORKSTRUCT* New_NETWORKSTRUCT(void);
void Delete_NETWORKSTRUCT(NETWORKSTRUCT** ppTheObject);

UASETTINGS* New_UASETTINGS(void);
void Delete_UASETTINGS(UASETTINGS** ppTheObject);


/*========================================================================
	FUNCTION PROTOTYPES
=========================================================================*/

/*========================================================================
	urlIsValid
==========================================================================
Purpose: Check if a URL is valid and has at least a scheme, host, and 
		 path component.
Params:  pvReqStruct	pURLREQSTRUCT	casted to a VOID*
Return:  TRUE if valid, otherwise FALSE
=========================================================================*/
int urlIsValid( VOID* pvReqStruct );

/*========================================================================
	FreeReqStruct 
==========================================================================
Purpose: Release a URLREQSTRUCT and all of it's parts
Params:  pvReqStruct	pURLREQSTRUCT*	casted to a VOID**
Return:	 1
=========================================================================*/
int FreeReqStruct( VOID** pvReqStruct );

/*========================================================================
	FreeNetStruct 
==========================================================================
Purpose: Release a NETWORKSTRUCT and all of it's parts
Params:  vsNetStruct	pNETWORKSTRUCT*	casted to a VOID**
Return:	 1
=========================================================================*/
int FreeNetStruct(VOID** vsNetStruct);

/*========================================================================
	FreeUaSettingsStruct 
==========================================================================
Purpose: Release a UASETTINGSSTRUCT and all of it's parts
Params:  vsStruct	pUASETTINGS*	casted to a VOID**
Return:	 TRUE
=========================================================================*/
int FreeUaSettingsStruct(VOID** vsStruct);

/*========================================================================
	GetMethod
==========================================================================
Purpose: Get the Method part from the URLREQSTRUCT
Params:  pvReqStruct	URLREQSTRUCT*	casted to VOID*
Return:  Method
=========================================================================*/
int GetMethod( VOID* pvReqStruct );

/*========================================================================
	GetUrl 
==========================================================================
Purpose: Get the Url part from the URLREQSTRUCT
Params:  pvReqStruct	URLREQSTRUCT*	casted to VOID*
		 pvUrl			BYTE**			casted to VOID**
Return:  length of pvUrl
=========================================================================*/
int GetUrl( VOID* pvReqStruct, VOID** pvUrl );

/*========================================================================
	GetHeader 
==========================================================================
Purpose: Create a WSP-Header, pvHeader, from the input parameters.
Params:  pvReqStruct				URLREQSTRUCT*	casted to VOID*
		 pvUaSettings				UASETTINGS*		casted to VOID*
		 pNetStruct					NETWORKSTRUCT*	casted to VOID*
		 pvWAEMaStruct				WAEMAINOBJECT*	casted to VOID*
		 iConnectionMode			int (0=CL, 1=CM)
		 iProfileEnabled			int (1=UAProf is enabled)
		 vsProxyCredentials			BYTE*			casted to VOID*
		 iProxyCredentialsLength	int
		 pvHeader					BYTE**			casted to VOID**
Return:  length of pvHeader
=========================================================================*/
int GetHeader( VOID* pvReqStruct, VOID* pvUaSettings, VOID* pNetStruct, VOID* pvWAEMaStruct,
			  int iConnectionMode, int iProfileEnabled, int iEncodingVersion, VOID* vsProxyCredentials,
			  int iProxyCredentialsLength, VOID** pvHeader );

/*========================================================================
	GetBody 
==========================================================================
Purpose: Get the Body from the URLREQSTRUCT
Params:  pvReqStruct	URLREQSTRUCT*	casted to VOID*
		 pvBody			BYTE**			casted to VOID**
Return:  length of pvBody
=========================================================================*/
int GetBody( VOID* pvReqStruct, VOID** pvBody);

/*========================================================================
	CreateWSPHeader
==========================================================================
Purpose: Add if required Post and Reload headers to an existing WSP-header. 
Params:  pvHeader			BYTE*			casted to VOID*
		 iHeadLen			int				length of pvHeader
		 iReload			int				1=Reload
		 ucMethod			unsigned char	Get or Post
		 pvReqStruct		URLREQSTRUCT*	casted to VOID*
		 pliHeaderLength	long int*		length of the hole WSP-header
Return:  pointer to the WSP-header
=========================================================================*/
void* CreateWSPHeader( VOID* pvHeader, int iHeadLen,
		int iReload, unsigned char ucMethod, int iEncodingVersion,
		VOID* pvReqStruct, long int* pliHeaderLength );

/*========================================================================
	ExamineCacheInfo 
==========================================================================
Purpose: Examine the content. If it is Multipart this function is invoked 
		 recursive, stored every multipart part in the cache, returns the 
		 first content part to the UserAgent.
Params:  pHeaderHandle			pHEADERDEF*
		 iUaType				int
		 iCacheInIdle			int
		 iCacheDirektive		int
		 pvReqStruct			URLREQSTRUCT*		casted to void*
		 pvHeader				BYTE**				casted to void**
		 pliHeadLen				long int*
		 pvBody					BYTE**				casted to void**
		 pliBodyLen				long int*
		 iFirstWrite			int*
		 iMultipart				int
Return:  1, if the content is a Multipart and there are some errors in the 
		 Multpart, 0 is returned.
=========================================================================*/
int ExamineCacheInfo( pHEADERDEF *pHeaderHandle, int iUaType, int iCacheInIdle,
                      int iCacheDirektive, void* pvReqStruct, void** pvHeader,
                      long int* pliHeadLen, void** pvBody, long int* pliBodyLen,
                      int* iFirstWrite, int iMultipart );

/*========================================================================
	GetURLfromLocation 
==========================================================================
Purpose: Get the Location value from the pvHeader and store the Location in pvUrl
Params:  pvHeader		BYTE*		casted to void*
		 iHeaderLength	int
		 pvUrl			BYTE**		casted to VOID**
		 liUrlLength	long int*
Return:  1 if success, otherwise 0
=========================================================================*/
int GetURLfromLocation( void* pvHeader, int iHeaderLength, VOID** pvUrl, long int* liUrlLength );

/*========================================================================
	GetHeaderHandle
==========================================================================
Purpose: Create a HeaderHandle from a Bytestream
Params:  ppHeaderHandle	pHEADERDEF*	casted to void**

⌨️ 快捷键说明

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