Commit Graph

331 Commits

Author SHA1 Message Date
Deomid Ryabkov
75059d1bdc Rename MG_DISABLE_CGI -> MG_ENABLE_CGI
Also factor out CGI-related code from http.c, it's getting too big.

Build tests with -Wundef

PUBLISHED_FROM=a1e82fafba73812c249db0b49c59d1b48417b60d
2016-10-13 19:22:50 +00:00
Deomid Ryabkov
bafc30bec6 Change from using #ifdef to #if for features tests
"#if FOO" still works with simple -DFOO, but gives more flexibility.
Specifically, if user expressed no preference (FOO is not defined),
we can apply reasonable defaults (this is the legitimate use of ifdef).

In short, from now on, please use

 #if MG_ENABLE_FOO

instead of

 #ifdef MG_ENABLE_FOO

Since we are all used to #ifdef, this change also adds a precommit check
to police this. Specifically, in *.h and *.c files that are Copyright Cesanta,
"ifdef" and "if defined()" are not allowed to be used with macros that contain
ENABLE or DISABLE, unless the like also contains "ifdef-ok".

Hence, if you are sure you want to use ifdef, use this:

 #ifdef MG_ENABLE_FOO /* ifdef-ok */

PUBLISHED_FROM=9be829448f53cff575d6cae8b9945fb12531c15a
2016-10-13 18:07:25 +00:00
Alexander Alashkin
0a8f839281 Mongoose 6.6
PUBLISHED_FROM=23d031720d8d6e170eab6bd615797f33e36a6701
2016-10-12 10:06:27 +00:00
Deomid Ryabkov
ab48174bac esp_mg_net_if refactoring: split LWIP & ESP parts
esp_mg_net_if was a rat's nest of mongoose net_if and event manager
implementaions and the event loop task for the ESP8266 miot port.
From that, pieces that are related to LWIP support have been pulled out,
separated into net_if and event manager files, and event loop task
has been moved under the miot esp8266 dirrectory.

This is done to facilitate LWIP code reuse. This may not be the end of
it, but it's a start.

Note: custom retransmit logic has been removed for now. Can be
reintroduced later is necessary.

PUBLISHED_FROM=fd5bbf75714583ce95776d4c76b6c5b5dc535364
2016-10-11 18:38:10 +00:00
Marko Mikulicic
4439251f17 Add MBED as platform
Currently this allows V7 to be built on MBED; more
work is likely required to port mongoose.

PUBLISHED_FROM=32cd0a38349c8e9019af46d4ce7e1429e660db25
2016-10-11 10:29:41 +00:00
Deomid Ryabkov
f9a6403b11 Add MG_EV_SSI_CALL_CTX
This is the variant of MG_EV_SSI_CALL with context of the SSI call being
processed in addition to the tag argument. Specifically, call handler
now gets access to the HTTP request and the name of the file being processed.

MG_EV_SSI_CALL is preserved for backward compatibility.

PUBLISHED_FROM=eeea7487c062505abdb23b6f64994ff7a6b60ff8
2016-10-04 23:51:29 +00:00
Deomid Ryabkov
8b12263dbc Fix mg_http_send_redirect doc
PUBLISHED_FROM=77cd3df9959b0e3a2550d1581586e69878bbee0d
2016-09-30 13:06:39 +00:00
Alexander Alashkin
376d2666a5 Add PIC32MX/CC3100 mqtt_client example
PUBLISHED_FROM=cda885a9dc5d1203b7b59b13ea7fd7934b31260a
2016-09-30 12:39:35 +00:00
Deomid Ryabkov
d90622630f Link MIOT for Linux statically
PUBLISHED_FROM=4f0adab828ebf06dbc3e0c4333bf0053f374b62f
2016-09-30 12:39:32 +00:00
Alexander Alashkin
da447b1067 Add PIC32MX/CC3100 mqtt_client example
PUBLISHED_FROM=cda885a9dc5d1203b7b59b13ea7fd7934b31260a
2016-09-30 12:37:08 +00:00
Deomid Ryabkov
460d95afc5 Add mg_http_send_redirect and make examples use it
PUBLISHED_FROM=f45e06aeba1c00212078d539b6f74cb8bd054326
2016-09-30 11:22:00 +00:00
Marko Mikulicic
286fa90ee9 Simple mDNS + DNS-SD impl
Main TODOs:
1. the spec requires the impl to resend the reply once and
   to send gratuitous updates

