blob: 2490b7897bc193bba6cc0dbd8252e8bc1818193f [file] [log] [blame]
liubin281ac462023-07-19 14:22:54 +08001/*************************************************************
2Description:
3 HTTP platform related function implementation.
4Author:
5 LiuBin
6Date:
7 2020/4/30 14:02:58
8*************************************************************/
9#ifndef _MBTK_HTTP_BASE_H
10#define _MBTK_HTTP_BASE_H
11
12#include <stdio.h>
13
14#include "mbtk_type.h"
15#include "mbtk_log.h"
16#include "mbtk_sock2.h"
17
18/*************************************************************
19 Public Function Declaration
20*************************************************************/
21int mbtk_http_init();
22int mbtk_http_deinit();
23int mbtk_http_open
24(
25 bool is_ssl,
26 bool ingnore_cert,
27 const void *host,
28 uint16 port
29);
30
31/*=============================================
32FUNCTION
33 mbtk_http_read
34
35DESCRIPTION
36 read content from socket.
37
38DEPENDENCIES
39 None
40
41PARAMETERS
42 *buf Store read content.
43 len the length of Content.
44 timeout Set timeout
45
46RETURN VALUE
47 Length of read content
48
49SIDE EFFECTS
50 None
51=============================================*/
52int mbtk_http_read
53(
54 int sock_fd,
55 void *buf,
56 uint16 len,
57 int timeout_ms
58);
59
60#if 0
61int mbtk_http_read_line
62(
63 FILE *file,
64 void *buf,
65 uint16 len
66);
67#else
68int mbtk_http_read_line
69(
70 int sock_fd,
71 void *buf,
72 uint16 len
73);
74#endif
75
76/*=============================================
77FUNCTION
78 mbtk_http_write
79
80DESCRIPTION
81 Write content to socket.
82
83DEPENDENCIES
84 None
85
86PARAMETERS
87 *buf Content to be transferred
88 len the length of Content.
89
90RETURN VALUE
91 Length of written content
92
93SIDE EFFECTS
94 None
95=============================================*/
96int mbtk_http_write
97(
98 int sock_fd,
99 void *buf,
100 uint16 len
101);
102
103/*=============================================
104FUNCTION
105 mbtk_http_close
106
107DESCRIPTION
108 close HTTP service.
109
110DEPENDENCIES
111 None
112
113PARAMETERS
114 *err Error number
115
116RETURN VALUE
117 TURE or FALSE
118
119SIDE EFFECTS
120 None
121=============================================*/
122int mbtk_http_close(int sock_fd);
123
124#endif /* _MBTK_HTTP_BASE_H */