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__ */
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.