2. advertise our clubby services as DNS-SD sub-services.

---

Tested with:

1. https://play.google.com/store/apps/details?id=com.grokkt.android.bonjour&hl=en
2. https://play.google.com/store/apps/details?id=com.druk.bonjour.browser&hl=en
3. osx `dns-sd`

Works well enough; it doesn't have some glitches due the fact that we
don't retransmit yet and we don't send gratuitous updates.

PUBLISHED_FROM=38d7a50beb274d4aeeda5b0b58e44dfa0789da84
2016-09-28 08:51:47 +00:00
Deomid Ryabkov
4d76a3be4c Amalgamation changes - clean up paths
Make paths embedded in amalgamated files nice and relative.
This facilitates subsequent clean un- and re-amalgamation.

PUBLISHED_FROM=d83e6000617c54ceaeb78b80c25814996043fe66
2016-09-27 05:06:32 +00:00
Deomid Ryabkov
7414a4fb06 Stop pretending that sl_* API is BSD-compatible
PUBLISHED_FROM=355fea9a5a75ac926d4c64d41828ebcd96c04080
2016-09-22 19:51:06 +00:00
Alexander Alashkin
6746933a3d Fix Windows compilation
PUBLISHED_FROM=04bcd98025263f32d337730cf179bdfc35b683f1
2016-09-15 12:21:53 +00:00
Dmitry Frank
8cb2833fa7 Implement miot dev call
PUBLISHED_FROM=40d62ce03a4f739b458076395941e4ad7c932fb3
2016-09-15 12:21:52 +00:00
Alexander Alashkin
1730f3c0c9 Fix Windows compilation
PUBLISHED_FROM=04bcd98025263f32d337730cf179bdfc35b683f1
2016-09-15 12:21:21 +00:00
Sergey Lyubka
d6dda04f4f Update mg_mgr docstring
PUBLISHED_FROM=da57dfe52e315dc1901d761289f0445be6e93cea
2016-09-13 11:37:47 +00:00
Artem Bulavin
1b0825ef4b Docs deployment via docs/make_doc
PUBLISHED_FROM=da5f7f80a9876ac4f1889a1176a3048f47980659
2016-09-13 11:37:46 +00:00
Sergey Lyubka
7249b2bd5f Update mg_mgr docstring
PUBLISHED_FROM=da57dfe52e315dc1901d761289f0445be6e93cea
2016-09-13 11:36:17 +00:00
Alexander Alashkin
238bf1a29e Fix MSVC2015 warnings in mongoose
PUBLISHED_FROM=9e2d5c45d112b9e9493d995b12fe989e93d66d5b
2016-09-13 08:51:20 +00:00
Alexander Alashkin
4cbf81da59 Use user timeout in multithreading polling
PUBLISHED_FROM=dbf75bfba087f1b0aa0531e5003ba3e69ed1a6ab
2016-09-12 14:21:05 +00:00
Alexander Alashkin
d9b7ec18e7 Add MG_F_ENABLE_BROADCAST option
PUBLISHED_FROM=293a54ab09e6879b6f0c36975a137eeaeff92098
2016-09-12 12:36:56 +00:00
Dmitry Frank
2a541175b5 Use void arguments list consistently in C code
On my way, fixed a couple of cases where we had `()` in the header, and
non-empty argument list in the source file.

