123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- #pragma once
- using namespace std;
- namespace HTTP
- {
- /******************************************************************************
- 错误代码定义
- ******************************************************************************/
- typedef enum ErrorCode
- {
- CUT_URL_PTL_URL_NULL = 1, //URL为空
- CUT_URL_PTL_PTL_TAIL_POS, //找不到协议尾部符号位置
- CUT_URL_PTL_PTL_NULL, //提取协议失败
- CUT_URL_PTL_PTL_UNKNOW, //未知的协议
- CUT_URL_DOMAIN_PTL_TAIL_POS, //找不到协议尾部符号位置
- CUT_URL_DOMAIN_URL_NULL, //URL为空
- CUT_URL_DOMAIN_DOMAIN_HEAD_POS, //域名头部位置无效
- CUT_URL_DOMAIN_DOMAIN_TAIL_POS, //找不到域名尾部符号位置
- CUT_URL_DOMAIN_DOMAIN_NULL, //提取域名失败
- PROCESS_DOMAIN_PORT_DOMAIN_NULL, //域名为空
- PROCESS_DOMAIN_PORT_PORT_POS, //端口定位失败
- PROCESS_DOMAIN_PORT_PORT_NULL, //提取端口失败
- PROCESS_DOMAIN_PORT_PORT_ZERO, //端口号为0
- PROCESS_DOMAIN_PORT_DOMAIN_RECUT, //重新提取域名失败
- CUT_URL_PATH_URL_NULL, //URL为空
- CUT_URL_PATH_DOMAIN_TAIL_POS, //域名尾部符号位置无效
- CUT_URL_PATH_PATH_NULL, //提取路径失败
- ENCODE_POST_DATA_FAIL, //对POST进行编码转换失败
- TRANS_CODE_PAGE_WC_FAIL, //转换成宽字符编码失败
- TRANS_CODE_PAGE_WC_NULL, //转换成宽字符编码为空
- TRANS_CODE_PAGE_DST_FAIL, //转换成目标编码失败
- TRANS_CODE_PAGE_DST_NULL, //转换成目标编码为空
- TRANS_DATA_TO_STR_SIZE_INVALID, //数据大小有误
- TRANS_DATA_TO_STR_DATA_NULL, //数据为空
- TRANS_DATA_TO_STR_REBUF_FAIL, //更改内存大小失败
- TRANS_DATA_TO_STR_STR_NULL, //转换为字符串为空
- ENCODE_RECV_STR_FAIL, //转换编码失败
- PARSE_COOKIE_STR_COOKIE_NULL, //Cookie为空串
- PARSE_COOKIE_STR_NAME_NULL, //Cookie名为空
- ADD_COOKIE_STRING_COOKIE_NULL, //添加Cookie为空
- ADD_COOKIE_STRING_NAME_NULL, //添加Cookie名为空
- ADD_COOKIE_SCOOKIE_NAME_NULL, //Cookie名为空
- ADD_COOKIE_SOCKET_FIND_INVALID, //找到的下标有误
- GET_IMG_DATA_NULL, //接收的数据为空
- GET_IMG_SIZE_INVALID, //接收的数据大小无效
- GET_IP_STR_DOMAIN_NULL, //域名为空
- GET_IP_STR_IP_NULL, //获取的IP地址为空
- GET_IP_STR_IPW_FAIL, //转换为宽字符串失败
- GET_IP_STR_IPW_NULL, //转换为宽字符串为空
- STARTUP_CREATE_SOCKET_STARTUP, //启动套接字失败
- STARTUP_CREATE_SOCKET_SOCKET, //创建套接字失败
- FILL_ADDR_INFO_DOMAIN_NULL, //域名为空
- FILL_ADDR_INFO_IP_ZERO, //IP数据无效
- FILL_ADDR_INFO_PORT_INVALID, //端口无效
- SELECT_TIMEOUT_TIMEOUT_INVALID, //超时值无效
- SELECT_TIMEOUT_INVALID_SOCKET, //套接字无效
- SELECT_TIMEOUT_CONN_TIMEOUT, //连接超时
- CONN_WITH_TIMEOUT_INVALID_SOCKET, //套接字无效
- CONN_WITH_TIMEOUT_SETNB_FAIL, //设置非阻塞模式失败
- CONN_WITH_TIMEOUT_ADDR_INVALID, //地址信息无效
- CONN_WITH_TIMEOUT_CONN_FAIL, //连接失败
- CONN_WITH_TIMEOUT_SETB_FAIL, //设置阻塞模式失败
- SET_SOCKET_TIMEOUT_INVALID_SOCKET, //套接字无效
- SET_SOCKET_TIMEOUT_VALUE_INVALID, //超时值无效
- SET_SOCKET_TIMEOUT_SET_SND_TIMEOUT, //设置发送超时失败
- SET_SOCKET_TIMEOUT_SET_RCV_TIMEOUT, //设置接收超时失败
- SEND_DATA_PATH_NULL, //路径为空
- SEND_DATA_INVALID_SOCKET, //套接字无效
- SEND_DATA_SEND_FAIL, //发送失败
- RECV_EACH_DATA_SIZE_INVALID, //接收数据大小无效
- RECV_EACH_DATA_MALLOC_FAIL, //申请内存失败
- RECV_EACH_DATA_INVALID_SOCKET, //套接字无效
- RECV_EACH_DATA_CONN_CLOSE, //连接断开
- RECV_EACH_DATA_RECV_FAIL, //接收失败
- GET_RESPONSE_COOKIES_RECV_DATA_NULL, //接收到的数据为空
- GET_RESPONSE_COOKIES_HEADER_LEN_INVALID, //响应头长度无效
- GET_RESPONSE_COOKIES_HEADER_NULL, //响应头为空
- REJECT_HEADER_DATA_SIZE_INVALID, //接收数据大小无效
- REJECT_HEADER_HEADER_LEN_INVALID, //响应头长度无效
- REJECT_HEADER_RECV_DATA_NULL, //接收到的数据为空
- END_VISIT_CLOSE_FAIL, //关闭套接字失败
- END_VISIT_CLEAN_FAIL, //清空套接字失败
- }EErrorCode;
- typedef enum Timeout
- {
- CONN_TIMEOUT_DEFAULT = 10 * 1000, //默认的连接超时
- SEND_TIMEOUT_DEFAULT = 10 * 1000, //默认的发送超时
- RECV_TIMEOUT_DEFAULT = 10 * 1000, //默认的接收超时
- }ETimeout;
- typedef struct Cookie
- {
- string strName; //Cookie名
- string strValue; //Cookie值
- string strPath; //Cookie路径
- string strDomain; //Cookie域名
- }SCookie;
- typedef enum Const
- {
- RECV_BUF_SIZE = 1024, //每次接收的数据大小
- }EConst;
- }
|