資源簡介
輕量級C++實現的httpserver和httpclient,給予mongoose,代碼量很小,可以方便嵌入到自己的項目中,為C++項目添加http的功能,拋棄libcurl這種重型庫
代碼片段和文件信息
#include?“mongoose.h“
#ifdef?MG_MODULE_LINES
#line?1?“mongoose/src/internal.h“
#endif
/*
?*?Copyright?(c)?2014?Cesanta?Software?Limited
?*?All?rights?reserved
?*/
#ifndef?CS_MONGOOSE_SRC_INTERNAL_H_
#define?CS_MONGOOSE_SRC_INTERNAL_H_
#ifndef?MG_MALLOC
#define?MG_MALLOC?malloc
#endif
#ifndef?MG_CALLOC
#define?MG_CALLOC?calloc
#endif
#ifndef?MG_REALLOC
#define?MG_REALLOC?realloc
#endif
#ifndef?MG_FREE
#define?MG_FREE?free
#endif
#ifndef?MBUF_REALLOC
#define?MBUF_REALLOC?MG_REALLOC
#endif
#ifndef?MBUF_FREE
#define?MBUF_FREE?MG_FREE
#endif
#define?MG_SET_PTRPTR(_ptr?_v)?\
??do?{??????????????????????????\
????if?(_ptr)?*(_ptr)?=?_v;?????\
??}?while?(0)
#ifndef?MG_INTERNAL
#define?MG_INTERNAL?static
#endif
#ifdef?PICOTCP
#define?NO_LIBC
#define?MG_DISABLE_PFS
#endif
/*?Amalgamated:?#include?“mongoose/src/net.h“?*/
/*?Amalgamated:?#include?“mongoose/src/http.h“?*/
/*?Amalgamated:?#include?“common/cs_dbg.h“?*/
#define?MG_CTL_MSG_MESSAGE_SIZE?8192
/*?internals?that?need?to?be?accessible?in?unit?tests?*/
MG_INTERNAL?struct?mg_connection?*mg_do_connect(struct?mg_connection?*nc
????????????????????????????????????????????????int?proto
????????????????????????????????????????????????union?socket_address?*sa);
MG_INTERNAL?int?mg_parse_address(const?char?*str?union?socket_address?*sa
?????????????????????????????????int?*proto?char?*host?size_t?host_len);
MG_INTERNAL?void?mg_call(struct?mg_connection?*nc
?????????????????????????mg_event_handler_t?ev_handler?int?ev?void?*ev_data);
void?mg_forward(struct?mg_connection?*from?struct?mg_connection?*to);
MG_INTERNAL?void?mg_add_conn(struct?mg_mgr?*mgr?struct?mg_connection?*c);
MG_INTERNAL?void?mg_remove_conn(struct?mg_connection?*c);
MG_INTERNAL?struct?mg_connection?*mg_create_connection(
????struct?mg_mgr?*mgr?mg_event_handler_t?callback
????struct?mg_add_sock_opts?opts);
#ifdef?_WIN32
/*?Retur?value?is?the?same?as?for?MultiByteToWideChar.?*/
int?to_wchar(const?char?*path?wchar_t?*wbuf?size_t?wbuf_len);
#endif
struct?ctl_msg?{
??mg_event_handler_t?callback;
??char?message[MG_CTL_MSG_MESSAGE_SIZE];
};
#if?MG_ENABLE_MQTT
struct?mg_mqtt_message;
MG_INTERNAL?int?parse_mqtt(struct?mbuf?*io?struct?mg_mqtt_message?*mm);
#endif
/*?Forward?declarations?for?testing.?*/
extern?void?*(*test_malloc)(size_t?size);
extern?void?*(*test_calloc)(size_t?count?size_t?size);
#ifndef?MIN
#define?MIN(a?b)?((a)?(b)???(a)?:?(b))
#endif
#if?MG_ENABLE_HTTP
struct?mg_serve_http_opts;
/*
?*?Reassemble?the?content?of?the?buffer?(buf?blen)?which?should?be
?*?in?the?HTTP?chunked?encoding?by?collapsing?data?chunks?to?the
?*?beginning?of?the?buffer.
?*
?*?If?chunks?get?reassembled?modify?hm->body?to?point?to?the?reassembled
?*?body?and?fire?MG_EV_HTTP_CHUNK?event.?If?handler?sets?MG_F_DELETE_CHUNK
?*?in?nc->flags?delete?reassembled?body?from?the?mbuf.
?*
?*?Return?reassembled?body?size.
?*/
MG_INTERNAL?size_t?mg_handle_chunked(struct?mg_connection?*nc
?????????????????????????????????????struct?http_m
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????????4??2018-03-17?21:22??CppHttpDemo\.git\COMMIT_EDITMSG
?????文件????????130??2018-03-17?21:20??CppHttpDemo\.git\config
?????文件?????????73??2018-03-17?21:20??CppHttpDemo\.git\desc
?????文件?????????23??2018-03-17?21:20??CppHttpDemo\.git\HEAD
?????文件????????177??2018-03-17?21:20??CppHttpDemo\.git\hooks\README.sample
?????文件????????984??2018-03-17?21:22??CppHttpDemo\.git\index
?????文件????????113??2018-03-17?21:20??CppHttpDemo\.git\info\exclude
?????文件????????346??2018-03-17?21:22??CppHttpDemo\.git\logs\HEAD
?????文件????????346??2018-03-17?21:22??CppHttpDemo\.git\logs\refs\heads\master
?????文件????????330??2018-03-17?21:22??CppHttpDemo\.git\ob
?????文件????????188??2018-03-17?21:22??CppHttpDemo\.git\ob
?????文件?????????89??2018-03-17?21:20??CppHttpDemo\.git\ob
?????文件??????50130??2018-03-17?21:22??CppHttpDemo\.git\ob
?????文件????????643??2018-03-17?21:22??CppHttpDemo\.git\ob
?????文件?????138007??2018-03-17?21:22??CppHttpDemo\.git\ob
?????文件????????296??2018-03-17?21:22??CppHttpDemo\.git\ob
?????文件?????????79??2018-03-17?21:22??CppHttpDemo\.git\ob
?????文件?????????55??2018-03-17?21:22??CppHttpDemo\.git\ob
?????文件???????1531??2018-03-17?21:22??CppHttpDemo\.git\ob
?????文件????????600??2018-03-17?21:22??CppHttpDemo\.git\ob
?????文件????????344??2018-03-17?21:20??CppHttpDemo\.git\ob
?????文件????????162??2018-03-17?21:22??CppHttpDemo\.git\ob
?????文件????????167??2018-03-17?21:20??CppHttpDemo\.git\ob
?????文件????????462??2018-03-17?21:22??CppHttpDemo\.git\ob
?????文件????????188??2018-03-17?21:20??CppHttpDemo\.git\ob
?????文件????????144??2018-03-17?21:22??CppHttpDemo\.git\ob
?????文件????????803??2018-03-17?21:22??CppHttpDemo\.git\ob
?????文件????????116??2018-03-17?21:22??CppHttpDemo\.git\ob
?????文件?????????41??2018-03-17?21:22??CppHttpDemo\.git\refs\heads\master
?????文件????????395??2014-12-19?12:57??CppHttpDemo\.gitattributes
............此處省略47個文件信息
評論
共有 條評論