PUBLISHED_FROM=5519526cf84e2bbd425a726fcc112fea1a95cbf1
2016-09-05 15:51:19 +00:00
Alexander Alashkin
5f93f7162f Add STM32F4/CC3100 example & Co
PUBLISHED_FROM=7f805d89dcb795c9b3ee637ef1dbdcfcf3323469
2016-09-05 15:06:21 +00:00
Sergey Lyubka
12437fd7fe Refactor Mongoose documentation
PUBLISHED_FROM=e9a4e5c7b4a1d03b93a2a79e29de19e60e919929
2016-09-01 14:35:02 +00:00
Deomid Ryabkov
0fe9ec1499 C Clubby refactoring
Complete rewrite of the C Clubby implementation: it is now modeled after
the Go implementation, with a slight difference that codec and channel
are the same object (something we should probably do in Go as well, as
we only have a single type of channel so far, which is used with all
types of codecs).

This implementation also comes with a new external API,
which is hopefully cleaner and easier to use (see mg_clubby.h).

In this PR I am not adding any new types of channels, but a UART channel
as well as websocket listener channel will be added after this lands.

PUBLISHED_FROM=d545d4bb6434e2a02ad159f9e4b64e594a4797e7
2016-08-29 11:20:54 +00:00
Artem Bulavin
fd839f1827 Pointer to int casting warning
PUBLISHED_FROM=6bf2a710edaae6133d68eaf900ede14bba75ad5a
2016-08-19 09:05:55 +00:00
Alexander Alashkin
f149f4aab1 Remove cs_dbg.h from amalgamated headers
PUBLISHED_FROM=993c4b1bec363e3f7975b83710e694792bedf5b3
2016-08-18 14:06:18 +00:00
Deomid Ryabkov
5fa544fc78 Make mg_http_serve_file public
A way to serve a single, specific file as opposed to the hairy monster
that is mg_serve_http.

PUBLISHED_FROM=6ed1bc487b9d41d212a5907337182f23b040aecf
2016-08-09 10:51:02 +00:00
Dmitry Frank
849ec1684a Apply Mongoose docs edits by Ev
PUBLISHED_FROM=5cd78790a03580aa23dd3d2d8b825ad449083cc2
2016-07-26 15:06:04 +00:00
Deomid Ryabkov
15643f8e67 Use rand() instead of random(), it's more standard
Remove the random() stubs from the codebase

PUBLISHED_FROM=0f56ec7dffa0af1f5061a17d8801239d6f0e32a5
2016-07-22 11:06:16 +00:00
Deomid Ryabkov
b987df1974 Refactor sys_config and ro_vars
Use the same config mechanism for ro_vars as for sys_config, get rid of a bunch of custom code.

PUBLISHED_FROM=d2be76cb97090669dd6a21e95d0ba821eaa1a313
2016-07-21 16:35:59 +00:00
Marko Mikulicic
e91a7c9599 Reamalgam after .h edits
PUBLISHED_FROM=da1faa9b46cd0ff22dcba6d324b5847c4a0d42d8
2016-07-21 15:06:41 +00:00
Sergey Lyubka
810eab9a58 Add SSI doc string
PUBLISHED_FROM=73540bf103672916eae35959d5e992a3616a6604
2016-07-20 11:07:37 +00:00
Deomid Ryabkov
9f78a2902b Fix SSL stuff
Do not use CA bundle on CC3200, it doesn't work.
Make ssl_ca_cert = "*" mean "no verification" and make sure
SSL is enabled on the connection when it's required, even w/o verification.

PUBLISHED_FROM=c8710a5d24ecfe174ef45b7f81c114d41faf5c12
2016-07-14 13:19:55 +00:00
Alexander Alashkin
68dd8d277d Get rid of ubjson
PUBLISHED_FROM=e6f1dca95ec7ed3795adf493cca9cdcdc07381f5
2016-07-12 20:49:59 +00:00
Deomid Ryabkov
36a1927915 Mongoose 6.5
PUBLISHED_FROM=d151a5a0bf34b135a7a2c879f5a6bd5676af275a
2016-07-12 13:20:04 +00:00
Deomid Ryabkov
c907e6c5fb Commonize mg_str
PUBLISHED_FROM=0e6a1c1a2356c1e12580e498c64ba7be367f601c
2016-07-06 23:49:57 +00:00
Deomid Ryabkov
29b3950ee7 Handle SimpleLink restarts in Mongoose
SimpleLink restart invalidates all sockets.
Listeners are restarted, outgoing connections are closed.

