acl/app/gid/gid_server/include/http_service.h

60 lines
1.4 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef __HTTP_SERVICE_INCLUDE_H__
#define __HTTP_SERVICE_INCLUDE_H__
#include "lib_acl.h"
#include "lib_protocol.h"
#ifdef __cplusplus
extern "C" {
#endif
/* in http_service.c */
/**
* HTTP 协议方式处理方法
* @param client {ACL_VSTREAM*} 客户端流
* @return {int} 0表示正常1表示正常且保持长连接-1表示出错
*/
int http_service(ACL_VSTREAM *client);
/**
* 服务端返回 HTTP 响应给客户端
* @param client {ACL_VSTREAM*} 客户端流
* @param status {int} HTTP 响应状态码1xx, 2xx, 3xx, 4xx, 5xx
* @param keep_alive {int} 是否与客户端保持长连接
* @param body {const char*} 数据体内容
* @param len {int} 数据体长度
*/
int http_server_send_respond(ACL_VSTREAM* client, int status,
int keep_alive, char* body, int len);
/* in http_json.c */
/**
* 请求数据的格式为 JSON 格式的处理
* @param client {ACL_VSTREAM*}
* @param hdr_req {HTTP_HDR_REQ*} HTTP 请求协议头对象
* @param json {ACL_JSON*} json 解析器对象
* @return {int} 0表示正常1表示正常且保持长连接-1表示出错
*/
int http_json_service(ACL_VSTREAM *client,
HTTP_HDR_REQ *hdr_req, ACL_JSON *json);
/* in http_xml.c */
/**
* 请求数据的格式为 XML 格式的处理
* @param client {ACL_VSTREAM*}
* @param hdr_req {HTTP_HDR_REQ*} HTTP 请求协议头对象
* @param xml {ACL_XML*} xml 解析器对象
* @return {int} 0表示正常1表示正常且保持长连接-1表示出错
*/
int http_xml_service(ACL_VSTREAM *client,
HTTP_HDR_REQ *hdr_req, ACL_XML *xml);
#ifdef __cplusplus
}
#endif
#endif