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

📄 hdrutil.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.
 */
/* ==================================================================
	FILE: hdrutil.h
  
	Utilities for Header Encoding/Decoding for WAP.
	Header file.

	Rev history:
		980923	JPR		Created
		990406	JPR		Corrections
		990408	JPR		Function create header Accept-language added
		990409	JPR		URL-functions removed
		990412	JPR		Uses Url.h instead of Url_Lib.h
						Macros used for character classification.	
		990416	JPR		Authentication functions updated (TR 64)
		990510	JPR		WSP_GetContentTypeByte updated
		990526	JPR		Corrections
		990815	JPR		Additions to support channel decoding
  	990825	JPR		Changes in CreateHeaderField
		990826	JPR		WSP_GetContentTypeString added
		991112	JPR		ADDRESS functions added
		000110	IPN		Moved Authentication functions to authoriz.h
		000111	JPR		Multipart functions updated
		000114	JPR		WSP Parameter handling changed.
		000117	JPR		Multipart functions added
		000121	JPR		WSP_GetEtag added, WSP_CreateHeaderField
						function updated
		000126	JPR		Comments added to WSP_CreateHeaderField
						Function WSP_GetProfileWarning added
						WSP_DeleteMultipartListWithContent added
		000211	JPR		WSP_CreateHeaderField updated to support 
						Accept Application and Bearer Indication.
						Function WSP_GetEtagWCHAR removed.
		000301	JPR		Function WAE_AddGenericFormDataPart implemented
		001106	JPR		Function WSP_GetPushHeaderAppId implemented
		001114  HEAD    Function WSP_BuildMultipart has a new parameter
						iTotalSize.
		010319	RMZ		Added function WSP_GetSetCookie.
		010403	IPN		Added function WSP_GetEncodingVersion.
        010502  ASPN    WTA_WML constants added.

 ================================================================== */
   
#ifndef CWAPHDRUTIL_H
#define CWAPHDRUTIL_H

#include "headdef.h"
#include "cmmnrsrc.h"
#include "wmldef.h"
#include "url.h"
#include "waectype.h"

/* ---------------------------------------------
	Descr : Creates a HEADERDEF element with
			the specified attributes.
	Input : Pointer to BYTE, Length of stream.
	Output:	Pointer to an Element, NULL if error
   --------------------------------------------- */
pHEADERDEF CreateHEADERDEF (BYTE *pbInstream, UINT32 iLength);

/* ---------------------------------------------
	Descr : Deletes a HEADERDEF element 
	Input : Pointer to HEADERDEF
	Output:	-
   --------------------------------------------- */
void DeleteHEADERDEF (pHEADERDEF pDef);
					
/* ---------------------------------------------
	Descr : Copies a byte stream with the 
			specified length. If the iLen is 
			negative the stream is terminated 
			with 0 and the length is determined 
			in the function.
	Input : String and length
	Output:	Copy of string, NULL if error
   --------------------------------------------- */
BYTE *B_CopyByteString (BYTE *pbString, INT32 iLen);


	
/* ========= HEADER ELEMENT FUNCTIONS ==========
	Functions for handling the header elements.
   ============================================= */
/* ---------------------------------------------
	Descr : Creates an element with the 
			specified values.
	Input : Header Field Name, pointer to BYTE
	Output:	Pointer to an Element, NULL if error
   --------------------------------------------- */
pHEADERELEMENT CreateHeaderElement (BYTE bCodePage, BYTE bFieldName, 
									BYTE *pbFieldName, BYTE *pbStart, BYTE *pbEnd);

/* ---------------------------------------------
	Descr : Add the element to the list.
	Input : Pointer to an Element, pDef
	Output:	TRUE if OK, FALSE otherwise
   --------------------------------------------- */
void AddHeaderElement (pHEADERDEF pDef, pHEADERELEMENT pHeadElm);

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


/* WTA-WML constants.
   These constants must be updated if there is changes in the 'ContentTypes.txt' file.
*/
#define TEXT_X_WAP_WTA_WML          0x37
#define APPLICATION_X_WAP_WTA_WMLC  0x38


/* =========== PARSER HELP FUNCTIONS =========== 
	  Help functions used during the parsing.
   ============================================= */
BOOL HdrNextByte (BYTE **pbStart, BYTE *pbEnd);

/* ---------------------------------------------
	Descr : Calculates the length of the field-
			value and steps in the stream.
	Input :	Pointer to HEADERDEF
	Output:	TRUE if OK, FALSE if error			
   --------------------------------------------- */
BOOL StepFieldLength (BYTE **ppbStart, BYTE *pbEnd);
/* ============================================= */



/* ============= PARSER FUNCTIONS ============== 
	   Functions used during the header parse.
   ============================================= */

/*	The following macros/functions with a signature 
	looking like 

		isFooCh (c) / BOOL isFooCh(BYTE bChar)

	determines if the character is of the specified
	type. If so, TRUE is returned, otherwise FALSE
	is returned. The macros/functions does NOT modify 
	anything.									
*/