PUBLISHED_FROM=15567dfb822bffbd44d39ba0e69a7ac64fd7a1c8
2016-07-06 13:56:50 +00:00
Sergey Lyubka
b7a0748312 Ditch JSON-RPC from mongoose
PUBLISHED_FROM=89b978c02be2f10eb930ff13673d45249fd67763
2016-07-01 11:35:18 +00:00
rojer
1d4f97bb4c SimpleLink net_if impl w/ async support; MG_F_SSL
SimpleLink sockets are suffciently different from BSD that all the
ifdefs have become too messy to warrant a separate net_if
implementation. As part of this we also implement proper async connect
support.

Added MG_F_SSL to identify SSL-enabled connections in a generic way,
since SSL state can be different depending on the implementation.

PUBLISHED_FROM=9cdb8c880b90683e4a26b972cf439d47d6f60917
2016-06-09 17:49:53 +00:00
rojer
dcf1cedec9 SimpleLink SSL support; split cert and key opts
SL requires cert and key to be separate files in DER format.

Date verification is disabled for now.

PUBLISHED_FROM=7d76150ed356140728a1e5fd82d8a0456347b7dc
2016-06-09 11:04:56 +00:00
rojer
04a38b446f Fix compilation with MG_DISABLE_HTTP_WEBSOCKET
Make restful_server and netcat examples compilation tests:
 - netcat doesn't use HTTP, compile it with MG_DISABLE_HTTP
 - restful_server doesn't use websocket, compile it with
   MG_DISABLE_HTTP_WEBSOCKET

h/t @labourcier, cesanta/mongoose#665

PUBLISHED_FROM=4494ac3cbd81e8314beb557ab301b4b44c4afb89
2016-06-07 16:43:24 +02:00
Dmitry Frank
177e829f4b Add v7 arg to _mk_ and _get_ functions
`v7_mk_undefined()` and `v7_mk_null()` are left unchanged, but marked
deprecated, and `V7_UNDEFINED` and `V7_NULL` are public now.

Xtensa code size with instrumentation: 590400 -> 590432, i.e. 32 bytes.
Xtensa code size without instrumentation: 530848 -> 531760, i.e. 912
bytes.

As objdump reveals, inside v7.c, `v7_mk_number` and others are inlined,
so the extra v7 argument is eliminated; outside of v7.c it's obviously
not inlined.

----

Also, v7_get_int() is added, which currently just casts stored double
value to int

PUBLISHED_FROM=e984b7308faf2380b3de388f238e0fae0aea545d
2016-05-28 18:59:27 +01:00
Sergey Lyubka
4ac688e560 Make mg_http_check_digest_auth() public
PUBLISHED_FROM=f00b94cabc2a89d27d5bc78d68d67db0930811b4
2016-05-16 13:57:13 +03:00
Deomid Ryabkov
5d0a5cfe72 Add CPP guards to net_if.h
cesanta/mongoose#653

PUBLISHED_FROM=a676dbce6d04b78ca316a4601e9cbb676ecc88d2
2016-05-15 22:07:14 +03:00
Marko Mikulicic
c84af7d1e2 Use stdint.h on MSVC >= 2012
Closes cesanta/mongoose#659

PUBLISHED_FROM=8a2e029715e5e7f9a2c75eea9b55270c51b273ef
2016-05-11 19:30:38 +02:00
Sergey Lyubka
19a28b3c81 Update cs_md5 description according to reality
PUBLISHED_FROM=b9c776bac4c8f2456c71b33641601fb38b30347e
2016-05-03 14:17:15 +02:00
Deomid Ryabkov
81bf4921d4 Compile mg-iot-cc3200 with ARM compiler, step 1
Code size: 167144 vs 199440

More changes to come (console support, warnings cleanup).

PUBLISHED_FROM=cbc06efcb354c240654518b493496a69293ebc2a
2016-05-03 13:13:04 +01:00