MTK HTTP 프로 토 콜 의 데이터 구조 및 매 거 진 정의

기록 을 작성 하 는 것 도 하나의 저장 이 라 고 할 수 있 으 니, 필요 한 친구 가 있 으 면 참고 할 수 있다.
nw_define.h
데이터 구조 와 매 거 진 을 저장 하 는 데 사용 합 니 다.
 
#ifndef __NW_DEFINE_H__
#define __NW_DEFINE_H__

/* standard c start */
typedef	char	nw_int8;
typedef signed char nw_S8;
typedef	unsigned char	nw_uint8;
typedef int	nw_int32;
typedef unsigned int	nw_uint32;
typedef short	nw_int16;
typedef unsigned short	nw_uint16;

#ifdef WIN32
typedef unsigned __int64	nw_uint64;
typedef __int64	nw_int64;
#else
typedef unsigned long long	nw_uint64;
typedef long long	nw_int64;
#endif
/* standard c end */

#define NW_ATTR_HIDDEN           0x02
#define NW_READ_WRITE            0x00000000L
#define NW_READ_ONLY             0x00000100L
#define NW_OPEN_DIR              0x00000800L
#define NW_CREATE                0x00010000L
#define NW_CREATE_ALWAYS         0x00020000L 

typedef struct _NW_HTTP_DATA	NW_HTTP_DATA;
typedef struct _NW_HTTP_REQ_INFO   NW_HTTP_REQ_INFO;

#define SOCKET_SUPPORT_ID_MAX	(4)

//      
typedef void (*NW_HTTP_EVENT_CALLABCK)(NW_HTTP_DATA *http_data, nw_uint32 event_type, nw_uint32 i_param, nw_uint32 w_param); // i_param 、w_param            

//request       
typedef struct _NW_HTTP_REQ_INFO
{
	nw_int8 *url;              	   //    
	nw_int8 *ref_url; 				     //referer  
	nw_int8 *ua;              	   //User-Agent  
	nw_int8 *head_param;      	   //       
	nw_int8 *get_data;         	   //Get       
	nw_uint8 *post_data;      	 	 //Post       
	nw_uint32 post_data_length;  	 //Post      
	nw_uint32 req_type;         	 //     Get\Post\Head
};


//response       
typedef struct _NW_HTTP_RESP_INFO
{
	nw_uint32 status;		       //      
	nw_uint32 content_length;	 //body  
	nw_uint32 content_offset;	 //body      offset
	nw_uint32 content_type;    //    
	nw_uint32 is_chunked;      //       chunk  
	nw_int8 *location;         //location
	nw_uint32 charset;         //    
}NW_HTTP_RESP_INFO;


typedef struct _NW_HTTP_DATA
{
/* request     start */
	NW_HTTP_REQ_INFO nw_req_info;     		 //      
	nw_int8 *nw_req_head_buf; 		    		 //       
	nw_uint32 nw_req_head_length; 		     //       
	nw_uint32 nw_req_head_offset;		     	 //     offset

	nw_uint8 *nw_send_buf; 			    			 //       
	nw_uint32 nw_send_buf_size; 		    	 //       
	nw_uint32 nw_send_data_length;		     //      

	nw_uint32 nw_net_type; //    
	nw_uint32 nw_timeout_id;             	 //http      
/* request     end */

/* response     start */
	NW_HTTP_RESP_INFO nw_resp_info;    		 //         
	nw_int8 *nw_resp_head_buf; 		    		 //        
	nw_uint32 nw_resp_head_length; 	     	 //response      
	nw_uint32 nw_resp_head_offset;		     //response     offset

	nw_uint32 nw_can_recv;			    		   //      
	nw_uint8 *nw_recv_buf;			     			 //       
	nw_uint32 nw_recv_buf_size;		    		 //         
	nw_uint32 nw_recv_data_length;		     //      

	//      (  buffer       ,           )
	nw_uint32 nw_peek_data_length;         //      
	nw_uint32 nw_peek_state;               //        
/* response     end */

	//HTTP_APP_MANAGER http_app;                  //http    
	nw_int32 nw_soc_id;
	NW_HTTP_EVENT_CALLABCK nw_event_callback;		//             
	nw_int32 file_handle;
};  

typedef enum
{
	NW_HTTP_TYPE_GET = 0,
	NW_HTTP_TYPE_POST,
	NW_HTTP_TYPE_HEAD,
};

typedef enum
{
	NW_HTTP_TYPE_CMWAP = 0,
	NW_HTTP_TYPE_CMNET,
	NW_HTTP_TYPE_CDWAP,
	NW_HTTP_TYPE_CDNET,
};

typedef void (*NW_TIMER_CALLBACK)(void* nw_timer_param_i, void *nw_timer_param_w);

typedef enum  __NW_TIMER_TYPE
{
	NW_TIMER_HTTP_TIMER_OUT = 0,
	NW_TIMER_HTTP_TIMER_OTHER, // timer        。
	NW_TIMER_HTTP_TIMER_MAX,
	
}NW_TIMER_TYPE;

typedef struct __NW_TIMER_DATA
{
	nw_uint32	timer_id; 	
	nw_int32	time; 
	NW_TIMER_CALLBACK callback_func; 
	nw_int8 used;
	nw_uint32 remain_time;
	nw_uint32 soc_id;
	NW_TIMER_TYPE type;
	void *nw_timer_param_i;
	void *nw_timer_param_w;
}NW_TIMER_DATA;

typedef enum __NW_HTTP_CONTENT_TYPE
{
	NW_MIME_TEXT_HTML = 1, 
	NW_MIME_TEXT_XHTML, 
	NW_MIME_TEXT_WML, 
	NW_MIME_TEXT_PLAIN, 
	NW_MIME_IMAGE_JPEG, 
	NW_MIME_IMAGE_GIF, 
	NW_MIME_IMAGE_PNG, 
	NW_MIME_EBK2_ZLIB_PAGE, 	
	NW_MIME_JAVA_JAD, 
	NW_MIME_JAVA_JAR, 
	NW_MIME_SYMBIAN_SIS, 
	NW_MIME_MMS, 

	NW_HTTP_CONTENT_TYPE_MAX
}NW_HTTP_CONTENT_TYPE;

#endif /* #ifndef __NW_DEFINE_H__ */

좋은 웹페이지 즐겨찾기