/* MACRO DEFINITIONS */
#define isWapCtlCh(c)			((c<=31)||(c==127))
#define isWapEndOfStringCh(c)	(c==0)
#define isWapQuoteCh(c)			(c==34)
#define isWapCRCh(c)			(c==13)
#define isWapLFCh(c)			(c==10)
#define isWapHTCh(c)			(c==9)
#define isWapSPCh(c)			(c==32)
#define isWapShortLengthCh(c)	(c<=30)
#define isWapLengthQuoteCh(c)	(c==31)
#define isWapCharCh(c)			(c<=127)
#define isWapShortIntegerCh(c)	(c & 128)
#define isWapBasicCh(c)			(c==128)

BOOL isWapTokenCh(BYTE bChar);

/*	General remark for all functions with a 
	signature looking like 
	
	  BOOL isFoo(BYTE **pbStart, BYTE *pbEnd)

	If the method returns TRUE the pbStart in is 
	updated to point at the position directly after 
	where the item Foo that was found in the input 
	string. If the method returns FALSE, then pbStart
	in has the same value at exit as it had on entry.
	pbEnd points to the first byte AFTER the valid
	bytestream.	Similar action takes place for the
	functions looking like 							

	  BOOL isFoo(pHEADERDEF pDef)

	but the fields in pDef is used instead.		  */

/* CR LF */
BOOL isWapCRLF(BYTE **ppbStart, BYTE *pbEnd);

/* [CRLF] 1*( SP | HT ) */
BOOL isWapLWS(BYTE **ppbStart, BYTE *pbEnd);

/* <any OCTET except CTLs but including LWS> */
BOOL isWapTEXT(BYTE **ppbStart, BYTE *pbEnd);

/* 1*<any CHAR except CTLs or tspecials> */
BOOL isWapToken (BYTE **ppbStart, BYTE *pbEnd);

/* <OCTET 127> */
BOOL isWapShiftDel (BYTE **ppbStart, BYTE *pbEnd);

/* <Any OCTET 1-31> */
BOOL isWapShortCutShiftDel (BYTE **ppbStart, BYTE *pbEnd);


/* ---------------- BASIC RULES ---------------- */

/* [Quote] *TEXT End-of-string */
BOOL isWapTextString(BYTE **ppbStart, BYTE *pbEnd);     

/* Token End-of-string */
BOOL isWapTokenText(BYTE **ppbStart, BYTE *pbEnd);

/* *TEXT End-of-string */
BOOL isWapExtensionMedia(BYTE **ppbStart, BYTE *pbEnd);     

/* <Octet 34> *TEXT End-of-string */
BOOL isWapQuotedString(BYTE **ppbStart, BYTE *pbEnd);     

/* OCTET (1xxx xxxx) */
BOOL isWapShortInteger (BYTE **ppbStart, BYTE *pbEnd);

/* <ANY OCTET 0-30> 1*30 OCTET */
BOOL isWapLongInteger (BYTE **ppbStart, BYTE *pbEnd);

/* <Octet 127> */
BOOL isWapQuote(BYTE **ppbStart, BYTE *pbEnd);

/* --------------------------------------------- */



/* --------------- LENGTH RULES ---------------- */

/* Short-length | (Length-quote Length) */
BOOL isWapValueLength (BYTE **ppbStart, BYTE *pbEnd);

/* <Any Octet 0-30> */
BOOL isWapShortLength(BYTE **ppbStart, BYTE *pbEnd);

/* <Octet 31> */
BOOL isWapLengthQuote(BYTE **ppbStart, BYTE *pbEnd);

/* --------------------------------------------- */



/* ----------- PARAMETER VALUE RULES ----------- */

/* <Octet 0> */
BOOL isWapNoValue(BYTE **ppbStart, BYTE *pbEnd);

/* No-Value | Token-text | Quoted-string */
BOOL isWapTextValue(BYTE **ppbStart, BYTE *pbEnd);

/* Short-integer | Long-integer */
BOOL isWapIntegerValue (BYTE **ppbStart, BYTE *pbEnd);

/* 1*2 Tokens ---- NOT IMPLEMENTED ---- */
BOOL isWapQValue(BYTE **ppbStart, BYTE *pbEnd);

/* Short-integer | Text-string */
BOOL isWapVersionValue(BYTE **ppbStart, BYTE *pbEnd);

/* --------------------------------------------- */



/* -------------- PARAMETER RULES -------------- */

/* Compact-value | Text-value */
BOOL isWapTypedValue(BYTE **ppbStart, BYTE *pbEnd);

/* Integer-value | Date-value | Q-value | Version-value | Uri-value */
BOOL isWapCompactValue(BYTE **ppbStart, BYTE *pbEnd);

/* Integer-value | Text-value */
BOOL isWapUnTypedValue(BYTE **ppbStart, BYTE *pbEnd);

/* --------------------------------------------- */



/* ------------ AUTHORIZATION RULES ------------ */

/* Token-text */
BOOL isWapAuthenticationScheme (BYTE **ppbStart, BYTE *pbEnd);

/* <OCTET 128> */
BOOL isWapBasic (BYTE **ppbStart, BYTE *pbEnd);

/* --------------------------------------------- */



/* ====================== HEADER PARSE FUNCTIONS =========================
					Functions used to parse the headers.
   ======================================================================= */

/*========================================================================
	WSP_PreParseHeaders 

⌨️ 快捷键说明

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