mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-26 12:14:56 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
acfc66cd60 | ||
|
|
6f140202ad | ||
|
|
cfe77a3d58 | ||
|
|
a0527a7f0e | ||
|
|
c90cffa688 | ||
|
|
d7a633bfa3 | ||
|
|
0ea3cdd228 | ||
|
|
ddef065493 | ||
|
|
ac857d18db | ||
|
|
663e928d65 | ||
|
|
189cd8c5f6 | ||
|
|
692f436b3d | ||
|
|
2e65ce8272 | ||
|
|
a35e5bd966 | ||
|
|
83fe5a17f3 | ||
|
|
49bbfaf130 | ||
|
|
cd9c7dcbec | ||
|
|
f868fc861b | ||
|
|
84907d5bc4 | ||
|
|
1cee8a16b9 | ||
|
|
57e32b87c7 | ||
|
|
6926655513 | ||
|
|
8354319e72 | ||
|
|
f9596cc1db | ||
|
|
b2e2ad9a45 | ||
|
|
a07fb2be51 | ||
|
|
7f259f2a79 | ||
|
|
8ce34af9f3 | ||
|
|
82761bb875 | ||
|
|
08a10a8af5 | ||
|
|
bd130136bc | ||
|
|
fb04203b72 | ||
|
|
4172c190e5 | ||
|
|
920abd627b | ||
|
|
02b7399f9a | ||
|
|
b8402ed073 | ||
|
|
06c5c4d2a4 | ||
|
|
57a4ec31d1 | ||
|
|
511c9a6d4a | ||
|
|
8ec47111d5 | ||
|
|
8b67274cc0 | ||
|
|
af22fb7a06 | ||
|
|
df5fff5e72 | ||
|
|
d9243d1c0b | ||
|
|
2fb145d39d | ||
|
|
14094aaef7 | ||
|
|
ec752645ee | ||
|
|
ceb2f1da41 | ||
|
|
aab857a66e | ||
|
|
066be0fe30 | ||
|
|
380e87ddfa | ||
|
|
e9a7a2af18 | ||
|
|
a83e7d8c42 | ||
|
|
bf7dd7ac63 | ||
|
|
0fc3370859 | ||
|
|
c416012f97 | ||
|
|
d3a8862bd8 | ||
|
|
08353731ef | ||
|
|
16700244b0 | ||
|
|
49ca223e9c | ||
|
|
38efe632ae | ||
|
|
39a3bb7e44 | ||
|
|
920e8d9145 | ||
|
|
aed6d05d8c | ||
|
|
d85d95a40b | ||
|
|
b5dd54a404 | ||
|
|
f7c0a2ee15 | ||
|
|
874b5bfdbf | ||
|
|
71d09722be | ||
|
|
349d25dccf | ||
|
|
3942914945 | ||
|
|
60c16bbb5d | ||
|
|
70b5f4130e | ||
|
|
17cfecc5c3 | ||
|
|
ebdd18769b | ||
|
|
f974fddd2a | ||
|
|
b1a46da309 | ||
|
|
81879be4be | ||
|
|
0a094d4c1f | ||
|
|
66a96410d4 | ||
|
|
d4b23f08b6 | ||
|
|
d6d956b9d8 | ||
|
|
383b2a48c5 | ||
|
|
ab1c464950 | ||
|
|
f20b5191f2 | ||
|
|
fc113d64f5 | ||
|
|
6f6b12bee7 | ||
|
|
4e6c2867da | ||
|
|
54989e819a | ||
|
|
bf505bb68d | ||
|
|
4072062b72 | ||
|
|
d6ba37dc3c | ||
|
|
a58d21aa28 | ||
|
|
6e8d4129b2 | ||
|
|
2485a8f8d9 | ||
|
|
1ae908f6d5 | ||
|
|
6b923bdff1 | ||
|
|
d39969d1e6 | ||
|
|
eaef5bd133 | ||
|
|
7cc7df8c0e | ||
|
|
551f393da7 | ||
|
|
e81f8373a2 | ||
|
|
dfa83f2c85 | ||
|
|
91bdbc5193 | ||
|
|
707b9ed2d6 | ||
|
|
cd6b846e22 | ||
|
|
807e4ea6ec | ||
|
|
507e8bfac9 | ||
|
|
2ea63a0ea6 | ||
|
|
7988acbff4 | ||
|
|
b8c3740446 | ||
|
|
7bdbd80552 | ||
|
|
577ad2599c | ||
|
|
4d9f8168b8 | ||
|
|
f1d0b451b1 | ||
|
|
ac921d4657 | ||
|
|
f046434f3b | ||
|
|
58b9ee41fa | ||
|
|
d28d7a67f2 | ||
|
|
20370e65d6 | ||
|
|
67626d49c9 | ||
|
|
cd9e179fcb | ||
|
|
0ba28e6153 | ||
|
|
de791765b2 | ||
|
|
e79121acb7 | ||
|
|
4bdec5c1c1 | ||
|
|
fa39d2f2fa | ||
|
|
c55d06ed57 | ||
|
|
3829873552 | ||
|
|
54ebcc5bd8 | ||
|
|
7782500dbb | ||
|
|
86ec6bb2f8 | ||
|
|
02499d672b | ||
|
|
8c2e641ed7 | ||
|
|
29c53082eb | ||
|
|
2fa988fc7b | ||
|
|
72f1d444d3 | ||
|
|
7dcc94202d | ||
|
|
a447ae5eab | ||
|
|
54ad1e4e47 | ||
|
|
39ea91cfc2 | ||
|
|
5ebff5d15e | ||
|
|
731512a947 | ||
|
|
304dbca63d | ||
|
|
18ff0fafe0 | ||
|
|
25de791424 | ||
|
|
6e88c9cfd1 | ||
|
|
9937e88985 | ||
|
|
57f964a139 | ||
|
|
cbd5835112 | ||
|
|
fba32acb73 | ||
|
|
2fdb1f78a2 | ||
|
|
ea2069df51 | ||
|
|
7267fc757d | ||
|
|
ea7d69060d | ||
|
|
6e5e2eb694 | ||
|
|
51466df7b9 | ||
|
|
d6259332d4 | ||
|
|
260229a4d1 | ||
|
|
7776df241c | ||
|
|
e17fdcb077 | ||
|
|
d96629cdf4 | ||
|
|
0c79fcfbd0 | ||
|
|
9125830de6 | ||
|
|
55963d0c9a | ||
|
|
44f7b91826 | ||
|
|
731ea5d50d | ||
|
|
9e517fde00 | ||
|
|
1ff61837ac | ||
|
|
3a8464e4b8 | ||
|
|
39b0b8e2fd | ||
|
|
3a61186491 | ||
|
|
2180e1786c | ||
|
|
8fb5e8ef19 | ||
|
|
a8f54d1851 | ||
|
|
c9721d4d7f | ||
|
|
c848372bbe | ||
|
|
a23daa1547 | ||
|
|
9dba6c806b | ||
|
|
fc635a9340 | ||
|
|
81f738af3f | ||
|
|
f6165d23e4 | ||
|
|
e4a4b6f260 | ||
|
|
0ceee1dc05 | ||
|
|
8a6cf95fad | ||
|
|
37a7031f4e | ||
|
|
8874f3de9d | ||
|
|
3c5d48ea13 | ||
|
|
a0d98b7a39 | ||
|
|
74b75899d3 | ||
|
|
240eca0b68 | ||
|
|
cd54b18de3 | ||
|
|
65e01dbabc | ||
|
|
62276ce63e | ||
|
|
f67fe352cf | ||
|
|
4805797752 | ||
|
|
4c038508f2 | ||
|
|
15db11c0e6 | ||
|
|
97fe505bb4 | ||
|
|
fd45a6d31b | ||
|
|
e1a9ad7f82 | ||
|
|
296affc6e4 | ||
|
|
1889e12b54 | ||
|
|
5e91d919e0 | ||
|
|
5934846852 | ||
|
|
5045dfab74 | ||
|
|
499a7d6a37 | ||
|
|
f72c3fa9a7 | ||
|
|
d0c50632cd | ||
|
|
fffb54e2c6 | ||
|
|
8bf3bd48a6 | ||
|
|
dbe976ad3e | ||
|
|
9a8a6b53ae | ||
|
|
84132b7b2a | ||
|
|
e69a7a1b25 | ||
|
|
7f2bdc217a | ||
|
|
76bb35d5db | ||
|
|
0187f297d1 | ||
|
|
6ff49dc196 | ||
|
|
cd778396ff | ||
|
|
0dcb50d39c | ||
|
|
fd763846e5 | ||
|
|
f4f310cf51 | ||
|
|
0798b72470 | ||
|
|
39a17f8a72 | ||
|
|
78454da3b3 | ||
|
|
e62dc8f3b2 | ||
|
|
e99088348d | ||
|
|
6a12bd7abc | ||
|
|
b39e30fb0c | ||
|
|
92b15395a4 | ||
|
|
7411ff1fca | ||
|
|
f2e7facbc3 | ||
|
|
f1b4f0c463 | ||
|
|
c04e3f80b9 | ||
|
|
717e872fdd | ||
|
|
dbff932d8b | ||
|
|
5c9f463cab | ||
|
|
3a8f47befd | ||
|
|
a3e2a41834 | ||
|
|
b667bd709d | ||
|
|
a4c668e37a | ||
|
|
900bbe724a | ||
|
|
f5a2857620 | ||
|
|
2ef6f7248d | ||
|
|
06b430e57f | ||
|
|
f061dcf8b6 | ||
|
|
99377bdd30 | ||
|
|
c6b5343c9b | ||
|
|
7f4e2a93d0 | ||
|
|
c151f9bc59 | ||
|
|
204bf9acec | ||
|
|
e3bac87016 | ||
|
|
1f09505248 | ||
|
|
7f99013179 | ||
|
|
8d72c2a7b2 | ||
|
|
c722cfec18 | ||
|
|
835af2cae1 | ||
|
|
bd2a4097b2 | ||
|
|
fcc75c6a3f | ||
|
|
e08b234326 | ||
|
|
5bd3df7a0f | ||
|
|
5bbf24bf41 | ||
|
|
ace1dc53b2 | ||
|
|
100480a1d5 | ||
|
|
a89a2df603 | ||
|
|
988ad66a12 | ||
|
|
85d6292b8f | ||
|
|
98ab0950c9 | ||
|
|
a7f9043072 | ||
|
|
6d8b747ff2 | ||
|
|
a17eae4142 | ||
|
|
7b05d70042 | ||
|
|
f328907da4 | ||
|
|
1cea7ba487 | ||
|
|
6848452149 | ||
|
|
f9a1d47f13 | ||
|
|
492dcdca8d | ||
|
|
4ef3a778c1 | ||
|
|
31c5ef1bc3 | ||
|
|
4656e7b0dd | ||
|
|
4216cf2ac1 | ||
|
|
37e4f51668 | ||
|
|
1dae0373c8 | ||
|
|
e928f36456 | ||
|
|
fcb94a1742 | ||
|
|
8ff010ca0f | ||
|
|
241090a82b | ||
|
|
618bef0eb2 | ||
|
|
3b69f5d500 | ||
|
|
b298d46a40 | ||
|
|
75059d1bdc | ||
|
|
15e9a92798 | ||
|
|
bafc30bec6 |
No files matched your search
@@ -0,0 +1,9 @@
|
|||||||
|
binary/
|
||||||
|
deps/
|
||||||
|
docker/
|
||||||
|
docs/
|
||||||
|
examples/
|
||||||
|
platforms/
|
||||||
|
src/
|
||||||
|
test/
|
||||||
|
multilingual/
|
||||||
@@ -5,33 +5,27 @@
|
|||||||
Mongoose is ideal for embedded environments. It has been designed
|
Mongoose is ideal for embedded environments. It has been designed
|
||||||
for connecting devices and bringing them online. On the market since 2004,
|
for connecting devices and bringing them online. On the market since 2004,
|
||||||
used by vast number of open source and
|
used by vast number of open source and
|
||||||
commercial products - it even runs on space stations!
|
commercial products - it even runs on the International Space station!
|
||||||
Mongoose makes embedded network programming fast, robust, and easy.
|
Mongoose makes embedded network programming fast, robust, and easy.
|
||||||
|
|
||||||
If you're looking for a pre-compiled Windows or Mac binary,
|
- [Download Mongoose Source Code here](https://www.cesanta.com)
|
||||||
- [Download pre-compiled Mongoose web server binary](https://www.cesanta.com/products/binary)
|
|
||||||
|
|
||||||
Alternatively,
|
Looking for a complete IoT firmware solution?
|
||||||
|
|
||||||
- [Download Mongoose Source Code here](http://hubs.ly/H01bWvx0)
|
Check out [Mongoose OS](https://mongoose-os.com) - open source embedded operating system for low-power connected microcontrollers. Secure, designed for Internet of Things, complete environment for prototyping, development and managing.
|
||||||
- [Check our latest releases] (https://github.com/cesanta/mongoose/releases)
|
|
||||||
- [Read User Guide and API reference](https://docs.cesanta.com/mongoose/dev)
|
|
||||||
- [Study mongoose example code](https://github.com/cesanta/mongoose/tree/master/examples)
|
|
||||||
|
|
||||||
If you are looking for a complete solution with firmware and cloud components, check out [Mongoose IoT Platform](https://github.com/cesanta/mongoose-iot).
|
|
||||||
|
|
||||||
# Support
|
# Support
|
||||||
- [Support Forum - Ask your technical questions here] (http://forum.cesanta.com/index.php?p=/categories/mongoose)
|
- [Study mongoose example code](https://github.com/cesanta/mongoose/tree/master/examples)
|
||||||
- [Chat - Visit www.cesanta.com for our live chat] (http://www.cesanta.com)
|
- [Read User Guide and API reference](https://docs.cesanta.com/mongoose)
|
||||||
- [Commercial one-to-one support - Available to all commercial license holders] (https://www.cesanta.com/services-support)
|
- [Support Forum - ask your technical questions here] (http://forum.cesanta.com/index.php?p=/categories/mongoose)
|
||||||
|
- [Commercial licensing and support available] (https://www.cesanta.com/services-support)
|
||||||
|
- [Check our latest releases] (https://github.com/cesanta/mongoose/releases)
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
|
|
||||||
* Cross-platform: works on Linux/UNIX, MacOS, QNX, eCos, Windows, Android,
|
* Cross-platform: works on Linux/UNIX, MacOS, QNX, eCos, Windows, Android,
|
||||||
iPhone, FreeRTOS (TI CC3200, ESP8266), etc
|
iPhone, FreeRTOS (TI CC3200, ESP8266), etc
|
||||||
* Single-threaded, asynchronous, non-blocking core with simple event-based API
|
* Supported hardware platforms: TI CC3200, TI MSP432, NRF52, STM32, PIC32, ESP8266, ESP32 and more
|
||||||
* Native support for [PicoTCP embedded TCP/IP stack](http://www.picotcp.com),
|
|
||||||
[LWIP embedded TCP/IP stack](https://en.wikipedia.org/wiki/LwIP)
|
|
||||||
* Builtin protocols:
|
* Builtin protocols:
|
||||||
- plain TCP, plain UDP, SSL/TLS (over TCP, one-way or two-way)
|
- plain TCP, plain UDP, SSL/TLS (over TCP, one-way or two-way)
|
||||||
- HTTP client, HTTP server
|
- HTTP client, HTTP server
|
||||||
@@ -39,6 +33,9 @@ If you are looking for a complete solution with firmware and cloud components, c
|
|||||||
- MQTT client, MQTT broker
|
- MQTT client, MQTT broker
|
||||||
- CoAP client, CoAP server
|
- CoAP client, CoAP server
|
||||||
- DNS client, DNS server, async DNS resolver
|
- DNS client, DNS server, async DNS resolver
|
||||||
|
* Single-threaded, asynchronous, non-blocking core with simple event-based API
|
||||||
|
* Native support for [PicoTCP embedded TCP/IP stack](http://www.picotcp.com),
|
||||||
|
[LWIP embedded TCP/IP stack](https://en.wikipedia.org/wiki/LwIP)
|
||||||
* Tiny static and run-time footprint
|
* Tiny static and run-time footprint
|
||||||
* Source code is both ISO C and ISO C++ compliant
|
* Source code is both ISO C and ISO C++ compliant
|
||||||
* Very easy to integrate: just copy
|
* Very easy to integrate: just copy
|
||||||
@@ -48,13 +45,9 @@ If you are looking for a complete solution with firmware and cloud components, c
|
|||||||
|
|
||||||
# Licensing
|
# Licensing
|
||||||
|
|
||||||
Mongoose is released under commercial and [GNU GPL v.2](http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) open source licenses.
|
Mongoose is released under Commercial and [GNU GPL v.2](http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) open source licenses.
|
||||||
|
|
||||||
Commercial Projects:
|
Commercial Projects: [Contact us for commercial license.] (https://www.cesanta.com/contact)
|
||||||
Once your project becomes commercialised GPLv2 licensing dictates that you need to either open your source fully or purchase a commercial license. Cesanta offer full, royalty-free commercial licenses without any GPL restrictions. If your needs require a custom license, we’d be happy to work on a solution with you. [Contact us for pricing.] (https://www.cesanta.com/contact)
|
|
||||||
|
|
||||||
Prototyping:
|
|
||||||
While your project is still in prototyping stage and not for sale, you can use Mongoose’s open source code without license restrictions.
|
|
||||||
|
|
||||||
# Dashboard Example
|
# Dashboard Example
|
||||||
|
|
||||||
@@ -64,7 +57,7 @@ the functionality:
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
[Developing a new product? Contact us today to discuss how Mongoose can help
|
[Developing a new product? Contact us today to discuss how Mongoose can help.
|
||||||
](https://www.cesanta.com/contact)
|
](https://www.cesanta.com/contact)
|
||||||
|
|
||||||
# Contributions
|
# Contributions
|
||||||
@@ -73,8 +66,7 @@ To submit contributions, sign
|
|||||||
[Cesanta CLA](https://docs.cesanta.com/contributors_la.shtml)
|
[Cesanta CLA](https://docs.cesanta.com/contributors_la.shtml)
|
||||||
and send GitHub pull request. You retain the copyright on your contributions.
|
and send GitHub pull request. You retain the copyright on your contributions.
|
||||||
|
|
||||||
## Working with the Source Code
|
# Looking for a pre-compiled Mongoose web server Windows or Mac binary?
|
||||||
|
- [Download pre-compiled Mongoose web server binary.](https://www.cesanta.com/products/binary)
|
||||||
See [tools](https://github.com/cesanta/mongoose/tree/master/tools) directory.
|
|
||||||
|
|
||||||
[](https://github.com/cesanta/mongoose)
|
[](https://github.com/cesanta/mongoose)
|
||||||
@@ -3,15 +3,15 @@ title: "CoAP API reference"
|
|||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "coap.h"
|
decl_name: "coap.h"
|
||||||
items:
|
items:
|
||||||
- { name: mg_set_protocol_coap.md }
|
|
||||||
- { name: mg_coap_add_option.md }
|
- { name: mg_coap_add_option.md }
|
||||||
- { name: mg_coap_free_options.md }
|
|
||||||
- { name: mg_coap_send_message.md }
|
|
||||||
- { name: mg_coap_send_ack.md }
|
|
||||||
- { name: mg_coap_parse.md }
|
|
||||||
- { name: mg_coap_compose.md }
|
- { name: mg_coap_compose.md }
|
||||||
- { name: struct_mg_coap_option.md }
|
- { name: mg_coap_free_options.md }
|
||||||
|
- { name: mg_coap_parse.md }
|
||||||
|
- { name: mg_coap_send_ack.md }
|
||||||
|
- { name: mg_coap_send_message.md }
|
||||||
|
- { name: mg_set_protocol_coap.md }
|
||||||
- { name: struct_mg_coap_message.md }
|
- { name: struct_mg_coap_message.md }
|
||||||
|
- { name: struct_mg_coap_option.md }
|
||||||
---
|
---
|
||||||
|
|
||||||
CoAP message format:
|
CoAP message format:
|
||||||
|
|||||||
@@ -9,5 +9,6 @@ signature: |
|
|||||||
---
|
---
|
||||||
|
|
||||||
Adds a new option to mg_coap_message structure.
|
Adds a new option to mg_coap_message structure.
|
||||||
Returns pointer to the newly created option.
|
Returns pointer to the newly created option.
|
||||||
|
Note: options must be freed by using mg_coap_free_options
|
||||||
|
|
||||||
@@ -7,5 +7,5 @@ signature: |
|
|||||||
---
|
---
|
||||||
|
|
||||||
Frees the memory allocated for options.
|
Frees the memory allocated for options.
|
||||||
If the cm paramater doesn't contain any option it does nothing.
|
If the cm parameter doesn't contain any option it does nothing.
|
||||||
|
|
||||||
@@ -3,17 +3,17 @@ title: "DNS API reference"
|
|||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "dns.h"
|
decl_name: "dns.h"
|
||||||
items:
|
items:
|
||||||
- { name: mg_dns_parse_record_data.md }
|
|
||||||
- { name: mg_send_dns_query.md }
|
|
||||||
- { name: mg_dns_insert_header.md }
|
|
||||||
- { name: mg_dns_copy_questions.md }
|
- { name: mg_dns_copy_questions.md }
|
||||||
- { name: mg_dns_encode_record.md }
|
|
||||||
- { name: mg_dns_encode_name.md }
|
- { name: mg_dns_encode_name.md }
|
||||||
- { name: mg_parse_dns.md }
|
- { name: mg_dns_encode_record.md }
|
||||||
|
- { name: mg_dns_insert_header.md }
|
||||||
|
- { name: mg_dns_parse_record_data.md }
|
||||||
- { name: mg_dns_uncompress_name.md }
|
- { name: mg_dns_uncompress_name.md }
|
||||||
|
- { name: mg_parse_dns.md }
|
||||||
|
- { name: mg_send_dns_query.md }
|
||||||
- { name: mg_set_protocol_dns.md }
|
- { name: mg_set_protocol_dns.md }
|
||||||
- { name: struct_mg_dns_resource_record.md }
|
|
||||||
- { name: struct_mg_dns_message.md }
|
- { name: struct_mg_dns_message.md }
|
||||||
|
- { name: struct_mg_dns_resource_record.md }
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,5 +21,5 @@ This function doesn't update the `name` and `rdata` pointers in the `rr`
|
|||||||
struct because they might be invalidated as soon as the IO buffer grows
|
struct because they might be invalidated as soon as the IO buffer grows
|
||||||
again.
|
again.
|
||||||
|
|
||||||
Returns the number of bytes appened or -1 in case of error.
|
Returns the number of bytes appended or -1 in case of error.
|
||||||
|
|
||||||
@@ -3,19 +3,21 @@ title: "Common API reference"
|
|||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "http.h"
|
decl_name: "http.h"
|
||||||
items:
|
items:
|
||||||
- { name: mg_set_protocol_http_websocket.md }
|
|
||||||
- { name: mg_send_websocket_handshake.md }
|
|
||||||
- { name: mg_send_websocket_handshake2.md }
|
|
||||||
- { name: mg_connect_ws.md }
|
- { name: mg_connect_ws.md }
|
||||||
- { name: mg_connect_ws_opt.md }
|
- { name: mg_connect_ws_opt.md }
|
||||||
|
- { name: mg_printf_websocket_frame.md }
|
||||||
- { name: mg_send_websocket_frame.md }
|
- { name: mg_send_websocket_frame.md }
|
||||||
- { name: mg_send_websocket_framev.md }
|
- { name: mg_send_websocket_framev.md }
|
||||||
- { name: mg_printf_websocket_frame.md }
|
- { name: mg_send_websocket_handshake.md }
|
||||||
|
- { name: mg_send_websocket_handshake2.md }
|
||||||
|
- { name: mg_send_websocket_handshake3.md }
|
||||||
|
- { name: mg_send_websocket_handshake3v.md }
|
||||||
|
- { name: mg_set_protocol_http_websocket.md }
|
||||||
- { name: mg_url_decode.md }
|
- { name: mg_url_decode.md }
|
||||||
- { name: struct_http_message.md }
|
- { name: struct_http_message.md }
|
||||||
- { name: struct_websocket_message.md }
|
|
||||||
- { name: struct_mg_http_multipart_part.md }
|
- { name: struct_mg_http_multipart_part.md }
|
||||||
- { name: struct_mg_ssi_call_ctx.md }
|
- { name: struct_mg_ssi_call_ctx.md }
|
||||||
|
- { name: struct_websocket_message.md }
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,8 @@ decl_name: "mg_connect_ws"
|
|||||||
symbol_kind: "func"
|
symbol_kind: "func"
|
||||||
signature: |
|
signature: |
|
||||||
struct mg_connection *mg_connect_ws(struct mg_mgr *mgr,
|
struct mg_connection *mg_connect_ws(struct mg_mgr *mgr,
|
||||||
mg_event_handler_t event_handler,
|
MG_CB(mg_event_handler_t event_handler,
|
||||||
const char *url, const char *protocol,
|
void *user_data);
|
||||||
const char *extra_headers);
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Helper function that creates an outbound WebSocket connection.
|
Helper function that creates an outbound WebSocket connection.
|
||||||
|
|||||||
@@ -3,11 +3,8 @@ title: "mg_connect_ws_opt()"
|
|||||||
decl_name: "mg_connect_ws_opt"
|
decl_name: "mg_connect_ws_opt"
|
||||||
symbol_kind: "func"
|
symbol_kind: "func"
|
||||||
signature: |
|
signature: |
|
||||||
struct mg_connection *mg_connect_ws_opt(struct mg_mgr *mgr,
|
struct mg_connection *mg_connect_ws_opt(
|
||||||
mg_event_handler_t ev_handler,
|
struct mg_mgr *mgr, MG_CB(mg_event_handler_t ev_handler, void *user_data);
|
||||||
struct mg_connect_opts opts,
|
|
||||||
const char *url, const char *protocol,
|
|
||||||
const char *extra_headers);
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Helper function that creates an outbound WebSocket connection
|
Helper function that creates an outbound WebSocket connection
|
||||||
|
|||||||
@@ -9,5 +9,6 @@ signature: |
|
|||||||
|
|
||||||
Sends multiple websocket frames.
|
Sends multiple websocket frames.
|
||||||
|
|
||||||
Like `mg_send_websocket_frame()`, but composes a frame from multiple buffers.
|
Like `mg_send_websocket_frame()`, but composes a frame from multiple
|
||||||
|
*buffers.
|
||||||
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
title: "mg_send_websocket_handshake3()"
|
||||||
|
decl_name: "mg_send_websocket_handshake3"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
void mg_send_websocket_handshake3(struct mg_connection *nc, const char *path,
|
||||||
|
const char *host, const char *protocol,
|
||||||
|
const char *extra_headers, const char *user,
|
||||||
|
const char *pass);
|
||||||
|
---
|
||||||
|
|
||||||
|
Like mg_send_websocket_handshake2 but also passes basic auth header
|
||||||
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
title: "mg_send_websocket_handshake3v()"
|
||||||
|
decl_name: "mg_send_websocket_handshake3v"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
void mg_send_websocket_handshake3v(struct mg_connection *nc,
|
||||||
|
const struct mg_str path,
|
||||||
|
const struct mg_str host,
|
||||||
|
const struct mg_str protocol,
|
||||||
|
const struct mg_str extra_headers,
|
||||||
|
const struct mg_str user,
|
||||||
|
const struct mg_str pass);
|
||||||
|
---
|
||||||
|
|
||||||
|
Same as mg_send_websocket_handshake3 but with strings not necessarily
|
||||||
|
NUL-temrinated
|
||||||
|
|
||||||
@@ -12,11 +12,6 @@ The user-defined event handler will receive following extra events:
|
|||||||
- MG_EV_HTTP_REQUEST: HTTP request has arrived. Parsed HTTP request
|
- MG_EV_HTTP_REQUEST: HTTP request has arrived. Parsed HTTP request
|
||||||
is passed as
|
is passed as
|
||||||
`struct http_message` through the handler's `void *ev_data` pointer.
|
`struct http_message` through the handler's `void *ev_data` pointer.
|
||||||
- MG_EV_HTTP_MULTIPART_REQUEST: A multipart POST request has received.
|
|
||||||
This event is sent before body is parsed. After this, the user
|
|
||||||
should expect a sequence of MG_EV_HTTP_PART_BEGIN/DATA/END requests.
|
|
||||||
This is also the last time when headers and other request fields are
|
|
||||||
accessible.
|
|
||||||
- MG_EV_HTTP_REPLY: The HTTP reply has arrived. The parsed HTTP reply is
|
- MG_EV_HTTP_REPLY: The HTTP reply has arrived. The parsed HTTP reply is
|
||||||
passed as `struct http_message` through the handler's `void *ev_data`
|
passed as `struct http_message` through the handler's `void *ev_data`
|
||||||
pointer.
|
pointer.
|
||||||
@@ -38,14 +33,27 @@ The user-defined event handler will receive following extra events:
|
|||||||
handshake. `ev_data` is `NULL`.
|
handshake. `ev_data` is `NULL`.
|
||||||
- MG_EV_WEBSOCKET_FRAME: new WebSocket frame has arrived. `ev_data` is
|
- MG_EV_WEBSOCKET_FRAME: new WebSocket frame has arrived. `ev_data` is
|
||||||
`struct websocket_message *`
|
`struct websocket_message *`
|
||||||
- MG_EV_HTTP_PART_BEGIN: new part of multipart message is started,
|
|
||||||
extra parameters are passed in mg_http_multipart_part
|
When compiled with MG_ENABLE_HTTP_STREAMING_MULTIPART, Mongoose parses
|
||||||
- MG_EV_HTTP_PART_DATA: new portion of data from the multiparted message
|
multipart requests and splits them into separate events:
|
||||||
no additional headers are available, only data and data size
|
- MG_EV_HTTP_MULTIPART_REQUEST: Start of the request.
|
||||||
- MG_EV_HTTP_PART_END: final boundary received, analogue to maybe used to
|
This event is sent before body is parsed. After this, the user
|
||||||
find the end of packet
|
should expect a sequence of PART_BEGIN/DATA/END requests.
|
||||||
Note: Mongoose should be compiled with MG_ENABLE_HTTP_STREAMING_MULTIPART
|
This is also the last time when headers and other request fields are
|
||||||
to enable MG_EV_HTTP_MULTIPART_REQUEST, MG_EV_HTTP_REQUEST_END,
|
accessible.
|
||||||
MG_EV_HTTP_REQUEST_CANCEL, MG_EV_HTTP_PART_BEGIN, MG_EV_HTTP_PART_DATA,
|
- MG_EV_HTTP_PART_BEGIN: Start of a part of a multipart message.
|
||||||
MG_EV_HTTP_PART_END constants
|
Argument: mg_http_multipart_part with var_name and file_name set
|
||||||
|
(if present). No data is passed in this message.
|
||||||
|
- MG_EV_HTTP_PART_DATA: new portion of data from the multipart message.
|
||||||
|
Argument: mg_http_multipart_part. var_name and file_name are preserved,
|
||||||
|
data is available in mg_http_multipart_part.data.
|
||||||
|
- MG_EV_HTTP_PART_END: End of the current part. var_name, file_name are
|
||||||
|
the same, no data in the message. If status is 0, then the part is
|
||||||
|
properly terminated with a boundary, status < 0 means that connection
|
||||||
|
was terminated.
|
||||||
|
- MG_EV_HTTP_MULTIPART_REQUEST_END: End of the multipart request.
|
||||||
|
Argument: mg_http_multipart_part, var_name and file_name are NULL,
|
||||||
|
status = 0 means request was properly closed, < 0 means connection
|
||||||
|
was terminated (note: in this case both PART_END and REQUEST_END are
|
||||||
|
delivered).
|
||||||
|
|
||||||
@@ -13,6 +13,7 @@ Source string is specified by (`src`, `src_len`), and destination is
|
|||||||
(`dst`, `dst_len`). If `is_form_url_encoded` is non-zero, then
|
(`dst`, `dst_len`). If `is_form_url_encoded` is non-zero, then
|
||||||
`+` character is decoded as a blank space character. This function
|
`+` character is decoded as a blank space character. This function
|
||||||
guarantees to NUL-terminate the destination. If destination is too small,
|
guarantees to NUL-terminate the destination. If destination is too small,
|
||||||
then the source string is partially decoded and `-1` is returned. Otherwise,
|
then the source string is partially decoded and `-1` is returned.
|
||||||
|
*Otherwise,
|
||||||
a length of the decoded string is returned, not counting final NUL.
|
a length of the decoded string is returned, not counting final NUL.
|
||||||
|
|
||||||
@@ -5,6 +5,7 @@ symbol_kind: "struct"
|
|||||||
signature: |
|
signature: |
|
||||||
struct http_message {
|
struct http_message {
|
||||||
struct mg_str message; /* Whole message: request line + headers + body */
|
struct mg_str message; /* Whole message: request line + headers + body */
|
||||||
|
struct mg_str body; /* Message body. 0-length for requests with no body */
|
||||||
|
|
||||||
/* HTTP Request line (or HTTP response line) */
|
/* HTTP Request line (or HTTP response line) */
|
||||||
struct mg_str method; /* "GET" */
|
struct mg_str method; /* "GET" */
|
||||||
@@ -28,9 +29,6 @@ signature: |
|
|||||||
/* Headers */
|
/* Headers */
|
||||||
struct mg_str header_names[MG_MAX_HTTP_HEADERS];
|
struct mg_str header_names[MG_MAX_HTTP_HEADERS];
|
||||||
struct mg_str header_values[MG_MAX_HTTP_HEADERS];
|
struct mg_str header_values[MG_MAX_HTTP_HEADERS];
|
||||||
|
|
||||||
/* Message body */
|
|
||||||
struct mg_str body; /* Zero-length for requests with no body */
|
|
||||||
};
|
};
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -3,11 +3,9 @@ title: "mg_connect_http()"
|
|||||||
decl_name: "mg_connect_http"
|
decl_name: "mg_connect_http"
|
||||||
symbol_kind: "func"
|
symbol_kind: "func"
|
||||||
signature: |
|
signature: |
|
||||||
struct mg_connection *mg_connect_http(struct mg_mgr *mgr,
|
struct mg_connection *mg_connect_http(
|
||||||
mg_event_handler_t event_handler,
|
struct mg_mgr *mgr,
|
||||||
const char *url,
|
MG_CB(mg_event_handler_t event_handler, void *user_data);
|
||||||
const char *extra_headers,
|
|
||||||
const char *post_data);
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Helper function that creates an outbound HTTP connection.
|
Helper function that creates an outbound HTTP connection.
|
||||||
|
|||||||
@@ -3,12 +3,8 @@ title: "mg_connect_http_opt()"
|
|||||||
decl_name: "mg_connect_http_opt"
|
decl_name: "mg_connect_http_opt"
|
||||||
symbol_kind: "func"
|
symbol_kind: "func"
|
||||||
signature: |
|
signature: |
|
||||||
struct mg_connection *mg_connect_http_opt(struct mg_mgr *mgr,
|
struct mg_connection *mg_connect_http_opt(
|
||||||
mg_event_handler_t ev_handler,
|
struct mg_mgr *mgr, MG_CB(mg_event_handler_t ev_handler, void *user_data);
|
||||||
struct mg_connect_opts opts,
|
|
||||||
const char *url,
|
|
||||||
const char *extra_headers,
|
|
||||||
const char *post_data);
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Helper function that creates an outbound HTTP connection.
|
Helper function that creates an outbound HTTP connection.
|
||||||
|
|||||||
@@ -3,22 +3,26 @@ title: "Server API reference"
|
|||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "http_server.h"
|
decl_name: "http_server.h"
|
||||||
items:
|
items:
|
||||||
- { name: mg_parse_http.md }
|
|
||||||
- { name: mg_get_http_header.md }
|
|
||||||
- { name: mg_http_parse_header.md }
|
|
||||||
- { name: mg_parse_multipart.md }
|
|
||||||
- { name: mg_get_http_var.md }
|
|
||||||
- { name: mg_serve_http.md }
|
|
||||||
- { name: mg_http_serve_file.md }
|
|
||||||
- { name: mg_register_http_endpoint.md }
|
|
||||||
- { name: mg_file_upload_handler.md }
|
- { name: mg_file_upload_handler.md }
|
||||||
|
- { name: mg_get_http_basic_auth.md }
|
||||||
|
- { name: mg_get_http_header.md }
|
||||||
|
- { name: mg_get_http_var.md }
|
||||||
- { name: mg_http_check_digest_auth.md }
|
- { name: mg_http_check_digest_auth.md }
|
||||||
- { name: mg_send_http_chunk.md }
|
- { name: mg_http_parse_header.md }
|
||||||
- { name: mg_printf_http_chunk.md }
|
- { name: mg_http_reverse_proxy.md }
|
||||||
- { name: mg_send_response_line.md }
|
- { name: mg_http_send_error.md }
|
||||||
- { name: mg_http_send_redirect.md }
|
- { name: mg_http_send_redirect.md }
|
||||||
- { name: mg_send_head.md }
|
- { name: mg_http_serve_file.md }
|
||||||
|
- { name: mg_parse_http.md }
|
||||||
|
- { name: mg_parse_http_basic_auth.md }
|
||||||
|
- { name: mg_parse_multipart.md }
|
||||||
- { name: mg_printf_html_escape.md }
|
- { name: mg_printf_html_escape.md }
|
||||||
|
- { name: mg_printf_http_chunk.md }
|
||||||
|
- { name: mg_register_http_endpoint.md }
|
||||||
|
- { name: mg_send_head.md }
|
||||||
|
- { name: mg_send_http_chunk.md }
|
||||||
|
- { name: mg_send_response_line.md }
|
||||||
|
- { name: mg_serve_http.md }
|
||||||
- { name: mg_fu_fname_fn.md }
|
- { name: mg_fu_fname_fn.md }
|
||||||
- { name: struct_mg_serve_http_opts.md }
|
- { name: struct_mg_serve_http_opts.md }
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ decl_name: "mg_file_upload_handler"
|
|||||||
symbol_kind: "func"
|
symbol_kind: "func"
|
||||||
signature: |
|
signature: |
|
||||||
void mg_file_upload_handler(struct mg_connection *nc, int ev, void *ev_data,
|
void mg_file_upload_handler(struct mg_connection *nc, int ev, void *ev_data,
|
||||||
mg_fu_fname_fn local_name_fn);
|
mg_fu_fname_fn local_name_fn
|
||||||
|
MG_UD_ARG(void *user_data);
|
||||||
---
|
---
|
||||||
|
|
||||||
File upload handler.
|
File upload handler.
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
title: "mg_get_http_basic_auth()"
|
||||||
|
decl_name: "mg_get_http_basic_auth"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
int mg_get_http_basic_auth(struct http_message *hm, char *user, size_t user_len,
|
||||||
|
char *pass, size_t pass_len);
|
||||||
|
---
|
||||||
|
|
||||||
|
Gets and parses the Authorization: Basic header
|
||||||
|
Returns -1 if no Authorization header is found, or if
|
||||||
|
mg_parse_http_basic_auth
|
||||||
|
fails parsing the resulting header.
|
||||||
|
|
||||||
@@ -12,5 +12,6 @@ Fetches a HTTP form variable.
|
|||||||
Fetches a variable `name` from a `buf` into a buffer specified by `dst`,
|
Fetches a variable `name` from a `buf` into a buffer specified by `dst`,
|
||||||
`dst_len`. The destination is always zero-terminated. Returns the length of
|
`dst_len`. The destination is always zero-terminated. Returns the length of
|
||||||
a fetched variable. If not found, 0 is returned. `buf` must be valid
|
a fetched variable. If not found, 0 is returned. `buf` must be valid
|
||||||
url-encoded buffer. If destination is too small, `-1` is returned.
|
url-encoded buffer. If destination is too small or an error occured,
|
||||||
|
negative number is returned.
|
||||||
|
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
title: "mg_http_reverse_proxy()"
|
||||||
|
decl_name: "mg_http_reverse_proxy"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
void mg_http_reverse_proxy(struct mg_connection *nc,
|
||||||
|
const struct http_message *hm, struct mg_str mount,
|
||||||
|
struct mg_str upstream);
|
||||||
|
---
|
||||||
|
|
||||||
|
Proxies a given request to a given upstream http server. The path prefix
|
||||||
|
in `mount` will be stripped of the path requested to the upstream server,
|
||||||
|
e.g. if mount is /api and upstream is http://localhost:8001/foo
|
||||||
|
then an incoming request to /api/bar will cause a request to
|
||||||
|
http://localhost:8001/foo/bar
|
||||||
|
|
||||||
|
EXPERIMENTAL API. Please use http_serve_http + url_rewrites if a static
|
||||||
|
mapping is good enough.
|
||||||
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
title: "mg_http_send_error()"
|
||||||
|
decl_name: "mg_http_send_error"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
void mg_http_send_error(struct mg_connection *nc, int code, const char *reason);
|
||||||
|
---
|
||||||
|
|
||||||
|
Sends an error response. If reason is NULL, the message will be inferred
|
||||||
|
from the error code (if supported).
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ Sends a redirect response.
|
|||||||
`status_code` should be either 301 or 302 and `location` point to the
|
`status_code` should be either 301 or 302 and `location` point to the
|
||||||
new location.
|
new location.
|
||||||
If `extra_headers` is not empty, then `extra_headers` are also sent
|
If `extra_headers` is not empty, then `extra_headers` are also sent
|
||||||
after the reponse line. `extra_headers` must NOT end end with new line.
|
after the response line. `extra_headers` must NOT end end with new line.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
title: "mg_parse_http_basic_auth()"
|
||||||
|
decl_name: "mg_parse_http_basic_auth"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
int mg_parse_http_basic_auth(struct mg_str *hdr, char *user, size_t user_len,
|
||||||
|
char *pass, size_t pass_len);
|
||||||
|
---
|
||||||
|
|
||||||
|
Parses the Authorization: Basic header
|
||||||
|
Returns -1 iif the authorization type is not "Basic" or any other error such
|
||||||
|
as incorrectly encoded base64 user password pair.
|
||||||
|
|
||||||
@@ -4,7 +4,8 @@ decl_name: "mg_register_http_endpoint"
|
|||||||
symbol_kind: "func"
|
symbol_kind: "func"
|
||||||
signature: |
|
signature: |
|
||||||
void mg_register_http_endpoint(struct mg_connection *nc, const char *uri_path,
|
void mg_register_http_endpoint(struct mg_connection *nc, const char *uri_path,
|
||||||
mg_event_handler_t handler);
|
MG_CB(mg_event_handler_t handler,
|
||||||
|
void *user_data);
|
||||||
---
|
---
|
||||||
|
|
||||||
Registers a callback for a specified http endpoint
|
Registers a callback for a specified http endpoint
|
||||||
@@ -20,7 +21,7 @@ static void handle_hello1(struct mg_connection *nc, int ev, void *ev_data) {
|
|||||||
nc->flags |= MG_F_SEND_AND_CLOSE;
|
nc->flags |= MG_F_SEND_AND_CLOSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_hello1(struct mg_connection *nc, int ev, void *ev_data) {
|
static void handle_hello2(struct mg_connection *nc, int ev, void *ev_data) {
|
||||||
(void) ev; (void) ev_data;
|
(void) ev; (void) ev_data;
|
||||||
mg_printf(nc, "HTTP/1.0 200 OK\r\n\r\n[I am Hello2]");
|
mg_printf(nc, "HTTP/1.0 200 OK\r\n\r\n[I am Hello2]");
|
||||||
nc->flags |= MG_F_SEND_AND_CLOSE;
|
nc->flags |= MG_F_SEND_AND_CLOSE;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ signature: |
|
|||||||
Sends buffer `buf` of size `len` to the client using chunked HTTP encoding.
|
Sends buffer `buf` of size `len` to the client using chunked HTTP encoding.
|
||||||
This function sends the buffer size as hex number + newline first, then
|
This function sends the buffer size as hex number + newline first, then
|
||||||
the buffer itself, then the newline. For example,
|
the buffer itself, then the newline. For example,
|
||||||
`mg_send_http_chunk(nc, "foo", 3)` whill append the `3\r\nfoo\r\n` string
|
`mg_send_http_chunk(nc, "foo", 3)` will append the `3\r\nfoo\r\n` string
|
||||||
to the `nc->send_mbuf` output IO buffer.
|
to the `nc->send_mbuf` output IO buffer.
|
||||||
|
|
||||||
NOTE: The HTTP header "Transfer-Encoding: chunked" should be sent prior to
|
NOTE: The HTTP header "Transfer-Encoding: chunked" should be sent prior to
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ signature: |
|
|||||||
|
|
||||||
Sends the response status line.
|
Sends the response status line.
|
||||||
If `extra_headers` is not NULL, then `extra_headers` are also sent
|
If `extra_headers` is not NULL, then `extra_headers` are also sent
|
||||||
after the reponse line. `extra_headers` must NOT end end with new line.
|
after the response line. `extra_headers` must NOT end end with new line.
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
mg_send_response_line(nc, 200, "Access-Control-Allow-Origin: *");
|
mg_send_response_line(nc, 200, "Access-Control-Allow-Origin: *");
|
||||||
|
|||||||
@@ -100,16 +100,19 @@ signature: |
|
|||||||
/* IP ACL. By default, NULL, meaning all IPs are allowed to connect */
|
/* IP ACL. By default, NULL, meaning all IPs are allowed to connect */
|
||||||
const char *ip_acl;
|
const char *ip_acl;
|
||||||
|
|
||||||
|
#if MG_ENABLE_HTTP_URL_REWRITES
|
||||||
/* URL rewrites.
|
/* URL rewrites.
|
||||||
*
|
*
|
||||||
* Comma-separated list of `uri_pattern=file_or_directory_path` rewrites.
|
* Comma-separated list of `uri_pattern=url_file_or_directory_path` rewrites.
|
||||||
* When HTTP request is received, Mongoose constructs a file name from the
|
* When HTTP request is received, Mongoose constructs a file name from the
|
||||||
* requested URI by combining `document_root` and the URI. However, if the
|
* requested URI by combining `document_root` and the URI. However, if the
|
||||||
* rewrite option is used and `uri_pattern` matches requested URI, then
|
* rewrite option is used and `uri_pattern` matches requested URI, then
|
||||||
* `document_root` is ignored. Instead, `file_or_directory_path` is used,
|
* `document_root` is ignored. Instead, `url_file_or_directory_path` is used,
|
||||||
* which should be a full path name or a path relative to the web server's
|
* which should be a full path name or a path relative to the web server's
|
||||||
* current working directory. Note that `uri_pattern`, as all Mongoose
|
* current working directory. It can also be an URI (http:// or https://)
|
||||||
* patterns, is a prefix pattern.
|
* in which case mongoose will behave as a reverse proxy for that destination.
|
||||||
|
*
|
||||||
|
* Note that `uri_pattern`, as all Mongoose patterns, is a prefix pattern.
|
||||||
*
|
*
|
||||||
* If uri_pattern starts with `@` symbol, then Mongoose compares it with the
|
* If uri_pattern starts with `@` symbol, then Mongoose compares it with the
|
||||||
* HOST header of the request. If they are equal, Mongoose sets document root
|
* HOST header of the request. If they are equal, Mongoose sets document root
|
||||||
@@ -123,6 +126,7 @@ signature: |
|
|||||||
* automatically appended to the redirect location.
|
* automatically appended to the redirect location.
|
||||||
*/
|
*/
|
||||||
const char *url_rewrites;
|
const char *url_rewrites;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* DAV document root. If NULL, DAV requests are going to fail. */
|
/* DAV document root. If NULL, DAV requests are going to fail. */
|
||||||
const char *dav_document_root;
|
const char *dav_document_root;
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ title: "Memory Buffers"
|
|||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "mbuf.h"
|
decl_name: "mbuf.h"
|
||||||
items:
|
items:
|
||||||
- { name: mbuf_init.md }
|
|
||||||
- { name: mbuf_free.md }
|
|
||||||
- { name: mbuf_append.md }
|
- { name: mbuf_append.md }
|
||||||
|
- { name: mbuf_free.md }
|
||||||
|
- { name: mbuf_init.md }
|
||||||
- { name: mbuf_insert.md }
|
- { name: mbuf_insert.md }
|
||||||
- { name: mbuf_remove.md }
|
- { name: mbuf_remove.md }
|
||||||
- { name: mbuf_resize.md }
|
- { name: mbuf_resize.md }
|
||||||
|
|||||||
+17
-15
@@ -3,24 +3,26 @@ title: "MQTT API reference"
|
|||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "mqtt.h"
|
decl_name: "mqtt.h"
|
||||||
items:
|
items:
|
||||||
- { name: mg_set_protocol_mqtt.md }
|
|
||||||
- { name: mg_send_mqtt_handshake.md }
|
|
||||||
- { name: mg_send_mqtt_handshake_opt.md }
|
|
||||||
- { name: mg_mqtt_publish.md }
|
|
||||||
- { name: mg_mqtt_subscribe.md }
|
|
||||||
- { name: mg_mqtt_unsubscribe.md }
|
|
||||||
- { name: mg_mqtt_disconnect.md }
|
|
||||||
- { name: mg_mqtt_connack.md }
|
- { name: mg_mqtt_connack.md }
|
||||||
- { name: mg_mqtt_puback.md }
|
- { name: mg_mqtt_disconnect.md }
|
||||||
- { name: mg_mqtt_pubrec.md }
|
- { name: mg_mqtt_match_topic_expression.md }
|
||||||
- { name: mg_mqtt_pubrel.md }
|
- { name: mg_mqtt_next_subscribe_topic.md }
|
||||||
- { name: mg_mqtt_pubcomp.md }
|
|
||||||
- { name: mg_mqtt_suback.md }
|
|
||||||
- { name: mg_mqtt_unsuback.md }
|
|
||||||
- { name: mg_mqtt_ping.md }
|
- { name: mg_mqtt_ping.md }
|
||||||
- { name: mg_mqtt_pong.md }
|
- { name: mg_mqtt_pong.md }
|
||||||
- { name: mg_mqtt_next_subscribe_topic.md }
|
- { name: mg_mqtt_puback.md }
|
||||||
- { name: struct_mg_mqtt_topic_expression.md }
|
- { name: mg_mqtt_pubcomp.md }
|
||||||
|
- { name: mg_mqtt_publish.md }
|
||||||
|
- { name: mg_mqtt_pubrec.md }
|
||||||
|
- { name: mg_mqtt_pubrel.md }
|
||||||
|
- { name: mg_mqtt_suback.md }
|
||||||
|
- { name: mg_mqtt_subscribe.md }
|
||||||
|
- { name: mg_mqtt_unsuback.md }
|
||||||
|
- { name: mg_mqtt_unsubscribe.md }
|
||||||
|
- { name: mg_mqtt_vmatch_topic_expression.md }
|
||||||
|
- { name: mg_send_mqtt_handshake.md }
|
||||||
|
- { name: mg_send_mqtt_handshake_opt.md }
|
||||||
|
- { name: mg_set_protocol_mqtt.md }
|
||||||
|
- { name: struct_mg_mqtt_proto_data.md }
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
title: "mg_mqtt_match_topic_expression()"
|
||||||
|
decl_name: "mg_mqtt_match_topic_expression"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
int mg_mqtt_match_topic_expression(struct mg_str exp, struct mg_str topic);
|
||||||
|
---
|
||||||
|
|
||||||
|
Matches a topic against a topic expression
|
||||||
|
|
||||||
|
Returns 1 if it matches; 0 otherwise.
|
||||||
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
title: "mg_mqtt_vmatch_topic_expression()"
|
||||||
|
decl_name: "mg_mqtt_vmatch_topic_expression"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
int mg_mqtt_vmatch_topic_expression(const char *exp, struct mg_str topic);
|
||||||
|
---
|
||||||
|
|
||||||
|
Same as `mg_mqtt_match_topic_expression()`, but takes `exp` as a
|
||||||
|
NULL-terminated string.
|
||||||
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
title: "struct mg_mqtt_proto_data"
|
||||||
|
decl_name: "struct mg_mqtt_proto_data"
|
||||||
|
symbol_kind: "struct"
|
||||||
|
signature: |
|
||||||
|
struct mg_mqtt_proto_data {
|
||||||
|
uint16_t keep_alive;
|
||||||
|
};
|
||||||
|
---
|
||||||
|
|
||||||
|
mg_mqtt_proto_data should be in header to allow external access to it
|
||||||
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
---
|
|
||||||
title: "struct mg_mqtt_topic_expression"
|
|
||||||
decl_name: "struct mg_mqtt_topic_expression"
|
|
||||||
symbol_kind: "struct"
|
|
||||||
signature: |
|
|
||||||
struct mg_mqtt_topic_expression {
|
|
||||||
const char *topic;
|
|
||||||
uint8_t qos;
|
|
||||||
};
|
|
||||||
---
|
|
||||||
|
|
||||||
puback
|
|
||||||
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
title: "LIST_ENTRY()"
|
||||||
|
decl_name: "LIST_ENTRY"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
LIST_ENTRY(mg_mqtt_session);
|
||||||
|
---
|
||||||
|
|
||||||
|
Broker
|
||||||
|
|
||||||
@@ -3,11 +3,9 @@ title: "MQTT Server API reference"
|
|||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "mqtt_server.h"
|
decl_name: "mqtt_server.h"
|
||||||
items:
|
items:
|
||||||
- { name: mg_mqtt_broker_init.md }
|
- { name: LIST_ENTRY.md }
|
||||||
- { name: mg_mqtt_broker.md }
|
|
||||||
- { name: mg_mqtt_next.md }
|
|
||||||
- { name: struct_mg_mqtt_session.md }
|
|
||||||
- { name: struct_mg_mqtt_broker.md }
|
- { name: struct_mg_mqtt_broker.md }
|
||||||
|
- { name: struct_mg_mqtt_session.md }
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_mqtt_broker()"
|
|
||||||
decl_name: "mg_mqtt_broker"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mg_mqtt_broker(struct mg_connection *brk, int ev, void *data);
|
|
||||||
---
|
|
||||||
|
|
||||||
Processes a MQTT broker message.
|
|
||||||
|
|
||||||
The listening connection expects a pointer to an initialised
|
|
||||||
`mg_mqtt_broker` structure in the `user_data` field.
|
|
||||||
|
|
||||||
Basic usage:
|
|
||||||
|
|
||||||
```c
|
|
||||||
mg_mqtt_broker_init(&brk, NULL);
|
|
||||||
|
|
||||||
if ((nc = mg_bind(&mgr, address, mg_mqtt_broker)) == NULL) {
|
|
||||||
// fail;
|
|
||||||
}
|
|
||||||
nc->user_data = &brk;
|
|
||||||
```
|
|
||||||
|
|
||||||
New incoming connections will receive a `mg_mqtt_session` structure
|
|
||||||
in the connection `user_data`. The original `user_data` will be stored
|
|
||||||
in the `user_data` field of the session structure. This allows the user
|
|
||||||
handler to store user data before `mg_mqtt_broker` creates the session.
|
|
||||||
|
|
||||||
Since only the MG_EV_ACCEPT message is processed by the listening socket,
|
|
||||||
for most events the `user_data` will thus point to a `mg_mqtt_session`.
|
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_mqtt_broker_init()"
|
|
||||||
decl_name: "mg_mqtt_broker_init"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mg_mqtt_broker_init(struct mg_mqtt_broker *brk, void *user_data);
|
|
||||||
---
|
|
||||||
|
|
||||||
Initialises a MQTT broker.
|
|
||||||
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_mqtt_next()"
|
|
||||||
decl_name: "mg_mqtt_next"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
struct mg_mqtt_session *mg_mqtt_next(struct mg_mqtt_broker *brk,
|
|
||||||
struct mg_mqtt_session *s);
|
|
||||||
---
|
|
||||||
|
|
||||||
Iterates over all MQTT session connections. Example:
|
|
||||||
|
|
||||||
```c
|
|
||||||
struct mg_mqtt_session *s;
|
|
||||||
for (s = mg_mqtt_next(brk, NULL); s != NULL; s = mg_mqtt_next(brk, s)) {
|
|
||||||
// Do something
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
@@ -4,8 +4,8 @@ decl_name: "struct mg_mqtt_broker"
|
|||||||
symbol_kind: "struct"
|
symbol_kind: "struct"
|
||||||
signature: |
|
signature: |
|
||||||
struct mg_mqtt_broker {
|
struct mg_mqtt_broker {
|
||||||
struct mg_mqtt_session *sessions; /* Session list */
|
LIST_HEAD(_mg_sesshead, mg_mqtt_session) sessions; /* Session list */
|
||||||
void *user_data; /* User data */
|
void *user_data; /* User data */
|
||||||
};
|
};
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ decl_name: "struct mg_mqtt_session"
|
|||||||
symbol_kind: "struct"
|
symbol_kind: "struct"
|
||||||
signature: |
|
signature: |
|
||||||
struct mg_mqtt_session {
|
struct mg_mqtt_session {
|
||||||
struct mg_mqtt_broker *brk; /* Broker */
|
struct mg_mqtt_broker *brk; /* Broker */
|
||||||
struct mg_mqtt_session *next, *prev; /* mg_mqtt_broker::sessions linkage */
|
LIST_ENTRY(mg_mqtt_session) link; /* mg_mqtt_broker::sessions linkage */
|
||||||
struct mg_connection *nc; /* Connection with the client */
|
struct mg_connection *nc; /* Connection with the client */
|
||||||
size_t num_subscriptions; /* Size of `subscriptions` array */
|
size_t num_subscriptions; /* Size of `subscriptions` array */
|
||||||
|
void *user_data; /* User data */
|
||||||
struct mg_mqtt_topic_expression *subscriptions;
|
struct mg_mqtt_topic_expression *subscriptions;
|
||||||
void *user_data; /* User data */
|
|
||||||
};
|
};
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
+16
-15
@@ -3,34 +3,35 @@ title: "Core API: TCP/UDP/SSL"
|
|||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "net.h"
|
decl_name: "net.h"
|
||||||
items:
|
items:
|
||||||
- { name: mg_mgr_init.md }
|
|
||||||
- { name: mg_mgr_free.md }
|
|
||||||
- { name: mg_mgr_poll.md }
|
|
||||||
- { name: mg_broadcast.md }
|
|
||||||
- { name: mg_next.md }
|
|
||||||
- { name: mg_add_sock.md }
|
- { name: mg_add_sock.md }
|
||||||
- { name: mg_add_sock_opt.md }
|
- { name: mg_add_sock_opt.md }
|
||||||
- { name: mg_bind.md }
|
- { name: mg_bind.md }
|
||||||
- { name: mg_bind_opt.md }
|
- { name: mg_bind_opt.md }
|
||||||
|
- { name: mg_broadcast.md }
|
||||||
|
- { name: mg_check_ip_acl.md }
|
||||||
- { name: mg_connect.md }
|
- { name: mg_connect.md }
|
||||||
- { name: mg_connect_opt.md }
|
- { name: mg_connect_opt.md }
|
||||||
- { name: mg_set_ssl.md }
|
|
||||||
- { name: mg_send.md }
|
|
||||||
- { name: mg_printf.md }
|
|
||||||
- { name: mg_vprintf.md }
|
|
||||||
- { name: mg_socketpair.md }
|
|
||||||
- { name: mg_check_ip_acl.md }
|
|
||||||
- { name: mg_enable_multithreading.md }
|
|
||||||
- { name: mg_enable_javascript.md }
|
- { name: mg_enable_javascript.md }
|
||||||
|
- { name: mg_mgr_free.md }
|
||||||
|
- { name: mg_mgr_init.md }
|
||||||
|
- { name: mg_mgr_init_opt.md }
|
||||||
|
- { name: mg_mgr_poll.md }
|
||||||
|
- { name: mg_next.md }
|
||||||
|
- { name: mg_printf.md }
|
||||||
|
- { name: mg_resolve.md }
|
||||||
|
- { name: mg_send.md }
|
||||||
|
- { name: mg_set_ssl.md }
|
||||||
- { name: mg_set_timer.md }
|
- { name: mg_set_timer.md }
|
||||||
|
- { name: mg_socketpair.md }
|
||||||
- { name: mg_time.md }
|
- { name: mg_time.md }
|
||||||
|
- { name: mg_vprintf.md }
|
||||||
- { name: mg_event_handler_t.md }
|
- { name: mg_event_handler_t.md }
|
||||||
- { name: struct_mg_mgr.md }
|
|
||||||
- { name: struct_mg_connection.md }
|
|
||||||
- { name: struct_mg_add_sock_opts.md }
|
- { name: struct_mg_add_sock_opts.md }
|
||||||
- { name: struct_mg_bind_opts.md }
|
- { name: struct_mg_bind_opts.md }
|
||||||
- { name: struct_mg_connect_opts.md }
|
- { name: struct_mg_connect_opts.md }
|
||||||
- { name: struct_mg_multithreading_opts.md }
|
- { name: struct_mg_connection.md }
|
||||||
|
- { name: struct_mg_mgr.md }
|
||||||
|
- { name: struct_mg_mgr_init_opts.md }
|
||||||
---
|
---
|
||||||
|
|
||||||
NOTE: Mongoose manager is single threaded. It does not protect
|
NOTE: Mongoose manager is single threaded. It does not protect
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ title: "mg_add_sock()"
|
|||||||
decl_name: "mg_add_sock"
|
decl_name: "mg_add_sock"
|
||||||
symbol_kind: "func"
|
symbol_kind: "func"
|
||||||
signature: |
|
signature: |
|
||||||
struct mg_connection *mg_add_sock(struct mg_mgr *, sock_t, mg_event_handler_t);
|
struct mg_connection *mg_add_sock(struct mg_mgr *mgr, sock_t sock,
|
||||||
|
MG_CB(mg_event_handler_t handler,
|
||||||
|
void *user_data);
|
||||||
---
|
---
|
||||||
|
|
||||||
Creates a connection, associates it with the given socket and event handler
|
Creates a connection, associates it with the given socket and event handler
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ title: "mg_add_sock_opt()"
|
|||||||
decl_name: "mg_add_sock_opt"
|
decl_name: "mg_add_sock_opt"
|
||||||
symbol_kind: "func"
|
symbol_kind: "func"
|
||||||
signature: |
|
signature: |
|
||||||
struct mg_connection *mg_add_sock_opt(struct mg_mgr *, sock_t,
|
struct mg_connection *mg_add_sock_opt(struct mg_mgr *mgr, sock_t sock,
|
||||||
mg_event_handler_t,
|
MG_CB(mg_event_handler_t handler,
|
||||||
struct mg_add_sock_opts);
|
void *user_data);
|
||||||
---
|
---
|
||||||
|
|
||||||
Creates a connection, associates it with the given socket and event handler
|
Creates a connection, associates it with the given socket and event handler
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ title: "mg_bind()"
|
|||||||
decl_name: "mg_bind"
|
decl_name: "mg_bind"
|
||||||
symbol_kind: "func"
|
symbol_kind: "func"
|
||||||
signature: |
|
signature: |
|
||||||
struct mg_connection *mg_bind(struct mg_mgr *, const char *,
|
struct mg_connection *mg_bind(struct mg_mgr *mgr, const char *address,
|
||||||
mg_event_handler_t);
|
MG_CB(mg_event_handler_t handler,
|
||||||
|
void *user_data);
|
||||||
---
|
---
|
||||||
|
|
||||||
Creates a listening connection.
|
Creates a listening connection.
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ decl_name: "mg_bind_opt"
|
|||||||
symbol_kind: "func"
|
symbol_kind: "func"
|
||||||
signature: |
|
signature: |
|
||||||
struct mg_connection *mg_bind_opt(struct mg_mgr *mgr, const char *address,
|
struct mg_connection *mg_bind_opt(struct mg_mgr *mgr, const char *address,
|
||||||
mg_event_handler_t handler,
|
MG_CB(mg_event_handler_t handler,
|
||||||
struct mg_bind_opts opts);
|
void *user_data);
|
||||||
---
|
---
|
||||||
|
|
||||||
Creates a listening connection.
|
Creates a listening connection.
|
||||||
@@ -15,7 +15,7 @@ the same as for the `mg_connect()` call, where `HOST` part is optional.
|
|||||||
`address` can be just a port number, e.g. `:8000`. To bind to a specific
|
`address` can be just a port number, e.g. `:8000`. To bind to a specific
|
||||||
interface, an IP address can be specified, e.g. `1.2.3.4:8000`. By default,
|
interface, an IP address can be specified, e.g. `1.2.3.4:8000`. By default,
|
||||||
a TCP connection is created. To create UDP connection, prepend `udp://`
|
a TCP connection is created. To create UDP connection, prepend `udp://`
|
||||||
prefix, e.g. `udp://:8000`. To summarize, `address` paramer has following
|
prefix, e.g. `udp://:8000`. To summarize, `address` parameter has following
|
||||||
format: `[PROTO://][IP_ADDRESS]:PORT`, where `PROTO` could be `tcp` or
|
format: `[PROTO://][IP_ADDRESS]:PORT`, where `PROTO` could be `tcp` or
|
||||||
`udp`.
|
`udp`.
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ title: "mg_broadcast()"
|
|||||||
decl_name: "mg_broadcast"
|
decl_name: "mg_broadcast"
|
||||||
symbol_kind: "func"
|
symbol_kind: "func"
|
||||||
signature: |
|
signature: |
|
||||||
void mg_broadcast(struct mg_mgr *, mg_event_handler_t func, void *, size_t);
|
void mg_broadcast(struct mg_mgr *mgr, mg_event_handler_t cb, void *data,
|
||||||
|
size_t len);
|
||||||
---
|
---
|
||||||
|
|
||||||
Passes a message of a given length to all connections.
|
Passes a message of a given length to all connections.
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ Subnet masks may vary from 0 to 32, inclusive. The default setting
|
|||||||
is to allow all access. On each request the full list is traversed,
|
is to allow all access. On each request the full list is traversed,
|
||||||
and the last match wins. Example:
|
and the last match wins. Example:
|
||||||
|
|
||||||
`-0.0.0.0/0,+192.168/16` - deny all acccesses, only allow 192.168/16 subnet
|
`-0.0.0.0/0,+192.168/16` - deny all accesses, only allow 192.168/16 subnet
|
||||||
|
|
||||||
To learn more about subnet masks, see this
|
To learn more about subnet masks, see this
|
||||||
link:https://en.wikipedia.org/wiki/Subnetwork[Wikipedia page on Subnetwork].
|
link:https://en.wikipedia.org/wiki/Subnetwork[Wikipedia page on Subnetwork].
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ decl_name: "mg_connect"
|
|||||||
symbol_kind: "func"
|
symbol_kind: "func"
|
||||||
signature: |
|
signature: |
|
||||||
struct mg_connection *mg_connect(struct mg_mgr *mgr, const char *address,
|
struct mg_connection *mg_connect(struct mg_mgr *mgr, const char *address,
|
||||||
mg_event_handler_t handler);
|
MG_CB(mg_event_handler_t handler,
|
||||||
|
void *user_data);
|
||||||
---
|
---
|
||||||
|
|
||||||
Connects to a remote host.
|
Connects to a remote host.
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ decl_name: "mg_connect_opt"
|
|||||||
symbol_kind: "func"
|
symbol_kind: "func"
|
||||||
signature: |
|
signature: |
|
||||||
struct mg_connection *mg_connect_opt(struct mg_mgr *mgr, const char *address,
|
struct mg_connection *mg_connect_opt(struct mg_mgr *mgr, const char *address,
|
||||||
mg_event_handler_t handler,
|
MG_CB(mg_event_handler_t handler,
|
||||||
struct mg_connect_opts opts);
|
void *user_data);
|
||||||
---
|
---
|
||||||
|
|
||||||
Connects to a remote host.
|
Connects to a remote host.
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_enable_multithreading()"
|
|
||||||
decl_name: "mg_enable_multithreading"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
void mg_enable_multithreading(struct mg_connection *nc);
|
|
||||||
---
|
|
||||||
|
|
||||||
Enables multi-threaded handling for the given listening connection `nc`.
|
|
||||||
For each accepted connection, Mongoose will create a separate thread
|
|
||||||
and run an event handler in that thread. Thus, if an event handler is doing
|
|
||||||
a blocking call or some long computation, it will not slow down
|
|
||||||
other connections.
|
|
||||||
|
|
||||||
@@ -3,7 +3,8 @@ title: "mg_event_handler_t"
|
|||||||
decl_name: "mg_event_handler_t"
|
decl_name: "mg_event_handler_t"
|
||||||
symbol_kind: "typedef"
|
symbol_kind: "typedef"
|
||||||
signature: |
|
signature: |
|
||||||
typedef void (*mg_event_handler_t)(struct mg_connection *, int ev, void *);
|
typedef void (*mg_event_handler_t)(struct mg_connection *nc, int ev,
|
||||||
|
void *ev_data MG_UD_ARG(void *user_data));
|
||||||
---
|
---
|
||||||
|
|
||||||
Callback function (event handler) prototype. Must be defined by the user.
|
Callback function (event handler) prototype. Must be defined by the user.
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
title: "mg_mgr_init_opt()"
|
||||||
|
decl_name: "mg_mgr_init_opt"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
void mg_mgr_init_opt(struct mg_mgr *mgr, void *user_data,
|
||||||
|
struct mg_mgr_init_opts opts);
|
||||||
|
---
|
||||||
|
|
||||||
|
Like `mg_mgr_init` but with more options.
|
||||||
|
|
||||||
|
Notably, this allows you to create a manger and choose
|
||||||
|
dynamically which networking interface implementation to use.
|
||||||
|
|
||||||
@@ -3,7 +3,7 @@ title: "mg_next()"
|
|||||||
decl_name: "mg_next"
|
decl_name: "mg_next"
|
||||||
symbol_kind: "func"
|
symbol_kind: "func"
|
||||||
signature: |
|
signature: |
|
||||||
struct mg_connection *mg_next(struct mg_mgr *, struct mg_connection *);
|
struct mg_connection *mg_next(struct mg_mgr *mgr, struct mg_connection *c);
|
||||||
---
|
---
|
||||||
|
|
||||||
Iterates over all active connections.
|
Iterates over all active connections.
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
title: "mg_resolve()"
|
||||||
|
decl_name: "mg_resolve"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
int mg_resolve(const char *domain_name, char *ip_addr_buf, size_t buf_len);
|
||||||
|
---
|
||||||
|
|
||||||
|
Convert domain name into IP address.
|
||||||
|
|
||||||
|
This is a utility function. If compilation flags have
|
||||||
|
`-DMG_ENABLE_GETADDRINFO`, then `getaddrinfo()` call is used for name
|
||||||
|
resolution. Otherwise, `gethostbyname()` is used.
|
||||||
|
|
||||||
|
CAUTION: this function can block.
|
||||||
|
Return 1 on success, 0 on failure.
|
||||||
|
|
||||||
@@ -7,6 +7,7 @@ signature: |
|
|||||||
void *user_data; /* Initial value for connection's user_data */
|
void *user_data; /* Initial value for connection's user_data */
|
||||||
unsigned int flags; /* Initial connection flags */
|
unsigned int flags; /* Initial connection flags */
|
||||||
const char **error_string; /* Placeholder for the error string */
|
const char **error_string; /* Placeholder for the error string */
|
||||||
|
struct mg_iface *iface; /* Interface instance */
|
||||||
};
|
};
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -7,13 +7,32 @@ signature: |
|
|||||||
void *user_data; /* Initial value for connection's user_data */
|
void *user_data; /* Initial value for connection's user_data */
|
||||||
unsigned int flags; /* Extra connection flags */
|
unsigned int flags; /* Extra connection flags */
|
||||||
const char **error_string; /* Placeholder for the error string */
|
const char **error_string; /* Placeholder for the error string */
|
||||||
#ifdef MG_ENABLE_SSL
|
struct mg_iface *iface; /* Interface instance */
|
||||||
/* SSL settings. */
|
#if MG_ENABLE_SSL
|
||||||
const char *ssl_cert; /* Server certificate to present to clients */
|
/*
|
||||||
const char *ssl_key; /* Private key corresponding to the certificate.
|
* SSL settings.
|
||||||
If ssl_cert is set but ssl_key is not, ssl_cert
|
*
|
||||||
is used. */
|
* Server certificate to present to clients or client certificate to
|
||||||
const char *ssl_ca_cert; /* Verify client certificates with this CA bundle */
|
* present to tunnel dispatcher (for tunneled connections).
|
||||||
|
*/
|
||||||
|
const char *ssl_cert;
|
||||||
|
/* Private key corresponding to the certificate. If ssl_cert is set but
|
||||||
|
* ssl_key is not, ssl_cert is used. */
|
||||||
|
const char *ssl_key;
|
||||||
|
/* CA bundle used to verify client certificates or tunnel dispatchers. */
|
||||||
|
const char *ssl_ca_cert;
|
||||||
|
/* Colon-delimited list of acceptable cipher suites.
|
||||||
|
* Names depend on the library used, for example:
|
||||||
|
*
|
||||||
|
* ECDH-ECDSA-AES128-GCM-SHA256:DHE-RSA-AES128-SHA256 (OpenSSL)
|
||||||
|
* TLS-ECDH-ECDSA-WITH-AES-128-GCM-SHA256:TLS-DHE-RSA-WITH-AES-128-GCM-SHA256
|
||||||
|
* (mbedTLS)
|
||||||
|
*
|
||||||
|
* For OpenSSL the list can be obtained by running "openssl ciphers".
|
||||||
|
* For mbedTLS, names can be found in library/ssl_ciphersuites.c
|
||||||
|
* If NULL, a reasonable default is used.
|
||||||
|
*/
|
||||||
|
const char *ssl_cipher_suites;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -7,16 +7,36 @@ signature: |
|
|||||||
void *user_data; /* Initial value for connection's user_data */
|
void *user_data; /* Initial value for connection's user_data */
|
||||||
unsigned int flags; /* Extra connection flags */
|
unsigned int flags; /* Extra connection flags */
|
||||||
const char **error_string; /* Placeholder for the error string */
|
const char **error_string; /* Placeholder for the error string */
|
||||||
#ifdef MG_ENABLE_SSL
|
struct mg_iface *iface; /* Interface instance */
|
||||||
/* SSL settings. */
|
const char *nameserver; /* DNS server to use, NULL for default */
|
||||||
const char *ssl_cert; /* Client certificate to present to the server */
|
#if MG_ENABLE_SSL
|
||||||
const char *ssl_key; /* Private key corresponding to the certificate.
|
/*
|
||||||
If ssl_cert is set but ssl_key is not, ssl_cert
|
* SSL settings.
|
||||||
is used. */
|
* Client certificate to present to the server.
|
||||||
const char *ssl_ca_cert; /* Verify server certificate using this CA bundle.
|
*/
|
||||||
If set to "*", then SSL is enabled but no cert
|
const char *ssl_cert;
|
||||||
verification is performed. */
|
/*
|
||||||
|
* Private key corresponding to the certificate.
|
||||||
|
* If ssl_cert is set but ssl_key is not, ssl_cert is used.
|
||||||
|
*/
|
||||||
|
const char *ssl_key;
|
||||||
|
/*
|
||||||
|
* Verify server certificate using this CA bundle. If set to "*", then SSL
|
||||||
|
* is enabled but no cert verification is performed.
|
||||||
|
*/
|
||||||
|
const char *ssl_ca_cert;
|
||||||
|
/* Colon-delimited list of acceptable cipher suites.
|
||||||
|
* Names depend on the library used, for example:
|
||||||
|
*
|
||||||
|
* ECDH-ECDSA-AES128-GCM-SHA256:DHE-RSA-AES128-SHA256 (OpenSSL)
|
||||||
|
* TLS-ECDH-ECDSA-WITH-AES-128-GCM-SHA256:TLS-DHE-RSA-WITH-AES-128-GCM-SHA256
|
||||||
|
* (mbedTLS)
|
||||||
|
*
|
||||||
|
* For OpenSSL the list can be obtained by running "openssl ciphers".
|
||||||
|
* For mbedTLS, names can be found in library/ssl_ciphersuites.c
|
||||||
|
* If NULL, a reasonable default is used.
|
||||||
|
*/
|
||||||
|
const char *ssl_cipher_suites;
|
||||||
/*
|
/*
|
||||||
* Server name verification. If ssl_ca_cert is set and the certificate has
|
* Server name verification. If ssl_ca_cert is set and the certificate has
|
||||||
* passed verification, its subject will be verified against this string.
|
* passed verification, its subject will be verified against this string.
|
||||||
@@ -25,6 +45,15 @@ signature: |
|
|||||||
* name verification.
|
* name verification.
|
||||||
*/
|
*/
|
||||||
const char *ssl_server_name;
|
const char *ssl_server_name;
|
||||||
|
/*
|
||||||
|
* PSK identity and key. Identity is a NUL-terminated string and key is a hex
|
||||||
|
* string. Key must be either 16 or 32 bytes (32 or 64 hex digits) for AES-128
|
||||||
|
* or AES-256 respectively.
|
||||||
|
* Note: Default list of cipher suites does not include PSK suites, if you
|
||||||
|
* want to use PSK you will need to set ssl_cipher_suites as well.
|
||||||
|
*/
|
||||||
|
const char *ssl_psk_identity;
|
||||||
|
const char *ssl_psk_key;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -14,19 +14,11 @@ signature: |
|
|||||||
size_t recv_mbuf_limit; /* Max size of recv buffer */
|
size_t recv_mbuf_limit; /* Max size of recv buffer */
|
||||||
struct mbuf recv_mbuf; /* Received data */
|
struct mbuf recv_mbuf; /* Received data */
|
||||||
struct mbuf send_mbuf; /* Data scheduled for sending */
|
struct mbuf send_mbuf; /* Data scheduled for sending */
|
||||||
#if defined(MG_ENABLE_SSL)
|
time_t last_io_time; /* Timestamp of the last socket IO */
|
||||||
#if !defined(MG_SOCKET_SIMPLELINK)
|
double ev_timer_time; /* Timestamp of the future MG_EV_TIMER */
|
||||||
SSL *ssl;
|
#if MG_ENABLE_SSL
|
||||||
SSL_CTX *ssl_ctx;
|
void *ssl_if_data; /* SSL library data. */
|
||||||
#else
|
|
||||||
char *ssl_cert;
|
|
||||||
char *ssl_key;
|
|
||||||
char *ssl_ca_cert;
|
|
||||||
char *ssl_server_name;
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
time_t last_io_time; /* Timestamp of the last socket IO */
|
|
||||||
double ev_timer_time; /* Timestamp of the future MG_EV_TIMER */
|
|
||||||
mg_event_handler_t proto_handler; /* Protocol-specific event handler */
|
mg_event_handler_t proto_handler; /* Protocol-specific event handler */
|
||||||
void *proto_data; /* Protocol-specific data */
|
void *proto_data; /* Protocol-specific data */
|
||||||
void (*proto_data_destructor)(void *proto_data);
|
void (*proto_data_destructor)(void *proto_data);
|
||||||
@@ -39,9 +31,10 @@ signature: |
|
|||||||
* void pointers, since some archs might have fat pointers for functions.
|
* void pointers, since some archs might have fat pointers for functions.
|
||||||
*/
|
*/
|
||||||
mg_event_handler_t f;
|
mg_event_handler_t f;
|
||||||
} priv_1; /* Used by mg_enable_multithreading() */
|
} priv_1;
|
||||||
void *priv_2; /* Used by mg_enable_multithreading() */
|
void *priv_2;
|
||||||
void *mgr_data; /* Implementation-specific event manager's data. */
|
void *mgr_data; /* Implementation-specific event manager's data. */
|
||||||
|
struct mg_iface *iface;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
/* Flags set by Mongoose */
|
/* Flags set by Mongoose */
|
||||||
#define MG_F_LISTENING (1 << 0) /* This connection is listening */
|
#define MG_F_LISTENING (1 << 0) /* This connection is listening */
|
||||||
@@ -55,11 +48,12 @@ signature: |
|
|||||||
#define MG_F_IS_WEBSOCKET (1 << 8) /* Websocket specific */
|
#define MG_F_IS_WEBSOCKET (1 << 8) /* Websocket specific */
|
||||||
|
|
||||||
/* Flags that are settable by user */
|
/* Flags that are settable by user */
|
||||||
#define MG_F_SEND_AND_CLOSE (1 << 10) /* Push remaining data and close */
|
#define MG_F_SEND_AND_CLOSE (1 << 10) /* Push remaining data and close */
|
||||||
#define MG_F_CLOSE_IMMEDIATELY (1 << 11) /* Disconnect */
|
#define MG_F_CLOSE_IMMEDIATELY (1 << 11) /* Disconnect */
|
||||||
#define MG_F_WEBSOCKET_NO_DEFRAG (1 << 12) /* Websocket specific */
|
#define MG_F_WEBSOCKET_NO_DEFRAG (1 << 12) /* Websocket specific */
|
||||||
#define MG_F_DELETE_CHUNK (1 << 13) /* HTTP specific */
|
#define MG_F_DELETE_CHUNK (1 << 13) /* HTTP specific */
|
||||||
#define MG_F_ENABLE_BROADCAST (1 << 14) /* Allow broadcast address usage */
|
#define MG_F_ENABLE_BROADCAST (1 << 14) /* Allow broadcast address usage */
|
||||||
|
#define MG_F_TUN_DO_NOT_RECONNECT (1 << 15) /* Don't reconnect tunnel */
|
||||||
|
|
||||||
#define MG_F_USER_1 (1 << 20) /* Flags left for application */
|
#define MG_F_USER_1 (1 << 20) /* Flags left for application */
|
||||||
#define MG_F_USER_2 (1 << 21)
|
#define MG_F_USER_2 (1 << 21)
|
||||||
|
|||||||
@@ -5,15 +5,19 @@ symbol_kind: "struct"
|
|||||||
signature: |
|
signature: |
|
||||||
struct mg_mgr {
|
struct mg_mgr {
|
||||||
struct mg_connection *active_connections;
|
struct mg_connection *active_connections;
|
||||||
|
#if MG_ENABLE_HEXDUMP
|
||||||
const char *hexdump_file; /* Debug hexdump file path */
|
const char *hexdump_file; /* Debug hexdump file path */
|
||||||
#ifndef MG_DISABLE_SOCKETPAIR
|
#endif
|
||||||
|
#if MG_ENABLE_BROADCAST
|
||||||
sock_t ctl[2]; /* Socketpair for mg_broadcast() */
|
sock_t ctl[2]; /* Socketpair for mg_broadcast() */
|
||||||
#endif
|
#endif
|
||||||
void *user_data; /* User data */
|
void *user_data; /* User data */
|
||||||
void *mgr_data; /* Implementation-specific event manager's data. */
|
int num_ifaces;
|
||||||
#ifdef MG_ENABLE_JAVASCRIPT
|
struct mg_iface **ifaces; /* network interfaces */
|
||||||
|
#if MG_ENABLE_JAVASCRIPT
|
||||||
struct v7 *v7;
|
struct v7 *v7;
|
||||||
#endif
|
#endif
|
||||||
|
const char *nameserver; /* DNS server to use */
|
||||||
};
|
};
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
---
|
||||||
|
title: "struct mg_mgr_init_opts"
|
||||||
|
decl_name: "struct mg_mgr_init_opts"
|
||||||
|
symbol_kind: "struct"
|
||||||
|
signature: |
|
||||||
|
struct mg_mgr_init_opts {
|
||||||
|
const struct mg_iface_vtable *main_iface;
|
||||||
|
int num_ifaces;
|
||||||
|
const struct mg_iface_vtable **ifaces;
|
||||||
|
const char *nameserver;
|
||||||
|
};
|
||||||
|
---
|
||||||
|
|
||||||
|
Optional parameters to `mg_mgr_init_opt()`.
|
||||||
|
|
||||||
|
If `main_iface` is not NULL, it will be used as the main interface in the
|
||||||
|
default interface set. The pointer will be free'd by `mg_mgr_free`.
|
||||||
|
Otherwise, the main interface will be autodetected based on the current
|
||||||
|
platform.
|
||||||
|
|
||||||
|
If `num_ifaces` is 0 and `ifaces` is NULL, the default interface set will be
|
||||||
|
used.
|
||||||
|
This is an advanced option, as it requires you to construct a full interface
|
||||||
|
set, including special networking interfaces required by some optional
|
||||||
|
features such as TCP tunneling. Memory backing `ifaces` and each of the
|
||||||
|
`num_ifaces` pointers it contains will be reclaimed by `mg_mgr_free`.
|
||||||
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
title: "struct mg_multithreading_opts"
|
|
||||||
decl_name: "struct mg_multithreading_opts"
|
|
||||||
symbol_kind: "struct"
|
|
||||||
signature: |
|
|
||||||
struct mg_multithreading_opts {
|
|
||||||
int poll_timeout; /* Polling interval */
|
|
||||||
};
|
|
||||||
---
|
|
||||||
|
|
||||||
Optional parameters for mg_enable_multithreading_opt()
|
|
||||||
|
|
||||||
@@ -6,6 +6,7 @@ items:
|
|||||||
- { name: mg_resolve_async.md }
|
- { name: mg_resolve_async.md }
|
||||||
- { name: mg_resolve_async_opt.md }
|
- { name: mg_resolve_async_opt.md }
|
||||||
- { name: mg_resolve_from_hosts_file.md }
|
- { name: mg_resolve_from_hosts_file.md }
|
||||||
|
- { name: mg_set_nameserver.md }
|
||||||
- { name: struct_mg_resolve_async_opts.md }
|
- { name: struct_mg_resolve_async_opts.md }
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
title: "mg_set_nameserver()"
|
||||||
|
decl_name: "mg_set_nameserver"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
void mg_set_nameserver(struct mg_mgr *mgr, const char *nameserver);
|
||||||
|
---
|
||||||
|
|
||||||
|
Set default DNS server
|
||||||
|
|
||||||
@@ -4,7 +4,7 @@ decl_name: "struct mg_resolve_async_opts"
|
|||||||
symbol_kind: "struct"
|
symbol_kind: "struct"
|
||||||
signature: |
|
signature: |
|
||||||
struct mg_resolve_async_opts {
|
struct mg_resolve_async_opts {
|
||||||
const char *nameserver_url;
|
const char *nameserver;
|
||||||
int max_retries; /* defaults to 2 if zero */
|
int max_retries; /* defaults to 2 if zero */
|
||||||
int timeout; /* in seconds; defaults to 5 if zero */
|
int timeout; /* in seconds; defaults to 5 if zero */
|
||||||
int accept_literal; /* pseudo-resolve literal ipv4 and ipv6 addrs */
|
int accept_literal; /* pseudo-resolve literal ipv4 and ipv6 addrs */
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ title: "URI"
|
|||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "uri.h"
|
decl_name: "uri.h"
|
||||||
items:
|
items:
|
||||||
|
- { name: mg_assemble_uri.md }
|
||||||
- { name: mg_parse_uri.md }
|
- { name: mg_parse_uri.md }
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
title: "mg_assemble_uri()"
|
||||||
|
decl_name: "mg_assemble_uri"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
int mg_assemble_uri(const struct mg_str *scheme, const struct mg_str *user_info,
|
||||||
|
const struct mg_str *host, unsigned int port,
|
||||||
|
const struct mg_str *path, const struct mg_str *query,
|
||||||
|
const struct mg_str *fragment, int normalize_path,
|
||||||
|
struct mg_str *uri);
|
||||||
|
---
|
||||||
|
|
||||||
|
Assemble URI from parts. Any of the inputs can be NULL or zero-length mg_str.
|
||||||
|
|
||||||
|
If normalize_path is true, path is normalized by resolving relative refs.
|
||||||
|
|
||||||
|
Result is a heap-allocated string (uri->p must be free()d after use).
|
||||||
|
|
||||||
|
Returns 0 on success, -1 on error.
|
||||||
|
|
||||||
@@ -3,7 +3,7 @@ title: "mg_parse_uri()"
|
|||||||
decl_name: "mg_parse_uri"
|
decl_name: "mg_parse_uri"
|
||||||
symbol_kind: "func"
|
symbol_kind: "func"
|
||||||
signature: |
|
signature: |
|
||||||
int mg_parse_uri(struct mg_str uri, struct mg_str *scheme,
|
int mg_parse_uri(const struct mg_str uri, struct mg_str *scheme,
|
||||||
struct mg_str *user_info, struct mg_str *host,
|
struct mg_str *user_info, struct mg_str *host,
|
||||||
unsigned int *port, struct mg_str *path, struct mg_str *query,
|
unsigned int *port, struct mg_str *path, struct mg_str *query,
|
||||||
struct mg_str *fragment);
|
struct mg_str *fragment);
|
||||||
|
|||||||
+14
-12
@@ -3,25 +3,27 @@ title: "Utility API"
|
|||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "util.h"
|
decl_name: "util.h"
|
||||||
items:
|
items:
|
||||||
- { name: mg_skip.md }
|
|
||||||
- { name: mg_ncasecmp.md }
|
|
||||||
- { name: mg_casecmp.md }
|
|
||||||
- { name: mg_base64_decode.md }
|
- { name: mg_base64_decode.md }
|
||||||
- { name: mg_base64_encode.md }
|
- { name: mg_base64_encode.md }
|
||||||
- { name: mg_stat.md }
|
- { name: mg_basic_auth_header.md }
|
||||||
- { name: mg_fopen.md }
|
|
||||||
- { name: mg_open.md }
|
|
||||||
- { name: mg_start_thread.md }
|
|
||||||
- { name: mg_conn_addr_to_str.md }
|
- { name: mg_conn_addr_to_str.md }
|
||||||
- { name: mg_sock_to_str.md }
|
- { name: mg_fopen.md }
|
||||||
- { name: mg_sock_addr_to_str.md }
|
- { name: mg_fread.md }
|
||||||
|
- { name: mg_fwrite.md }
|
||||||
- { name: mg_hexdump.md }
|
- { name: mg_hexdump.md }
|
||||||
- { name: mg_hexdump_connection.md }
|
- { name: mg_hexdump_connection.md }
|
||||||
- { name: mg_asprintf.md }
|
- { name: mg_hexdumpf.md }
|
||||||
- { name: mg_avprintf.md }
|
|
||||||
- { name: mg_is_big_endian.md }
|
- { name: mg_is_big_endian.md }
|
||||||
- { name: mg_next_comma_list_entry.md }
|
|
||||||
- { name: mg_match_prefix.md }
|
- { name: mg_match_prefix.md }
|
||||||
|
- { name: mg_mbuf_append_base64.md }
|
||||||
|
- { name: mg_mbuf_append_base64_putc.md }
|
||||||
|
- { name: mg_next_comma_list_entry.md }
|
||||||
|
- { name: mg_open.md }
|
||||||
|
- { name: mg_skip.md }
|
||||||
|
- { name: mg_sock_addr_to_str.md }
|
||||||
|
- { name: mg_sock_to_str.md }
|
||||||
|
- { name: mg_start_thread.md }
|
||||||
|
- { name: mg_stat.md }
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_asprintf()"
|
|
||||||
decl_name: "mg_asprintf"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_asprintf(char **buf, size_t size, const char *fmt, ...);
|
|
||||||
---
|
|
||||||
|
|
||||||
Prints message to the buffer. If the buffer is large enough to hold the
|
|
||||||
message, it returns buffer. If buffer is to small, it allocates a large
|
|
||||||
enough buffer on heap and returns allocated buffer.
|
|
||||||
This is a supposed use case:
|
|
||||||
|
|
||||||
char buf[5], *p = buf;
|
|
||||||
mg_avprintf(&p, sizeof(buf), "%s", "hi there");
|
|
||||||
use_p_somehow(p);
|
|
||||||
if (p != buf) {
|
|
||||||
free(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
The purpose of this is to avoid malloc-ing if generated strings are small.
|
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_avprintf()"
|
|
||||||
decl_name: "mg_avprintf"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_avprintf(char **buf, size_t size, const char *fmt, va_list ap);
|
|
||||||
---
|
|
||||||
|
|
||||||
Same as mg_asprintf, but takes varargs list.
|
|
||||||
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
title: "mg_basic_auth_header()"
|
||||||
|
decl_name: "mg_basic_auth_header"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
void mg_basic_auth_header(const struct mg_str user, const struct mg_str pass,
|
||||||
|
struct mbuf *buf);
|
||||||
|
---
|
||||||
|
|
||||||
|
Generate a Basic Auth header and appends it to buf.
|
||||||
|
If pass is NULL, then user is expected to contain the credentials pair
|
||||||
|
already encoded as `user:pass`.
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_casecmp()"
|
|
||||||
decl_name: "mg_casecmp"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_casecmp(const char *s1, const char *s2);
|
|
||||||
---
|
|
||||||
|
|
||||||
Cross-platform version of `strcasecmp()`.
|
|
||||||
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
title: "mg_fread()"
|
||||||
|
decl_name: "mg_fread"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
size_t mg_fread(void *ptr, size_t size, size_t count, FILE *f);
|
||||||
|
---
|
||||||
|
|
||||||
|
Reads data from the given file stream.
|
||||||
|
|
||||||
|
Return value is a number of bytes readen.
|
||||||
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
title: "mg_fwrite()"
|
||||||
|
decl_name: "mg_fwrite"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
size_t mg_fwrite(const void *ptr, size_t size, size_t count, FILE *f);
|
||||||
|
---
|
||||||
|
|
||||||
|
Writes data to the given file stream.
|
||||||
|
|
||||||
|
Return value is a number of bytes wtitten.
|
||||||
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
title: "mg_hexdumpf()"
|
||||||
|
decl_name: "mg_hexdumpf"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
void mg_hexdumpf(FILE *fp, const void *buf, int len);
|
||||||
|
---
|
||||||
|
|
||||||
|
Same as mg_hexdump, but with output going to file instead of a buffer.
|
||||||
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
title: "mg_mbuf_append_base64()"
|
||||||
|
decl_name: "mg_mbuf_append_base64"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
void mg_mbuf_append_base64(struct mbuf *mbuf, const void *data, size_t len);
|
||||||
|
---
|
||||||
|
|
||||||
|
Encode `len` bytes starting at `data` as base64 and append them to an mbuf.
|
||||||
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
title: "mg_mbuf_append_base64_putc()"
|
||||||
|
decl_name: "mg_mbuf_append_base64_putc"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
void mg_mbuf_append_base64_putc(char ch, void *user_data);
|
||||||
|
---
|
||||||
|
|
||||||
|
Use with cs_base64_init/update/finish in order to write out base64 in chunks.
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_ncasecmp()"
|
|
||||||
decl_name: "mg_ncasecmp"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_ncasecmp(const char *s1, const char *s2, size_t len);
|
|
||||||
---
|
|
||||||
|
|
||||||
Cross-platform version of `strncasecmp()`.
|
|
||||||
|
|
||||||
@@ -7,10 +7,10 @@ To create a CoAP client, follow this pattern:
|
|||||||
1. Create an outbound connection by calling `mg_connect`
|
1. Create an outbound connection by calling `mg_connect`
|
||||||
2. Call `mg_set_protocol_coap` for created connection
|
2. Call `mg_set_protocol_coap` for created connection
|
||||||
3. Create an event handler function that handles the following events:
|
3. Create an event handler function that handles the following events:
|
||||||
- `MG_EV_COAP_CON`
|
- `MG_EV_COAP_CON`
|
||||||
- `MG_EV_COAP_NOC`
|
- `MG_EV_COAP_NOC`
|
||||||
- `MG_EV_COAP_ACK`
|
- `MG_EV_COAP_ACK`
|
||||||
- `MG_EV_COAP_RST`
|
- `MG_EV_COAP_RST`
|
||||||
|
|
||||||
Here's an example of the simplest CoAP client.
|
Here's an example of the simplest CoAP client.
|
||||||
Error checking is omitted for the sake of clarity:
|
Error checking is omitted for the sake of clarity:
|
||||||
@@ -39,6 +39,13 @@ static void coap_handler(struct mg_connection *nc, int ev, void *p) {
|
|||||||
s_time_to_exit = 1;
|
s_time_to_exit = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case MG_EV_CLOSE: {
|
||||||
|
if (s_time_to_exit == 0) {
|
||||||
|
printf("Server closed connection\n");
|
||||||
|
s_time_to_exit = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,4 +2,6 @@
|
|||||||
title: DNS client example
|
title: DNS client example
|
||||||
---
|
---
|
||||||
|
|
||||||
TBD
|
See https://github.com/cesanta/mongoose/blob/master/mongoose.c and search
|
||||||
|
for the `mg_resolve_async_eh()` function - that is the core of
|
||||||
|
built-in Mongoose async DNS resolver.
|
||||||
@@ -2,4 +2,8 @@
|
|||||||
title: Overview
|
title: Overview
|
||||||
---
|
---
|
||||||
|
|
||||||
TBD
|
Mongoose uses non-blocking DNS resolver. For each name to be resolved,
|
||||||
|
it first checks the `/etc/hosts` file (or, `hosts` on Windows).
|
||||||
|
If the entry is not found there, then the `8.8.8.8` DNS server is queried.
|
||||||
|
When IP address is found, Mongoose proceeds with making the connection
|
||||||
|
with the resolved IP address.
|
||||||
@@ -29,3 +29,7 @@ Example:
|
|||||||
```c
|
```c
|
||||||
opts.cgi_interpreter = "C:\\ruby\\ruby.exe";
|
opts.cgi_interpreter = "C:\\ruby\\ruby.exe";
|
||||||
```
|
```
|
||||||
|
NOTE: In the CGI handler we don't use explicitly a system call waitpid() for
|
||||||
|
reaping zombie processes. Instead, we set the SIGCHLD handler to SIG_IGN.
|
||||||
|
It will cause zombie processes to be reaped automatically.
|
||||||
|
CAUTION: not all OSes (e.g. QNX) reap zombies if SIGCHLD is ignored.
|
||||||
@@ -18,18 +18,21 @@ static int exit_flag = 0;
|
|||||||
|
|
||||||
static void ev_handler(struct mg_connection *c, int ev, void *p) {
|
static void ev_handler(struct mg_connection *c, int ev, void *p) {
|
||||||
if (ev == MG_EV_HTTP_REPLY) {
|
if (ev == MG_EV_HTTP_REPLY) {
|
||||||
|
struct http_message *hm = (struct http_message *)p;
|
||||||
c->flags |= MG_F_CLOSE_IMMEDIATELY;
|
c->flags |= MG_F_CLOSE_IMMEDIATELY;
|
||||||
fwrite(hm->message.p, 1, hm->message.len, stdout);
|
fwrite(hm->message.p, 1, (int)hm->message.len, stdout);
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
exit_flag = 1;
|
exit_flag = 1;
|
||||||
}
|
} else if (ev == MG_EV_CLOSE) {
|
||||||
|
exit_flag = 1;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
struct mg_mgr mgr;
|
struct mg_mgr mgr;
|
||||||
|
|
||||||
mg_mgr_init(&mgr, NULL);
|
mg_mgr_init(&mgr, NULL);
|
||||||
mg_connect_http(mgr, ev_handler, url, NULL, NULL);
|
mg_connect_http(&mgr, ev_handler, url, NULL, NULL);
|
||||||
|
|
||||||
|
|
||||||
while (exit_flag == 0) {
|
while (exit_flag == 0) {
|
||||||
@@ -41,4 +44,4 @@ int main(void) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
See full source code at [HTTP client example](https://github.com/cesanta/dev/tree/master/mongoose/examples/http_client).
|
See full source code at [HTTP client example](https://github.com/cesanta/mongoose/tree/master/examples/http_client).
|
||||||
@@ -2,4 +2,15 @@
|
|||||||
title: Digest Authentication
|
title: Digest Authentication
|
||||||
---
|
---
|
||||||
|
|
||||||
TBD
|
Mongoose has a built-in Digest (MD5) authentication support. In order to
|
||||||
|
enable Digest authentication, create a file `.htpasswd` in the directory
|
||||||
|
you would like to protect. That file should be in the format that Apache's
|
||||||
|
`htdigest` utility.
|
||||||
|
|
||||||
|
You can use either Apache `htdigest` utility, or
|
||||||
|
Mongoose pre-build binary (https://www.cesanta.com/products/binary)
|
||||||
|
to add new users into that file:
|
||||||
|
|
||||||
|
```
|
||||||
|
mongoose -A /path/to/.htdigest mydomain.com joe joes_password
|
||||||
|
```
|
||||||
@@ -30,8 +30,8 @@ static void ev_handler(struct mg_connection *c, int ev, void *p) {
|
|||||||
|
|
||||||
// We have received an HTTP request. Parsed request is contained in `hm`.
|
// We have received an HTTP request. Parsed request is contained in `hm`.
|
||||||
// Send HTTP reply to the client which shows full original request.
|
// Send HTTP reply to the client which shows full original request.
|
||||||
mg_send_head(c, 200, hm.message.len, "Content-Type: text/plain");
|
mg_send_head(c, 200, hm->message.len, "Content-Type: text/plain");
|
||||||
mg_printf(c, "%.*s", hm.message.len, hm.message.p);
|
mg_printf(c, "%.*s", (int)hm->message.len, hm->message.p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -35,7 +35,7 @@ The exec directive is used to execute a command on a server,
|
|||||||
and show command's output. Example: `<!--#exec "ls -l" -->`
|
and show command's output. Example: `<!--#exec "ls -l" -->`
|
||||||
|
|
||||||
The call directive is a way to invoke a C handler from the HTML page.
|
The call directive is a way to invoke a C handler from the HTML page.
|
||||||
On each occurence of `<!--#call PARAMS -->` directive,
|
On each occurrence of `<!--#call PARAMS -->` directive,
|
||||||
Mongoose calls a registered event handler with `MG_EV_SSI_CALL` event.
|
Mongoose calls a registered event handler with `MG_EV_SSI_CALL` event.
|
||||||
Event parameter will point to the `PARAMS` string.
|
Event parameter will point to the `PARAMS` string.
|
||||||
An event handler can output any text, for example by calling
|
An event handler can output any text, for example by calling
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
title: MQTT client example
|
title: MQTT client example
|
||||||
---
|
---
|
||||||
|
|
||||||
TBD
|
See https://github.com/cesanta/mongoose/tree/master/examples/mqtt_client
|
||||||
@@ -2,4 +2,4 @@
|
|||||||
title: MQTT server example
|
title: MQTT server example
|
||||||
---
|
---
|
||||||
|
|
||||||
TBD
|
See https://github.com/cesanta/mongoose/tree/master/examples/mqtt_broker
|
||||||
@@ -2,10 +2,7 @@
|
|||||||
title: Disabling flags
|
title: Disabling flags
|
||||||
---
|
---
|
||||||
|
|
||||||
- `MG_DISABLE_HTTP_WEBSOCKET` disable HTTP + WebSocket protocol support
|
|
||||||
- `MG_DISABLE_HTTP_DIGEST_AUTH` disable HTTP Digest (MD5) authorisation support
|
- `MG_DISABLE_HTTP_DIGEST_AUTH` disable HTTP Digest (MD5) authorisation support
|
||||||
- `MG_DISABLE_MQTT` disable MQTT support
|
- `CS_DISABLE_SHA1` disable SHA1 support (used by WebSocket)
|
||||||
- `MG_DISABLE_SHA1` disable SHA1 support (used by WebSocket)
|
- `CS_DISABLE_MD5` disable MD5 support (used by HTTP auth)
|
||||||
- `MG_DISABLE_MD5` disable MD5 support (used by HTTP auth)
|
|
||||||
- `MG_DISABLE_SOCKETPAIR` disable `mg_broadcast()` API
|
|
||||||
- `MG_DISABLE_HTTP_KEEP_ALIVE` useful for embedded systems to save resources
|
- `MG_DISABLE_HTTP_KEEP_ALIVE` useful for embedded systems to save resources
|
||||||
@@ -2,10 +2,18 @@
|
|||||||
title: Enabling flags
|
title: Enabling flags
|
||||||
---
|
---
|
||||||
|
|
||||||
- `MG_ENABLE_SSL` Enable OpenSSL support
|
- `MG_ENABLE_SSL` Enable [SSL/TLS support](https://docs.cesanta.com/mongoose/master/#/http/ssl.md/) (OpenSSL API)
|
||||||
- `MG_ENABLE_IPV6` Enable IPV6 support
|
- `MG_ENABLE_IPV6` Enable IPv6 support
|
||||||
- `MG_ENABLE_THREADS` enable `mg_start_thread()` API
|
- `MG_ENABLE_MQTT` enable [MQTT client](https://docs.cesanta.com/mongoose/master/#/mqtt/client_example.md/) (on by default, set to 0 to disable)
|
||||||
- `MG_ENABLE_MQTT_BROKER` enable MQTT broker
|
- `MG_ENABLE_MQTT_BROKER` enable [MQTT broker](https://docs.cesanta.com/mongoose/master/#/mqtt/server_example.md/)
|
||||||
- `MG_ENABLE_DNS_SERVER` enable DNS server
|
- `MG_ENABLE_DNS_SERVER` enable DNS server
|
||||||
- `MG_ENABLE_COAP` enable CoAP protocol
|
- `MG_ENABLE_COAP` enable CoAP protocol
|
||||||
|
- `MG_ENABLE_HTTP` Enable HTTP protocol support (on by default, set to 0 to disable)
|
||||||
|
- `MG_ENABLE_HTTP_CGI` Enable [CGI](https://docs.cesanta.com/mongoose/master/#/http/cgi.md/) support
|
||||||
|
- `MG_ENABLE_HTTP_SSI` Enable [Server Side Includes](https://docs.cesanta.com/mongoose/master/#/http/ssi.md/) support
|
||||||
|
- `MG_ENABLE_HTTP_SSI_EXEC` Enable SSI `exec` operator
|
||||||
|
- `MG_ENABLE_HTTP_WEBDAV` enable WebDAV extensions to HTTP
|
||||||
|
- `MG_ENABLE_HTTP_WEBSOCKET` enable WebSocket extension to HTTP (on by default, =0 to disable)
|
||||||
|
- `MG_ENABLE_BROADCAST` enable `mg_broadcast()` API
|
||||||
- `MG_ENABLE_GETADDRINFO` enable `getaddrinfo()` in `mg_resolve2()`
|
- `MG_ENABLE_GETADDRINFO` enable `getaddrinfo()` in `mg_resolve2()`
|
||||||
|
- `MG_ENABLE_THREADS` enable `mg_start_thread()` API
|
||||||
@@ -5,6 +5,5 @@ title: Platform specific
|
|||||||
Mongoose tries to detect the target platform whenever possible, but in some cases you have
|
Mongoose tries to detect the target platform whenever possible, but in some cases you have
|
||||||
to explicitly declare some peculiarities of your target, such as:
|
to explicitly declare some peculiarities of your target, such as:
|
||||||
|
|
||||||
- `MG_LWIP`: use LWIP networking stack
|
|
||||||
- `MG_CC3200`: enable workarounds for the TI CC3200 target.
|
- `MG_CC3200`: enable workarounds for the TI CC3200 target.
|
||||||
- `MG_ESP8266`: enable workarounds for the ESP8266 target, add `RTOS_SDK` to specify the RTOS SDK flavour.
|
- `MG_ESP8266`: enable workarounds for the ESP8266 target, add `RTOS_SDK` to specify the RTOS SDK flavour.
|
||||||
@@ -9,3 +9,4 @@ title: Tunables
|
|||||||
- `MG_SSL_CRYPTO_MODERN`, `MG_SSL_CRYPTO_OLD` - choose either "Modern" or "Old" ciphers
|
- `MG_SSL_CRYPTO_MODERN`, `MG_SSL_CRYPTO_OLD` - choose either "Modern" or "Old" ciphers
|
||||||
instead of the default "Intermediate" setting.
|
instead of the default "Intermediate" setting.
|
||||||
See [this article](https://wiki.mozilla.org/Security/Server_Side_TLS#Recommended_configurations) for details.
|
See [this article](https://wiki.mozilla.org/Security/Server_Side_TLS#Recommended_configurations) for details.
|
||||||
|
- `MG_USER_FILE_FUNCTIONS` allow you to use custom file operation, by defining you own `mg_stat`, `mg_fopen`, `mg_open`, `mg_fread` and `mg_fwrite` functions
|
||||||
@@ -1 +0,0 @@
|
|||||||
*.exe
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* app.ld
|
* app.ld
|
||||||
*
|
*
|
||||||
* GCC Linker script for Mongoose IoT. Based on TI's example "blinky.ld".
|
* GCC Linker script for Mongoose OS. Based on TI's example "blinky.ld".
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
|
* Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
|
||||||
*
|
*
|
||||||
@@ -42,9 +42,8 @@ HEAP_SIZE = 0xB000;
|
|||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
/* SRAM size of 240KB (0x3C000) for cc3200 ES 1.33 device onward,
|
/* SRAM size of 240KB (0x3C000) for cc3200 ES 1.33 device onward,
|
||||||
* 176KB (0x2C000) for XCC3200HZ (pre-release device).
|
* 176KB (0x2C000) for XCC3200HZ (pre-release device). */
|
||||||
* We use the latter for maximum compatibility. */
|
SRAM (rwx) : ORIGIN = 0x20004000, LENGTH = 0x3C000
|
||||||
SRAM (rwx) : ORIGIN = 0x20004000, LENGTH = 0x2C000
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
|
|||||||
@@ -24,11 +24,12 @@
|
|||||||
<listOptionValue builtIn="false" value="RUNTIME_SUPPORT_LIBRARY=libc.a"/>
|
<listOptionValue builtIn="false" value="RUNTIME_SUPPORT_LIBRARY=libc.a"/>
|
||||||
<listOptionValue builtIn="false" value="OUTPUT_TYPE=executable"/>
|
<listOptionValue builtIn="false" value="OUTPUT_TYPE=executable"/>
|
||||||
</option>
|
</option>
|
||||||
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.324606890" name="Compiler version" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="5.2.7" valueType="string"/>
|
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.324606890" name="Compiler version" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="5.2.8" valueType="string"/>
|
||||||
<targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.targetPlatformDebug.1595303251" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.targetPlatformDebug"/>
|
<targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.targetPlatformDebug.1595303251" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.targetPlatformDebug"/>
|
||||||
<builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.builderDebug.664577987" keepEnvironmentInBuildfile="false" name="GNU Make" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.builderDebug"/>
|
<builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.builderDebug.664577987" keepEnvironmentInBuildfile="false" name="GNU Make" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.builderDebug"/>
|
||||||
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.compilerDebug.239238133" name="ARM Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.compilerDebug">
|
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.compilerDebug.239238133" name="ARM Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.compilerDebug">
|
||||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE.1334773591" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE" valueType="definedSymbols">
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE.1334773591" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE" valueType="definedSymbols">
|
||||||
|
<listOptionValue builtIn="false" value="MG_ENABLE_FILESYSTEM=1"/>
|
||||||
<listOptionValue builtIn="false" value="MG_ENABLE_HTTP_STREAMING_MULTIPART=1"/>
|
<listOptionValue builtIn="false" value="MG_ENABLE_HTTP_STREAMING_MULTIPART=1"/>
|
||||||
<listOptionValue builtIn="false" value="SL_PLATFORM_MULTI_THREADED=1"/>
|
<listOptionValue builtIn="false" value="SL_PLATFORM_MULTI_THREADED=1"/>
|
||||||
<listOptionValue builtIn="false" value="MG_FS_SLFS=1"/>
|
<listOptionValue builtIn="false" value="MG_FS_SLFS=1"/>
|
||||||
@@ -123,11 +124,12 @@
|
|||||||
<listOptionValue builtIn="false" value="RUNTIME_SUPPORT_LIBRARY=libc.a"/>
|
<listOptionValue builtIn="false" value="RUNTIME_SUPPORT_LIBRARY=libc.a"/>
|
||||||
<listOptionValue builtIn="false" value="OUTPUT_TYPE=executable"/>
|
<listOptionValue builtIn="false" value="OUTPUT_TYPE=executable"/>
|
||||||
</option>
|
</option>
|
||||||
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.541661556" name="Compiler version" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="5.2.7" valueType="string"/>
|
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.541661556" name="Compiler version" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="5.2.8" valueType="string"/>
|
||||||
<targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.targetPlatformRelease.1731528219" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.targetPlatformRelease"/>
|
<targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.targetPlatformRelease.1731528219" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.targetPlatformRelease"/>
|
||||||
<builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.builderRelease.1517621311" keepEnvironmentInBuildfile="false" name="GNU Make" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.builderRelease"/>
|
<builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.builderRelease.1517621311" keepEnvironmentInBuildfile="false" name="GNU Make" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.builderRelease"/>
|
||||||
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.compilerRelease.1511107079" name="ARM Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.compilerRelease">
|
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.compilerRelease.1511107079" name="ARM Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.compilerRelease">
|
||||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE.709446512" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE" valueType="definedSymbols">
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE.709446512" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE" valueType="definedSymbols">
|
||||||
|
<listOptionValue builtIn="false" value="MG_ENABLE_FILESYSTEM=1"/>
|
||||||
<listOptionValue builtIn="false" value="MG_ENABLE_HTTP_STREAMING_MULTIPART=1"/>
|
<listOptionValue builtIn="false" value="MG_ENABLE_HTTP_STREAMING_MULTIPART=1"/>
|
||||||
<listOptionValue builtIn="false" value="SL_PLATFORM_MULTI_THREADED=1"/>
|
<listOptionValue builtIn="false" value="SL_PLATFORM_MULTI_THREADED=1"/>
|
||||||
<listOptionValue builtIn="false" value="MG_FS_SLFS=1"/>
|
<listOptionValue builtIn="false" value="MG_FS_SLFS=1"/>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
// #define WIFI_STA_SSID "YourWiFi"
|
// #define WIFI_STA_SSID "YourWiFi"
|
||||||
// #define WIFI_STA_PASS "YourPass"
|
// #define WIFI_STA_PASS "YourPass"
|
||||||
|
|
||||||
#define MG_TASK_PRIORITY 3
|
#define MGOS_TASK_PRIORITY 3
|
||||||
#define MG_TASK_STACK_SIZE 8192
|
#define MG_TASK_STACK_SIZE 8192
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
@@ -214,7 +214,7 @@ int main(void) {
|
|||||||
LOG(LL_ERROR, ("Failed to create SL task"));
|
LOG(LL_ERROR, ("Failed to create SL task"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mg_start_task(MG_TASK_PRIORITY, MG_TASK_STACK_SIZE, mg_init)) {
|
if (!mg_start_task(MGOS_TASK_PRIORITY, MG_TASK_STACK_SIZE, mg_init)) {
|
||||||
LOG(LL_ERROR, ("Failed to create MG task"));
|
LOG(LL_ERROR, ("Failed to create MG task"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,11 +24,12 @@
|
|||||||
<listOptionValue builtIn="false" value="RUNTIME_SUPPORT_LIBRARY=libc.a"/>
|
<listOptionValue builtIn="false" value="RUNTIME_SUPPORT_LIBRARY=libc.a"/>
|
||||||
<listOptionValue builtIn="false" value="OUTPUT_TYPE=executable"/>
|
<listOptionValue builtIn="false" value="OUTPUT_TYPE=executable"/>
|
||||||
</option>
|
</option>
|
||||||
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.324606890" name="Compiler version" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="5.2.7" valueType="string"/>
|
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.324606890" name="Compiler version" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="5.2.8" valueType="string"/>
|
||||||
<targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.targetPlatformDebug.1595303251" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.targetPlatformDebug"/>
|
<targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.targetPlatformDebug.1595303251" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.targetPlatformDebug"/>
|
||||||
<builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.builderDebug.664577987" keepEnvironmentInBuildfile="false" name="GNU Make" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.builderDebug"/>
|
<builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.builderDebug.664577987" keepEnvironmentInBuildfile="false" name="GNU Make" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.builderDebug"/>
|
||||||
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.compilerDebug.239238133" name="ARM Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.compilerDebug">
|
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.compilerDebug.239238133" name="ARM Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.compilerDebug">
|
||||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE.1334773591" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE" valueType="definedSymbols">
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE.1334773591" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE" valueType="definedSymbols">
|
||||||
|
<listOptionValue builtIn="false" value="MG_ENABLE_FILESYSTEM=1"/>
|
||||||
<listOptionValue builtIn="false" value="MG_ENABLE_HTTP_STREAMING_MULTIPART=1"/>
|
<listOptionValue builtIn="false" value="MG_ENABLE_HTTP_STREAMING_MULTIPART=1"/>
|
||||||
<listOptionValue builtIn="false" value="SL_PLATFORM_MULTI_THREADED=1"/>
|
<listOptionValue builtIn="false" value="SL_PLATFORM_MULTI_THREADED=1"/>
|
||||||
<listOptionValue builtIn="false" value="MG_FS_SLFS=1"/>
|
<listOptionValue builtIn="false" value="MG_FS_SLFS=1"/>
|
||||||
@@ -123,11 +124,12 @@
|
|||||||
<listOptionValue builtIn="false" value="RUNTIME_SUPPORT_LIBRARY=libc.a"/>
|
<listOptionValue builtIn="false" value="RUNTIME_SUPPORT_LIBRARY=libc.a"/>
|
||||||
<listOptionValue builtIn="false" value="OUTPUT_TYPE=executable"/>
|
<listOptionValue builtIn="false" value="OUTPUT_TYPE=executable"/>
|
||||||
</option>
|
</option>
|
||||||
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.541661556" name="Compiler version" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="5.2.7" valueType="string"/>
|
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.541661556" name="Compiler version" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="5.2.8" valueType="string"/>
|
||||||
<targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.targetPlatformRelease.1731528219" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.targetPlatformRelease"/>
|
<targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.targetPlatformRelease.1731528219" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.targetPlatformRelease"/>
|
||||||
<builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.builderRelease.1517621311" keepEnvironmentInBuildfile="false" name="GNU Make" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.builderRelease"/>
|
<builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.builderRelease.1517621311" keepEnvironmentInBuildfile="false" name="GNU Make" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.builderRelease"/>
|
||||||
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.compilerRelease.1511107079" name="ARM Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.compilerRelease">
|
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.compilerRelease.1511107079" name="ARM Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.compilerRelease">
|
||||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE.709446512" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE" valueType="definedSymbols">
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE.709446512" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE" valueType="definedSymbols">
|
||||||
|
<listOptionValue builtIn="false" value="MG_ENABLE_FILESYSTEM=1"/>
|
||||||
<listOptionValue builtIn="false" value="MG_ENABLE_HTTP_STREAMING_MULTIPART=1"/>
|
<listOptionValue builtIn="false" value="MG_ENABLE_HTTP_STREAMING_MULTIPART=1"/>
|
||||||
<listOptionValue builtIn="false" value="SL_PLATFORM_MULTI_THREADED=1"/>
|
<listOptionValue builtIn="false" value="SL_PLATFORM_MULTI_THREADED=1"/>
|
||||||
<listOptionValue builtIn="false" value="MG_FS_SLFS=1"/>
|
<listOptionValue builtIn="false" value="MG_FS_SLFS=1"/>
|
||||||
|
|||||||
Loaded 100 of 301 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user