mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-25 12:04:47 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1c2ffe1a0 | ||
|
|
9210a762de | ||
|
|
1620110f50 | ||
|
|
0d882f1b43 | ||
|
|
1bb85799ce | ||
|
|
12207edd55 | ||
|
|
bb37f72a63 | ||
|
|
b852e0f8c3 | ||
|
|
25dc078af7 | ||
|
|
06f525713f | ||
|
|
05ade0ba3c | ||
|
|
ec91eaf0f3 | ||
|
|
8392b9407a | ||
|
|
60fe567845 | ||
|
|
02e83c77a4 | ||
|
|
538a1a9bfa | ||
|
|
862fbd0abc | ||
|
|
2121be1abe | ||
|
|
0c794f19d2 | ||
|
|
44ef3b43d2 | ||
|
|
d27e7b3e7e | ||
|
|
f0d1800c6b | ||
|
|
81b61d335f | ||
|
|
70f14336f1 | ||
|
|
19ea5aba43 | ||
|
|
2a7fa4cb68 | ||
|
|
3d094ec921 | ||
|
|
abe19d2367 | ||
|
|
2b408e85e9 | ||
|
|
27897d5514 | ||
|
|
dfcfdfd0f7 | ||
|
|
ec032181c6 | ||
|
|
1cc6a48eea | ||
|
|
17b4054ea5 | ||
|
|
0ec11128f7 | ||
|
|
ed0423f79d | ||
|
|
ba69eb248c | ||
|
|
eefec28b50 | ||
|
|
564c352d0c | ||
|
|
d20eb8b280 | ||
|
|
cc617d537d | ||
|
|
205d4c6832 | ||
|
|
18cea946f1 | ||
|
|
0884338b2a | ||
|
|
ba768693ed | ||
|
|
3170261876 | ||
|
|
2d7e8aa712 | ||
|
|
c083f204fc | ||
|
|
e83e13d8c6 | ||
|
|
70d268d95f | ||
|
|
71f5556de7 | ||
|
|
8c64266f95 | ||
|
|
124b4e93c7 | ||
|
|
e01eeed303 | ||
|
|
4b3cfb4bc0 | ||
|
|
e5dfbec36d | ||
|
|
be1587a933 | ||
|
|
3e87f18a29 | ||
|
|
2214cf66a4 | ||
|
|
7b886ccbde | ||
|
|
b69b288d6c | ||
|
|
37fe251d31 | ||
|
|
5ec7ec141a | ||
|
|
e31079e107 | ||
|
|
1701fb0d03 | ||
|
|
f2ce01641e | ||
|
|
b5e4eef966 | ||
|
|
b93822fc50 | ||
|
|
715f98c546 | ||
|
|
b1878dc9d0 | ||
|
|
fe8cf7d9d6 | ||
|
|
5fa6b0a6ef | ||
|
|
d3ab638e5d | ||
|
|
44e773af54 | ||
|
|
ece3f43f34 | ||
|
|
edd1350864 | ||
|
|
8e0ef3ca5c | ||
|
|
b74913ded5 | ||
|
|
42abbb7e55 | ||
|
|
a4869febf6 | ||
|
|
b10355a536 | ||
|
|
e86d4da129 | ||
|
|
46ad050cea | ||
|
|
2a7cf8d5a7 | ||
|
|
07fd086230 | ||
|
|
f040d094ea | ||
|
|
f101d1422a | ||
|
|
6631c5db87 | ||
|
|
c429a0dc56 | ||
|
|
3f59974639 | ||
|
|
c10a88b64b | ||
|
|
d5e5b3397d | ||
|
|
ab83acf2d1 | ||
|
|
1db25117b0 | ||
|
|
bd1271dd41 | ||
|
|
5dddbb3fce | ||
|
|
a28decbef4 | ||
|
|
73d9c125c0 | ||
|
|
667abfb5e1 | ||
|
|
8c65c2f9af | ||
|
|
f36205e65f | ||
|
|
e2c0b2b477 | ||
|
|
29254ce84b | ||
|
|
1a0716ae4d | ||
|
|
e46ee68a95 | ||
|
|
db496fd7dd | ||
|
|
0a3e129527 | ||
|
|
12491777bb | ||
|
|
ad4b87e24a | ||
|
|
7ffc51d38e | ||
|
|
c9243c3f47 | ||
|
|
0d6c424e62 | ||
|
|
dc9395c904 | ||
|
|
2bb750070a | ||
|
|
17b0b65cab | ||
|
|
b5b63e731c | ||
|
|
7e376bb860 | ||
|
|
b313d697ff | ||
|
|
1cadd2b2aa | ||
|
|
f40b377fff | ||
|
|
43509c1781 | ||
|
|
209d1dd426 | ||
|
|
1f9e1a38b5 | ||
|
|
69936ac9f6 | ||
|
|
6de419d14c | ||
|
|
1200f50e2e | ||
|
|
73bec74380 | ||
|
|
f70647e28e | ||
|
|
effa61f9b2 | ||
|
|
b8bde63554 | ||
|
|
409d3d388a | ||
|
|
2c4bf4cea4 | ||
|
|
1b9c3a0fb0 | ||
|
|
71cc0cfd80 | ||
|
|
63da5aa403 | ||
|
|
cb13900c32 | ||
|
|
926a0e2cf2 | ||
|
|
2bfcfeb359 | ||
|
|
16d8e3b4f9 | ||
|
|
682fe2c9a0 | ||
|
|
bdd309b10b | ||
|
|
21fbf9cdc5 | ||
|
|
9ed98cecff | ||
|
|
ab4e229f57 | ||
|
|
7feab86700 | ||
|
|
6bc0af5dd0 | ||
|
|
6cb685b700 | ||
|
|
5c582c35d8 | ||
|
|
10ab9ae1ea | ||
|
|
756d127cab | ||
|
|
a49eb47a91 | ||
|
|
e15056a9e4 | ||
|
|
66d4069644 | ||
|
|
9aae863956 | ||
|
|
878ec8a86c | ||
|
|
8fccfca17b | ||
|
|
69925c774d | ||
|
|
c1298973e1 | ||
|
|
bedda34515 | ||
|
|
767b0ab90b | ||
|
|
b0109c3319 | ||
|
|
a42271a088 | ||
|
|
154e471256 | ||
|
|
bfc411acaf | ||
|
|
2acbb0ad62 | ||
|
|
60ce504489 | ||
|
|
22b8eda0df | ||
|
|
80ed81583e | ||
|
|
ce0c3a0fe7 | ||
|
|
492c6385da | ||
|
|
5b023cb85b | ||
|
|
4717a15c17 | ||
|
|
d6e7f8ee83 | ||
|
|
17ff656a7d | ||
|
|
4e8965cce5 | ||
|
|
b3d27a3c43 | ||
|
|
66dcca9392 | ||
|
|
0f1a3cf84b | ||
|
|
a4b7025396 | ||
|
|
9c148fd47e | ||
|
|
293d8c22e1 | ||
|
|
5f2ff680d5 | ||
|
|
8eaca9437e | ||
|
|
6e72bf4b5f | ||
|
|
710e7b2004 | ||
|
|
666a3b68e9 | ||
|
|
02e97adbef | ||
|
|
236724ea29 | ||
|
|
b503915ca5 | ||
|
|
156db0bc5e | ||
|
|
11b6bd7d9c | ||
|
|
7ca952faa6 | ||
|
|
4fc40f0ffb | ||
|
|
cac4b3e254 | ||
|
|
0d5cb5cbcc | ||
|
|
a35901121b | ||
|
|
e0740fc2ca | ||
|
|
7d22b5fe18 | ||
|
|
d2e66ac58d | ||
|
|
34cc8da87e | ||
|
|
1957ba8ffe | ||
|
|
72758812f5 | ||
|
|
ab5a0c43de | ||
|
|
c8291e4ae9 | ||
|
|
84e9ea76db | ||
|
|
b8994f8bc3 | ||
|
|
b53d8439e5 | ||
|
|
337e8abf2f | ||
|
|
f0bc1c031f | ||
|
|
19d2b93ec7 | ||
|
|
e0304f2b8f | ||
|
|
f7a86f8cf1 | ||
|
|
340f0dbf89 | ||
|
|
d90b62d911 | ||
|
|
d84aff6420 | ||
|
|
b3b73f4751 | ||
|
|
3c7b2dcd6d | ||
|
|
49470f9bd2 | ||
|
|
f7cf4f60ef | ||
|
|
7e0d06689e | ||
|
|
b843957bd2 | ||
|
|
1a0167eb6d | ||
|
|
6ea3b98941 | ||
|
|
4b0b93d4f3 | ||
|
|
64abf061bf | ||
|
|
05d5c68982 | ||
|
|
235dafe646 | ||
|
|
0cc40b0c70 | ||
|
|
07a0d1265b | ||
|
|
967d746574 | ||
|
|
bd12cb1b87 | ||
|
|
a21ca5d40b | ||
|
|
2d399107fb | ||
|
|
03bfa3806b | ||
|
|
6536ae9bcc | ||
|
|
e8fc817a0c | ||
|
|
e621ade392 | ||
|
|
3273c20ca9 | ||
|
|
a6b2124fd5 | ||
|
|
5a1ff125d7 | ||
|
|
ad58a48144 | ||
|
|
a205fd7877 | ||
|
|
776360ca93 | ||
|
|
af7602497d | ||
|
|
0f83c2a6e5 | ||
|
|
0d58748e63 | ||
|
|
01902bb8b9 | ||
|
|
e28e9aa1d7 | ||
|
|
587e79dc05 | ||
|
|
acd65f2340 | ||
|
|
d55fb80746 | ||
|
|
4536694f20 | ||
|
|
2c5a6d4df6 | ||
|
|
4c8e219643 | ||
|
|
daeca8128b | ||
|
|
fe6d357858 | ||
|
|
a99cc3dbaf | ||
|
|
3c4c04199a | ||
|
|
8ca692100f | ||
|
|
0b9f28b8e3 | ||
|
|
1dff394b63 | ||
|
|
f4c35d1036 | ||
|
|
81c166ad74 | ||
|
|
1f56776050 | ||
|
|
b3a0e7b884 | ||
|
|
8594507b5b | ||
|
|
fa811ce12b | ||
|
|
c1ef477ff3 | ||
|
|
4be3a96987 | ||
|
|
387f875aa1 | ||
|
|
cc069e7e5d | ||
|
|
df994df611 | ||
|
|
8f77fd3940 | ||
|
|
7530062e4b | ||
|
|
0e63510708 | ||
|
|
26260a1d88 | ||
|
|
9e82844f10 | ||
|
|
0568b5a75b | ||
|
|
3baabebb34 | ||
|
|
bf4dd15317 | ||
|
|
b0f2f9621a | ||
|
|
04d6d05e9e | ||
|
|
7339c7dfe7 | ||
|
|
c1152f5eeb | ||
|
|
024922d566 | ||
|
|
6f64c8c0de | ||
|
|
2a5ac3c2e5 | ||
|
|
7b0120f0c2 | ||
|
|
7ee1f14a6d | ||
|
|
3aaf7d0da7 | ||
|
|
434f3f8415 | ||
|
|
739d78a45a | ||
|
|
8a62633b2f | ||
|
|
aae1a687a9 | ||
|
|
61285ec418 | ||
|
|
a00b3f1c6c | ||
|
|
2c813f3e72 | ||
|
|
ea68d7a705 | ||
|
|
654f401038 | ||
|
|
ad89122a06 | ||
|
|
73ed158e76 | ||
|
|
548c3dc77f | ||
|
|
c1fa067a1f | ||
|
|
9fd87060f9 | ||
|
|
de0a3b035a | ||
|
|
9f76ea8030 | ||
|
|
76b7356873 | ||
|
|
c24d5aabd8 | ||
|
|
0df6645b90 | ||
|
|
b19cf8654f | ||
|
|
19933a4673 | ||
|
|
76963f7d01 | ||
|
|
e670ea3d61 | ||
|
|
fa33b57e4f | ||
|
|
77e369bc79 | ||
|
|
94ad9767d3 | ||
|
|
aa76f5673b | ||
|
|
81a699c801 | ||
|
|
bd15c456b2 | ||
|
|
10d9e1e9ae | ||
|
|
6a3813f633 | ||
|
|
51fe22a95f | ||
|
|
105762416f | ||
|
|
db7087f455 | ||
|
|
c5693503cb | ||
|
|
b74590a4a5 | ||
|
|
d5eeed48eb | ||
|
|
fc5c0d0964 | ||
|
|
aa2647c0bc | ||
|
|
cef0acdb40 | ||
|
|
2140656acc | ||
|
|
fd0c969f16 | ||
|
|
dfeb929e0e | ||
|
|
d3e67733a6 | ||
|
|
eff74fdc9d | ||
|
|
5e4c40ad09 | ||
|
|
087e6d3142 | ||
|
|
587b074822 | ||
|
|
6aa8c01ac7 | ||
|
|
3bbcd5df3e | ||
|
|
af512c57ef | ||
|
|
58297a7871 | ||
|
|
18a530048c | ||
|
|
f9ed75d6b3 | ||
|
|
3c1f41e575 | ||
|
|
c772936dd1 | ||
|
|
253696be45 | ||
|
|
79b7accc55 | ||
|
|
7a1e846c73 | ||
|
|
ce59ff89c3 | ||
|
|
d31d064d5e | ||
|
|
467fbf4bb4 | ||
|
|
6769223ce1 | ||
|
|
294e483885 | ||
|
|
43513e2d56 | ||
|
|
d1b7687e98 | ||
|
|
9ac09da1d2 | ||
|
|
24a330c750 | ||
|
|
13a9c773f2 | ||
|
|
3cd166d065 | ||
|
|
490066fd17 | ||
|
|
94fce72ade | ||
|
|
eacc64bdd1 | ||
|
|
7b037f4957 | ||
|
|
fa841916c1 | ||
|
|
75c11436ff | ||
|
|
e07a8283ec | ||
|
|
2a174b0d3b | ||
|
|
013993abae | ||
|
|
dccc153c68 | ||
|
|
db0867f435 | ||
|
|
7234121835 | ||
|
|
3aafc073d8 | ||
|
|
b527ed313c | ||
|
|
cd86559685 | ||
|
|
f67e843be6 | ||
|
|
4f9ebd8092 | ||
|
|
6c044d6aeb | ||
|
|
c6ee909aa4 | ||
|
|
393063428e | ||
|
|
1494f5e831 | ||
|
|
8bfd0c2ca3 | ||
|
|
e9de2f3eb1 | ||
|
|
8bf9d09d96 | ||
|
|
67255ce8f5 | ||
|
|
5db89aa264 | ||
|
|
8a9b1d9873 | ||
|
|
c08c1afb1e | ||
|
|
2c7f58aed2 | ||
|
|
b3ee71acbe | ||
|
|
52ab6bc499 | ||
|
|
bf059ad42f | ||
|
|
85df6a6131 | ||
|
|
d840b4a4ee | ||
|
|
a8c2ce544e | ||
|
|
b95022a3b3 | ||
|
|
8c45a9d2c9 | ||
|
|
0fe64fbff9 | ||
|
|
64e806628b | ||
|
|
ccd2b2699f | ||
|
|
0b5c0c9889 | ||
|
|
6293e7dbec | ||
|
|
87325ece82 | ||
|
|
6cbd9b3067 | ||
|
|
aa27fde9d0 | ||
|
|
e854585802 | ||
|
|
2c5aba24cc | ||
|
|
806ee0f2cb | ||
|
|
e72b95fb1c | ||
|
|
471e7ff61a | ||
|
|
3d2de154d1 | ||
|
|
fc551ec2e9 | ||
|
|
f5e2c68c8b | ||
|
|
074ef5197b | ||
|
|
5f1f4a0df8 | ||
|
|
86334e9040 | ||
|
|
f71cc3ebc3 | ||
|
|
00910462e7 | ||
|
|
2fc56dd1d0 | ||
|
|
a5ebe71394 | ||
|
|
0eb8bf6b51 | ||
|
|
3a0fe5288c | ||
|
|
bfca233160 | ||
|
|
acf217601b | ||
|
|
b0d0fbfd9f | ||
|
|
9411f1c7b6 | ||
|
|
d7d7ebf99a | ||
|
|
8072ae2057 | ||
|
|
e529e644ab | ||
|
|
d6fdfe5b1b | ||
|
|
50e15e574f | ||
|
|
58f1533779 | ||
|
|
f4a49829ea | ||
|
|
3efe6641eb | ||
|
|
0459d9e106 | ||
|
|
305d69ee36 | ||
|
|
98e744a9ad | ||
|
|
1d97f2e2b5 | ||
|
|
c92bc4b4ac | ||
|
|
6a3e1e41c4 | ||
|
|
650caface3 | ||
|
|
8b6e02e985 | ||
|
|
3ee6fe45f9 | ||
|
|
e811afd397 | ||
|
|
b197a674e1 | ||
|
|
08f6b99b13 | ||
|
|
b18d0301f3 | ||
|
|
5596621420 | ||
|
|
bd8a66eee7 | ||
|
|
b62ebb3c10 | ||
|
|
45d796fe5b | ||
|
|
d8a3b90cad | ||
|
|
5be9e55425 | ||
|
|
6b6acd3967 | ||
|
|
1b06403a19 | ||
|
|
b740c80855 | ||
|
|
29594283c1 | ||
|
|
51f54f9b7e | ||
|
|
1f48b1ca65 | ||
|
|
fd2d7cccf3 | ||
|
|
5726e680ec | ||
|
|
fadf28adb4 | ||
|
|
a321c2d096 | ||
|
|
bbb07bf6f7 | ||
|
|
a801160bc0 | ||
|
|
662cc27f4f | ||
|
|
ccfe7e0724 | ||
|
|
8061a41b38 | ||
|
|
d01aa01a51 | ||
|
|
39392b3690 | ||
|
|
54d4611eb6 | ||
|
|
34cdce750d | ||
|
|
f3fafb6759 | ||
|
|
0372c97ff5 | ||
|
|
b46136a0af | ||
|
|
ac3d41fb79 | ||
|
|
14be42c868 | ||
|
|
f0ec14543a | ||
|
|
f46c5b7214 | ||
|
|
ccd6bcd95f | ||
|
|
a3b63f3b0d | ||
|
|
f2905a5e10 | ||
|
|
1ef6c6aeb5 | ||
|
|
bd53529b45 | ||
|
|
cc8ecc5a42 | ||
|
|
5a816a1d41 | ||
|
|
9922286c67 | ||
|
|
cdc439bc38 | ||
|
|
ae8422e304 | ||
|
|
539d080346 | ||
|
|
041ec6e1f8 | ||
|
|
f618fe125c | ||
|
|
8ab514fabc | ||
|
|
08ad2c3145 | ||
|
|
c64fd404d4 | ||
|
|
143b0ac126 | ||
|
|
c2e2432010 | ||
|
|
1d2a768184 | ||
|
|
fb099641bc | ||
|
|
6da9afbf29 | ||
|
|
dceb4beb09 | ||
|
|
6f697db49d | ||
|
|
b44193780e | ||
|
|
8e0212c3db | ||
|
|
3861e2e1e7 | ||
|
|
21eefa4b55 | ||
|
|
fb6c6aafeb | ||
|
|
df07426e78 | ||
|
|
5cf1523a13 | ||
|
|
f2fe47e9f7 | ||
|
|
2557ab2e60 | ||
|
|
fbc1708000 | ||
|
|
0539cf1023 | ||
|
|
07b410447b | ||
|
|
fb69016196 | ||
|
|
169cbc044f | ||
|
|
08091d02e5 | ||
|
|
6f2dcf92a7 | ||
|
|
578e52618d | ||
|
|
ec0fe66a17 | ||
|
|
8fee24291a | ||
|
|
05bba2958d | ||
|
|
e656b1c792 | ||
|
|
e0ccbadd25 | ||
|
|
40a2a8822f | ||
|
|
e2ee356a87 | ||
|
|
189bef61d3 | ||
|
|
7d94f9f61b | ||
|
|
e37a0b9056 | ||
|
|
0b57b23951 | ||
|
|
c84826e84e | ||
|
|
064fc6ff7b | ||
|
|
042ea53478 | ||
|
|
900b0acf7a | ||
|
|
dc5f2e295a | ||
|
|
c1849c2b19 | ||
|
|
4eadf3699f | ||
|
|
b30cf6587c | ||
|
|
fbc231f33e | ||
|
|
bc8c839342 | ||
|
|
90a23fe230 | ||
|
|
065027843e | ||
|
|
8906b1ac0f | ||
|
|
05f9e61a41 | ||
|
|
782896b5d3 | ||
|
|
4258f62560 | ||
|
|
537ba64a54 | ||
|
|
25d20b7354 | ||
|
|
04d8362905 | ||
|
|
21266e9a45 | ||
|
|
7304e2171d | ||
|
|
61fc480850 | ||
|
|
562e82f5ac | ||
|
|
d7ff85bb48 | ||
|
|
55bc6105e1 | ||
|
|
306c0b6096 | ||
|
|
024078ae33 | ||
|
|
b5a9ba8390 | ||
|
|
93f36927ca | ||
|
|
1db90cafd1 | ||
|
|
bf23a0def7 | ||
|
|
ea1cbeea9d | ||
|
|
aeda7e5520 | ||
|
|
a7899af8b8 | ||
|
|
b0385f47af | ||
|
|
86c384657c | ||
|
|
6e569110d2 | ||
|
|
3b1024b13c | ||
|
|
b3f5d11275 | ||
|
|
1078ba0a92 | ||
|
|
005c8170d4 | ||
|
|
b8d1d7a10b | ||
|
|
76769fb4d5 | ||
|
|
6ff6f0a4c6 | ||
|
|
72a45d2f6a | ||
|
|
2fe7c8a410 | ||
|
|
5269eb9c39 | ||
|
|
0a86bc0af2 | ||
|
|
bc9f6ba0b0 | ||
|
|
9e16a0ae42 | ||
|
|
9ccbb49aef | ||
|
|
d59f84fbbc | ||
|
|
4bbb5008b1 | ||
|
|
49ce25511e | ||
|
|
985276665d | ||
|
|
91f553c45f | ||
|
|
38ede8ec58 | ||
|
|
997f6543ce | ||
|
|
b50081a83b | ||
|
|
34f512d244 | ||
|
|
eb5752f41b | ||
|
|
ef8e7419fa | ||
|
|
cfcdd15b89 | ||
|
|
b26debaebc | ||
|
|
6deb061b12 | ||
|
|
4c6745670c | ||
|
|
01c662b7de | ||
|
|
179fe652c2 | ||
|
|
394bc3260d | ||
|
|
ce1a70e2dc | ||
|
|
99022896f6 | ||
|
|
446b400667 | ||
|
|
a0d9b6a7e0 | ||
|
|
7d53c21efe | ||
|
|
b78efbac36 | ||
|
|
9be9dcec46 | ||
|
|
3766ab802b | ||
|
|
b9141925a3 | ||
|
|
ed79fe86aa | ||
|
|
2f0b0955a9 | ||
|
|
2f8e15a900 | ||
|
|
b8b3a5c305 | ||
|
|
e7ea421c54 | ||
|
|
8de9699390 | ||
|
|
bf592a22ae | ||
|
|
8d4a619a15 | ||
|
|
1a3588624d | ||
|
|
74b3fd2efc | ||
|
|
091356ed59 | ||
|
|
fc0e1ee311 | ||
|
|
8dbfcbff58 | ||
|
|
317591bc8a | ||
|
|
f71b3b91c0 | ||
|
|
9e255bcbce | ||
|
|
8af319b953 | ||
|
|
f90fd9cec4 | ||
|
|
d386b1c12d | ||
|
|
81551ec50d | ||
|
|
8fafcf6eaa | ||
|
|
f0df6c61c9 | ||
|
|
6cf36b5771 | ||
|
|
54799187e9 | ||
|
|
6d0320be06 | ||
|
|
317a1527ad | ||
|
|
490eb0f57f | ||
|
|
f95283e341 | ||
|
|
837da0e458 | ||
|
|
8ce82a100e | ||
|
|
9ece98c101 | ||
|
|
6a83147b33 | ||
|
|
90e4228e1d | ||
|
|
553aeeef77 | ||
|
|
6147e865f8 | ||
|
|
7b296fabb0 | ||
|
|
00c8f8acd0 | ||
|
|
1e1efa2c5e | ||
|
|
b0b0dd9f0b | ||
|
|
30bb1c52d0 | ||
|
|
7fc96a61ad | ||
|
|
4a164c39b4 | ||
|
|
b0e4069bb7 | ||
|
|
19cbb27b4c | ||
|
|
d44c864387 | ||
|
|
36e21e53e0 | ||
|
|
b7598cc354 | ||
|
|
0a4f322d49 | ||
|
|
bf013fcdae | ||
|
|
fd52fccc15 | ||
|
|
c493d3a4ce | ||
|
|
aeceb2b9e7 | ||
|
|
cb5f833dd2 | ||
|
|
0740ccd9f7 | ||
|
|
716c84c896 | ||
|
|
c5fda07d1e | ||
|
|
7fffe0abaa | ||
|
|
8a42325c23 | ||
|
|
78900304bf | ||
|
|
fb6dfbcd3c | ||
|
|
3dd4c7da2a | ||
|
|
03c955410c | ||
|
|
74f77c9ded | ||
|
|
3caca03e8a | ||
|
|
49469840ab | ||
|
|
85613ab02d | ||
|
|
6e4ce85c87 | ||
|
|
2a093dc183 | ||
|
|
01eeadbaf4 | ||
|
|
851b3a7cfb | ||
|
|
b6dc830bcb | ||
|
|
8ef02aae41 | ||
|
|
423dbd58a1 | ||
|
|
5582db615a | ||
|
|
1479ebfb5d | ||
|
|
4389ef1e77 | ||
|
|
5c305e7fa8 | ||
|
|
0427908eae | ||
|
|
2df53c3d27 | ||
|
|
53ec9adb1b | ||
|
|
8b95a22e75 | ||
|
|
665298a04b | ||
|
|
7e668df1fe | ||
|
|
85414cfec2 | ||
|
|
b973187960 | ||
|
|
991080e613 | ||
|
|
72bf199577 | ||
|
|
7bda43a6ec | ||
|
|
2b8b0ebe95 | ||
|
|
0aa61ce58f | ||
|
|
51a5dc78d7 | ||
|
|
232bd9a22b | ||
|
|
58327a1753 | ||
|
|
7844d84798 | ||
|
|
7a30a42797 | ||
|
|
094202ff16 | ||
|
|
9c4523f4fa | ||
|
|
69859c61e0 | ||
|
|
9878518e29 | ||
|
|
cde270728f | ||
|
|
5559d0fa68 | ||
|
|
8feff78526 | ||
|
|
226a3de55d | ||
|
|
67d0f5f4ae | ||
|
|
192f5e563c | ||
|
|
b6296e7a67 | ||
|
|
67e17d3bc3 | ||
|
|
64a6fef823 | ||
|
|
e0c64cc4ff | ||
|
|
3e55478b3b | ||
|
|
9aef821862 | ||
|
|
f394df840e | ||
|
|
7d33699173 | ||
|
|
d3ffe8c647 | ||
|
|
9b99f62311 | ||
|
|
3319ce78d3 | ||
|
|
8eabf43525 | ||
|
|
adb12bb7be | ||
|
|
3c10b36651 | ||
|
|
d37c300d87 | ||
|
|
9fc92e901e | ||
|
|
5b52529295 | ||
|
|
f77a7ad623 | ||
|
|
504ef9422e | ||
|
|
cbbcec0895 | ||
|
|
32d90c38db | ||
|
|
e1f7f3d7bb | ||
|
|
244536ea72 | ||
|
|
fa24a3e09e | ||
|
|
5ec26a5015 | ||
|
|
8a8ff2aef0 | ||
|
|
069254be6a | ||
|
|
f3cd74cb46 | ||
|
|
4be8aa0f91 | ||
|
|
93dd7a85f6 | ||
|
|
062596e3fb | ||
|
|
5af2de635e | ||
|
|
a16df91fbb | ||
|
|
44178b9103 | ||
|
|
b767f930ad | ||
|
|
ba61a6545a | ||
|
|
23ada5c7a5 | ||
|
|
97c37efffe | ||
|
|
5db95be4fc | ||
|
|
5897422c70 | ||
|
|
a7db0d3cc5 | ||
|
|
c49036a713 | ||
|
|
03246997fa | ||
|
|
f4eac6e4fc | ||
|
|
48f695f3e6 | ||
|
|
3525f044f5 | ||
|
|
b58f8b9d7c | ||
|
|
c00962e881 | ||
|
|
9bcf1d662b | ||
|
|
586e0721d8 | ||
|
|
882dd1f3a7 | ||
|
|
399291d783 | ||
|
|
46ac2e5252 | ||
|
|
a81818b2db | ||
|
|
9b0d112176 | ||
|
|
ac17df0c65 | ||
|
|
c4be4e7928 | ||
|
|
877cbbd11d | ||
|
|
b2bb03310e | ||
|
|
5c8885ee5f | ||
|
|
40ec6b263d | ||
|
|
3742da8770 | ||
|
|
19b06418c5 | ||
|
|
b7b8b9219d | ||
|
|
949966964f | ||
|
|
c0a0f9c1df | ||
|
|
7cff2fa8f1 | ||
|
|
c1b703a039 | ||
|
|
e0eff1d2bb | ||
|
|
037ef76ad8 | ||
|
|
ae8025cd5c | ||
|
|
1804cc3a09 | ||
|
|
2d8e6b45ec | ||
|
|
3fa52d0d7d | ||
|
|
6a7129d7af | ||
|
|
f0e113a532 | ||
|
|
8b3e415201 | ||
|
|
eb6a8afe8d | ||
|
|
a705a89e4a | ||
|
|
ea509c0a36 | ||
|
|
269600d875 | ||
|
|
95e3a8f3cc | ||
|
|
ffeff3ab69 | ||
|
|
bdc009eb65 | ||
|
|
683f65f8ac | ||
|
|
a737698372 | ||
|
|
eeecbbcff9 | ||
|
|
44b3d60692 | ||
|
|
641c7d1967 | ||
|
|
7923d1e930 | ||
|
|
42e072a868 | ||
|
|
97296934ab | ||
|
|
83dbe5fa3e | ||
|
|
b566b8b45a | ||
|
|
ecdfda56c2 | ||
|
|
166c4a244a | ||
|
|
be7bfbac39 | ||
|
|
3c8953672d | ||
|
|
045b196eeb | ||
|
|
d763fce8ed | ||
|
|
15c8ba5d3f | ||
|
|
1b75017c3c | ||
|
|
3ffe5e958f | ||
|
|
4f6a78cde8 | ||
|
|
3081d0766b | ||
|
|
c1e34cb9b5 | ||
|
|
dedf67fb52 | ||
|
|
a74fb940aa | ||
|
|
09275ae4ca | ||
|
|
657717d0fb | ||
|
|
4493d35d26 | ||
|
|
0d26ce9bcc | ||
|
|
fe77075996 | ||
|
|
4d6b126b9d | ||
|
|
7b1900d547 | ||
|
|
5a8c56e784 | ||
|
|
8c4cfc8101 | ||
|
|
5f1f5ffffd | ||
|
|
603c4b7672 | ||
|
|
4b49c63344 | ||
|
|
9bdc910327 | ||
|
|
730f50f770 | ||
|
|
91606a9e3f | ||
|
|
22b52f831b | ||
|
|
071b3f558f | ||
|
|
59cd4004ac | ||
|
|
7f7c1ff6c2 | ||
|
|
ad3acf355e | ||
|
|
4dcc4e3308 | ||
|
|
a9902b55d8 | ||
|
|
d46798c2a7 | ||
|
|
90623492b7 | ||
|
|
ddf3ba8a15 | ||
|
|
0c4d33d558 | ||
|
|
1c3b6ad59b | ||
|
|
473a12d700 | ||
|
|
774cfc4bdc | ||
|
|
509fbcc4f8 | ||
|
|
00862344f7 | ||
|
|
5ad2b0531a | ||
|
|
be8dbb0dc7 | ||
|
|
bdfa0b302b | ||
|
|
7541304a9a | ||
|
|
395a51eeca | ||
|
|
17e2d49c43 | ||
|
|
ac71c320cd | ||
|
|
0356bf6092 | ||
|
|
8bc1edd027 | ||
|
|
403f0dc8a5 | ||
|
|
dffa198ebd | ||
|
|
7028417d88 | ||
|
|
2d4ebba3ed | ||
|
|
aa3fda9c33 | ||
|
|
0f9f0b545e | ||
|
|
9fcc398540 | ||
|
|
61f4ab61cb | ||
|
|
1f481cbe54 | ||
|
|
f4ee10a96a | ||
|
|
9974be3fdc | ||
|
|
793171e9e0 | ||
|
|
cee7087d54 | ||
|
|
f9bcffcbd5 | ||
|
|
8fd7e87333 | ||
|
|
c436194d43 | ||
|
|
fcd160cc8c | ||
|
|
5adbadc901 | ||
|
|
5084279d81 | ||
|
|
bd21d0d0cf | ||
|
|
a3fd81540a | ||
|
|
ba3f6a5e76 | ||
|
|
25c56e86c9 | ||
|
|
0897b0969d | ||
|
|
6cb1c3c0e9 | ||
|
|
df257a8e8a | ||
|
|
71abdc1bda | ||
|
|
22de1dc0f2 | ||
|
|
6357b30712 | ||
|
|
b0e18d5e8a | ||
|
|
be58d73a0a | ||
|
|
c1f630f5ed | ||
|
|
ab75bfa6e7 | ||
|
|
a4e0225c69 | ||
|
|
6d3d6c3601 | ||
|
|
2872de75a0 | ||
|
|
70936e3738 | ||
|
|
c272883ec1 | ||
|
|
d9619a8fa4 | ||
|
|
9ec2022447 | ||
|
|
10f56c55e6 | ||
|
|
69682d6d97 | ||
|
|
b61575eb2b | ||
|
|
6942de4f57 | ||
|
|
8085e21a05 | ||
|
|
0061fe02e6 | ||
|
|
6bb40e6ec9 | ||
|
|
94efcc83a1 | ||
|
|
03402cf359 | ||
|
|
a473cf99b5 | ||
|
|
c26bd2ffe8 | ||
|
|
9dc3d09981 | ||
|
|
76b4c9a6ff | ||
|
|
41add69294 | ||
|
|
c911c9ad19 | ||
|
|
dd883c0563 | ||
|
|
16a0c89d5f | ||
|
|
ac0e6f3377 | ||
|
|
68f7be7a1a | ||
|
|
b796e33ede | ||
|
|
1051ba77c0 | ||
|
|
cb5b6b972a | ||
|
|
925f21aca4 | ||
|
|
dc09851ac8 | ||
|
|
323ba9d90c | ||
|
|
c6ff8ab6dc | ||
|
|
b5443f10c5 | ||
|
|
3ae1a0f82a | ||
|
|
81f0f8a7c2 | ||
|
|
50963df42f | ||
|
|
b316989378 | ||
|
|
23c68e2677 | ||
|
|
b46bee0540 | ||
|
|
4c6c27d8f6 | ||
|
|
3c531897b6 | ||
|
|
6c7672f4af | ||
|
|
2def6e867d | ||
|
|
573f13c1ed | ||
|
|
b7f9e5c947 | ||
|
|
da85affe5c | ||
|
|
3168a2aca0 | ||
|
|
1f5feaa103 | ||
|
|
4be3dfd52b | ||
|
|
1e26983263 | ||
|
|
a620419b59 | ||
|
|
ffdc9b0d3a | ||
|
|
379e047289 | ||
|
|
8e420406b9 | ||
|
|
fc0364b321 | ||
|
|
ea4986dec5 | ||
|
|
2be30a3193 | ||
|
|
81f90c7b51 | ||
|
|
205a564482 | ||
|
|
497df68de1 | ||
|
|
eaf8e24d4c | ||
|
|
1721fb0484 | ||
|
|
fe0b144b84 | ||
|
|
d391bca2d3 | ||
|
|
a0b6e70ff8 | ||
|
|
4f15392440 | ||
|
|
959fcfdf1d | ||
|
|
57f90d200d | ||
|
|
663c645cf1 | ||
|
|
972b255a48 | ||
|
|
8c5dfa4227 | ||
|
|
290d48e1aa | ||
|
|
4eb3a1c978 | ||
|
|
b4a36a8303 | ||
|
|
d08ee4e63a | ||
|
|
42f5802e47 | ||
|
|
120ffb0b1f | ||
|
|
d3a3ba0a32 | ||
|
|
79eebc14bb | ||
|
|
6fc41e2a3c | ||
|
|
4843323f87 | ||
|
|
04c6f3e6ef | ||
|
|
5345c7260e | ||
|
|
71a48ccde0 | ||
|
|
41e24d7733 | ||
|
|
f888b30863 | ||
|
|
10029d6a8d | ||
|
|
6697a2cfaa | ||
|
|
59020e0d5d | ||
|
|
70abd1f98d | ||
|
|
312ca8e978 | ||
|
|
e1ccdc0570 | ||
|
|
c7f9fe4a03 | ||
|
|
89aaf1c30c | ||
|
|
601af780c9 | ||
|
|
93477c8db4 | ||
|
|
ec5531dbf4 | ||
|
|
157f87f01a | ||
|
|
0f4ca8d010 | ||
|
|
0a168b6791 | ||
|
|
a025577b30 | ||
|
|
ef61d6ea48 | ||
|
|
e6bf658271 | ||
|
|
9cccb9839b | ||
|
|
2bd188f3d6 | ||
|
|
9fa840c1c7 | ||
|
|
e0e599ffa1 | ||
|
|
e93d18d200 | ||
|
|
34150f3f71 | ||
|
|
db6730c8a3 | ||
|
|
08cac802a4 | ||
|
|
af6a52e060 | ||
|
|
1c63645254 | ||
|
|
be5d8b1d4f | ||
|
|
2ac3552e6e | ||
|
|
3c3c775213 | ||
|
|
a24b7043ed | ||
|
|
7b621d7b5b | ||
|
|
8a335a8cea | ||
|
|
355c292dbf | ||
|
|
2511d747ae | ||
|
|
03c326a04e | ||
|
|
b3312f3761 | ||
|
|
2e250ee7aa | ||
|
|
924984dde1 | ||
|
|
33b7bb91d9 | ||
|
|
f68fe0fb5c | ||
|
|
e6663ec186 | ||
|
|
6ff0f9ccd8 | ||
|
|
48830aa9a9 | ||
|
|
9276f764e0 | ||
|
|
7876d464f2 | ||
|
|
5d0d01c2c1 | ||
|
|
393418d50d | ||
|
|
23bb912eb5 | ||
|
|
1d5b5296da | ||
|
|
655f5db996 | ||
|
|
c20cc4ae09 | ||
|
|
7581229bbf | ||
|
|
d094e090ff | ||
|
|
c7a13025e4 | ||
|
|
e4cd6bd824 | ||
|
|
f3ad0572e2 | ||
|
|
406d6cc305 | ||
|
|
d042697b10 | ||
|
|
ba678b9ad1 | ||
|
|
7a5cf118e9 | ||
|
|
e9a2da61ef | ||
|
|
d3fe1ef681 | ||
|
|
9725bca966 | ||
|
|
1f627e4263 | ||
|
|
7ac0c5fc2a | ||
|
|
091ebd8a98 | ||
|
|
d9a6e85b65 | ||
|
|
7cc3d89980 | ||
|
|
f58b90f7ea | ||
|
|
fd84109c1d | ||
|
|
626f605835 | ||
|
|
943a8a2708 | ||
|
|
d7b2b3f42e | ||
|
|
fafc5c8348 | ||
|
|
15bd8b4fe9 | ||
|
|
928aed4342 | ||
|
|
98782e44c2 | ||
|
|
65b23777b2 | ||
|
|
c8fd3d6d25 | ||
|
|
01e7cd5f13 | ||
|
|
3ac9bd0468 | ||
|
|
9f498d2eea | ||
|
|
2d2d9ad277 | ||
|
|
2cc18a8ea3 | ||
|
|
25036d5f48 | ||
|
|
defee39ef9 | ||
|
|
c78afb12a3 | ||
|
|
f72b0b5056 | ||
|
|
d46e505a80 | ||
|
|
4027bcf7ea | ||
|
|
2905392665 | ||
|
|
98db3360df | ||
|
|
f26c713482 | ||
|
|
05e55334fc | ||
|
|
01fe61276e | ||
|
|
219253ad71 | ||
|
|
7b125558cb | ||
|
|
02120e24b6 | ||
|
|
91bc79c14c | ||
|
|
5ca552cf1c | ||
|
|
2066304b14 | ||
|
|
1c6f8b95eb | ||
|
|
5384591f5b | ||
|
|
309668ccbc | ||
|
|
06a9fb3f53 | ||
|
|
00db56f7d7 | ||
|
|
cec06eb25c | ||
|
|
73a3897e1b | ||
|
|
100c4c15ce | ||
|
|
c59bf6613a | ||
|
|
ac435bcb91 | ||
|
|
5d0bfccbc7 | ||
|
|
813489dc2f | ||
|
|
828f31d5e6 | ||
|
|
8130f7f25f | ||
|
|
943e1c5f77 | ||
|
|
ecb3301bcb | ||
|
|
a0f33aebf7 | ||
|
|
6862981640 | ||
|
|
f61f2d2e9f | ||
|
|
1743e175cd | ||
|
|
a027f58744 | ||
|
|
c98886402b | ||
|
|
112a1e908a | ||
|
|
01ae80ecd1 | ||
|
|
52997c6c51 | ||
|
|
1c114a279e | ||
|
|
93148e3223 | ||
|
|
f01807ef17 | ||
|
|
a4ed740518 | ||
|
|
0e2f3de154 | ||
|
|
d128d2146a | ||
|
|
c683e1e988 | ||
|
|
0b7038d44d | ||
|
|
55698b91c0 | ||
|
|
eff54827b2 | ||
|
|
2c2c7f6894 | ||
|
|
5baa4d969e | ||
|
|
d745c41d5b | ||
|
|
a86bde7b3f | ||
|
|
4ab2309a5d | ||
|
|
9172f62970 | ||
|
|
daa47e8272 | ||
|
|
2419f02766 | ||
|
|
c8d45c9ff1 | ||
|
|
0b667ca869 | ||
|
|
1a5ea930ab | ||
|
|
e4bfb2b5b0 | ||
|
|
936e7bbc88 | ||
|
|
93b5063251 | ||
|
|
e0668bc1c0 | ||
|
|
fa5aa308bc | ||
|
|
cbfa57a955 | ||
|
|
f8898b016e | ||
|
|
8a9630485f | ||
|
|
066e4ac332 | ||
|
|
f231760395 | ||
|
|
ebfa5f0ba7 | ||
|
|
d7754516f0 | ||
|
|
00fd1884ff | ||
|
|
b828be4873 | ||
|
|
4045a541ef | ||
|
|
f7557c9e48 | ||
|
|
7c62b5005e | ||
|
|
b804217501 | ||
|
|
c6128094b6 | ||
|
|
0fc0230364 | ||
|
|
dd6458262d | ||
|
|
eb68bb2ce1 | ||
|
|
8dc62c25ed | ||
|
|
d8fec13d2c | ||
|
|
922d148ab5 | ||
|
|
08f05d6f8c | ||
|
|
7bec3b4954 | ||
|
|
4d3fba57d4 | ||
|
|
1a8a144726 | ||
|
|
00ea3830a7 | ||
|
|
3880300cd9 | ||
|
|
6b0e4a425d | ||
|
|
f883504d2d | ||
|
|
a1c5995967 | ||
|
|
8500afbbd4 | ||
|
|
13cb94cf2b | ||
|
|
f26a79d75c | ||
|
|
68e2cd9b29 | ||
|
|
6e44bab3d5 | ||
|
|
677fea7bfa | ||
|
|
0d2ae10bd9 | ||
|
|
faa582040b | ||
|
|
0ad4002569 | ||
|
|
dfc2e97d5e | ||
|
|
57159dc5c0 | ||
|
|
77ff1511ff | ||
|
|
124ab99995 | ||
|
|
8ea08306b8 | ||
|
|
3e0d20a335 | ||
|
|
727b3d4f19 | ||
|
|
80782b289f | ||
|
|
72127a4bed | ||
|
|
d4a49e00e7 | ||
|
|
5826d0e41c | ||
|
|
68cb7ce8d9 | ||
|
|
514699fc41 | ||
|
|
deca1aaf46 | ||
|
|
b8bfa5565b | ||
|
|
50c7844031 | ||
|
|
cba0d1b2f9 | ||
|
|
5735ee3269 | ||
|
|
ee3593b887 | ||
|
|
9bebe7cf68 | ||
|
|
bd5e4dba26 | ||
|
|
2427c40a4c | ||
|
|
744df7b244 | ||
|
|
3965aecfd4 | ||
|
|
93bcde0176 | ||
|
|
4b3884a49d | ||
|
|
768908ae4a | ||
|
|
1a965d5c43 | ||
|
|
01b612cff5 | ||
|
|
176db1aedb | ||
|
|
06f8238107 | ||
|
|
97127a57da | ||
|
|
61825b2390 | ||
|
|
669ffe2c74 | ||
|
|
a50b8ff5d7 | ||
|
|
aae2954c14 | ||
|
|
abab569778 | ||
|
|
365a731574 | ||
|
|
285dc63c5c | ||
|
|
24d9fbffae | ||
|
|
04178ad0f7 | ||
|
|
a0e66fb9e6 | ||
|
|
df3c216315 | ||
|
|
e9a6bad751 | ||
|
|
4b7d871048 | ||
|
|
2528dd6425 | ||
|
|
b3fcd9c420 | ||
|
|
9270fc0b15 | ||
|
|
33aa021e96 | ||
|
|
1c78ed1fed | ||
|
|
562c318648 | ||
|
|
65cb894f0d | ||
|
|
bbd27a0a9c | ||
|
|
79e138ef28 | ||
|
|
387334c8c2 | ||
|
|
cd021daf79 | ||
|
|
536aa1fb62 | ||
|
|
a14a838dab | ||
|
|
ad57731ae1 | ||
|
|
ad90b0b7b1 | ||
|
|
18325cb216 | ||
|
|
8df70ba58b | ||
|
|
ee43a5389f | ||
|
|
6192573eb8 | ||
|
|
92ecef7bd3 | ||
|
|
45d7f4ca7e | ||
|
|
144c2f443e | ||
|
|
98d877c5f0 | ||
|
|
9de31ba816 | ||
|
|
560561c5b7 | ||
|
|
ed2d4c1c2b | ||
|
|
e70628cbdc | ||
|
|
161edec195 | ||
|
|
2ba4a74762 | ||
|
|
693316de44 | ||
|
|
6e68124405 | ||
|
|
c8105cffba | ||
|
|
21f6944fc7 | ||
|
|
5adcba7ba1 | ||
|
|
fc8ba744dc | ||
|
|
4fc43cfbf7 | ||
|
|
22837f93c8 | ||
|
|
b03ececbbb | ||
|
|
708908dce5 | ||
|
|
f33302acc9 | ||
|
|
7f8cdf1e79 | ||
|
|
dbc7b5e70b | ||
|
|
4c445453d3 | ||
|
|
4b8fb23def | ||
|
|
253bc64c9e | ||
|
|
32d3fc6803 | ||
|
|
920875ecc9 | ||
|
|
85d3e7f375 | ||
|
|
4ceb50d485 | ||
|
|
7d2fca9574 | ||
|
|
d88e60a525 | ||
|
|
4b4dcb20ca | ||
|
|
d4ab0aa7fd | ||
|
|
c02c1130ed | ||
|
|
f9bbb37721 | ||
|
|
57837f285f | ||
|
|
3379f11b23 | ||
|
|
c74534cf5e | ||
|
|
64ca1ad787 | ||
|
|
8022635c04 | ||
|
|
1f37595200 | ||
|
|
30738f6638 | ||
|
|
bd53e46873 | ||
|
|
122115dbea | ||
|
|
28162f8034 | ||
|
|
9cfd3124ef | ||
|
|
36748ee406 | ||
|
|
2a25e449a2 | ||
|
|
f2f60a7b3b | ||
|
|
82916a1cef | ||
|
|
f86c14abb3 | ||
|
|
fa76312313 | ||
|
|
46687f6fe3 | ||
|
|
6386cdff50 | ||
|
|
7c25c0d6f3 | ||
|
|
8ed57f57cb | ||
|
|
c8f207c277 | ||
|
|
d70d9aff11 | ||
|
|
1118c997b5 | ||
|
|
b999275550 | ||
|
|
f549646ddd | ||
|
|
5ee8552e6c | ||
|
|
b0eb7b6dec | ||
|
|
a546d360d0 | ||
|
|
3cc8a98b9d | ||
|
|
1032f0ade7 | ||
|
|
eb65d269eb | ||
|
|
b379f81004 | ||
|
|
d1b0342a18 | ||
|
|
b815e6bc04 | ||
|
|
81bf65954c | ||
|
|
9cfe72af4a | ||
|
|
7c2e1e1339 | ||
|
|
817115cb6c | ||
|
|
7a3734e54d | ||
|
|
79c3341f74 | ||
|
|
abdd14b0a1 | ||
|
|
1f77e53b23 | ||
|
|
a619de0508 | ||
|
|
8faa11585c | ||
|
|
13259f8902 | ||
|
|
bb5aba2e19 | ||
|
|
22fc01d5f2 | ||
|
|
3b4672c109 | ||
|
|
351bd42bc4 | ||
|
|
e418da4bd8 | ||
|
|
18d13f9848 | ||
|
|
ee792db6a3 | ||
|
|
129bf93b30 | ||
|
|
1dda8b9e60 | ||
|
|
107e303282 | ||
|
|
22f76091a2 | ||
|
|
376e5ccaae | ||
|
|
b792304cf8 | ||
|
|
b357485523 | ||
|
|
07936343c8 | ||
|
|
1b93ca0fb2 | ||
|
|
18cd18d1e5 | ||
|
|
deab6772e8 | ||
|
|
d6d2d7575a | ||
|
|
d63ec65663 | ||
|
|
f0a927831e | ||
|
|
ef16a733d2 | ||
|
|
9044c02edc | ||
|
|
2fa98b00f2 | ||
|
|
15b4d566e7 | ||
|
|
6dabbe237d | ||
|
|
2caff93f83 | ||
|
|
2903937cba | ||
|
|
c33fd6a7fb | ||
|
|
64180e8fe8 | ||
|
|
001134af89 | ||
|
|
b91044dea7 | ||
|
|
34639f86b0 | ||
|
|
32559f15ea | ||
|
|
b10eef1e32 | ||
|
|
7c4911598c | ||
|
|
efacb20bdc | ||
|
|
2e6188205f | ||
|
|
83fec2cf45 | ||
|
|
9be36eb9cb | ||
|
|
a51802ecaf | ||
|
|
b1c220e610 | ||
|
|
36f6b805e3 | ||
|
|
64efad9e46 | ||
|
|
8a8d5ce151 | ||
|
|
907417f9ec | ||
|
|
0965177e72 | ||
|
|
7d07ca8427 | ||
|
|
d18b2b390a | ||
|
|
fefe8b1c15 | ||
|
|
ea2ff010a9 | ||
|
|
e357cb3185 | ||
|
|
293ee2162c | ||
|
|
c29ee769bc | ||
|
|
82399f1561 | ||
|
|
9255ceaf8a | ||
|
|
bb9c7c0eb3 | ||
|
|
8ec327f9c7 | ||
|
|
c9b982eaff | ||
|
|
248e7b6e29 | ||
|
|
cb1ae312a1 | ||
|
|
aec25cf547 | ||
|
|
4db3fc2515 | ||
|
|
79d6017c56 | ||
|
|
d4c122b17a | ||
|
|
57fd93eeda | ||
|
|
19cac05747 | ||
|
|
5ebede5096 | ||
|
|
46ecb07fc8 | ||
|
|
a628a05efb | ||
|
|
fc626bb57f | ||
|
|
1291839182 | ||
|
|
736e7a2cf9 | ||
|
|
7884a2f3c7 | ||
|
|
dde699ffda | ||
|
|
fa54a22aed | ||
|
|
822b0c011a | ||
|
|
a0f8a197c9 | ||
|
|
7e75e51332 | ||
|
|
b37efbe891 | ||
|
|
6e648c90b0 | ||
|
|
377d6acc74 | ||
|
|
f552d15fe4 | ||
|
|
d1204e8a66 | ||
|
|
9ec48e41f7 | ||
|
|
9055a83b4f | ||
|
|
dd047b2613 | ||
|
|
b7a32069b1 | ||
|
|
00d475bc7e | ||
|
|
33ab44430c | ||
|
|
b355da32b9 | ||
|
|
3f0366a514 | ||
|
|
7ecbbc517d | ||
|
|
a04c94444e | ||
|
|
42b9ac1145 | ||
|
|
7be4925c70 | ||
|
|
7b19568683 | ||
|
|
8f56779855 | ||
|
|
fdfad8462c | ||
|
|
3773ef45e7 | ||
|
|
c0ca3cacb4 | ||
|
|
bed0630698 | ||
|
|
53baa18836 | ||
|
|
32a2144426 | ||
|
|
264026acde | ||
|
|
43503ef73a | ||
|
|
7f52717e9d | ||
|
|
bd59185ef1 | ||
|
|
310ffcd4eb | ||
|
|
d23664a457 | ||
|
|
a1e316ddcf | ||
|
|
e328758fc7 | ||
|
|
dbf49255a3 | ||
|
|
1391bdcf8b | ||
|
|
d8106a8ffe | ||
|
|
ae55789c4b | ||
|
|
ec02ccf5b2 | ||
|
|
f970cd78d7 | ||
|
|
8140ea16a7 | ||
|
|
2883709756 | ||
|
|
ca4c2c6c41 | ||
|
|
fbc56f4adf | ||
|
|
2f014237b2 | ||
|
|
f33e3a7752 | ||
|
|
d5b5cec797 | ||
|
|
f8e1f17651 | ||
|
|
be58bfe22b | ||
|
|
995a63dc39 | ||
|
|
e8d57ac4e1 | ||
|
|
eab3a83548 | ||
|
|
3fb9e5fd56 | ||
|
|
41448278cf | ||
|
|
48516b43c5 | ||
|
|
80b7be0568 | ||
|
|
4183552aee | ||
|
|
527e89754e | ||
|
|
30e0f42c97 | ||
|
|
39b40daf5d | ||
|
|
94636f4d30 | ||
|
|
fd53548c5e | ||
|
|
354ea30797 | ||
|
|
11303e0dc1 | ||
|
|
b4c645f703 | ||
|
|
3256218fd2 | ||
|
|
a4f14b0ddf | ||
|
|
e7459d91f9 | ||
|
|
b32d1c15f0 | ||
|
|
1e0d57a832 | ||
|
|
f3617a1cf3 | ||
|
|
89a9a50b96 | ||
|
|
69d2ba7316 | ||
|
|
3ea5f8dbde | ||
|
|
d56152875d | ||
|
|
7459d30a28 | ||
|
|
16bf9101aa | ||
|
|
2b20af36a7 | ||
|
|
f5e87cceec | ||
|
|
36fcb7ed21 | ||
|
|
9fe7807b02 | ||
|
|
88e3017ee5 | ||
|
|
17f3738192 | ||
|
|
6cfdc39005 | ||
|
|
58886a9693 | ||
|
|
66e022c454 | ||
|
|
ea3968601e | ||
|
|
54be13d1d8 | ||
|
|
22ea825d46 | ||
|
|
8c03aa2801 | ||
|
|
5bb952260a | ||
|
|
face6c44c6 | ||
|
|
66c2bfe822 | ||
|
|
3721bcc790 | ||
|
|
cacab6fe4c | ||
|
|
6ad8674cd4 | ||
|
|
847990ce49 | ||
|
|
1bfdc1f138 | ||
|
|
58367fe23e | ||
|
|
a8712e2307 | ||
|
|
8acfae1111 | ||
|
|
70fc71c6f7 | ||
|
|
dd5118cab0 | ||
|
|
2d75a6ccd4 | ||
|
|
e004ab1693 | ||
|
|
acddfc3bf4 | ||
|
|
519d4b0286 | ||
|
|
8005a5e687 | ||
|
|
f5943fe591 | ||
|
|
cea7fcdb37 | ||
|
|
b5213c13dd | ||
|
|
3a06b4833c | ||
|
|
5cdf6c1d05 | ||
|
|
5754e5dd59 | ||
|
|
e5ab1c454b | ||
|
|
697576b63c | ||
|
|
2db41aef09 | ||
|
|
7f4ad3cade | ||
|
|
74c4c32082 | ||
|
|
30d545443c | ||
|
|
dedba52315 | ||
|
|
481f7b5cff | ||
|
|
6ce4f4930c | ||
|
|
e33a10db75 | ||
|
|
ef17055145 | ||
|
|
6a2fa10a4e | ||
|
|
6b81a5846d | ||
|
|
b54d086fde | ||
|
|
5ee9d22263 | ||
|
|
7dcb097a5d | ||
|
|
29a30239ab | ||
|
|
ed54b60ea3 | ||
|
|
199af33b30 | ||
|
|
adfa1d0e20 | ||
|
|
ef25c42e86 | ||
|
|
91a638156c | ||
|
|
26ce666938 | ||
|
|
7548af895b | ||
|
|
9548437a9e | ||
|
|
5e50b7104c | ||
|
|
d824cf7dbd | ||
|
|
0613cc62f4 | ||
|
|
d9cbcb5fa8 | ||
|
|
a4f5355161 | ||
|
|
a24b6c1909 | ||
|
|
fd7dc72410 | ||
|
|
e4f4dfab3b | ||
|
|
66010be5a6 | ||
|
|
852c42a8f3 | ||
|
|
132725de7b | ||
|
|
0a761c09e3 | ||
|
|
09ce6ae1c5 | ||
|
|
85e60ed858 | ||
|
|
86fd18324b | ||
|
|
fdf82e5d6c | ||
|
|
eb0b1580d1 | ||
|
|
2d33c545b8 | ||
|
|
cdaf523aa8 | ||
|
|
3195f2cec2 | ||
|
|
ea89a4afab | ||
|
|
3415b62d2d | ||
|
|
ee80822564 | ||
|
|
3c9e218d07 | ||
|
|
387a602885 | ||
|
|
ef0ff43975 | ||
|
|
ae37407369 | ||
|
|
e1c91b5763 | ||
|
|
c49b472f92 | ||
|
|
0a6b1b9418 | ||
|
|
ac40673a9e | ||
|
|
818f99b286 | ||
|
|
320da5e84c | ||
|
|
6957c379d5 | ||
|
|
88e880f107 | ||
|
|
bf8c4dfc83 | ||
|
|
5dff282132 | ||
|
|
1148ac0ae4 | ||
|
|
59c46fc594 | ||
|
|
03a94e3a6a | ||
|
|
5c8e05a4fc | ||
|
|
d791ce393b | ||
|
|
a452231086 | ||
|
|
a392a19c9c | ||
|
|
a864c04702 | ||
|
|
8d2f7296a1 | ||
|
|
040936eb47 | ||
|
|
101beec3ae | ||
|
|
2f1a836bf0 | ||
|
|
62f5e0a1a9 | ||
|
|
cca771e70e | ||
|
|
0c7e6b548f | ||
|
|
8b87e8aa92 | ||
|
|
415bbf2932 | ||
|
|
48df4f18cd | ||
|
|
dc0f9aca4a | ||
|
|
1b9b8e3f6c | ||
|
|
5d10e9dbee | ||
|
|
0adc858c85 | ||
|
|
eda1e8a402 | ||
|
|
4b0e34cdf4 | ||
|
|
c688687ff8 | ||
|
|
d56e5bea62 | ||
|
|
aed7b6b37a | ||
|
|
8114443e97 | ||
|
|
8ba0a33f84 | ||
|
|
661ed61779 | ||
|
|
427f95337f | ||
|
|
fa8490fb4e | ||
|
|
5be1c6381b | ||
|
|
6794a89f79 | ||
|
|
8f19ee7b97 | ||
|
|
c63135ec7f | ||
|
|
5c87f2f22c | ||
|
|
6e6e34c423 | ||
|
|
bb983fb4b2 | ||
|
|
285bbf50e9 | ||
|
|
c2ad2e1151 | ||
|
|
46e796ffaa | ||
|
|
3bf25d86f2 | ||
|
|
2dca4805b0 | ||
|
|
54aa4678d1 | ||
|
|
3ab0e6cade | ||
|
|
41e3b23253 | ||
|
|
b00d780a50 | ||
|
|
71b3e26232 | ||
|
|
40f28c02b9 | ||
|
|
362b22a673 | ||
|
|
d6be9a2bba | ||
|
|
6bfd113a87 | ||
|
|
b7f86ba743 | ||
|
|
2bab274056 | ||
|
|
dd6bffdd0d | ||
|
|
bcc044eb92 | ||
|
|
a7f1982d03 | ||
|
|
d013e0fc78 | ||
|
|
6f69ad93c1 | ||
|
|
7ea2093a91 | ||
|
|
dd32deb2ad | ||
|
|
ad71fb321c | ||
|
|
cc6c28a7ff | ||
|
|
c763087462 | ||
|
|
63ff4ddea0 | ||
|
|
4178fc125d | ||
|
|
dcfa7ad657 | ||
|
|
c061e60664 | ||
|
|
a0dd3ecd68 | ||
|
|
0168a312f2 | ||
|
|
92fe5a5b58 | ||
|
|
7f3d450b32 | ||
|
|
8166339920 | ||
|
|
57424d4a26 | ||
|
|
6511b6dd5d | ||
|
|
0625b97246 | ||
|
|
9f8ce82825 | ||
|
|
c3c925dc84 | ||
|
|
36f3703499 | ||
|
|
6ae59c3711 | ||
|
|
c8f5f85635 | ||
|
|
4e5e186784 | ||
|
|
828f7a513c | ||
|
|
6085998d57 | ||
|
|
71e44d5b65 | ||
|
|
e762bbdbf8 | ||
|
|
fe0d2272f6 | ||
|
|
e017b88adf | ||
|
|
5f76d9cf33 | ||
|
|
85a5bdf4dc | ||
|
|
4abc34ffd1 | ||
|
|
250b1d511b | ||
|
|
59e3b0285a | ||
|
|
f961f993c8 | ||
|
|
adf124c00c | ||
|
|
f8579131e8 | ||
|
|
1dde754724 | ||
|
|
771696fda8 | ||
|
|
dd5f469c83 | ||
|
|
6d3fda12cd | ||
|
|
dc32480563 | ||
|
|
06ac9e18cb | ||
|
|
0648943220 | ||
|
|
7a4a82e872 | ||
|
|
6c0c05cf7f | ||
|
|
efd2db129f | ||
|
|
f4f276f370 | ||
|
|
bff1462e9e | ||
|
|
4d06f33089 | ||
|
|
a433d9ef03 | ||
|
|
58606e1702 | ||
|
|
1ccc9aa72e | ||
|
|
49a9bb5a8b | ||
|
|
380d6ac5c2 | ||
|
|
7d9f76df05 | ||
|
|
96707acb4e | ||
|
|
4e504823c0 | ||
|
|
82faa2e9c9 | ||
|
|
1df9cd8071 | ||
|
|
a8d5e4dd28 | ||
|
|
e59ea39a33 | ||
|
|
62d1dc1eea | ||
|
|
379af7dec2 | ||
|
|
68a45adac7 | ||
|
|
9ea8e29cb0 | ||
|
|
90092c0762 | ||
|
|
26699914cc |
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
blank_issues_enabled: false
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
name: Issue template
|
||||||
|
about: Please fill this issue template for reporting Mongoose issues
|
||||||
|
#title:
|
||||||
|
#labels:
|
||||||
|
#assignees:
|
||||||
|
---
|
||||||
|
|
||||||
|
- My goal is: _describe_
|
||||||
|
- My actions were: _describe_
|
||||||
|
- My expectation was: _describe_
|
||||||
|
- The result I saw: _provide logs or description_
|
||||||
|
- My question is: _your question_
|
||||||
|
|
||||||
|
# Environment
|
||||||
|
|
||||||
|
- mongoose version: _X.Y_
|
||||||
|
- Compiler/IDE and SDK: ZZZ version _X.Y_
|
||||||
|
- Target hardware/board: _?_
|
||||||
|
- Connectivity chip/module: _?_
|
||||||
|
- Target RTOS/OS (if applicable): _?_
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
- My goal is: _describe_
|
|
||||||
- My actions were: _describe_
|
|
||||||
- My expectation was: _describe_
|
|
||||||
- The result I saw: _provide logs or description_
|
|
||||||
- My question is: _your question_
|
|
||||||
|
|
||||||
# Environment
|
|
||||||
|
|
||||||
- mongoose version: _X.Y_
|
|
||||||
- Compiler/IDE and SDK: ZZZ version _X.Y_
|
|
||||||
- Target hardware/board: _?_
|
|
||||||
- Connectivity chip/module: _?_
|
|
||||||
- Target RTOS/OS (if applicable): _?_
|
|
||||||
@@ -1,26 +1,24 @@
|
|||||||
name: CIFuzz
|
name: CIFuzz
|
||||||
on:
|
on:
|
||||||
pull_request:
|
schedule:
|
||||||
paths:
|
- cron: '0 2 * * *' # run at 2 AM UTC
|
||||||
- "mongoose.c"
|
# Allow manual runs
|
||||||
- "mongoose.h"
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Fuzzing:
|
Fuzzing:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: if ./test/match_changed_files.sh '^src/' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
|
||||||
- name: Build Fuzzers
|
- name: Build Fuzzers
|
||||||
id: build
|
id: build
|
||||||
if: ${{ env.GO == 1 }}
|
|
||||||
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
|
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
|
||||||
with:
|
with:
|
||||||
oss-fuzz-project-name: 'mongoose'
|
oss-fuzz-project-name: 'mongoose'
|
||||||
dry-run: false
|
dry-run: false
|
||||||
language: c++
|
language: c++
|
||||||
- name: Run Fuzzers
|
- name: Run Fuzzers
|
||||||
if: ${{ env.GO == 1 }}
|
|
||||||
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
|
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
|
||||||
with:
|
with:
|
||||||
oss-fuzz-project-name: 'mongoose'
|
oss-fuzz-project-name: 'mongoose'
|
||||||
@@ -28,8 +26,8 @@ jobs:
|
|||||||
dry-run: false
|
dry-run: false
|
||||||
language: c++
|
language: c++
|
||||||
- name: Upload Crash
|
- name: Upload Crash
|
||||||
uses: actions/upload-artifact@v1
|
uses: actions/upload-artifact@v4
|
||||||
if: env.GO == 1 && failure() && steps.build.outcome == 'success'
|
if: failure() && steps.build.outcome == 'success'
|
||||||
with:
|
with:
|
||||||
name: artifacts
|
name: artifacts
|
||||||
path: ./out/artifacts
|
path: ./out/artifacts
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
name: "CodeQL Scanning"
|
||||||
|
# https://github.com/github/codeql-action
|
||||||
|
|
||||||
|
on:
|
||||||
|
#schedule:
|
||||||
|
# - cron: '30 23 * * *' # run at 11:30 PM UTC
|
||||||
|
# Allow manual runs
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
IPV6: 0
|
||||||
|
jobs:
|
||||||
|
CodeQL-Build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
permissions:
|
||||||
|
security-events: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v3
|
||||||
|
with:
|
||||||
|
languages: cpp
|
||||||
|
- run: |
|
||||||
|
make -C test test CC=gcc ASAN= ASAN_OPTIONS=
|
||||||
|
./test/setup_ga_network.sh && make -C test mip_test CC=gcc ASAN= ASAN_OPTIONS=
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v3
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
name: Fuzz
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 21 * * *' # run at 9 PM UTC
|
||||||
|
# Allow manual runs
|
||||||
|
workflow_dispatch:
|
||||||
|
env:
|
||||||
|
CC: clang
|
||||||
|
jobs:
|
||||||
|
fuzz:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
target: [fuzz, fuzz_tls]
|
||||||
|
name: ${{ matrix.target }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: make -C test ${{ matrix.target }} ARGS="-max_total_time=14400"
|
||||||
|
|
||||||
|
# as we're not getting access to test units causing a problem, convert from the log:
|
||||||
|
# base64 -d > dataofdeath
|
||||||
|
# then paste the base64 data, enter, Ctrl-D; maybe check with hexdump -C dataofdeath
|
||||||
@@ -0,0 +1,509 @@
|
|||||||
|
name: Full build
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 22 * * *' # run at 10 PM UTC
|
||||||
|
# Allow manual runs
|
||||||
|
workflow_dispatch:
|
||||||
|
env:
|
||||||
|
IPV6: 0
|
||||||
|
jobs:
|
||||||
|
linux:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
cc: [gcc, clang, g++, clang++]
|
||||||
|
target: [test]
|
||||||
|
ssl: ["", BUILTIN, MBEDTLS, OPENSSL, WOLFSSL]
|
||||||
|
select: ["-DMG_ENABLE_POLL=0 -DMG_ENABLE_EPOLL=0", "-DMG_ENABLE_POLL=1 -DMG_ENABLE_EPOLL=0", "-DMG_ENABLE_POLL=0 -DMG_ENABLE_EPOLL=1"]
|
||||||
|
exclude:
|
||||||
|
- ssl: MBEDTLS
|
||||||
|
select: "-DMG_ENABLE_POLL=0 -DMG_ENABLE_EPOLL=0"
|
||||||
|
- ssl: MBEDTLS
|
||||||
|
select: "-DMG_ENABLE_POLL=1 -DMG_ENABLE_EPOLL=0"
|
||||||
|
- ssl: OPENSSL
|
||||||
|
select: "-DMG_ENABLE_POLL=0 -DMG_ENABLE_EPOLL=0"
|
||||||
|
- ssl: OPENSSL
|
||||||
|
select: "-DMG_ENABLE_POLL=1 -DMG_ENABLE_EPOLL=0"
|
||||||
|
- ssl: WOLFSSL
|
||||||
|
select: "-DMG_ENABLE_POLL=0 -DMG_ENABLE_EPOLL=0"
|
||||||
|
- ssl: WOLFSSL
|
||||||
|
select: "-DMG_ENABLE_POLL=1 -DMG_ENABLE_EPOLL=0"
|
||||||
|
include:
|
||||||
|
- ssl: BUILTIN
|
||||||
|
cc: gcc
|
||||||
|
target: test
|
||||||
|
select: "-DMG_ENABLE_POLL=0 -DMG_ENABLE_EPOLL=1 -DMG_ENABLE_CHACHA20=0"
|
||||||
|
name: linux ${{ matrix.target }} CC=${{ matrix.cc }} SSL=${{ matrix.ssl }} TFLAGS=${{ matrix.select }}
|
||||||
|
env:
|
||||||
|
CC: ${{ matrix.cc }}
|
||||||
|
SSL: ${{ matrix.ssl }}
|
||||||
|
TFLAGS: ${{ matrix.select }} -DMQTT_LOCALHOST -DNO_ABORT
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- uses: webfactory/ssh-agent@v0.9.1
|
||||||
|
with:
|
||||||
|
ssh-private-key: ${{ secrets.HEALTH_TESTS_SSH_KEY }}
|
||||||
|
- run: sudo apt -y update ; sudo apt -y install libmbedtls-dev libwolfssl-dev && test/setup_mqtt_server.sh && make -C test ${{ matrix.target }} > log
|
||||||
|
- if: success() || failure()
|
||||||
|
run: |
|
||||||
|
cat log
|
||||||
|
test/health.awk < log > json
|
||||||
|
scp -o "StrictHostKeyChecking=no" json "root@176.9.217.245:/data/downloads/health/linux_${{ matrix.target }}_${{ matrix.cc }}_${{ matrix.ssl }}_${{ matrix.select }}_$(date +"%Y%m%d").json"
|
||||||
|
mip:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
cc: [gcc, clang, g++, clang++]
|
||||||
|
target: [mip_test, mip_tap_test]
|
||||||
|
ssl: ["", BUILTIN, MBEDTLS, OPENSSL, WOLFSSL]
|
||||||
|
# #3226: built-in TCP is currently not working with WolfSSL (builds fine)
|
||||||
|
exclude:
|
||||||
|
- ssl: WOLFSSL
|
||||||
|
target: mip_tap_test
|
||||||
|
name: ${{ matrix.target }} CC=${{ matrix.cc }} SSL=${{ matrix.ssl }}
|
||||||
|
env:
|
||||||
|
CC: ${{ matrix.cc }}
|
||||||
|
SSL: ${{ matrix.ssl }}
|
||||||
|
TFLAGS: -DMQTT_LOCALHOST -DNO_ABORT
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- uses: webfactory/ssh-agent@v0.9.1
|
||||||
|
with:
|
||||||
|
ssh-private-key: ${{ secrets.HEALTH_TESTS_SSH_KEY }}
|
||||||
|
- run: if [ "${{ matrix.target }}" == "mip_tap_test" ]; then ./test/setup_ga_network.sh ; export IPV6=0; else export IPV6=1 ; fi && sudo apt -y update ; sudo apt -y install libmbedtls-dev libwolfssl-dev && make -C test ${{ matrix.target }} > log
|
||||||
|
- if: success() || failure()
|
||||||
|
run: |
|
||||||
|
cat log
|
||||||
|
test/health.awk < log > json
|
||||||
|
scp -o "StrictHostKeyChecking=no" json "root@176.9.217.245:/data/downloads/health/${{ matrix.target }}_${{ matrix.cc }}_${{ matrix.ssl }}_$(date +"%Y%m%d").json"
|
||||||
|
|
||||||
|
mip89:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
max-parallel: 1 # no parallel runs, to minimize MQTT errors
|
||||||
|
matrix:
|
||||||
|
target: [mip_vc98]
|
||||||
|
name: mip89 ${{ matrix.target }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: make -C test ${{ matrix.target }} IPV6=1
|
||||||
|
s390:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: ["", BUILTIN]
|
||||||
|
name: S390 SSL=${{ matrix.ssl }}
|
||||||
|
env:
|
||||||
|
TFLAGS: -DMQTT_LOCALHOST
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: sudo apt -y update ; sudo apt -y install binfmt-support qemu-user-static && ./test/setup_mqtt_server.sh && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make -C test s390 SSL=${{ matrix.ssl }} MULTIREC=NO
|
||||||
|
armhf:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: ["", BUILTIN]
|
||||||
|
name: ArmHF SSL=${{ matrix.ssl }}
|
||||||
|
env:
|
||||||
|
TFLAGS: -DMQTT_LOCALHOST
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: sudo apt -y update ; sudo apt -y install binfmt-support qemu-user-static && ./test/setup_mqtt_server.sh && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make -C test armhf SSL=${{ matrix.ssl }} MULTIREC=NO
|
||||||
|
unamalgamated-mg_prefix:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: ["", BUILTIN, MBEDTLS, OPENSSL, WOLFSSL]
|
||||||
|
name: unamalgamated-mg_prefix SSL=${{ matrix.ssl }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: sudo apt -y update ; sudo apt -y install libmbedtls-dev libwolfssl-dev
|
||||||
|
- run: make -C test unamalgamated SSL=${{ matrix.ssl }} && make -C test mg_prefix
|
||||||
|
valgrind:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: ["", BUILTIN, MBEDTLS, OPENSSL, WOLFSSL]
|
||||||
|
name: Valgrind SSL=${{ matrix.ssl }}
|
||||||
|
env:
|
||||||
|
TFLAGS: -DMQTT_LOCALHOST
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: sudo apt -y update ; sudo apt -y install libmbedtls-dev libwolfssl-dev valgrind
|
||||||
|
- run: ./test/setup_mqtt_server.sh && make -C test valgrind SSL=${{ matrix.ssl }}
|
||||||
|
macos:
|
||||||
|
runs-on: macos-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: ["", BUILTIN, MBEDTLS, OPENSSL, WOLFSSL]
|
||||||
|
select: [-DMG_ENABLE_POLL=0, -DMG_ENABLE_POLL=1]
|
||||||
|
exclude:
|
||||||
|
- ssl: MBEDTLS
|
||||||
|
select: -DMG_ENABLE_POLL=0
|
||||||
|
- ssl: MBEDTLS # see issue#2694
|
||||||
|
select: -DMG_ENABLE_POLL=1
|
||||||
|
- ssl: OPENSSL
|
||||||
|
select: -DMG_ENABLE_POLL=0
|
||||||
|
- ssl: WOLFSSL
|
||||||
|
select: -DMG_ENABLE_POLL=0
|
||||||
|
name: macos SSL=${{ matrix.ssl }} TFLAGS=${{ matrix.select }}
|
||||||
|
env:
|
||||||
|
SSL: ${{ matrix.ssl }}
|
||||||
|
TFLAGS: ${{ matrix.select }} -DMQTT_LOCALHOST ${{ matrix.env.tflags }} -DNO_ABORT -Wno-sign-conversion -Wno-undef # Workarounds for MbedTLS
|
||||||
|
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- uses: webfactory/ssh-agent@v0.9.1
|
||||||
|
with:
|
||||||
|
ssh-private-key: ${{ secrets.HEALTH_TESTS_SSH_KEY }}
|
||||||
|
- run: brew install mbedtls wolfssl mosquitto gawk # jq openssl already pre-installed
|
||||||
|
- run: /opt/homebrew/opt/mosquitto/sbin/mosquitto -c /Users/runner/work/mongoose/mongoose/test/mosquitto.conf.macos &
|
||||||
|
- run: make -C test test ASAN_OPTIONS= MBEDTLS=$(echo $(brew --cellar)/mbedtls*/*) OPENSSL=$(echo $(brew --cellar)/openssl*/*) WOLFSSL=$(echo $(brew --cellar)/wolfssl*/*) > log
|
||||||
|
- if: success() || failure()
|
||||||
|
run: |
|
||||||
|
cat log
|
||||||
|
test/health.awk < log > json
|
||||||
|
scp -o "StrictHostKeyChecking=no" json "root@176.9.217.245:/data/downloads/health/macos_test_cc_${{ matrix.ssl }}_${{ matrix.select }}_$(date +"%Y%m%d").json"
|
||||||
|
|
||||||
|
windows:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
max-parallel: 1 # no parallel runs, to minimize MQTT errors
|
||||||
|
matrix:
|
||||||
|
target: [vc98, vc17, vc22, mingw, mingw++]
|
||||||
|
ssl: ["", BUILTIN]
|
||||||
|
select: [-DMG_ENABLE_POLL=0, -DMG_ENABLE_POLL=1]
|
||||||
|
exclude:
|
||||||
|
- target: vc98
|
||||||
|
select: -DMG_ENABLE_POLL=1
|
||||||
|
name: windows ${{ matrix.target }} SSL=${{ matrix.ssl }} TFLAGS=${{ matrix.select }}
|
||||||
|
env:
|
||||||
|
SSL: ${{ matrix.ssl }}
|
||||||
|
TFLAGS: ${{ matrix.select }} -DMQTT_LOCALHOST -DNO_ABORT
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- uses: webfactory/ssh-agent@v0.9.1
|
||||||
|
with:
|
||||||
|
ssh-private-key: ${{ secrets.HEALTH_TESTS_SSH_KEY }}
|
||||||
|
- run: ./test/setup_mqtt_server.sh && make -C test ${{ matrix.target }} > log
|
||||||
|
- if: success() || failure()
|
||||||
|
run: |
|
||||||
|
cat log
|
||||||
|
test/health.awk < log > json
|
||||||
|
scp -o "StrictHostKeyChecking=no" json "root@176.9.217.245:/data/downloads/health/windows_${{ matrix.target }}_${{ matrix.cc }}_${{ matrix.ssl }}_${{ matrix.select }}_$(date +"%Y%m%d").json"
|
||||||
|
|
||||||
|
arm:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: ["", BUILTIN]
|
||||||
|
name: Arm SSL=${{ matrix.ssl }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: make -C test arm SSL=${{ matrix.ssl }}
|
||||||
|
riscv:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: ["", BUILTIN]
|
||||||
|
name: RISC-V SSL=${{ matrix.ssl }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: make -C test riscv SSL=${{ matrix.ssl }}
|
||||||
|
|
||||||
|
tutorials:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: [-DMG_TLS=MG_TLS_NONE, -DMG_TLS=MG_TLS_BUILTIN]
|
||||||
|
name: tutorials ${{ matrix.ssl }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: webfactory/ssh-agent@v0.9.1
|
||||||
|
with:
|
||||||
|
ssh-private-key: ${{ secrets.HEALTH_TESTS_SSH_KEY }}
|
||||||
|
- run: sudo apt -y install libpcap-dev
|
||||||
|
- run: make -C test tutorials CFLAGS_EXTRA="${{ matrix.ssl }}" > log
|
||||||
|
- if: success() || failure()
|
||||||
|
run: |
|
||||||
|
cat log
|
||||||
|
test/health.awk < log > json
|
||||||
|
scp -o "StrictHostKeyChecking=no" json "root@176.9.217.245:/data/downloads/health/tutorials_${{ matrix.ssl }}_$(date +"%Y%m%d").json"
|
||||||
|
- run: make -C test clean_tutorials
|
||||||
|
|
||||||
|
tutorials_win:
|
||||||
|
runs-on: windows-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: [-DMG_TLS=MG_TLS_NONE, -DMG_TLS=MG_TLS_BUILTIN]
|
||||||
|
name: tutorials_win ${{ matrix.ssl }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
# - uses: egor-tensin/setup-mingw@v2
|
||||||
|
# with:
|
||||||
|
# platform: x64
|
||||||
|
- name: test they build
|
||||||
|
run: make -C test tutorials_win CFLAGS_EXTRA="${{ matrix.ssl }}"
|
||||||
|
shell: cmd
|
||||||
|
- name: test they clean
|
||||||
|
run: make -C test clean_tutorials_win
|
||||||
|
shell: cmd
|
||||||
|
tutorials_mac:
|
||||||
|
runs-on: macos-latest
|
||||||
|
env: { HOMEBREW_NO_AUTO_UPDATE: 1 }
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: [-DMG_TLS=MG_TLS_NONE, -DMG_TLS=MG_TLS_BUILTIN]
|
||||||
|
name: tutorials_mac ${{ matrix.ssl }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: make -C test tutorials_mac CFLAGS_EXTRA="${{ matrix.ssl }}"
|
||||||
|
- run: make -C test clean_tutorials_mac
|
||||||
|
|
||||||
|
|
||||||
|
arduino:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: echo # nothing specific to install or do
|
||||||
|
- run: make -C test/arduino
|
||||||
|
- run: make -C test/arduino cleanall
|
||||||
|
|
||||||
|
|
||||||
|
# wizard_examples:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# strategy:
|
||||||
|
# fail-fast: false
|
||||||
|
# matrix:
|
||||||
|
# example:
|
||||||
|
# - path: esp32/esp32-idf
|
||||||
|
# name: ${{ matrix.example.path }}
|
||||||
|
# env:
|
||||||
|
# GO: 0
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# with: { fetch-depth: 2 }
|
||||||
|
# - run: echo # nothing specific to install or do
|
||||||
|
# fi
|
||||||
|
# - run: make -C tutorials/${{ matrix.example.path }} build
|
||||||
|
|
||||||
|
wizard_examples_arm:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
example:
|
||||||
|
- path: infineon/xmc47_relax-make-baremetal-builtin
|
||||||
|
- path: infineon/xmc_plt2go_4400-make-baremetal-builtin
|
||||||
|
- path: infineon/xmc72_evk-make-baremetal-builtin
|
||||||
|
- path: nxp/frdm-mcxn947-make-baremetal-builtin
|
||||||
|
- path: nxp/frdm-mcxn947-make-freertos-builtin
|
||||||
|
- path: nxp/rt1020-evk-make-baremetal-builtin
|
||||||
|
- path: nxp/rt1060-evk-make-baremetal-builtin
|
||||||
|
- path: nxp/rt1170-evk-make-baremetal-builtin
|
||||||
|
- path: pico-sdk/pico-w-picosdk-baremetal-builtin
|
||||||
|
- path: pico-sdk/pico-2-w-picosdk-baremetal-builtin
|
||||||
|
- path: pico-sdk/w5500-evb-pico-picosdk-baremetal-builtin
|
||||||
|
- path: pico-sdk/w5500-evb-pico2-picosdk-baremetal-builtin
|
||||||
|
- path: pico-sdk/w55rp20-evb-pico-picosdk-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-f429zi-make-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-f429zi-make-freertos-builtin
|
||||||
|
- path: stm32/nucleo-f746zg-make-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-f746zg-make-freertos-builtin
|
||||||
|
- path: stm32/nucleo-h563zi-make-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-h563zi-make-freertos-builtin
|
||||||
|
- path: stm32/nucleo-h723zg-make-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-h723zg-make-freertos-builtin
|
||||||
|
- path: stm32/nucleo-h743zi-make-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-h743zi-make-freertos-builtin
|
||||||
|
- path: stm32/stm32h573i-dk-make-baremetal-builtin
|
||||||
|
- path: stm32/stm32h573i-dk-make-freertos-builtin
|
||||||
|
- path: ti/ek-tm4c1294xl-make-baremetal-builtin
|
||||||
|
- path: ti/ek-tm4c1294xl-make-freertos-builtin
|
||||||
|
name: ${{ matrix.example.path }}
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
- run: make -C tutorials/${{ matrix.example.path }} build
|
||||||
|
|
||||||
|
|
||||||
|
generic_examples:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
example:
|
||||||
|
- path: micropython/esp32
|
||||||
|
- path: http/uart-bridge/esp32
|
||||||
|
- path: http/http-client/esp8266/http-client-server
|
||||||
|
name: ${{ matrix.example.path }}
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: echo # nothing specific to install or do
|
||||||
|
- run: make -C tutorials/${{ matrix.example.path }} build
|
||||||
|
|
||||||
|
generic_examples_arm:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
example:
|
||||||
|
- path: mqtt/mqtt-client/microchip/same54-xpro
|
||||||
|
- path: nxp/nxp-frdmk66f-freertos
|
||||||
|
- path: nxp/nxp-lpcxpresso54s018m-freertos
|
||||||
|
- path: nxp/nxp-mimxrt1020-freertos
|
||||||
|
- path: nxp/nxp-evkbimxrt1050-lwip-freertos
|
||||||
|
- path: nxp/nxp-evkmimxrt1020-lwip-freertos
|
||||||
|
- path: nxp/nxp-evkmimxrt1024-lwip-freertos
|
||||||
|
- path: nxp/nxp-evkmimxrt1060-lwip-freertos
|
||||||
|
- path: nxp/nxp-evkmimxrt1064-lwip-freertos
|
||||||
|
- path: nxp/nxp-evkmimxrt1160-cm7-lwip-freertos
|
||||||
|
- path: nxp/nxp-evkmimxrt1170-cm7-lwip-freertos
|
||||||
|
- path: nxp/nxp-frdmk64f-lwip-freertos
|
||||||
|
- path: nxp/nxp-frdmk66f-lwip-freertos
|
||||||
|
- path: nxp/nxp-lpcxpresso54018-lwip-freertos
|
||||||
|
- path: nxp/nxp-lpcxpresso54608-lwip-freertos
|
||||||
|
- path: nxp/nxp-lpcxpresso54618-lwip-freertos
|
||||||
|
- path: nxp/nxp-lpcxpresso54628-lwip-freertos
|
||||||
|
- path: nxp/nxp-twrk65f180m-lwip-freertos
|
||||||
|
- path: nxp/nxp-twrkv58f220m-lwip-freertos
|
||||||
|
- path: pico-sdk/pico-rmii
|
||||||
|
- path: stm32/nucleo-f429zi-make-baremetal-builtin-rndis
|
||||||
|
- path: stm32/nucleo-f746zg-make-baremetal-builtin-rndis
|
||||||
|
- path: stm32/nucleo-g031-make-baremetal-builtin
|
||||||
|
- path: ti/ti-ek-tm4c1294xl-http-server
|
||||||
|
- path: ti/ek-tm4c1294xl-make-baremetal-builtin-rndis
|
||||||
|
name: ${{ matrix.example.path }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
- run: make -C tutorials/${{ matrix.example.path }} build
|
||||||
|
|
||||||
|
device_dashboard_examples:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
example:
|
||||||
|
- path: esp32
|
||||||
|
name: ${{ matrix.example.path }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: echo # nothing specific to install or do
|
||||||
|
- run: make -C tutorials/http/device-dashboard/${{ matrix.example.path }} build
|
||||||
|
|
||||||
|
|
||||||
|
device_dashboard_examples_arm:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: ["", -DMG_TLS=MG_TLS_BUILTIN]
|
||||||
|
example:
|
||||||
|
- path: http/device-dashboard/microchip/same54-xpro
|
||||||
|
- path: nxp/rt1020-evk-make-freertos-builtin
|
||||||
|
- path: nxp/rt1060-evk-make-freertos-builtin
|
||||||
|
- path: nxp/rt1170-evk-make-freertos-builtin
|
||||||
|
- path: renesas/ek-ra6m4-make-baremetal-builtin
|
||||||
|
- path: pico-sdk/pico-rndis-dashboard
|
||||||
|
- path: pico-sdk/pico-w-picosdk-freertos-lwip
|
||||||
|
- path: pico-sdk/pico-2-w-picosdk-freertos-lwip
|
||||||
|
- path: stm32/nucleo-f746zg-make-freertos-tcp
|
||||||
|
- path: stm32/nucleo-f746zg-make-baremetal-builtin-cmsis_driver
|
||||||
|
name: ${{ matrix.example.path }} ${{ matrix.ssl }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
- run: make -C tutorials/${{ matrix.example.path }} build CFLAGS_EXTRA="${{ matrix.ssl }}"
|
||||||
|
|
||||||
|
# mqtt_dashboard_examples:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# strategy:
|
||||||
|
# fail-fast: false
|
||||||
|
# matrix:
|
||||||
|
# example:
|
||||||
|
# - path:
|
||||||
|
# name: ${{ matrix.example.path }}
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# with: { fetch-depth: 2 }
|
||||||
|
# - run: echo # nothing specific to install or do
|
||||||
|
# - run: make -C tutorials/${{ matrix.example.path }} build
|
||||||
|
|
||||||
|
mqtt_dashboard_examples_arm:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
example:
|
||||||
|
- path: pico-sdk/pico-rndis-device
|
||||||
|
name: ${{ matrix.example.path }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
- run: make -C tutorials/${{ matrix.example.path }} build
|
||||||
|
|
||||||
|
# dual_examples:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# strategy:
|
||||||
|
# fail-fast: false
|
||||||
|
# matrix:
|
||||||
|
# example:
|
||||||
|
# - path:
|
||||||
|
# name: ${{ matrix.example.path }}
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# with: { fetch-depth: 2 }
|
||||||
|
# - run: echo # nothing specific to install or do
|
||||||
|
# - run: make -C tutorials/${{ matrix.example.path }} device_dashboard
|
||||||
|
# - run: make -C tutorials/${{ matrix.example.path }} mqtt_dashboard
|
||||||
|
|
||||||
|
cube_examples:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: sudo pip install yq
|
||||||
|
- run: cd test/cube && make
|
||||||
|
|
||||||
|
# xpresso_examples:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# with: { fetch-depth: 2 }
|
||||||
|
# - run: sudo pip install yq
|
||||||
|
# - run: cd test/xpresso && make
|
||||||
@@ -0,0 +1,143 @@
|
|||||||
|
name: Full test
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 23 * * *' # run at 11 PM UTC
|
||||||
|
# Allow manual runs
|
||||||
|
workflow_dispatch:
|
||||||
|
env:
|
||||||
|
IPV6: 0
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
test_f7:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- name: baremetal
|
||||||
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
- run: make -C tutorials/stm32/nucleo-f746zg-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
- run: make -C tutorials/stm32/nucleo-f746zg-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
- run: make -C tutorials/stm32/nucleo-f746zg-make-freertos-tcp test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
- name: Cube
|
||||||
|
run: sudo pip install yq
|
||||||
|
# - run: make -C test/cube PROJECTS=../../tutorials/stm32/nucleo-f746zg-cube-baremetal-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=5
|
||||||
|
# - run: make -C test/cube PROJECTS=../../tutorials/stm32/nucleo-f746zg-cube-freertos-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=5
|
||||||
|
- run: make -C test/cube PROJECTS=../../tutorials/stm32/nucleo-f746zg-cube-freertos-lwip VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=5
|
||||||
|
|
||||||
|
test_f4:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- name: baremetal
|
||||||
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
- run: make -C tutorials/stm32/nucleo-f429zi-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
- run: make -C tutorials/stm32/nucleo-f429zi-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
- name: Cube
|
||||||
|
run: sudo pip install yq
|
||||||
|
# - run: make -C test/cube PROJECTS=../../tutorials/stm32/nucleo-f429zi-cube-baremetal-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=2
|
||||||
|
# - run: make -C test/cube PROJECTS=../../tutorials/stm32/nucleo-f429zi-cube-freertos-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=2
|
||||||
|
- run: make -C test/cube PROJECTS=../../tutorials/stm32/nucleo-f429zi-cube-freertos-lwip VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=2
|
||||||
|
|
||||||
|
test_h743:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 3 }
|
||||||
|
- name: baremetal
|
||||||
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
- run: make -C tutorials/stm32/nucleo-h743zi-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
- run: make -C tutorials/stm32/nucleo-h743zi-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# - name: Cube
|
||||||
|
# run: echo # nothing specific to install or do
|
||||||
|
# - run: make -C test/cube PROJECTS=../../tutorials/stm32/nucleo-h743zi-cube-baremetal-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=6
|
||||||
|
# - run: make -C test/cube PROJECTS=../../tutorials/stm32/nucleo-h743zi-cube-freertos-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=6
|
||||||
|
|
||||||
|
test_h723:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 3 }
|
||||||
|
- name: baremetal
|
||||||
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
- run: make -C tutorials/stm32/nucleo-h723zg-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
- run: make -C tutorials/stm32/nucleo-h723zg-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
|
||||||
|
test_h5:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 3 }
|
||||||
|
- name: baremetal
|
||||||
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
- run: make -C tutorials/stm32/nucleo-h563zi-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
- run: make -C tutorials/stm32/nucleo-h563zi-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
|
||||||
|
test_rt1020:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 3 }
|
||||||
|
- name: baremetal
|
||||||
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
- run: make -C tutorials/nxp/rt1020-evk-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
- run: make -C tutorials/nxp/rt1020-evk-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
|
||||||
|
test_rt1060:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 3 }
|
||||||
|
- name: baremetal
|
||||||
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
- run: make -C tutorials/nxp/rt1060-evk-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
- run: make -C tutorials/nxp/rt1060-evk-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
|
||||||
|
test_rt1170:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 3 }
|
||||||
|
- name: baremetal
|
||||||
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
- run: make -C tutorials/nxp/rt1170-evk-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
- run: make -C tutorials/nxp/rt1170-evk-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
|
||||||
|
test_ra6m4:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 3 }
|
||||||
|
- name: baremetal
|
||||||
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
- run: make -C tutorials/renesas/ek-ra6m4-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# - run: make -C tutorials/renesas/ek-ra6m4-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
|
||||||
|
test_tm4c:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- name: baremetal
|
||||||
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
- run: make -C tutorials/ti/ek-tm4c1294xl-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
- run: make -C tutorials/ti/ek-tm4c1294xl-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
|
||||||
|
test_same54:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- name: baremetal
|
||||||
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
- run: make -C tutorials/http/device-dashboard/microchip/same54-xpro test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
- run: make -C tutorials/mqtt/mqtt-client/microchip/same54-xpro test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
|
||||||
|
test_pico_w5500:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- name: SDK
|
||||||
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
- run: make -C tutorials/pico-sdk/w5500-evb-pico-picosdk-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
name: On demand ad hoc test
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
env:
|
||||||
|
IPV6: 0
|
||||||
|
jobs:
|
||||||
|
macos:
|
||||||
|
runs-on: macos-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: [MBEDTLS, WOLFSSL]
|
||||||
|
select: [-DMG_ENABLE_POLL=1]
|
||||||
|
name: macos SSL=${{ matrix.ssl }} TFLAGS=${{ matrix.select }}
|
||||||
|
env:
|
||||||
|
SSL: ${{ matrix.ssl }}
|
||||||
|
TFLAGS: ${{ matrix.select }} -DMQTT_LOCALHOST -DNO_ABORT -Wno-sign-conversion -Wno-undef # Workarounds for MbedTLS
|
||||||
|
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- uses: webfactory/ssh-agent@v0.9.1
|
||||||
|
with:
|
||||||
|
ssh-private-key: ${{ secrets.HEALTH_TESTS_SSH_KEY }}
|
||||||
|
- run: brew install mbedtls wolfssl mosquitto gawk # jq openssl already pre-installed
|
||||||
|
- run: /opt/homebrew/opt/mosquitto/sbin/mosquitto -c /Users/runner/work/mongoose/mongoose/test/mosquitto.conf.macos &
|
||||||
|
- run: make -C test test ASAN_OPTIONS= MBEDTLS=$(echo $(brew --cellar)/mbedtls*/*) OPENSSL=$(echo $(brew --cellar)/openssl*/*) WOLFSSL=$(echo $(brew --cellar)/wolfssl*/*) > log
|
||||||
|
- if: success() || failure()
|
||||||
|
run: |
|
||||||
|
cat log
|
||||||
|
test/health.awk < log > json
|
||||||
|
scp -o "StrictHostKeyChecking=no" json "root@176.9.217.245:/data/downloads/health/macos_test_cc_${{ matrix.ssl }}_${{ matrix.select }}_$(date +"%Y%m%d").json"
|
||||||
@@ -0,0 +1,723 @@
|
|||||||
|
name: Build and test - essentials
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- "**Makefile"
|
||||||
|
- "**.c"
|
||||||
|
- "**.h"
|
||||||
|
# Allow manual runs
|
||||||
|
workflow_dispatch:
|
||||||
|
env:
|
||||||
|
IPV6: 0
|
||||||
|
jobs:
|
||||||
|
linux:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
cc: [gcc, clang++]
|
||||||
|
target: [test, mip_test]
|
||||||
|
ssl: ["", BUILTIN]
|
||||||
|
name: linux ${{ matrix.target }} CC=${{ matrix.cc }} SSL=${{ matrix.ssl }}
|
||||||
|
env:
|
||||||
|
CC: ${{ matrix.cc }}
|
||||||
|
SSL: ${{ matrix.ssl }}
|
||||||
|
TFLAGS: -DMQTT_LOCALHOST
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: if [ "${{ matrix.target }}" == "test" ]; then ./test/setup_mqtt_server.sh ; fi && make -C test ${{ matrix.target }}
|
||||||
|
s390:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
TFLAGS: -DMQTT_LOCALHOST
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: sudo apt -y update ; sudo apt -y install binfmt-support qemu-user-static && ./test/setup_mqtt_server.sh && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make -C test s390
|
||||||
|
armhf:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
TFLAGS: -DMQTT_LOCALHOST
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: sudo apt -y update ; sudo apt -y install binfmt-support qemu-user-static && ./test/setup_mqtt_server.sh && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make -C test armhf
|
||||||
|
unamalgamated-mg_prefix:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: make -C test unamalgamated && make -C test mg_prefix
|
||||||
|
macos:
|
||||||
|
runs-on: macos-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: ["", BUILTIN]
|
||||||
|
name: macos SSL=${{ matrix.ssl }}
|
||||||
|
env:
|
||||||
|
SSL: ${{ matrix.ssl }}
|
||||||
|
TFLAGS: -DMQTT_LOCALHOST # -DNO_SNTP_CHECK
|
||||||
|
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
brew install mosquitto
|
||||||
|
/opt/homebrew/opt/mosquitto/sbin/mosquitto -c /Users/runner/work/mongoose/mongoose/test/mosquitto.conf.macos &
|
||||||
|
make -C test test ASAN_OPTIONS=
|
||||||
|
windows:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
target: [vc98, vc22, mingw++]
|
||||||
|
name: windows ${{ matrix.target }}
|
||||||
|
env:
|
||||||
|
TFLAGS: -DMQTT_LOCALHOST
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: ./test/setup_mqtt_server.sh && make -C test ${{ matrix.target }}
|
||||||
|
arm:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: make -C test arm
|
||||||
|
riscv:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: make -C test riscv
|
||||||
|
|
||||||
|
tutorials:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: make -C test tutorials_essential
|
||||||
|
- run: make -C test clean_tutorials_essential
|
||||||
|
tutorials_win:
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
# - uses: egor-tensin/setup-mingw@v2
|
||||||
|
# with:
|
||||||
|
# platform: x64
|
||||||
|
- name: test they build
|
||||||
|
run: make -C test tutorials_win
|
||||||
|
shell: cmd
|
||||||
|
- name: test they clean
|
||||||
|
run: make -C test clean_tutorials_win
|
||||||
|
shell: cmd
|
||||||
|
tutorials_mac:
|
||||||
|
runs-on: macos-latest
|
||||||
|
env: { HOMEBREW_NO_AUTO_UPDATE: 1 }
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: make -C test tutorials_mac
|
||||||
|
- run: make -C test clean_tutorials_mac
|
||||||
|
|
||||||
|
|
||||||
|
# wizard_examples:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# strategy:
|
||||||
|
# fail-fast: false
|
||||||
|
# matrix:
|
||||||
|
# example:
|
||||||
|
# - path: esp32/esp32-idf
|
||||||
|
# name: ${{ matrix.example.path }}
|
||||||
|
# env:
|
||||||
|
# GO: 0
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# with: { fetch-depth: 2 }
|
||||||
|
# - run: |
|
||||||
|
# if ./test/match_changed_files.sh '^src'; then
|
||||||
|
# echo GO=1 >> $GITHUB_ENV
|
||||||
|
# # nothing specific to install or do
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# run: make -C tutorials/${{ matrix.example.path }} build
|
||||||
|
|
||||||
|
wizard_examples_arm:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
example:
|
||||||
|
- path: infineon/xmc47_relax-make-baremetal-builtin
|
||||||
|
- path: infineon/xmc_plt2go_4400-make-baremetal-builtin
|
||||||
|
- path: infineon/xmc72_evk-make-baremetal-builtin
|
||||||
|
- path: nxp/frdm-mcxn947-make-baremetal-builtin
|
||||||
|
- path: nxp/frdm-mcxn947-make-freertos-builtin
|
||||||
|
- path: nxp/rt1020-evk-make-baremetal-builtin
|
||||||
|
- path: nxp/rt1060-evk-make-baremetal-builtin
|
||||||
|
- path: nxp/rt1170-evk-make-baremetal-builtin
|
||||||
|
- path: pico-sdk/pico-w-picosdk-baremetal-builtin
|
||||||
|
- path: pico-sdk/pico-2-w-picosdk-baremetal-builtin
|
||||||
|
- path: pico-sdk/w5500-evb-pico-picosdk-baremetal-builtin
|
||||||
|
- path: pico-sdk/w5500-evb-pico2-picosdk-baremetal-builtin
|
||||||
|
- path: pico-sdk/w55rp20-evb-pico-picosdk-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-f429zi-make-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-f429zi-make-freertos-builtin
|
||||||
|
- path: stm32/nucleo-f746zg-make-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-f746zg-make-freertos-builtin
|
||||||
|
- path: stm32/nucleo-h563zi-make-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-h563zi-make-freertos-builtin
|
||||||
|
- path: stm32/nucleo-h723zg-make-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-h723zg-make-freertos-builtin
|
||||||
|
- path: stm32/nucleo-h743zi-make-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-h743zi-make-freertos-builtin
|
||||||
|
- path: stm32/stm32h573i-dk-make-baremetal-builtin
|
||||||
|
- path: stm32/stm32h573i-dk-make-freertos-builtin
|
||||||
|
- path: ti/ek-tm4c1294xl-make-baremetal-builtin
|
||||||
|
- path: ti/ek-tm4c1294xl-make-freertos-builtin
|
||||||
|
name: ${{ matrix.example.path }}
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: |
|
||||||
|
if ./test/match_changed_files.sh '^src'; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: make -C tutorials/${{ matrix.example.path }} build
|
||||||
|
|
||||||
|
|
||||||
|
generic_examples:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
example:
|
||||||
|
- path: http/uart-bridge/esp32
|
||||||
|
- path: http/http-client/esp8266/http-client-server
|
||||||
|
name: ${{ matrix.example.path }}
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: if ./test/match_changed_files.sh '^src|^tutorials/http/uart-bridge|^tutorials/${{ matrix.example.path }}'; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
# nothing specific to install or do
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: make -C tutorials/${{ matrix.example.path }} build
|
||||||
|
|
||||||
|
generic_examples_arm:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
example:
|
||||||
|
- path: stm32/nucleo-g031-make-baremetal-builtin
|
||||||
|
name: ${{ matrix.example.path }}
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: if ./test/match_changed_files.sh '^src|^tutorials/${{ matrix.example.path }}'; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: make -C tutorials/${{ matrix.example.path }} build
|
||||||
|
|
||||||
|
device_dashboard_examples:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
example:
|
||||||
|
- path: esp32
|
||||||
|
name: ${{ matrix.example.path }}
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|tutorials/http/device-dashboard'; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
# nothing specific to install or do
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: make -C tutorials/http/device-dashboard/${{ matrix.example.path }} build
|
||||||
|
|
||||||
|
device_dashboard_examples_arm:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
example:
|
||||||
|
- path: http/device-dashboard/microchip/same54-xpro
|
||||||
|
- path: nxp/rt1020-evk-make-freertos-builtin
|
||||||
|
- path: nxp/rt1060-evk-make-freertos-builtin
|
||||||
|
- path: nxp/rt1170-evk-make-freertos-builtin
|
||||||
|
- path: renesas/ek-ra6m4-make-baremetal-builtin
|
||||||
|
- path: pico-sdk/pico-rndis-dashboard
|
||||||
|
- path: pico-sdk/pico-w-picosdk-freertos-lwip
|
||||||
|
- path: pico-sdk/pico-2-w-picosdk-freertos-lwip
|
||||||
|
- path: stm32/nucleo-f746zg-make-freertos-tcp
|
||||||
|
- path: stm32/nucleo-f746zg-make-baremetal-builtin-cmsis_driver
|
||||||
|
name: ${{ matrix.example.path }}
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|tutorials/http/device-dashboard|^tutorials/${{ matrix.example.path }}'; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: make -C tutorials/${{ matrix.example.path }} build
|
||||||
|
|
||||||
|
# mqtt_dashboard_examples:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# strategy:
|
||||||
|
# fail-fast: false
|
||||||
|
# matrix:
|
||||||
|
# example:
|
||||||
|
# - path:
|
||||||
|
# name: ${{ matrix.example.path }}
|
||||||
|
# env:
|
||||||
|
# GO: 0
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# with: { fetch-depth: 2 }
|
||||||
|
# - run: |
|
||||||
|
# if ./test/match_changed_files.sh '^src|tutorials/mqtt/mqtt-dashboard/device|^tutorials/${{ matrix.example.path }}'; then
|
||||||
|
# echo GO=1 >> $GITHUB_ENV
|
||||||
|
# # nothing specific to install or do
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# run: make -C tutorials/${{ matrix.example.path }} build
|
||||||
|
|
||||||
|
mqtt_dashboard_examples_arm:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
example:
|
||||||
|
- path: pico-sdk/pico-rndis-device
|
||||||
|
name: ${{ matrix.example.path }}
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|tutorials/mqtt/mqtt-dashboard/device|^tutorials/${{ matrix.example.path }}'; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: make -C tutorials/${{ matrix.example.path }} build
|
||||||
|
|
||||||
|
cube_examples:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|tutorials/stm32/nucleo-*-cube-*'; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
sudo pip install yq
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: cd test/cube && make
|
||||||
|
|
||||||
|
# xpresso_examples:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# env:
|
||||||
|
# GO: 0
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# with: { fetch-depth: 2 }
|
||||||
|
# - run: |
|
||||||
|
# if ./test/match_changed_files.sh '^src|tutorials/stm32/nucleo-*-cube-*'; then
|
||||||
|
# echo GO=1 >> $GITHUB_ENV
|
||||||
|
# sudo pip install yq
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# run: cd test/xpresso && make
|
||||||
|
|
||||||
|
|
||||||
|
# test_f7:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# env:
|
||||||
|
# GO: 0
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# with: { fetch-depth: 2 }
|
||||||
|
# - name: baremetal
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh "^src|tutorials/http/device-dashboard|tutorials/stm32/nucleo-f7.*-make-" ; then
|
||||||
|
# echo GO=1 >> $GITHUB_ENV
|
||||||
|
# sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
# fi
|
||||||
|
# # always run baremetal on core or dashboard or specific example changes; other examples only on specific example changes
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# continue-on-error: true # continue so next test has a chance to re-flash and exit from collisions and flash failures
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh '^src|tutorials/http/device-dashboard|tutorials/stm32/nucleo-f746zg-make-baremetal-builtin'; then
|
||||||
|
# make -C tutorials/stm32/nucleo-f746zg-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh 'tutorials/stm32/nucleo-f746zg-make-freertos-builtin'; then
|
||||||
|
# make -C tutorials/stm32/nucleo-f746zg-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh 'tutorials/stm32/nucleo-f746zg-make-freertos-tcp'; then
|
||||||
|
# make -C tutorials/stm32/nucleo-f746zg-make-freertos-tcp test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# fi
|
||||||
|
# - name: Cube
|
||||||
|
# run: |
|
||||||
|
# echo GO=0 >> $GITHUB_ENV
|
||||||
|
# if ./test/match_changed_files.sh 'tutorials/stm32/nucleo-f7.*-cube-'; then
|
||||||
|
# echo GO=1 >> $GITHUB_ENV
|
||||||
|
# # nothing specific to install or do
|
||||||
|
# fi
|
||||||
|
## - if: ${{ env.GO == 1 }}
|
||||||
|
## run: |
|
||||||
|
## if ./test/match_changed_files.sh 'tutorials/stm32/nucleo-f746zg-cube-baremetal-builtin'; then
|
||||||
|
## make -C test/cube test PROJECTS=../../tutorials/stm32/nucleo-f746zg-cube-baremetal-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=5
|
||||||
|
## fi
|
||||||
|
## - if: ${{ env.GO == 1 }}
|
||||||
|
## run: |
|
||||||
|
## if ./test/match_changed_files.sh 'tutorials/stm32/nucleo-f746zg-cube-freertos-builtin'; then
|
||||||
|
## make -C test/cube test PROJECTS=../../tutorials/stm32/nucleo-f746zg-cube-freertos-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=5
|
||||||
|
## fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh 'tutorials/stm32/nucleo-f746zg-cube-freertos-lwip'; then
|
||||||
|
# make -C test/cube test PROJECTS=../../tutorials/stm32/nucleo-f746zg-cube-freertos-lwip VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=5
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# test_f4:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# env:
|
||||||
|
# GO: 0
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# with: { fetch-depth: 2 }
|
||||||
|
# - name: baremetal
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh "^src|tutorials/http/device-dashboard|tutorials/stm32/nucleo-f4.*-make-" ; then
|
||||||
|
# echo GO=1 >> $GITHUB_ENV
|
||||||
|
# sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# continue-on-error: true
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh '^src|tutorials/http/device-dashboard|tutorials/stm32/nucleo-f429zi-make-baremetal-builtin'; then
|
||||||
|
# make -C tutorials/stm32/nucleo-f429zi-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh 'tutorials/stm32/nucleo-f429zi-make-freertos-builtin'; then
|
||||||
|
# make -C tutorials/stm32/nucleo-f429zi-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# fi
|
||||||
|
# - name: Cube
|
||||||
|
# run: |
|
||||||
|
# echo GO=0 >> $GITHUB_ENV
|
||||||
|
# if ./test/match_changed_files.sh 'tutorials/stm32/nucleo-f4.*-cube-'; then
|
||||||
|
# echo GO=1 >> $GITHUB_ENV
|
||||||
|
# # nothing specific to install or do
|
||||||
|
# fi
|
||||||
|
## - if: ${{ env.GO == 1 }}
|
||||||
|
## run: |
|
||||||
|
## if ./test/match_changed_files.sh 'tutorials/stm32/nucleo-f429zi-cube-baremetal-builtin'; then
|
||||||
|
## make -C test/cube test PROJECTS=../../tutorials/stm32/nucleo-f429zi-cube-baremetal-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=2
|
||||||
|
## fi
|
||||||
|
## - if: ${{ env.GO == 1 }}
|
||||||
|
## run: |
|
||||||
|
## if ./test/match_changed_files.sh 'tutorials/stm32/nucleo-f429zi-cube-freertos-builtin'; then
|
||||||
|
## make -C test/cube test PROJECTS=../../tutorials/stm32/nucleo-f429zi-cube-freertos-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=2
|
||||||
|
## fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh 'tutorials/stm32/nucleo-f429zi-cube-freertos-lwip'; then
|
||||||
|
# make -C test/cube test PROJECTS=../../tutorials/stm32/nucleo-f429zi-cube-freertos-lwip VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=2
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
# test_h743:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# env:
|
||||||
|
# GO: 0
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# with: { fetch-depth: 3 }
|
||||||
|
# - name: baremetal
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh "^src|tutorials/http/device-dashboard|tutorials/stm32/nucleo-h74.*-make-" ; then
|
||||||
|
# echo GO=1 >> $GITHUB_ENV
|
||||||
|
# sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# continue-on-error: true
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh '^src|tutorials/http/device-dashboard|tutorials/stm32/nucleo-h743zi-make-baremetal-builtin'; then
|
||||||
|
# make -C tutorials/stm32/nucleo-h743zi-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh 'tutorials/stm32/nucleo-h743zi-make-freertos-builtin'; then
|
||||||
|
# make -C tutorials/stm32/nucleo-h743zi-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# fi
|
||||||
|
## - name: Cube
|
||||||
|
## run: |
|
||||||
|
## echo GO=0 >> $GITHUB_ENV
|
||||||
|
## if ./test/match_changed_files.sh 'tutorials/stm32/nucleo-h74.*-cube-'; then
|
||||||
|
## echo GO=1 >> $GITHUB_ENV
|
||||||
|
## # nothing specific to install or do
|
||||||
|
## fi
|
||||||
|
## - if: ${{ env.GO == 1 }}
|
||||||
|
## run: |
|
||||||
|
## if ./test/match_changed_files.sh 'tutorials/stm32/nucleo-h743zi-cube-baremetal-builtin'; then
|
||||||
|
## make -C test/cube test PROJECTS=../../tutorials/stm32/nucleo-h743zi-cube-baremetal-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=6
|
||||||
|
## fi
|
||||||
|
## - if: ${{ env.GO == 1 }}
|
||||||
|
## run: |
|
||||||
|
## if ./test/match_changed_files.sh 'tutorials/stm32/nucleo-h743zi-cube-freertos-builtin'; then
|
||||||
|
## make -C test/cube test PROJECTS=../../tutorials/stm32/nucleo-h743zi-cube-freertos-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=6
|
||||||
|
## fi
|
||||||
|
#
|
||||||
|
# test_h723:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# env:
|
||||||
|
# GO: 0
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# with: { fetch-depth: 3 }
|
||||||
|
# - name: baremetal
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh "^src|tutorials/http/device-dashboard|tutorials/stm32/nucleo-h72.*-make-" ; then
|
||||||
|
# echo GO=1 >> $GITHUB_ENV
|
||||||
|
# sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# continue-on-error: true
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh '^src|tutorials/http/device-dashboard|tutorials/stm32/nucleo-h723zg-make-baremetal-builtin'; then
|
||||||
|
# make -C tutorials/stm32/nucleo-h723zg-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh 'tutorials/stm32/nucleo-h723zg-make-freertos-builtin'; then
|
||||||
|
# make -C tutorials/stm32/nucleo-h723zg-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
# test_h5:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# env:
|
||||||
|
# GO: 0
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# with: { fetch-depth: 3 }
|
||||||
|
# - name: baremetal
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh "^src|tutorials/http/device-dashboard|tutorials/stm32/nucleo-h5.*-make-" ; then
|
||||||
|
# echo GO=1 >> $GITHUB_ENV
|
||||||
|
# sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# continue-on-error: true
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh '^src|tutorials/http/device-dashboard|tutorials/stm32/nucleo-h563zi-make-baremetal-builtin'; then
|
||||||
|
# make -C tutorials/stm32/nucleo-h563zi-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh 'tutorials/stm32/nucleo-h563zi-make-freertos-builtin'; then
|
||||||
|
# make -C tutorials/stm32/nucleo-h563zi-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
# test_rt1020:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# env:
|
||||||
|
# GO: 0
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# with: { fetch-depth: 3 }
|
||||||
|
# - name: baremetal
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh "^src|tutorials/http/device-dashboard|tutorials/nxp/rt1020.*-make-" ; then
|
||||||
|
# echo GO=1 >> $GITHUB_ENV
|
||||||
|
# sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# continue-on-error: true
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh '^src|tutorials/http/device-dashboard|tutorials/nxp/rt1020-evk-make-baremetal-builtin'; then
|
||||||
|
# make -C tutorials/nxp/rt1020-evk-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh 'tutorials/nxp/rt1020-evk-make-freertos-builtin'; then
|
||||||
|
# make -C tutorials/nxp/rt1020-evk-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
# test_rt1060:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# env:
|
||||||
|
# GO: 0
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# with: { fetch-depth: 3 }
|
||||||
|
# - name: baremetal
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh "^src|tutorials/http/device-dashboard|tutorials/nxp/rt1060.*-make-" ; then
|
||||||
|
# echo GO=1 >> $GITHUB_ENV
|
||||||
|
# sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# continue-on-error: true
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh '^src|tutorials/http/device-dashboard|tutorials/nxp/rt1060-evk-make-baremetal-builtin'; then
|
||||||
|
# make -C tutorials/nxp/rt1060-evk-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh 'tutorials/nxp/rt1060-evk-make-freertos-builtin'; then
|
||||||
|
# make -C tutorials/nxp/rt1060-evk-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
# test_rt1170:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# env:
|
||||||
|
# GO: 0
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# with: { fetch-depth: 3 }
|
||||||
|
# - name: baremetal
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh "^src|tutorials/http/device-dashboard|tutorials/nxp/rt1170.*-make-" ; then
|
||||||
|
# echo GO=1 >> $GITHUB_ENV
|
||||||
|
# sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# continue-on-error: true
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh '^src|tutorials/http/device-dashboard|tutorials/nxp/rt1170-evk-make-baremetal-builtin'; then
|
||||||
|
# make -C tutorials/nxp/rt1170-evk-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh 'tutorials/nxp/rt1170-evk-make-freertos-builtin'; then
|
||||||
|
# make -C tutorials/nxp/rt1170-evk-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
# test_ra6m4:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# env:
|
||||||
|
# GO: 0
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# with: { fetch-depth: 3 }
|
||||||
|
# - name: baremetal
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh "^src|tutorials/http/device-dashboard|tutorials/renesas/ek-ra6m4.*-make-" ; then
|
||||||
|
# echo GO=1 >> $GITHUB_ENV
|
||||||
|
# sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# continue-on-error: true
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh '^src|tutorials/http/device-dashboard|tutorials/renesas/ek-ra6m4-make-baremetal-builtin'; then
|
||||||
|
# make -C tutorials/renesas/ek-ra6m4-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# fi
|
||||||
|
## - if: ${{ env.GO == 1 }}
|
||||||
|
## run: |
|
||||||
|
## if ./test/match_changed_files.sh 'tutorials/renesas/ek-ra6m4-make-freertos-builtin'; then
|
||||||
|
## make -C tutorials/renesas/ek-ra6m4-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
## fi
|
||||||
|
#
|
||||||
|
# test_tm4c:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# env:
|
||||||
|
# GO: 0
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# with: { fetch-depth: 2 }
|
||||||
|
# - name: baremetal
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh "^src|tutorials/http/device-dashboard|tutorials/ti/ek-tm4c.*-make-" ; then
|
||||||
|
# echo GO=1 >> $GITHUB_ENV
|
||||||
|
# sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh '^src|tutorials/http/device-dashboard|tutorials/ti/ek-tm4c1294xl-make-baremetal-builtin'; then
|
||||||
|
# make -C tutorials/ti/ek-tm4c1294xl-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh 'tutorials/ti/ek-tm4c1294xl-make-freertos-builtin'; then
|
||||||
|
# make -C tutorials/ti/ek-tm4c1294xl-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
# test_same54:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# env:
|
||||||
|
# GO: 0
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# with: { fetch-depth: 2 }
|
||||||
|
# - name: baremetal
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh "^src|tutorials/http/device-dashboard|tutorials/mqtt/mqtt-client" ; then
|
||||||
|
# echo GO=1 >> $GITHUB_ENV
|
||||||
|
# sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh '^src|tutorials/http/device-dashboard'; then
|
||||||
|
# make -C tutorials/http/device-dashboard/microchip/same54-xpro test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh '^src|tutorials/mqtt/mqtt-client'; then
|
||||||
|
# make -C tutorials/mqtt/mqtt-client/microchip/same54-xpro test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
# test_pico_w5500:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# env:
|
||||||
|
# GO: 0
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# with: { fetch-depth: 2 }
|
||||||
|
# - name: SDK
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh "^src" ; then
|
||||||
|
# echo GO=1 >> $GITHUB_ENV
|
||||||
|
# sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# run: make -C tutorials/pico-sdk/w5500-evb-pico-picosdk-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
|
||||||
+565
-106
@@ -1,10 +1,6 @@
|
|||||||
name: build
|
name: original workflow, outdated # *** YES, OUTDATED *** kept for hystorical/reference purposes, attachment, etc.
|
||||||
on:
|
on:
|
||||||
push:
|
workflow_dispatch:
|
||||||
paths:
|
|
||||||
- "**Makefile"
|
|
||||||
- "**.c"
|
|
||||||
- "**.h"
|
|
||||||
env:
|
env:
|
||||||
IPV6: 0
|
IPV6: 0
|
||||||
jobs:
|
jobs:
|
||||||
@@ -15,11 +11,22 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
cc: [gcc, clang, g++, clang++]
|
cc: [gcc, clang, g++, clang++]
|
||||||
target: [test, mip_test]
|
target: [test, mip_test]
|
||||||
ssl: [MBEDTLS, OPENSSL]
|
ssl: ["", MBEDTLS, OPENSSL]
|
||||||
name: linux ${{ matrix.target }} CC=${{ matrix.cc }} SSL=${{ matrix.ssl }}
|
select: ["-DMG_ENABLE_POLL=0 -DMG_ENABLE_EPOLL=0", "-DMG_ENABLE_POLL=1 -DMG_ENABLE_EPOLL=0", "-DMG_ENABLE_POLL=0 -DMG_ENABLE_EPOLL=1"]
|
||||||
|
exclude:
|
||||||
|
- ssl: MBEDTLS
|
||||||
|
select: "-DMG_ENABLE_POLL=0 -DMG_ENABLE_EPOLL=0"
|
||||||
|
- ssl: MBEDTLS
|
||||||
|
select: "-DMG_ENABLE_POLL=1 -DMG_ENABLE_EPOLL=0"
|
||||||
|
- ssl: OPENSSL
|
||||||
|
select: "-DMG_ENABLE_POLL=0 -DMG_ENABLE_EPOLL=0"
|
||||||
|
- ssl: OPENSSL
|
||||||
|
select: "-DMG_ENABLE_POLL=1 -DMG_ENABLE_EPOLL=0"
|
||||||
|
name: linux ${{ matrix.target }} CC=${{ matrix.cc }} SSL=${{ matrix.ssl }} TFLAGS=${{ matrix.select }}
|
||||||
env:
|
env:
|
||||||
CC: ${{ matrix.cc }}
|
CC: ${{ matrix.cc }}
|
||||||
SSL: ${{ matrix.ssl }}
|
SSL: ${{ matrix.ssl }}
|
||||||
|
TFLAGS: ${{ matrix.select }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
@@ -54,7 +61,21 @@ jobs:
|
|||||||
run: make unamalgamated && make valgrind && make mg_prefix
|
run: make unamalgamated && make valgrind && make mg_prefix
|
||||||
macos:
|
macos:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
env: { HOMEBREW_NO_AUTO_UPDATE: 1 }
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: ["", MBEDTLS, OPENSSL]
|
||||||
|
select: [-DMG_ENABLE_POLL=0, -DMG_ENABLE_POLL=1]
|
||||||
|
exclude:
|
||||||
|
- ssl: MBEDTLS
|
||||||
|
select: -DMG_ENABLE_POLL=0
|
||||||
|
- ssl: OPENSSL
|
||||||
|
select: -DMG_ENABLE_POLL=0
|
||||||
|
name: macos SSL=${{ matrix.ssl }} TFLAGS=${{ matrix.select }}
|
||||||
|
env:
|
||||||
|
SSL: ${{ matrix.ssl }}
|
||||||
|
TFLAGS: ${{ matrix.select }} -DNO_SNTP_CHECK -Wno-sign-conversion # Workaround for MbedTLS 3.5.0
|
||||||
|
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
@@ -62,27 +83,28 @@ jobs:
|
|||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
run: brew install jq mbedtls openssl
|
run: brew install jq mbedtls openssl
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
run: make test upload-coverage TFLAGS=-DNO_SNTP_CHECK SSL=OPENSSL ASAN_OPTIONS= OPENSSL=`echo /usr/local/Cellar/openssl*/*`
|
run: make test ASAN_OPTIONS= MBEDTLS=`echo /usr/local/Cellar/mbedtls*/*` OPENSSL=`echo /usr/local/Cellar/openssl*/*`
|
||||||
- if: ${{ env.GO == 1 }}
|
|
||||||
run: make test SSL=MBEDTLS TFLAGS=-DNO_SNTP_CHECK ASAN_OPTIONS= MBEDTLS=`echo /usr/local/Cellar/mbedtls*/*`
|
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
run: make mg_prefix
|
run: make mg_prefix
|
||||||
windows:
|
windows:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
target: [vc98, vc17, vc22, mingw, mingw++]
|
||||||
|
select: [-DMG_ENABLE_POLL=0, -DMG_ENABLE_POLL=1]
|
||||||
|
exclude:
|
||||||
|
- target: vc98
|
||||||
|
select: -DMG_ENABLE_POLL=1
|
||||||
|
name: windows ${{ matrix.target }} TFLAGS=${{ matrix.select }}
|
||||||
|
env:
|
||||||
|
TFLAGS: ${{ matrix.select }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
run: make vc98 vc17 vc22 mingw mingw++
|
run: make ${{ matrix.target }}
|
||||||
arduino-xiao:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with: { fetch-depth: 2 }
|
|
||||||
- run: if ./test/match_changed_files.sh '^examples/arduino|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
|
||||||
- if: ${{ env.GO == 1 }}
|
|
||||||
run: make arduino-xiao
|
|
||||||
arm:
|
arm:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -99,8 +121,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- run: sudo apt -y install libmbedtls-dev libpcap-dev
|
- run: sudo apt -y install libmbedtls-dev libpcap-dev
|
||||||
- run: make clean examples
|
- run: make examples
|
||||||
- run: make clean test MG_ENABLE_POLL=1
|
- run: make clean
|
||||||
examples_win:
|
examples_win:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -122,92 +144,63 @@ jobs:
|
|||||||
- run: make examples_mac
|
- run: make examples_mac
|
||||||
- run: make clean_examples_mac
|
- run: make clean_examples_mac
|
||||||
|
|
||||||
test_f7:
|
|
||||||
|
arduino:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: if ./test/match_changed_files.sh "^src|examples/stm32/nucleo-f7" ; then echo GO=1 >> $GITHUB_ENV ; fi
|
- run: |
|
||||||
|
if ./test/match_changed_files.sh "^src|examples/device-dashboard|examples/arduino" ; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
# nothing specific to install or do
|
||||||
|
fi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
run: sudo apt -y update; sudo apt -y install gcc-arm-none-eabi
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/arduino'; then
|
||||||
|
make -C examples/arduino arduino-xiao
|
||||||
|
fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh '^src|examples/arduino'; then
|
||||||
|
# make -C examples/arduino arduino-nano
|
||||||
|
# fi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
run: make -C examples/stm32/nucleo-f746zg-baremetal test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
run: make -C examples/arduino clean
|
||||||
- if: ${{ env.GO == 1 }}
|
|
||||||
run: make -C examples/stm32/nucleo-f746zg-freertos test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
|
||||||
- if: ${{ env.GO == 1 }}
|
|
||||||
run: make -C examples/stm32/nucleo-f746zg-freertos-tcp test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
|
||||||
|
|
||||||
test_f4:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with: { fetch-depth: 2 }
|
|
||||||
- run: if ./test/match_changed_files.sh "^src|examples/stm32/nucleo-f4" ; then echo GO=1 >> $GITHUB_ENV ; fi
|
|
||||||
- if: ${{ env.GO == 1 }}
|
|
||||||
run: sudo apt -y update; sudo apt -y install gcc-arm-none-eabi
|
|
||||||
- if: ${{ env.GO == 1 }}
|
|
||||||
run: make -C examples/stm32/nucleo-f429zi-baremetal test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
|
||||||
- if: ${{ env.GO == 1 }}
|
|
||||||
run: make -C examples/stm32/nucleo-f429zi-freertos test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
|
||||||
|
|
||||||
test_h7:
|
generic_examples:
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with: { fetch-depth: 3 }
|
|
||||||
- run: if ./test/match_changed_files.sh "^src|examples/stm32/nucleo-h7" ; then echo GO=1 >> $GITHUB_ENV ; fi
|
|
||||||
- if: ${{ env.GO == 1 }}
|
|
||||||
run: sudo apt -y update; sudo apt -y install gcc-arm-none-eabi
|
|
||||||
- if: ${{ env.GO == 1 }}
|
|
||||||
run: make -C examples/stm32/nucleo-h743zi-baremetal test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
|
||||||
|
|
||||||
test_tm4c:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with: { fetch-depth: 2 }
|
|
||||||
- run: if ./test/match_changed_files.sh "^src|examples/ti/ek-tm4c" ; then echo GO=1 >> $GITHUB_ENV ; fi
|
|
||||||
- if: ${{ env.GO == 1 }}
|
|
||||||
run: sudo apt -y update; sudo apt -y install gcc-arm-none-eabi
|
|
||||||
- run: echo GO=0 > $GITHUB_ENV ; if ./test/match_changed_files.sh "^src|examples/ti/ek-tm4c1294xl-baremetal" ; then echo GO=1 > $GITHUB_ENV ; fi
|
|
||||||
- if: ${{ env.GO == 1 }}
|
|
||||||
run: make -C examples/ti/ek-tm4c1294xl-baremetal test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
|
||||||
- run: echo GO=0 > $GITHUB_ENV ; if ./test/match_changed_files.sh "^src|examples/ti/ek-tm4c1294xl-freertos" ; then echo GO=1 > $GITHUB_ENV ; fi
|
|
||||||
- if: ${{ env.GO == 1 }}
|
|
||||||
run: make -C examples/ti/ek-tm4c1294xl-freertos test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
|
||||||
|
|
||||||
test_pico_w5500:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with: { fetch-depth: 2 }
|
|
||||||
- run: if ./test/match_changed_files.sh "^src|examples/rp2040/pico-w5500" ; then echo GO=1 >> $GITHUB_ENV ; fi
|
|
||||||
- if: ${{ env.GO == 1 }}
|
|
||||||
run: sudo apt -y update; sudo apt -y install gcc-arm-none-eabi
|
|
||||||
- if: ${{ env.GO == 1 }}
|
|
||||||
run: make -C examples/rp2040/pico-w5500 test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
|
||||||
|
|
||||||
matrix_examples:
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
example:
|
example:
|
||||||
- path: esp32/device-dashboard
|
|
||||||
- path: esp32/uart-bridge
|
- path: esp32/uart-bridge
|
||||||
|
- path: esp32/micropython
|
||||||
- path: esp8266/http-client-server
|
- path: esp8266/http-client-server
|
||||||
- path: stm32/nucleo-h743zi-baremetal
|
name: ${{ matrix.example.path }}
|
||||||
- path: stm32/stm32-nucleo-f746z
|
env:
|
||||||
- path: stm32/stm32-nucleo-f746zg
|
GO: 0
|
||||||
- path: stm32/stm32-nucleo-f429z
|
steps:
|
||||||
- path: stm32/stm32-nucleo-h743z
|
- uses: actions/checkout@v3
|
||||||
- path: stm32/nucleo-f429zi-baremetal
|
with: { fetch-depth: 2 }
|
||||||
- path: stm32/nucleo-f429zi-freertos
|
- run: if ./test/match_changed_files.sh '^src|^examples/${{ matrix.example.path }}'; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
- path: stm32/nucleo-f429zi-rndis
|
- if: ${{ env.GO == 1 }}
|
||||||
- path: stm32/nucleo-f746zg-baremetal
|
run: |
|
||||||
- path: stm32/nucleo-f746zg-freertos
|
# nothing specific to install or do
|
||||||
- path: stm32/nucleo-f746zg-freertos-tcp
|
- if: ${{ env.GO == 1 }}
|
||||||
- path: stm32/nucleo-f746zg-rndis
|
run: make -C examples/${{ matrix.example.path }} build
|
||||||
|
|
||||||
|
generic_examples_arm:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
example:
|
||||||
|
- path: microchip/same54-xpro/mqtt-client
|
||||||
|
- path: infineon/infineon-xmc4700_4800-lwip-rtx-rtos
|
||||||
- path: nxp/nxp-mimxrt1020-azurertos
|
- path: nxp/nxp-mimxrt1020-azurertos
|
||||||
- path: nxp/nxp-frdmk66f-freertos
|
- path: nxp/nxp-frdmk66f-freertos
|
||||||
- path: nxp/nxp-lpcxpresso54s018m-freertos
|
- path: nxp/nxp-lpcxpresso54s018m-freertos
|
||||||
@@ -227,39 +220,215 @@ jobs:
|
|||||||
- path: nxp/nxp-lpcxpresso54628-lwip-freertos
|
- path: nxp/nxp-lpcxpresso54628-lwip-freertos
|
||||||
- path: nxp/nxp-twrk65f180m-lwip-freertos
|
- path: nxp/nxp-twrk65f180m-lwip-freertos
|
||||||
- path: nxp/nxp-twrkv58f220m-lwip-freertos
|
- path: nxp/nxp-twrkv58f220m-lwip-freertos
|
||||||
- path: infineon/infineon-xmc4700_4800-lwip-rtx-rtos
|
|
||||||
- path: ti/ti-ek-tm4c1294xl-http-server
|
|
||||||
- path: ti/ek-tm4c1294xl-baremetal
|
|
||||||
- path: ti/ek-tm4c1294xl-freertos
|
|
||||||
- path: rp2040/pico-rmii
|
- path: rp2040/pico-rmii
|
||||||
- path: rp2040/pico-rndis-dashboard
|
- path: stm32/nucleo-f429zi-make-baremetal-builtin-rndis
|
||||||
- path: rp2040/pico-w
|
- path: stm32/nucleo-f746zg-make-baremetal-builtin-rndis
|
||||||
- path: rp2040/pico-w5500
|
- path: stm32/nucleo-g031-make-baremetal-builtin
|
||||||
|
- path: ti/ti-ek-tm4c1294xl-http-server
|
||||||
|
- path: ti/ek-tm4c1294xl-make-baremetal-builtin-rndis
|
||||||
name: ${{ matrix.example.path }}
|
name: ${{ matrix.example.path }}
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: if ./test/match_changed_files.sh '^src|^examples/${{ matrix.example.path }}'; then echo GO=1 >> $GITHUB_ENV ; fi
|
- run: if ./test/match_changed_files.sh '^src|^examples/${{ matrix.example.path }}'; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
run: sudo apt -y update ; sudo apt -y install gcc-arm-none-eabi
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
run: make -C examples/${{ matrix.example.path }} build
|
run: make -C examples/${{ matrix.example.path }} build
|
||||||
|
|
||||||
cube_examples:
|
device_dashboard_examples:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
example:
|
||||||
|
- path: esp32/device-dashboard
|
||||||
|
name: ${{ matrix.example.path }}
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: if ./test/match_changed_files.sh '^src|examples/stm32/nucleo-*-cube-*'; then echo GO=1 >> $GITHUB_ENV ; fi
|
- run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|^examples/${{ matrix.example.path }}'; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
# nothing specific to install or do
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: make -C examples/${{ matrix.example.path }} build
|
||||||
|
|
||||||
|
device_dashboard_examples_arm:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
example:
|
||||||
|
- path: microchip/same54-xpro/device-dashboard
|
||||||
|
- path: nxp/rt1020-evk-make-baremetal-builtin
|
||||||
|
- path: nxp/rt1020-evk-make-freertos-builtin
|
||||||
|
- path: nxp/rt1060-evk-make-baremetal-builtin
|
||||||
|
- path: nxp/rt1060-evk-make-freertos-builtin
|
||||||
|
- path: rp2040/pico-rndis-dashboard
|
||||||
|
- path: rp2040/pico-w
|
||||||
|
- path: rp2040/pico-w5500
|
||||||
|
- path: stm32/nucleo-f429zi-make-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-f429zi-make-freertos-builtin
|
||||||
|
- path: stm32/nucleo-f746zg-make-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-f746zg-make-freertos-builtin
|
||||||
|
- path: stm32/nucleo-f746zg-make-freertos-tcp
|
||||||
|
- path: stm32/nucleo-f746zg-make-baremetal-builtin-cmsis_driver
|
||||||
|
- path: stm32/nucleo-h563zi-make-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-h563zi-make-freertos-builtin
|
||||||
|
- path: stm32/nucleo-h723zg-make-freertos-builtin
|
||||||
|
- path: stm32/nucleo-h743zi-make-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-h743zi-make-freertos-builtin
|
||||||
|
- path: stm32/stm32h573i-dk-make-baremetal-builtin
|
||||||
|
- path: stm32/stm32h573i-dk-make-freertos-builtin
|
||||||
|
- path: ti/ek-tm4c1294xl-make-baremetal-builtin
|
||||||
|
- path: ti/ek-tm4c1294xl-make-freertos-builtin
|
||||||
|
name: ${{ matrix.example.path }}
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|^examples/${{ matrix.example.path }}'; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: make -C examples/${{ matrix.example.path }} build
|
||||||
|
|
||||||
|
# mqtt_dashboard_examples:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# strategy:
|
||||||
|
# fail-fast: false
|
||||||
|
# matrix:
|
||||||
|
# example:
|
||||||
|
# - path:
|
||||||
|
# name: ${{ matrix.example.path }}
|
||||||
|
# env:
|
||||||
|
# GO: 0
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v3
|
||||||
|
# with: { fetch-depth: 2 }
|
||||||
|
# - run: |
|
||||||
|
# if ./test/match_changed_files.sh '^src|examples/mqtt-dashboard/device|^examples/${{ matrix.example.path }}'; then
|
||||||
|
# echo GO=1 >> $GITHUB_ENV
|
||||||
|
# # nothing specific to install or do
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# run: make -C examples/${{ matrix.example.path }} build
|
||||||
|
|
||||||
|
mqtt_dashboard_examples_arm:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
example:
|
||||||
|
- path: rp2040/pico-rndis-device
|
||||||
|
name: ${{ matrix.example.path }}
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/mqtt-dashboard/device|^examples/${{ matrix.example.path }}'; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: make -C examples/${{ matrix.example.path }} build
|
||||||
|
|
||||||
|
# dual_examples:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# strategy:
|
||||||
|
# fail-fast: false
|
||||||
|
# matrix:
|
||||||
|
# example:
|
||||||
|
# - path:
|
||||||
|
# name: ${{ matrix.example.path }}
|
||||||
|
# env:
|
||||||
|
# GO: 0
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v3
|
||||||
|
# with: { fetch-depth: 2 }
|
||||||
|
# - run: |
|
||||||
|
# if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/mqtt-dashboard/device|^examples/${{ matrix.example.path }}'; then
|
||||||
|
# echo GO=1 >> $GITHUB_ENV
|
||||||
|
# # nothing specific to install or do
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh '^src|examples/device-dashboard|^examples/${{ matrix.example.path }}'; then
|
||||||
|
# make -C examples/${{ matrix.example.path }} device_dashboard
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh '^src|examples/mqtt-dashboard/device|^examples/${{ matrix.example.path }}'; then
|
||||||
|
# make -C examples/${{ matrix.example.path }} mqtt_dashboard
|
||||||
|
# fi
|
||||||
|
|
||||||
|
dual_examples_arm:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
example:
|
||||||
|
- path: stm32/nucleo-h723zg-make-baremetal-builtin
|
||||||
|
name: ${{ matrix.example.path }}
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/mqtt-dashboard/device|^examples/${{ matrix.example.path }}'; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|^examples/${{ matrix.example.path }}'; then
|
||||||
|
make -C examples/${{ matrix.example.path }} device_dashboard
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/mqtt-dashboard/device|^examples/${{ matrix.example.path }}'; then
|
||||||
|
make -C examples/${{ matrix.example.path }} mqtt_dashboard
|
||||||
|
fi
|
||||||
|
|
||||||
|
cube_examples:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/stm32/nucleo-*-cube-*'; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
# nothing specific to install or do
|
||||||
|
fi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
run: cd test/cube && make
|
run: cd test/cube && make
|
||||||
|
|
||||||
zephyr_examples:
|
zephyr_examples:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: if ./test/match_changed_files.sh '^src/.*.[ch]|^examples/zephyr'; then sudo apt -y update ; sudo apt -y install gcc-arm-none-eabi ; fi
|
- run: |
|
||||||
|
if ./test/match_changed_files.sh '^src/.*.[ch]|^examples/zephyr'; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
fi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
run: make -C examples/zephyr init
|
run: make -C examples/zephyr init
|
||||||
- name: minify manifest
|
- name: minify manifest
|
||||||
@@ -279,3 +448,293 @@ jobs:
|
|||||||
run: make -C examples/zephyr/mqtt-aws-client build
|
run: make -C examples/zephyr/mqtt-aws-client build
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
run: make -C examples/zephyr/websocket-server build
|
run: make -C examples/zephyr/websocket-server build
|
||||||
|
|
||||||
|
test_f7:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- name: baremetal
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh "^src|examples/device-dashboard|examples/stm32/nucleo-f7.*-make-" ; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-f746zg-make-baremetal-builtin'; then
|
||||||
|
make -C examples/stm32/nucleo-f746zg-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-f746zg-make-freertos-builtin'; then
|
||||||
|
make -C examples/stm32/nucleo-f746zg-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-f746zg-make-freertos-tcp'; then
|
||||||
|
make -C examples/stm32/nucleo-f746zg-make-freertos-tcp test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
fi
|
||||||
|
- name: Cube
|
||||||
|
run: |
|
||||||
|
echo GO=0 >> $GITHUB_ENV
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-f7.*-cube-'; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
# nothing specific to install or do
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-f746zg-cube-baremetal-builtin'; then
|
||||||
|
make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f746zg-cube-baremetal-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=5
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-f746zg-cube-freertos-builtin'; then
|
||||||
|
make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f746zg-cube-freertos-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=5
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-f746zg-cube-freertos-lwip'; then
|
||||||
|
make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f746zg-cube-freertos-lwip VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=5
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
test_f4:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- name: baremetal
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh "^src|examples/device-dashboard|examples/stm32/nucleo-f4.*-make-" ; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-f429zi-make-baremetal-builtin'; then
|
||||||
|
make -C examples/stm32/nucleo-f429zi-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-f429zi-make-freertos-builtin'; then
|
||||||
|
make -C examples/stm32/nucleo-f429zi-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
fi
|
||||||
|
- name: Cube
|
||||||
|
run: |
|
||||||
|
echo GO=0 >> $GITHUB_ENV
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-f4.*-cube-'; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
# nothing specific to install or do
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-f429zi-cube-baremetal-builtin'; then
|
||||||
|
make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f429zi-cube-baremetal-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=2
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-f429zi-cube-freertos-builtin'; then
|
||||||
|
make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f429zi-cube-freertos-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=2
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-f429zi-cube-freertos-lwip'; then
|
||||||
|
make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f429zi-cube-freertos-lwip VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=2
|
||||||
|
fi
|
||||||
|
|
||||||
|
test_h743:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with: { fetch-depth: 3 }
|
||||||
|
- name: baremetal
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh "^src|examples/device-dashboard|examples/stm32/nucleo-h74.*-make-" ; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-h743zi-make-baremetal-builtin'; then
|
||||||
|
make -C examples/stm32/nucleo-h743zi-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-h743zi-make-freertos-builtin'; then
|
||||||
|
make -C examples/stm32/nucleo-h743zi-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
fi
|
||||||
|
- name: Cube
|
||||||
|
run: |
|
||||||
|
echo GO=0 >> $GITHUB_ENV
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-h74.*-cube-'; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
# nothing specific to install or do
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-h743zi-cube-baremetal-builtin'; then
|
||||||
|
make -C test/cube test PROJECTS=../../examples/stm32/nucleo-h743zi-cube-baremetal-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=6
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-h743zi-cube-freertos-builtin'; then
|
||||||
|
make -C test/cube test PROJECTS=../../examples/stm32/nucleo-h743zi-cube-freertos-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=6
|
||||||
|
fi
|
||||||
|
|
||||||
|
test_h723:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with: { fetch-depth: 3 }
|
||||||
|
- name: baremetal
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh "^src|examples/device-dashboard|examples/stm32/nucleo-h72.*-make-" ; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-h723zg-make-baremetal-builtin'; then
|
||||||
|
make -C examples/stm32/nucleo-h723zg-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-h723zg-make-freertos-builtin'; then
|
||||||
|
make -C examples/stm32/nucleo-h723zg-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
fi
|
||||||
|
|
||||||
|
test_h5:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with: { fetch-depth: 3 }
|
||||||
|
- name: baremetal
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh "^src|examples/device-dashboard|examples/stm32/nucleo-h5.*-make-" ; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-h563zi-make-baremetal-builtin'; then
|
||||||
|
make -C examples/stm32/nucleo-h563zi-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-h563zi-make-freertos-builtin'; then
|
||||||
|
make -C examples/stm32/nucleo-h563zi-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
fi
|
||||||
|
|
||||||
|
test_rt1020:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with: { fetch-depth: 3 }
|
||||||
|
- name: baremetal
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh "^src|examples/device-dashboard|examples/nxp/rt1020.*-make-" ; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
#if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/nxp/rt1020-evk-make-baremetal-builtin'; then
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/nxp/rt1020-evk-make-baremetal-builtin'; then
|
||||||
|
make -C examples/nxp/rt1020-evk-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
#if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/nxp/rt1020-evk-make-freertos-builtin'; then
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/nxp/rt1020-evk-make-freertos-builtin'; then
|
||||||
|
make -C examples/nxp/rt1020-evk-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
fi
|
||||||
|
|
||||||
|
test_rt1060:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with: { fetch-depth: 3 }
|
||||||
|
- name: baremetal
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh "^src|examples/device-dashboard|examples/nxp/rt1060.*-make-" ; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/nxp/rt1060-evk-make-baremetal-builtin'; then
|
||||||
|
make -C examples/nxp/rt1060-evk-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/nxp/rt1060-evk-make-freertos-builtin'; then
|
||||||
|
make -C examples/nxp/rt1060-evk-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
fi
|
||||||
|
|
||||||
|
test_tm4c:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- name: baremetal
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh "^src|examples/device-dashboard|examples/ti/ek-tm4c.*-make-" ; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: make -C examples/ti/ek-tm4c1294xl-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: make -C examples/ti/ek-tm4c1294xl-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
|
||||||
|
test_same54:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- name: baremetal
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh "^src|examples/device-dashboard|examples/microchip/same54-xpro" ; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: make -C examples/microchip/same54-xpro/device-dashboard test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: make -C examples/microchip/same54-xpro/mqtt-client test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
|
||||||
|
test_pico_w5500:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- name: SDK
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh "^src|examples/device-dashboard|examples/rp2040/pico-w5500" ; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: make -C examples/rp2040/pico-w5500 test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
name: Zephyr
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *' # run at 12 AM UTC
|
||||||
|
# Allow manual runs
|
||||||
|
workflow_dispatch:
|
||||||
|
jobs:
|
||||||
|
zephyr_examples:
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
revno: ["--mr v3.7-branch", "--mr v4.2.0", "--mr v4.3.0"] # LTS, latest stable
|
||||||
|
name: Zephyr ${{ matrix.revno }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: test/setup_ga_docker_filesystem.sh
|
||||||
|
- run: make -C tutorials/zephyr init REPO=zephyrprojectrtos/ci:v0.28.8 REVNO="${{ matrix.revno }}"
|
||||||
|
- run: make -C tutorials/zephyr minify REVNO="${{ matrix.revno }}"
|
||||||
|
- run: make -C tutorials/zephyr update
|
||||||
|
- run: make -C tutorials/zephyr/device-dashboard build REPO=zephyrprojectrtos/ci:v0.28.8
|
||||||
|
- run: make -C tutorials/zephyr/http-client build REPO=zephyrprojectrtos/ci:v0.28.8
|
||||||
|
- run: make -C tutorials/zephyr/http-server build REPO=zephyrprojectrtos/ci:v0.28.8
|
||||||
|
- run: make -C tutorials/zephyr/mqtt-aws-client build REPO=zephyrprojectrtos/ci:v0.28.8
|
||||||
|
- run: make -C tutorials/zephyr/websocket-server build REPO=zephyrprojectrtos/ci:v0.28.8
|
||||||
|
# Latest CI image does not work with pre 4.4, they changed some SDK paths
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
Copyright (c) 2004-2013 Sergey Lyubka
|
Copyright (c) 2004-2013 Sergey Lyubka
|
||||||
Copyright (c) 2013-2023 Cesanta Software Limited
|
Copyright (c) 2013-2026 Cesanta Software Limited
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
This software is dual-licensed: you can redistribute it and/or modify
|
This software is dual-licensed: you can redistribute it and/or modify
|
||||||
|
|||||||
@@ -1,206 +0,0 @@
|
|||||||
SRCS = mongoose.c test/unit_test.c test/packed_fs.c
|
|
||||||
HDRS = $(wildcard src/*.h) $(wildcard src/tcpip/*.h)
|
|
||||||
DEFS ?= -DMG_MAX_HTTP_HEADERS=7 -DMG_ENABLE_LINES -DMG_ENABLE_PACKED_FS=1 -DMG_ENABLE_SSI=1 -DMG_ENABLE_ASSERT=1
|
|
||||||
WARN ?= -pedantic -W -Wall -Werror -Wshadow -Wdouble-promotion -fno-common -Wconversion -Wundef
|
|
||||||
OPTS ?= -O3 -g3
|
|
||||||
INCS ?= -Isrc -I.
|
|
||||||
SSL ?=
|
|
||||||
CWD ?= $(realpath $(CURDIR))
|
|
||||||
ENV ?= -e Tmp=. -e WINEDEBUG=-all
|
|
||||||
DOCKER ?= docker run --platform linux/amd64 --rm $(ENV) -v $(CWD):$(CWD) -w $(CWD)
|
|
||||||
VCFLAGS = /nologo /W3 /O2 /MD /I. $(DEFS) $(TFLAGS)
|
|
||||||
IPV6 ?= 1
|
|
||||||
ASAN ?= -fsanitize=address,undefined,alignment -fno-sanitize-recover=all -fno-omit-frame-pointer -fno-common
|
|
||||||
ASAN_OPTIONS ?= detect_leaks=1
|
|
||||||
EXAMPLES := $(dir $(wildcard examples/*/Makefile))
|
|
||||||
EXAMPLES_MAC := $(filter-out examples/mip-pcap/ examples/mip-tap/, $(EXAMPLES))
|
|
||||||
EXAMPLES_WIN := $(dir $(wildcard examples/device-dashboard/Makefile) $(wildcard examples/file-*/Makefile) $(wildcard examples/http-*/Makefile) $(wildcard examples/mqtt-*/Makefile) $(wildcard examples/websocket-*/Makefile) $(wildcard examples/webui-*/Makefile))
|
|
||||||
EXAMPLES_EMBEDDED := $(filter-out $(wildcard examples/zephyr/*/), $(dir $(wildcard examples/*/*/Makefile)))
|
|
||||||
PREFIX ?= /usr/local
|
|
||||||
VERSION ?= $(shell cut -d'"' -f2 src/version.h)
|
|
||||||
COMMON_CFLAGS ?= $(C_WARN) $(WARN) $(INCS) $(DEFS) -DMG_ENABLE_IPV6=$(IPV6) $(TFLAGS) -pthread
|
|
||||||
CFLAGS ?= $(OPTS) $(ASAN) $(COMMON_CFLAGS)
|
|
||||||
VALGRIND_CFLAGS ?= $(OPTS) $(COMMON_CFLAGS)
|
|
||||||
VALGRIND_RUN ?= valgrind --tool=memcheck --gen-suppressions=all --leak-check=full --show-leak-kinds=all --leak-resolution=high --track-origins=yes --error-exitcode=1 --exit-on-first-error=yes --fair-sched=yes
|
|
||||||
.PHONY: clean_examples examples mip_test test valgrind
|
|
||||||
|
|
||||||
ifeq "$(findstring ++,$(CC))" ""
|
|
||||||
# $(CC) does not end with ++, i.e. we're using C. Apply C flags
|
|
||||||
C_WARN ?= -Wmissing-prototypes -Wstrict-prototypes
|
|
||||||
else
|
|
||||||
# $(CC) ends with ++, i.e. we're using C++. Apply C++ flags
|
|
||||||
C_WARN ?= -Wno-deprecated
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq "$(SSL)" "MBEDTLS"
|
|
||||||
MBEDTLS ?= /usr/local
|
|
||||||
CFLAGS += -DMG_ENABLE_MBEDTLS=1 -I$(MBEDTLS)/include -I/usr/include
|
|
||||||
LDFLAGS ?= -L$(MBEDTLS)/lib -lmbedtls -lmbedcrypto -lmbedx509
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq "$(SSL)" "OPENSSL"
|
|
||||||
OPENSSL ?= /usr/local
|
|
||||||
CFLAGS += -DMG_ENABLE_OPENSSL=1 -I$(OPENSSL)/include
|
|
||||||
LDFLAGS ?= -L$(OPENSSL)/lib -lssl -lcrypto
|
|
||||||
endif
|
|
||||||
|
|
||||||
all:
|
|
||||||
$(MAKE) -C examples/http-server
|
|
||||||
|
|
||||||
tall: mg_prefix unamalgamated test mip_test arm examples vc98 vc17 vc22 mingw mingw++ fuzz
|
|
||||||
|
|
||||||
mip_test: test/mip_test.c mongoose.c mongoose.h Makefile mip_tap_test
|
|
||||||
$(CC) test/mip_test.c $(INCS) $(WARN) $(OPTS) $(C_WARN) $(ASAN) -o $@
|
|
||||||
ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./$@
|
|
||||||
|
|
||||||
mip_tap_test: test/mip_tap_test.c mongoose.c mongoose.h Makefile
|
|
||||||
$(CC) test/mip_tap_test.c $(INCS) $(WARN) $(OPTS) $(C_WARN) $(ASAN) -o $@
|
|
||||||
ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./$@
|
|
||||||
|
|
||||||
examples:
|
|
||||||
@for X in $(EXAMPLES); do test -f $$X/Makefile || continue; $(MAKE) -C $$X example || exit 1; done
|
|
||||||
clean_examples:
|
|
||||||
for X in $(EXAMPLES); do test -f $$X/Makefile || continue; $(MAKE) -C $$X clean || exit 1; done
|
|
||||||
|
|
||||||
examples_mac:
|
|
||||||
for X in $(EXAMPLES_MAC); do test -f $$X/Makefile || continue; $(MAKE) -C $$X example || exit 1; done
|
|
||||||
clean_examples_mac:
|
|
||||||
for X in $(EXAMPLES_MAC); do test -f $$X/Makefile || continue; $(MAKE) -C $$X clean || exit 1; done
|
|
||||||
|
|
||||||
examples_win:
|
|
||||||
$(foreach X, $(EXAMPLES_WIN), $(MAKE) -C $(X) example &)
|
|
||||||
clean_examples_win:
|
|
||||||
$(foreach X, $(EXAMPLES_WIN), $(MAKE) -C $(X) clean &)
|
|
||||||
|
|
||||||
test/packed_fs.c: Makefile src/ssi.h test/fuzz.c test/data/a.txt
|
|
||||||
$(CC) $(CFLAGS) test/pack.c -o pack
|
|
||||||
$(RUN) ./pack Makefile src/ssi.h test/fuzz.c test/data/a.txt test/data/range.txt > $@
|
|
||||||
|
|
||||||
DIR ?= test/data
|
|
||||||
OUT ?= packed_fs.c
|
|
||||||
mkfs:
|
|
||||||
$(CC) $(CFLAGS) test/pack.c -o pack
|
|
||||||
$(RUN) ./pack -s $(DIR) `find $(DIR) -type f` > $(OUT)
|
|
||||||
# find $(DIR) -type f | sed -e s,^$(DIR),,g -e s,^/,,g
|
|
||||||
|
|
||||||
# Check that all external (exported) symbols have "mg_" prefix
|
|
||||||
mg_prefix: mongoose.c mongoose.h
|
|
||||||
$(CC) mongoose.c $(CFLAGS) -c -o /tmp/x.o && nm /tmp/x.o | grep ' T ' | grep -v 'mg_' ; test $$? = 1
|
|
||||||
|
|
||||||
musl: test
|
|
||||||
musl: ASAN =
|
|
||||||
musl: WARN += -Wno-sign-conversion
|
|
||||||
musl: CC = $(DOCKER) mdashnet/cc1 gcc
|
|
||||||
musl: RUN = $(DOCKER) mdashnet/cc1
|
|
||||||
|
|
||||||
# Make sure we can build from an unamalgamated sources
|
|
||||||
unamalgamated: $(HDRS) Makefile test/packed_fs.c
|
|
||||||
$(CC) src/*.c test/packed_fs.c test/unit_test.c $(CFLAGS) $(LDFLAGS) -g -o unit_test
|
|
||||||
|
|
||||||
fuzz: ASAN = -fsanitize=fuzzer,signed-integer-overflow,address,undefined
|
|
||||||
fuzz: mongoose.c mongoose.h Makefile test/fuzz.c
|
|
||||||
$(CC) test/fuzz.c $(OPTS) $(WARN) $(INCS) $(TFLAGS) $(ASAN) -o fuzzer
|
|
||||||
$(RUN) ./fuzzer
|
|
||||||
|
|
||||||
FUZZDATA ?= /tmp/fuzzdata
|
|
||||||
fuzz2: mongoose.c mongoose.h Makefile test/fuzz.c
|
|
||||||
$(CC) test/fuzz.c -DMAIN $(OPTS) $(WARN) $(ASAN) $(INCS) -o fuzzer
|
|
||||||
$(RUN) ./fuzzer $(FUZZDATA)
|
|
||||||
|
|
||||||
test: Makefile mongoose.h $(SRCS)
|
|
||||||
$(CC) $(SRCS) $(CFLAGS) $(LDFLAGS) -o unit_test
|
|
||||||
ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
|
|
||||||
|
|
||||||
coverage: CFLAGS += -coverage
|
|
||||||
coverage: test
|
|
||||||
gcov -l -n *.gcno | sed '/^$$/d' | sed 'N;s/\n/ /'
|
|
||||||
gcov -t mongoose.c > mongoose.gcov
|
|
||||||
|
|
||||||
upload-coverage: coverage
|
|
||||||
curl -s https://codecov.io/bash | /bin/bash
|
|
||||||
|
|
||||||
valgrind: Makefile mongoose.h mongoose.c
|
|
||||||
$(CC) $(SRCS) $(VALGRIND_CFLAGS) $(LDFLAGS) -g -o unit_test
|
|
||||||
$(VALGRIND_RUN) ./unit_test
|
|
||||||
|
|
||||||
armhf: ASAN=
|
|
||||||
armhf: IPV6=0
|
|
||||||
armhf: CC = $(DOCKER) mdashnet/armhf cc
|
|
||||||
armhf: RUN = $(DOCKER) mdashnet/armhf
|
|
||||||
armhf: test
|
|
||||||
|
|
||||||
s390: ASAN=
|
|
||||||
s390: IPV6=0
|
|
||||||
s390: CC = $(DOCKER) mdashnet/s390 cc
|
|
||||||
s390: RUN = $(DOCKER) mdashnet/s390
|
|
||||||
s390: test
|
|
||||||
|
|
||||||
arm: DEFS += -DMG_ENABLE_FILE=0 -DMG_ENABLE_TCPIP=1 -DMG_ARCH=MG_ARCH_NEWLIB
|
|
||||||
arm: mongoose.h $(SRCS)
|
|
||||||
$(DOCKER) mdashnet/armgcc arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb $(SRCS) $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) -o unit_test -nostartfiles --specs nosys.specs -e 0
|
|
||||||
|
|
||||||
riscv: DEFS += -DMG_ENABLE_FILE=0 -DMG_ENABLE_TCPIP=1 -DMG_ARCH=MG_ARCH_NEWLIB
|
|
||||||
riscv: mongoose.h $(SRCS)
|
|
||||||
$(DOCKER) mdashnet/riscv riscv-none-elf-gcc -march=rv32imc -mabi=ilp32 $(SRCS) $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) -o unit_test
|
|
||||||
|
|
||||||
vc98: Makefile mongoose.h $(SRCS)
|
|
||||||
$(DOCKER) mdashnet/vc98 wine cl $(SRCS) $(VCFLAGS) ws2_32.lib /Fe$@.exe
|
|
||||||
$(DOCKER) mdashnet/vc98 wine $@.exe
|
|
||||||
|
|
||||||
vc17: Makefile mongoose.h $(SRCS)
|
|
||||||
$(DOCKER) mdashnet/vc17 wine64 cl $(SRCS) $(VCFLAGS) ws2_32.lib /Fe$@.exe
|
|
||||||
$(DOCKER) mdashnet/vc17 wine64 $@.exe
|
|
||||||
|
|
||||||
vc22: Makefile mongoose.h $(SRCS)
|
|
||||||
$(DOCKER) mdashnet/vc22 wine64 cl $(SRCS) $(VCFLAGS) ws2_32.lib /Fe$@.exe
|
|
||||||
$(DOCKER) mdashnet/vc22 wine64 $@.exe
|
|
||||||
|
|
||||||
mingw: Makefile mongoose.h $(SRCS)
|
|
||||||
$(DOCKER) mdashnet/mingw x86_64-w64-mingw32-gcc $(SRCS) -W -Wall -Werror -I. $(DEFS) -lwsock32 -o $@.exe
|
|
||||||
$(DOCKER) mdashnet/mingw wine64 $@.exe
|
|
||||||
|
|
||||||
arduino: ENV = -v $(CWD)/arduino:/root
|
|
||||||
arduino:
|
|
||||||
curl -sL http://downloads.arduino.cc/arduino-1.8.19-linux64.tar.xz | unxz | tar -xf -
|
|
||||||
mv arduino-* $@
|
|
||||||
$(DOCKER) mdashnet/cc2 ./arduino/arduino --pref "boardsmanager.additional.urls=https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json" --save-prefs
|
|
||||||
$(DOCKER) mdashnet/cc2 ./arduino/arduino --pref "compiler.warning_level=all" --save-prefs
|
|
||||||
$(DOCKER) mdashnet/cc2 ./arduino/arduino --install-boards Seeeduino:samd
|
|
||||||
|
|
||||||
arduino-xiao: ENV = -v $(CWD)/arduino:/root
|
|
||||||
arduino-xiao: arduino
|
|
||||||
rm -rf tmp; mkdir tmp
|
|
||||||
cp examples/arduino/w5500/w5500.ino tmp/tmp.ino
|
|
||||||
cp mongoose.c mongoose.h examples/arduino/w5500/mongoose_custom.h tmp/
|
|
||||||
$(DOCKER) mdashnet/cc2 ./arduino/arduino --verbose --verify --board Seeeduino:samd:seeed_XIAO_m0 tmp/tmp.ino
|
|
||||||
|
|
||||||
mingw++: Makefile mongoose.h $(SRCS)
|
|
||||||
$(DOCKER) mdashnet/mingw x86_64-w64-mingw32-g++ $(SRCS) -W -Wall -Werror -I. $(DEFS) -lwsock32 -o $@.exe
|
|
||||||
|
|
||||||
linux-libs: CFLAGS += -fPIC
|
|
||||||
linux-libs: mongoose.o
|
|
||||||
$(CC) mongoose.o $(LDFLAGS) -shared -o libmongoose.so.$(VERSION)
|
|
||||||
$(AR) rcs libmongoose.a mongoose.o
|
|
||||||
|
|
||||||
install: linux-libs
|
|
||||||
install -Dm644 libmongoose.a libmongoose.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib
|
|
||||||
ln -s libmongoose.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libmongoose.so
|
|
||||||
install -Dm644 mongoose.h $(DESTDIR)$(PREFIX)/include/mongoose.h
|
|
||||||
|
|
||||||
uninstall:
|
|
||||||
rm -rf $(DESTDIR)$(PREFIX)/lib/libmongoose.a $(DESTDIR)$(PREFIX)/lib/libmongoose.so.$(VERSION) $(DESTDIR)$(PREFIX)/include/mongoose.h $(DESTDIR)$(PREFIX)/lib/libmongoose.so
|
|
||||||
|
|
||||||
mongoose.c: Makefile $(wildcard src/*.c) $(wildcard src/tcpip/*.c)
|
|
||||||
(cat src/license.h; echo; echo '#include "mongoose.h"' ; (for F in src/*.c src/tcpip/*.c ; do echo; echo '#ifdef MG_ENABLE_LINES'; echo "#line 1 \"$$F\""; echo '#endif'; cat $$F | sed -e 's,#include ".*,,'; done))> $@
|
|
||||||
|
|
||||||
mongoose.h: $(HDRS) Makefile
|
|
||||||
(cat src/license.h; echo; echo '#ifndef MONGOOSE_H'; echo '#define MONGOOSE_H'; echo; cat src/version.h ; echo; echo '#ifdef __cplusplus'; echo 'extern "C" {'; echo '#endif'; cat src/arch.h src/arch_*.h src/net_*.h src/config.h src/str.h src/queue.h src/fmt.h src/printf.h src/log.h src/timer.h src/fs.h src/util.h src/url.h src/iobuf.h src/base64.h src/md5.h src/sha1.h src/event.h src/net.h src/http.h src/ssi.h src/tls.h src/tls_mbed.h src/tls_openssl.h src/ws.h src/sntp.h src/mqtt.h src/dns.h src/json.h src/rpc.h src/tcpip/tcpip.h src/tcpip/driver_*.h | sed -e '/keep/! s,#include ".*,,' -e 's,^#pragma once,,'; echo; echo '#ifdef __cplusplus'; echo '}'; echo '#endif'; echo '#endif // MONGOOSE_H')> $@
|
|
||||||
|
|
||||||
|
|
||||||
clean: clean_examples clean_embedded
|
|
||||||
rm -rf $(PROG) *.exe *.o *.dSYM *_test* ut fuzzer *.gcov *.gcno *.gcda *.obj *.exe *.ilk *.pdb slow-unit* _CL_* infer-out data.txt crash-* test/packed_fs.c pack arduino tmp
|
|
||||||
#find examples -maxdepth 3 -name zephyr -prune -o -name Makefile -print | xargs dirname | xargs -n1 make clean -C
|
|
||||||
|
|
||||||
clean_embedded:
|
|
||||||
for X in $(EXAMPLES_EMBEDDED); do test -f $$X/Makefile || continue; $(MAKE) -C $$X clean || exit 1; done
|
|
||||||
|
|
||||||
@@ -1,40 +1,165 @@
|
|||||||
# Mongoose - Embedded Web Server / Embedded Networking Library
|
# Mongoose - Embedded Web Server / Embedded Network Library
|
||||||
|
|
||||||
[](https://opensource.org/licenses/gpl-2.0.php)
|
[](https://opensource.org/licenses/gpl-2.0.php)
|
||||||
[](https://github.com/cesanta/mongoose/actions)
|
[](https://github.com/cesanta/mongoose/actions)
|
||||||
[](https://codecov.io/gh/cesanta/mongoose)
|
[](https://codecov.io/gh/cesanta/mongoose)
|
||||||
[](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:mongoose)
|
[](https://issues.oss-fuzz.com/issues?sort=-opened&can=1&q=proj:mongoose)
|
||||||
|
|
||||||
Mongoose is a network library for C/C++.
|
<img src="https://mongoose.ws/images/logo.svg" width="48" height="48" align="left" style="float:left;" /> Mongoose is a network library for C/C++. It provides event-driven non-blocking
|
||||||
It implements event-driven
|
APIs for TCP, UDP, HTTP, WebSocket, MQTT, and other protocols. It is designed
|
||||||
non-blocking APIs for TCP, UDP, HTTP, WebSocket, MQTT. It is designed for
|
for connecting devices and bringing them online. On the market since 2004, used
|
||||||
connecting devices and bringing them online. On the market since 2004, used by
|
by vast number of open source and commercial products - it even runs on the
|
||||||
vast number of open source and commercial products - it even runs on the
|
|
||||||
International Space Station! Mongoose makes embedded network programming fast,
|
International Space Station! Mongoose makes embedded network programming fast,
|
||||||
robust, and easy. Features include:
|
robust, and easy. Features include:
|
||||||
|
|
||||||
- Cross-platform:
|
- Cross-platform:
|
||||||
- works on Linux/UNIX, MacOS, Windows, Android
|
- works on Linux/UNIX, MacOS, Windows, Android
|
||||||
- works on STM32, NXP, ESP32, NRF52, TI, Microchip, and other
|
- works on ST, NXP, ESP32, Nordic, TI, Microchip, Infineon, Renesas and other chips
|
||||||
- write code once - and it'll work everywhere
|
- write code once - and it'll work everywhere
|
||||||
- ideal for the unification of the network infrastructure code across company
|
- ideal for the unification of the network infrastructure code across company
|
||||||
- Built-in protocols: plain TCP/UDP, HTTP, MQTT, Websocket
|
- Built-in protocols: plain TCP/UDP, SNTP, HTTP, MQTT, Websocket, and other
|
||||||
- SSL/TLS support: mbedTLS, OpenSSL or custom (via API)
|
|
||||||
- Asynchronous DNS resolver
|
- Asynchronous DNS resolver
|
||||||
- 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 `mongoose.c` and `mongoose.h` files to your source tree. See
|
- Easy to integrate: just copy [mongoose.c](https://raw.githubusercontent.com/cesanta/mongoose/master/mongoose.c)
|
||||||
[exact steps](https://mongoose.ws/documentation/#2-minute-integration-guide)
|
and [mongoose.h](https://raw.githubusercontent.com/cesanta/mongoose/master/mongoose.h) files to your source tree
|
||||||
- Works with any network stack with socket API, like LwIP or FreeRTOS-Plus-TCP
|
- Built-in TCP/IP stack with drivers for bare metal or RTOS systems
|
||||||
- Provides a built-in TCP/IP stack with drivers for bare metal or RTOS systems
|
- Available drivers: STM32F, STM32H; NXP RT1xxx; TI TM4C; Microchip SAME54; Wiznet W5500
|
||||||
- A complete Web device dashboard
|
- A complete Web device dashboard on bare metal ST Nucleo boards is only 6 files
|
||||||
[bare metal example on Nucleo-F429ZI](examples/stm32/nucleo-f429zi-baremetal)
|
|
||||||
is only 6 files
|
|
||||||
- For comparison, a CubeIDE generated HTTP example is 400+ files
|
- For comparison, a CubeIDE generated HTTP example is 400+ files
|
||||||
- Detailed [user guide, API reference and tons of tutorials](https://mongoose.ws/documentation/) available
|
- Can run on top of an existing TCP/IP stack with BSD API, e.g. lwIP, Zephyr, Azure, etc
|
||||||
|
- Built-in TLS 1.3 ECC stack. Also can use external TLS libraries - mbedTLS, OpenSSL, or other
|
||||||
|
- Does not depend on any other software to implement networking
|
||||||
|
- Built-in firmware updates for STM32 H5, STM32 H7
|
||||||
|
|
||||||
|
See https://mongoose.ws/ for complete documentation, videos, case studies, etc.
|
||||||
|
|
||||||
# Commercial use
|
## Supported platforms
|
||||||
|
|
||||||
|
Mongoose can work on top of any TCP/IP stack that supports BSD sockets API.
|
||||||
|
Platforms supported by the 3rd party TCP/IP stacks:
|
||||||
|
|
||||||
|
| TCP/IP stack | Notes |
|
||||||
|
| :-------------- | :------- |
|
||||||
|
| **lwIP** | All devices running lwIP, for example ESP32, ESP32S3, ESP32C3, ESP32C6, etc |
|
||||||
|
| **Zephyr** | All devices supported by Zephyr |
|
||||||
|
| **Other** | Any other TCP/IP stack that supports BSD socket API, for example Amazon FreeRTOS-TCP |
|
||||||
|
| **Linux, Mac, Windows** | Workstations, server, single board computers, embedded Linux devices running on MPUs or FPGAs |
|
||||||
|
|
||||||
|
Optionally, Mongoose provides its own built-in TCP/IP stack, eliminating the
|
||||||
|
need for additional software to implement networking functionality. The
|
||||||
|
built-in stack supports operation in both bare-metal and RTOS environments.
|
||||||
|
Platforms supported by the Mongoose built-in TCP/IP stack:
|
||||||
|
|
||||||
|
| Hardware | Notes |
|
||||||
|
| :------------- | :------- |
|
||||||
|
| **STM32** | All STM32 MCUs with built-in Ethernet: STM32Fxx, STM32H5xx, STM32H7xx |
|
||||||
|
| **NXP** | All NXP MCUs with built-in Ethernet: IMXRT102x, IMXRT104x, IMXRT105x, IMXRT106x, IMXRT117x, RW612, MCXN94x |
|
||||||
|
| **Microchip** | ATSAME54 MCUs with built-int Ethernet |
|
||||||
|
| **Renesas** | RA5M, RA6M, RA8M MCUs with built-in Ethernet |
|
||||||
|
| **Infineon** | XMC4, XMC7 MCUs with built-in Ethernet |
|
||||||
|
| **Texas Instruments** | TM4C, TMS570 MCUs with built-in Ethernet |
|
||||||
|
| **Cypress WiFi** | Any MCU with CY43xx WiFi chips, like RP2040 Pico-W, RP2350 Pico2-W, Arduino Portenta |
|
||||||
|
| **Wiznet Ethernet** | Any MCU that use Wiznet W5500 or Wiznet 5100 MAC+PHY chips |
|
||||||
|
| **Cellular** | NRF9160, SIM800 |
|
||||||
|
|
||||||
|
## Usage Examples
|
||||||
|
|
||||||
|
Below are quick snippets that should give an idea how simple the API is and
|
||||||
|
how easy it is to create applications with it.
|
||||||
|
|
||||||
|
Create a simple web server that serves a directory. The behavior of the
|
||||||
|
HTTP server is specified by its event handler function:
|
||||||
|
|
||||||
|
```c
|
||||||
|
#include "mongoose.h" // To build, run: cc main.c mongoose.c
|
||||||
|
|
||||||
|
// HTTP server event handler function
|
||||||
|
void ev_handler(struct mg_connection *c, int ev, void *ev_data) {
|
||||||
|
if (ev == MG_EV_HTTP_MSG) {
|
||||||
|
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
||||||
|
struct mg_http_serve_opts opts = { .root_dir = "./web_root/" };
|
||||||
|
mg_http_serve_dir(c, hm, &opts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
struct mg_mgr mgr; // Declare event manager
|
||||||
|
mg_mgr_init(&mgr); // Initialise event manager
|
||||||
|
mg_http_listen(&mgr, "http://0.0.0.0:8000", ev_handler, NULL); // Setup listener
|
||||||
|
for (;;) { // Run an infinite event loop
|
||||||
|
mg_mgr_poll(&mgr, 1000);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
HTTP server implements a REST API that returns current time. JSON formatting:
|
||||||
|
```c
|
||||||
|
static void ev_handler(struct mg_connection *c, int ev, void *ev_data) {
|
||||||
|
if (ev == MG_EV_HTTP_MSG) {
|
||||||
|
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
||||||
|
if (mg_match(hm->uri, mg_str("/api/time/get"), NULL)) {
|
||||||
|
mg_http_reply(c, 200, "", "{%m:%lu}\n", MG_ESC("time"), time(NULL));
|
||||||
|
} else {
|
||||||
|
mg_http_reply(c, 500, "", "{%m:%m}\n", MG_ESC("error"), MG_ESC("Unsupported URI"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
MQTT client that subscribes to a topic `device1/rx` and
|
||||||
|
echoes incoming messages to `device1/tx`:
|
||||||
|
|
||||||
|
```c
|
||||||
|
#include "mongoose.h"
|
||||||
|
|
||||||
|
static const char *s_mqtt_url = "mqtt://broker.hivemq.com:1883";
|
||||||
|
static struct mg_connection *s_mqtt_conn = NULL;
|
||||||
|
|
||||||
|
// MQTT connection event handler function
|
||||||
|
static void ev_handler(struct mg_connection *c, int ev, void *ev_data) {
|
||||||
|
if (ev == MG_EV_OPEN) {
|
||||||
|
MG_INFO(("%lu created, connecting to %s ...", c->id, s_mqtt_url));
|
||||||
|
} else if (ev == MG_EV_MQTT_OPEN) {
|
||||||
|
struct mg_mqtt_opts opts = {.qos = 1, .topic = mg_str("device1/rx")};
|
||||||
|
mg_mqtt_sub(c, &opts);
|
||||||
|
MG_INFO(("%lu connected, subscribing to %s", c->id, opts.topic.buf));
|
||||||
|
} else if (ev == MG_EV_MQTT_MSG) {
|
||||||
|
char response[100];
|
||||||
|
struct mg_mqtt_message *mm = (struct mg_mqtt_message *) ev_data;
|
||||||
|
struct mg_mqtt_opts opts = {.qos = 1, .topic = mg_str("device1/tx")};
|
||||||
|
mg_snprintf(response, sizeof(response), "Received [%.*s] / [%.*s]",
|
||||||
|
mm->topic.len, mm->topic.buf, mm->data.len, mm->data.buf);
|
||||||
|
opts.message = mg_str(response);
|
||||||
|
mg_mqtt_pub(c, &opts);
|
||||||
|
} else if (ev == MG_EV_CLOSE) {
|
||||||
|
MG_INFO(("%u closing", c->id));
|
||||||
|
s_mqtt_conn = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reconnection timer function. If we get disconnected, reconnect again
|
||||||
|
static void timer_fn(void *arg) {
|
||||||
|
struct mg_mgr *mgr = (struct mg_mgr *) arg;
|
||||||
|
if (s_mqtt_conn == NULL) {
|
||||||
|
struct mg_mqtt_opts opts = {.clean = true};
|
||||||
|
s_mqtt_conn = mg_mqtt_connect(mgr, s_mqtt_url, &opts, ev_handler, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
struct mg_mgr mgr; // Mongoose event manager. Holds all connections
|
||||||
|
mg_mgr_init(&mgr); // Initialise event manager
|
||||||
|
mg_timer_add(&mgr, 3000, MG_TIMER_REPEAT | MG_TIMER_RUN_NOW, timer_fn, &mgr);
|
||||||
|
for (;;) {
|
||||||
|
mg_mgr_poll(&mgr, 1000); // Infinite event loop
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Commercial use
|
||||||
- Mongoose is used by hundreds of businesses, from Fortune500 giants like
|
- Mongoose is used by hundreds of businesses, from Fortune500 giants like
|
||||||
Siemens, Schneider Electric, Broadcom, Bosch, Google, Samsung, Qualcomm, Caterpillar to the small businesses
|
Siemens, Schneider Electric, Broadcom, Bosch, Google, Samsung, Qualcomm, Caterpillar to the small businesses
|
||||||
- Used to solve a wide range of business needs, like implementing Web UI
|
- Used to solve a wide range of business needs, like implementing Web UI
|
||||||
@@ -44,11 +169,11 @@ robust, and easy. Features include:
|
|||||||
- See [Case Studies](https://mongoose.ws/case-studies/) from our respected
|
- See [Case Studies](https://mongoose.ws/case-studies/) from our respected
|
||||||
customers like [Schneider Electric](https://mongoose.ws/case-studies/schneider-electric/) (industrial automation), [Broadcom](https://mongoose.ws/case-studies/broadcom/) (semiconductors), [Pilz](https://mongoose.ws/case-studies/pilz/) (industrial automation), and others
|
customers like [Schneider Electric](https://mongoose.ws/case-studies/schneider-electric/) (industrial automation), [Broadcom](https://mongoose.ws/case-studies/broadcom/) (semiconductors), [Pilz](https://mongoose.ws/case-studies/pilz/) (industrial automation), and others
|
||||||
- See [Testimonials](https://mongoose.ws/testimonials/) from engineers that integrated Mongoose in their commercial products
|
- See [Testimonials](https://mongoose.ws/testimonials/) from engineers that integrated Mongoose in their commercial products
|
||||||
- We provide [Evaluation and Commercial licensing](https://mongoose.ws/licensing/), [support](https://mongoose.ws/support/), consultancy and integration
|
- We provide [Evaluation and Commercial licensing](https://mongoose.ws/licensing/), [support](https://mongoose.ws/support/), consultancy and [integration
|
||||||
assistance - don't hesitate to [contact us](https://mongoose.ws/contact/)
|
services](https://mongoose.ws/integration/) - don't hesitate to [contact us](https://mongoose.ws/contact/)
|
||||||
|
|
||||||
|
|
||||||
# Security
|
## Security
|
||||||
|
|
||||||
We take security seriously:
|
We take security seriously:
|
||||||
1. Mongoose repository runs a
|
1. Mongoose repository runs a
|
||||||
@@ -73,8 +198,32 @@ We take security seriously:
|
|||||||
have specific security requirements and run independent security audits,
|
have specific security requirements and run independent security audits,
|
||||||
of which we get notified and in case of any issue, act similar to (3).
|
of which we get notified and in case of any issue, act similar to (3).
|
||||||
|
|
||||||
|
## How to report security vulnerabilities
|
||||||
|
|
||||||
# Contributions
|
Please send an email to support@cesanta.com, with the full information.
|
||||||
|
Do NOT create a github issue.
|
||||||
|
|
||||||
|
## Articles
|
||||||
|
|
||||||
|
Technical guides and deep dives into embedded web servers, WebUI integration and embedded networking technologies:
|
||||||
|
- [Embedded Web Server: A Comprehensive Guide for Modern Connected Devices](https://mongoose.ws/articles/embedded-web-server-a-comprehensive-guide-for-modern-connected-devices/)
|
||||||
|
- [Building Embedded Web Device Dashboards](https://mongoose.ws/articles/building-embedded-web-device-dashboard/)
|
||||||
|
- [ESP32 Device Dashboard: A Step-by-Step Guide for Developers](https://mongoose.ws/articles/esp32-device-dashboard/)
|
||||||
|
- [How to build an STM32 Web Dashboard](https://mongoose.ws/articles/stm32-device-dashboard/)
|
||||||
|
- [STM32 WebSocket Guide](https://mongoose.ws/articles/stm32-websocket-guide/)
|
||||||
|
- [Web File Manager on STM32, ESP32 and Embedded Linux](https://mongoose.ws/articles/building-a-web-file-manager-on-stm32-esp32-embedded-linux/)
|
||||||
|
- [Web dashboard on Zephyr RTOS](https://mongoose.ws/articles/web-dashboard-on-zephyr-rtos/)
|
||||||
|
- [Limiting TCP/IP RAM usage on STM32](https://mongoose.ws/articles/limiting-tcpip-ram-usage-on-stm32/)
|
||||||
|
- [STM32 Ethernet explained](https://mongoose.ws/articles/stm32-ethernet-explained/)
|
||||||
|
- [MQTT on a Microcontroller](https://mongoose.ws/articles/mqtt-on-a-microcontroller/)
|
||||||
|
- [STM32 OTA Firmware Update](https://mongoose.ws/articles/stm32-ota-firmware-update/)
|
||||||
|
- [RP2350 OTA Firmware Update](https://mongoose.ws/articles/rp2350-ota-firmware-update/)
|
||||||
|
- [STM32 Ethernet and caches](https://mongoose.ws/articles/stm32-ethernet-and-cache/)
|
||||||
|
- [NXP RW612 OTA Firmware Update](https://mongoose.ws/articles/rw612-ota-firmware-update/)
|
||||||
|
- [lwIP vs Mongoose - TCP/IP Stack Integration Benchmark](https://mongoose.ws/articles/lwip-vs-mongoose-tcpip-stack-integration/)
|
||||||
|
|
||||||
|
|
||||||
|
## Contributions
|
||||||
|
|
||||||
Contributions are welcome! Please follow the guidelines below:
|
Contributions are welcome! Please follow the guidelines below:
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
# Mongoose Network Library Examples
|
|
||||||
|
|
||||||
In order to build and run any of the existing examples, please follow:
|
|
||||||
https://mongoose.ws/documentation/#how-to-build-and-run-examples
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
Rules for creating a new example:
|
|
||||||
|
|
||||||
- Makefile golden reference for desktop/server example: [http-server](http-server)
|
|
||||||
- Makefile golden reference for the embedded example:
|
|
||||||
[stm32/nucleo-f746zg-baremetal](stm32/nucleo-f746zg-baremetal)
|
|
||||||
- An example must build on Windows, Mac and Ubuntu Linux systems
|
|
||||||
- Assume that user installed tools according to https://mongoose.ws/tutorials/tools/
|
|
||||||
- Makefile must not include any other make files
|
|
||||||
- Use `CFLAGS` for system-specific compilation options
|
|
||||||
- Use `CFLAGS_MONGOOSE` for mongoose-specific compilation options
|
|
||||||
- Use `$(CFLAGS) $(CFLAGS_MONGOOSE) $(CFLAGS_EXTRA)` to compile
|
|
||||||
- If external repository is required, download it on demand using git
|
|
||||||
shallow clone. See embedded example golden reference
|
|
||||||
- Keep Makefile as short as possible, but verbose to understand it easily
|
|
||||||
- Symlink files when required, like `mongoose.c`, `ca.pem`, etc. Make no copies
|
|
||||||
- Example's README.md should contain only the title and the link to mongoose.ws
|
|
||||||
tutorial page
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Arduino.h"
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
#define MG_ARCH MG_ARCH_CUSTOM
|
|
||||||
#define MG_ENABLE_SOCKET 0
|
|
||||||
#define MG_ENABLE_TCPIP 1
|
|
||||||
#define mkdir(a, b) (-1)
|
|
||||||
//#define MG_ENABLE_LOG 0
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
#include <SPI.h>
|
|
||||||
#include "mongoose.h"
|
|
||||||
|
|
||||||
#define SS_PIN 3 // Slave select pin
|
|
||||||
struct mg_mgr mgr; // Mongoose event manager
|
|
||||||
struct mg_tcpip_spi spi = {
|
|
||||||
NULL, // SPI data
|
|
||||||
[](void *) { digitalWrite(SS_PIN, LOW); }, // begin transation
|
|
||||||
[](void *) { digitalWrite(SS_PIN, HIGH); }, // end transaction
|
|
||||||
[](void *, uint8_t c) { return SPI.transfer(c); }, // execute transaction
|
|
||||||
};
|
|
||||||
struct mg_tcpip_if mif = {.mac = {2, 0, 1, 2, 3, 5}}; // network interface
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
Serial.begin(115200);
|
|
||||||
pinMode(SS_PIN, OUTPUT);
|
|
||||||
SPI.begin();
|
|
||||||
|
|
||||||
// Set logging function to a serial print
|
|
||||||
mg_log_set_fn([](char ch, void *) { Serial.print(ch); }, NULL);
|
|
||||||
mg_mgr_init(&mgr);
|
|
||||||
|
|
||||||
delay(3000);
|
|
||||||
MG_INFO(("Starting TCP/IP stack..."));
|
|
||||||
|
|
||||||
mif.driver = &mg_tcpip_driver_w5500;
|
|
||||||
mif.driver_data = &spi;
|
|
||||||
mg_tcpip_init(&mgr, &mif);
|
|
||||||
|
|
||||||
// Start a 5 sec timer, print status message periodically
|
|
||||||
mg_timer_add(
|
|
||||||
&mgr, 5000, MG_TIMER_REPEAT,
|
|
||||||
[](void *) {
|
|
||||||
MG_INFO(("ethernet: %s", mg_tcpip_driver_w5500.up(&mif) ? "up" : "down"));
|
|
||||||
},
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
// Setup HTTP listener. Respond "ok" on any HTTP request
|
|
||||||
mg_http_listen(
|
|
||||||
&mgr, "http://0.0.0.0",
|
|
||||||
[](struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
|
||||||
if (ev == MG_EV_HTTP_MSG) mg_http_reply(c, 200, "", "ok\n");
|
|
||||||
},
|
|
||||||
&mgr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
mg_mgr_poll(&mgr, 1);
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
See detailed tutorial at https://mongoose.ws/tutorials/captive-dns-server/
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
// Copyright (c) 2020 Cesanta Software Limited
|
|
||||||
// All rights reserved
|
|
||||||
//
|
|
||||||
// Example captive DNS server (captive portal).
|
|
||||||
// 1. Run `make`. This builds and starts a server on port 5533
|
|
||||||
// 2. Run `dig -t A www.google.com -4 @localhost -p 5533`
|
|
||||||
|
|
||||||
#include "mongoose.h"
|
|
||||||
|
|
||||||
static const char *s_listen_url = "udp://0.0.0.0:5533";
|
|
||||||
|
|
||||||
// DNS answer section. We response with IP 1.2.3.4 - you can change it
|
|
||||||
// in the last 4 bytes of this array
|
|
||||||
uint8_t answer[] = {
|
|
||||||
0xc0, 0x0c, // Point to the name in the DNS question
|
|
||||||
0, 1, // 2 bytes - record type, A
|
|
||||||
0, 1, // 2 bytes - address class, INET
|
|
||||||
0, 0, 0, 120, // 4 bytes - TTL
|
|
||||||
0, 4, // 2 bytes - address length
|
|
||||||
1, 2, 3, 4 // 4 bytes - IP address
|
|
||||||
};
|
|
||||||
|
|
||||||
static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
|
||||||
if (ev == MG_EV_OPEN) {
|
|
||||||
c->is_hexdumping = 1;
|
|
||||||
} else if (ev == MG_EV_READ) {
|
|
||||||
struct mg_dns_rr rr; // Parse first question, offset 12 is header size
|
|
||||||
size_t n = mg_dns_parse_rr(c->recv.buf, c->recv.len, 12, true, &rr);
|
|
||||||
MG_INFO(("DNS request parsed, result=%d", (int) n));
|
|
||||||
if (n > 0) {
|
|
||||||
char buf[512];
|
|
||||||
struct mg_dns_header *h = (struct mg_dns_header *) buf;
|
|
||||||
memset(buf, 0, sizeof(buf)); // Clear the whole datagram
|
|
||||||
h->txnid = ((struct mg_dns_header *) c->recv.buf)->txnid; // Copy tnxid
|
|
||||||
h->num_questions = mg_htons(1); // We use only the 1st question
|
|
||||||
h->num_answers = mg_htons(1); // And only one answer
|
|
||||||
h->flags = mg_htons(0x8400); // Authoritative response
|
|
||||||
memcpy(buf + sizeof(*h), c->recv.buf + sizeof(*h), n); // Copy question
|
|
||||||
memcpy(buf + sizeof(*h) + n, answer, sizeof(answer)); // And answer
|
|
||||||
mg_send(c, buf, 12 + n + sizeof(answer)); // And send it!
|
|
||||||
}
|
|
||||||
mg_iobuf_del(&c->recv, 0, c->recv.len);
|
|
||||||
}
|
|
||||||
(void) fn_data;
|
|
||||||
(void) ev_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void) {
|
|
||||||
struct mg_mgr mgr;
|
|
||||||
|
|
||||||
mg_log_set(MG_LL_DEBUG); // Set log level
|
|
||||||
mg_mgr_init(&mgr); // Initialise event manager
|
|
||||||
mg_listen(&mgr, s_listen_url, fn, NULL); // Start DNS server
|
|
||||||
for (;;) mg_mgr_poll(&mgr, 1000); // Event loop
|
|
||||||
mg_mgr_free(&mgr);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
PROG ?= example # Program we are building
|
|
||||||
PACK ?= ./pack # Packing executable
|
|
||||||
DELETE = rm -rf # Command to remove files
|
|
||||||
OUT ?= -o $(PROG) # Compiler argument for output file
|
|
||||||
SOURCES = main.c mongoose.c net.c packed_fs.c # Source code files
|
|
||||||
CFLAGS = -W -Wall -Wextra -g -I. # Build options
|
|
||||||
|
|
||||||
# Mongoose build options. See https://mongoose.ws/documentation/#build-options
|
|
||||||
CFLAGS_MONGOOSE += -DMG_ENABLE_PACKED_FS=1
|
|
||||||
|
|
||||||
FILES_TO_EMBED ?= $(wildcard web_root/*)
|
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT) # Windows settings. Assume MinGW compiler. To use VC: make CC=cl CFLAGS=/MD OUT=/Feprog.exe
|
|
||||||
PROG ?= example.exe # Use .exe suffix for the binary
|
|
||||||
PACK = pack.exe # Packing executable
|
|
||||||
CC = gcc # Use MinGW gcc compiler
|
|
||||||
CFLAGS += -lws2_32 # Link against Winsock library
|
|
||||||
DELETE = cmd /C del /Q /F /S # Command prompt command to delete files
|
|
||||||
OUT ?= -o $(PROG) # Build output
|
|
||||||
MAKE += WINDOWS=1 CC=$(CC)
|
|
||||||
endif
|
|
||||||
|
|
||||||
all: $(PROG) # Default target. Build and run program
|
|
||||||
$(RUN) ./$(PROG) $(ARGS)
|
|
||||||
|
|
||||||
# Before embedding files, gzip them to save space
|
|
||||||
packed_fs.c: $(FILES_TO_EMBED) Makefile
|
|
||||||
$(CC) ../../test/pack.c -o $(PACK)
|
|
||||||
ifeq ($(OS),Windows_NT)
|
|
||||||
$(PACK) $(FILES_TO_EMBED) > $@
|
|
||||||
else
|
|
||||||
rm -rf tmp/web_root && mkdir tmp && cp -r web_root tmp/
|
|
||||||
find tmp -type f | xargs -n1 gzip
|
|
||||||
cd tmp && ../pack `find web_root -type f` > ../$@
|
|
||||||
endif
|
|
||||||
|
|
||||||
$(PROG): $(SOURCES) # Build program from sources
|
|
||||||
$(CC) $(SOURCES) $(CFLAGS) $(CFLAGS_MONGOOSE) $(CFLAGS_EXTRA) $(OUT)
|
|
||||||
|
|
||||||
clean: # Cleanup. Delete built program and all build artifacts
|
|
||||||
$(DELETE) $(PROG) *.o *.obj *.exe *.dSYM pack tmp mbedtls
|
|
||||||
|
|
||||||
# see https://mongoose.ws/tutorials/tls/#how-to-build for TLS build options
|
|
||||||
|
|
||||||
mbedtls: # Pull and build mbedTLS library
|
|
||||||
git clone --depth 1 -b v2.28.2 https://github.com/mbed-tls/mbedtls $@
|
|
||||||
$(MAKE) -C mbedtls/library
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
# A complete device dashboard
|
|
||||||
|
|
||||||
This example is a demonstration of how Mongoose Library could be integrated
|
|
||||||
into an embedded device and provide a complete device dashboard with the
|
|
||||||
following features:
|
|
||||||
|
|
||||||
- Authentication: login-protected dashboard
|
|
||||||
- Multiple logins with different permissions (admin and user)
|
|
||||||
- Web UI is fully embedded into the server/firmware binary, and does not
|
|
||||||
need a filesystem to serve it. UI is resilient to FS problems
|
|
||||||
- Administrators can change server settings
|
|
||||||
- All changes are propagated to all connected clients
|
|
||||||
- The device is connected to the external MQTT server
|
|
||||||
- Logged in clients can send/receive messages via MQTT
|
|
||||||
|
|
||||||
## Screenshots
|
|
||||||
|
|
||||||
This is a login screen that prompts for user/password
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Main dashboard
|
|
||||||
|
|
||||||
The main dashboard page shows the interactive MQTT console
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
See a detailed tutorial at https://mongoose.ws/tutorials/device-dashboard/
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../test/data/ca.pem
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
// Copyright (c) 2020-2022 Cesanta Software Limited
|
|
||||||
// All rights reserved
|
|
||||||
|
|
||||||
#include "mongoose.h"
|
|
||||||
|
|
||||||
const char *s_listening_url = "http://0.0.0.0:8000";
|
|
||||||
const char *s_listening_surl = "https://0.0.0.0:8443";
|
|
||||||
|
|
||||||
void device_dashboard_fn(struct mg_connection *, int, void *, void *);
|
|
||||||
|
|
||||||
int main(void) {
|
|
||||||
struct mg_mgr mgr;
|
|
||||||
mg_log_set(MG_LL_DEBUG); // Set debug log level
|
|
||||||
mg_mgr_init(&mgr);
|
|
||||||
mg_http_listen(&mgr, s_listening_url, device_dashboard_fn, NULL);
|
|
||||||
MG_INFO(("Listening on %s", s_listening_url));
|
|
||||||
#if MG_ENABLE_MBEDTLS || MG_ENABLE_OPENSSL
|
|
||||||
mg_http_listen(&mgr, s_listening_surl, device_dashboard_fn, "");
|
|
||||||
MG_INFO(("Listening on %s", s_listening_surl));
|
|
||||||
#endif
|
|
||||||
while (mgr.conns != NULL) mg_mgr_poll(&mgr, 500);
|
|
||||||
mg_mgr_free(&mgr);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
||||||
@@ -1,284 +0,0 @@
|
|||||||
// Copyright (c) 2020-2022 Cesanta Software Limited
|
|
||||||
// All rights reserved
|
|
||||||
|
|
||||||
#include "mongoose.h"
|
|
||||||
|
|
||||||
#if !defined(MQTT_SERVER)
|
|
||||||
#if MG_ENABLE_MBEDTLS || MG_ENABLE_OPENSSL
|
|
||||||
#define MQTT_SERVER "mqtts://broker.hivemq.com:8883"
|
|
||||||
#else
|
|
||||||
#define MQTT_SERVER "mqtt://broker.hivemq.com:1883"
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#define MQTT_PUBLISH_TOPIC "mg/my_device"
|
|
||||||
#define MQTT_SUBSCRIBE_TOPIC "mg/#"
|
|
||||||
|
|
||||||
// Certificate generation procedure:
|
|
||||||
// openssl ecparam -name prime256v1 -genkey -noout -out key.pem
|
|
||||||
// openssl req -new -key key.pem -x509 -nodes -days 3650 -out cert.pem
|
|
||||||
static const char *s_ssl_cert =
|
|
||||||
"-----BEGIN CERTIFICATE-----\n"
|
|
||||||
"MIIBCTCBsAIJAK9wbIDkHnAoMAoGCCqGSM49BAMCMA0xCzAJBgNVBAYTAklFMB4X\n"
|
|
||||||
"DTIzMDEyOTIxMjEzOFoXDTMzMDEyNjIxMjEzOFowDTELMAkGA1UEBhMCSUUwWTAT\n"
|
|
||||||
"BgcqhkjOPQIBBggqhkjOPQMBBwNCAARzSQS5OHd17lUeNI+6kp9WYu0cxuEIi/JT\n"
|
|
||||||
"jphbCmdJD1cUvhmzM9/phvJT9ka10Z9toZhgnBq0o0xfTQ4jC1vwMAoGCCqGSM49\n"
|
|
||||||
"BAMCA0gAMEUCIQCe0T2E0GOiVe9KwvIEPeX1J1J0T7TNacgR0Ya33HV9VgIgNvdn\n"
|
|
||||||
"aEWiBp1xshs4iz6WbpxrS1IHucrqkZuJLfNZGZI=\n"
|
|
||||||
"-----END CERTIFICATE-----\n";
|
|
||||||
|
|
||||||
static const char *s_ssl_key =
|
|
||||||
"-----BEGIN EC PRIVATE KEY-----\n"
|
|
||||||
"MHcCAQEEICBz3HOkQLPBDtdknqC7k1PNsWj6HfhyNB5MenfjmqiooAoGCCqGSM49\n"
|
|
||||||
"AwEHoUQDQgAEc0kEuTh3de5VHjSPupKfVmLtHMbhCIvyU46YWwpnSQ9XFL4ZszPf\n"
|
|
||||||
"6YbyU/ZGtdGfbaGYYJwatKNMX00OIwtb8A==\n"
|
|
||||||
"-----END EC PRIVATE KEY-----\n";
|
|
||||||
|
|
||||||
static time_t s_boot_timestamp = 0; // Updated by SNTP
|
|
||||||
#ifndef DISABLE_ROUTING
|
|
||||||
static struct mg_connection *s_sntp_conn = NULL; // SNTP connection
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Define a system time alternative
|
|
||||||
time_t ourtime(time_t *tp) {
|
|
||||||
time_t t = s_boot_timestamp + (time_t) (mg_millis() / 1000);
|
|
||||||
if (tp != NULL) *tp = t;
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Authenticated user.
|
|
||||||
// A user can be authenticated by:
|
|
||||||
// - a name:pass pair
|
|
||||||
// - a token
|
|
||||||
// When a user is shown a login screen, she enters a user:pass. If successful,
|
|
||||||
// a server returns user info which includes token. From that point on,
|
|
||||||
// client can use token for authentication. Tokens could be refreshed/changed
|
|
||||||
// on a server side, forcing clients to re-login.
|
|
||||||
struct user {
|
|
||||||
const char *name, *pass, *token;
|
|
||||||
};
|
|
||||||
|
|
||||||
// This is a configuration structure we're going to show on a dashboard
|
|
||||||
static struct config {
|
|
||||||
char *url, *pub, *sub; // MQTT settings
|
|
||||||
} s_config;
|
|
||||||
|
|
||||||
static struct mg_connection *s_mqtt = NULL; // MQTT connection
|
|
||||||
static bool s_connected = false; // MQTT connection established
|
|
||||||
|
|
||||||
// Try to update a single configuration value
|
|
||||||
static void update_config(struct mg_str *body, const char *name, char **value) {
|
|
||||||
char buf[256];
|
|
||||||
if (mg_http_get_var(body, name, buf, sizeof(buf)) > 0) {
|
|
||||||
free(*value);
|
|
||||||
*value = strdup(buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse HTTP requests, return authenticated user or NULL
|
|
||||||
static struct user *getuser(struct mg_http_message *hm) {
|
|
||||||
// In production, make passwords strong and tokens randomly generated
|
|
||||||
// In this example, user list is kept in RAM. In production, it can
|
|
||||||
// be backed by file, database, or some other method.
|
|
||||||
static struct user users[] = {
|
|
||||||
{"admin", "pass0", "admin_token"},
|
|
||||||
{"user1", "pass1", "user1_token"},
|
|
||||||
{"user2", "pass2", "user2_token"},
|
|
||||||
{NULL, NULL, NULL},
|
|
||||||
};
|
|
||||||
char user[256], pass[256];
|
|
||||||
struct user *u;
|
|
||||||
mg_http_creds(hm, user, sizeof(user), pass, sizeof(pass));
|
|
||||||
if (user[0] != '\0' && pass[0] != '\0') {
|
|
||||||
// Both user and password is set, search by user/password
|
|
||||||
for (u = users; u->name != NULL; u++)
|
|
||||||
if (strcmp(user, u->name) == 0 && strcmp(pass, u->pass) == 0) return u;
|
|
||||||
} else if (user[0] == '\0') {
|
|
||||||
// Only password is set, search by token
|
|
||||||
for (u = users; u->name != NULL; u++)
|
|
||||||
if (strcmp(pass, u->token) == 0) return u;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Notify all config watchers about the config change
|
|
||||||
static void send_notification(struct mg_mgr *mgr, const char *fmt, ...) {
|
|
||||||
struct mg_connection *c;
|
|
||||||
for (c = mgr->conns; c != NULL; c = c->next) {
|
|
||||||
if (c->data[0] == 'W') {
|
|
||||||
va_list ap;
|
|
||||||
va_start(ap, fmt);
|
|
||||||
mg_ws_vprintf(c, WEBSOCKET_OP_TEXT, fmt, &ap);
|
|
||||||
va_end(ap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send simulated metrics data to the dashboard, for chart rendering
|
|
||||||
static void timer_metrics_fn(void *param) {
|
|
||||||
send_notification(param, "{%m:%m,%m:[%lu, %d]}", MG_ESC("name"),
|
|
||||||
MG_ESC("metrics"), MG_ESC("data"),
|
|
||||||
(unsigned long) ourtime(NULL),
|
|
||||||
10 + (int) ((double) rand() * 10 / RAND_MAX));
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef DISABLE_ROUTING
|
|
||||||
|
|
||||||
// MQTT event handler function
|
|
||||||
static void mqtt_fn(struct mg_connection *c, int ev, void *ev_data, void *fnd) {
|
|
||||||
if (ev == MG_EV_CONNECT && mg_url_is_ssl(s_config.url)) {
|
|
||||||
struct mg_tls_opts opts = {.ca = "ca.pem",
|
|
||||||
.srvname = mg_url_host(s_config.url)};
|
|
||||||
mg_tls_init(c, &opts);
|
|
||||||
} else if (ev == MG_EV_MQTT_OPEN) {
|
|
||||||
s_connected = true;
|
|
||||||
c->is_hexdumping = 1;
|
|
||||||
struct mg_mqtt_opts sub_opts;
|
|
||||||
memset(&sub_opts, 0, sizeof(sub_opts));
|
|
||||||
sub_opts.topic = mg_str(s_config.sub);
|
|
||||||
sub_opts.qos = 2;
|
|
||||||
|
|
||||||
mg_mqtt_sub(s_mqtt, &sub_opts);
|
|
||||||
send_notification(c->mgr, "{%m:%m,%m:null}", MG_ESC("name"),
|
|
||||||
MG_ESC("config"), MG_ESC("data"));
|
|
||||||
MG_INFO(("MQTT connected, server %s", MQTT_SERVER));
|
|
||||||
} else if (ev == MG_EV_MQTT_MSG) {
|
|
||||||
struct mg_mqtt_message *mm = ev_data;
|
|
||||||
send_notification(
|
|
||||||
c->mgr, "{%m:%m,%m:{%m: %m, %m: %m, %m: %d}}", MG_ESC("name"),
|
|
||||||
MG_ESC("message"), MG_ESC("data"), MG_ESC("topic"), mg_print_esc,
|
|
||||||
(int) mm->topic.len, mm->topic.ptr, MG_ESC("data"), mg_print_esc,
|
|
||||||
(int) mm->data.len, mm->data.ptr, MG_ESC("qos"), (int) mm->qos);
|
|
||||||
} else if (ev == MG_EV_MQTT_CMD) {
|
|
||||||
struct mg_mqtt_message *mm = (struct mg_mqtt_message *) ev_data;
|
|
||||||
MG_DEBUG(("%lu cmd %d qos %d", c->id, mm->cmd, mm->qos));
|
|
||||||
} else if (ev == MG_EV_CLOSE) {
|
|
||||||
s_mqtt = NULL;
|
|
||||||
if (s_connected) {
|
|
||||||
s_connected = false;
|
|
||||||
send_notification(c->mgr, "{%m:%m,%m:null}", MG_ESC("name"),
|
|
||||||
MG_ESC("config"), MG_ESC("data"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
(void) fnd;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Keep MQTT connection open - reconnect if closed
|
|
||||||
static void timer_mqtt_fn(void *param) {
|
|
||||||
struct mg_mgr *mgr = (struct mg_mgr *) param;
|
|
||||||
if (s_mqtt == NULL) {
|
|
||||||
struct mg_mqtt_opts opts;
|
|
||||||
memset(&opts, 0, sizeof(opts));
|
|
||||||
s_mqtt = mg_mqtt_connect(mgr, s_config.url, &opts, mqtt_fn, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// SNTP connection event handler. When we get a response from an SNTP server,
|
|
||||||
// adjust s_boot_timestamp. We'll get a valid time from that point on
|
|
||||||
static void sfn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
|
||||||
if (ev == MG_EV_SNTP_TIME) {
|
|
||||||
uint64_t t = *(uint64_t *) ev_data;
|
|
||||||
s_boot_timestamp = (time_t) ((t - mg_millis()) / 1000);
|
|
||||||
c->is_closing = 1;
|
|
||||||
} else if (ev == MG_EV_CLOSE) {
|
|
||||||
s_sntp_conn = NULL;
|
|
||||||
}
|
|
||||||
(void) fn_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void timer_sntp_fn(void *param) { // SNTP timer function. Sync up time
|
|
||||||
struct mg_mgr *mgr = (struct mg_mgr *) param;
|
|
||||||
if (s_sntp_conn == NULL && s_boot_timestamp == 0) {
|
|
||||||
s_sntp_conn = mg_sntp_connect(mgr, NULL, sfn, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// HTTP request handler function
|
|
||||||
void device_dashboard_fn(struct mg_connection *c, int ev, void *ev_data,
|
|
||||||
void *fn_data) {
|
|
||||||
if (ev == MG_EV_OPEN && c->is_listening) {
|
|
||||||
mg_timer_add(c->mgr, 1000, MG_TIMER_REPEAT, timer_metrics_fn, c->mgr);
|
|
||||||
#ifndef DISABLE_ROUTING
|
|
||||||
mg_timer_add(c->mgr, 1000, MG_TIMER_REPEAT, timer_mqtt_fn, c->mgr);
|
|
||||||
mg_timer_add(c->mgr, 1000, MG_TIMER_REPEAT, timer_sntp_fn, c->mgr);
|
|
||||||
#endif
|
|
||||||
s_config.url = strdup(MQTT_SERVER);
|
|
||||||
s_config.pub = strdup(MQTT_PUBLISH_TOPIC);
|
|
||||||
s_config.sub = strdup(MQTT_SUBSCRIBE_TOPIC);
|
|
||||||
} else if (ev == MG_EV_ACCEPT && fn_data != NULL) {
|
|
||||||
struct mg_tls_opts opts = {.cert = s_ssl_cert, .certkey = s_ssl_key};
|
|
||||||
mg_tls_init(c, &opts);
|
|
||||||
} else if (ev == MG_EV_HTTP_MSG) {
|
|
||||||
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
|
||||||
struct user *u = getuser(hm);
|
|
||||||
// MG_INFO(("%p [%.*s] auth %s", c->fd, (int) hm->uri.len, hm->uri.ptr,
|
|
||||||
// u ? u->name : "NULL"));
|
|
||||||
if (mg_http_match_uri(hm, "/api/hi")) {
|
|
||||||
mg_http_reply(c, 200, "", "hi\n"); // Testing endpoint
|
|
||||||
} else if (mg_http_match_uri(hm, "/api/debug")) {
|
|
||||||
int level = mg_json_get_long(hm->body, "$.level", MG_LL_DEBUG);
|
|
||||||
mg_log_set(level);
|
|
||||||
mg_http_reply(c, 200, "", "Debug level set to %d\n", level);
|
|
||||||
} else if (u == NULL && mg_http_match_uri(hm, "/api/#")) {
|
|
||||||
// All URIs starting with /api/ must be authenticated
|
|
||||||
mg_http_reply(c, 403, "", "Denied\n");
|
|
||||||
} else if (mg_http_match_uri(hm, "/api/config/get")) {
|
|
||||||
#ifdef DISABLE_ROUTING
|
|
||||||
mg_http_reply(c, 200, NULL, "{%m:%m,%m:%m,%m:%m}\n", MG_ESC("url"),
|
|
||||||
MG_ESC(s_config.url), MG_ESC("pub"), MG_ESC(s_config.pub),
|
|
||||||
MG_ESC("sub"), MG_ESC(s_config.sub));
|
|
||||||
#else
|
|
||||||
mg_http_reply(c, 200, NULL, "{%m:%m,%m:%m,%m:%m,%m:%s}\n", MG_ESC("url"),
|
|
||||||
MG_ESC(s_config.url), MG_ESC("pub"), MG_ESC(s_config.pub),
|
|
||||||
MG_ESC("sub"), MG_ESC(s_config.sub), MG_ESC("connected"),
|
|
||||||
s_connected ? "true" : "false");
|
|
||||||
#endif
|
|
||||||
} else if (mg_http_match_uri(hm, "/api/config/set")) {
|
|
||||||
// Admins only
|
|
||||||
if (strcmp(u->name, "admin") == 0) {
|
|
||||||
update_config(&hm->body, "url", &s_config.url);
|
|
||||||
update_config(&hm->body, "pub", &s_config.pub);
|
|
||||||
update_config(&hm->body, "sub", &s_config.sub);
|
|
||||||
if (s_mqtt) s_mqtt->is_closing = 1; // Ask to disconnect from MQTT
|
|
||||||
send_notification(c->mgr, "{%m:%m,%m:null}", MG_ESC("name"),
|
|
||||||
MG_ESC("config"), MG_ESC("data"));
|
|
||||||
mg_http_reply(c, 200, "", "ok\n");
|
|
||||||
} else {
|
|
||||||
mg_http_reply(c, 403, "", "Denied\n");
|
|
||||||
}
|
|
||||||
} else if (mg_http_match_uri(hm, "/api/message/send")) {
|
|
||||||
char buf[256];
|
|
||||||
if (s_connected &&
|
|
||||||
mg_http_get_var(&hm->body, "message", buf, sizeof(buf)) > 0) {
|
|
||||||
struct mg_mqtt_opts pub_opts;
|
|
||||||
memset(&pub_opts, 0, sizeof(pub_opts));
|
|
||||||
pub_opts.topic = mg_str(s_config.pub);
|
|
||||||
pub_opts.message = mg_str(buf);
|
|
||||||
pub_opts.qos = 2, pub_opts.retain = false;
|
|
||||||
|
|
||||||
mg_mqtt_pub(s_mqtt, &pub_opts);
|
|
||||||
}
|
|
||||||
mg_http_reply(c, 200, "", "ok\n");
|
|
||||||
} else if (mg_http_match_uri(hm, "/api/watch")) {
|
|
||||||
c->data[0] = 'W'; // Mark ourselves as a event listener
|
|
||||||
mg_ws_upgrade(c, hm, NULL);
|
|
||||||
} else if (mg_http_match_uri(hm, "/api/login")) {
|
|
||||||
mg_http_reply(c, 200, NULL, "{%m:%m,%m:%m}\n", MG_ESC("user"),
|
|
||||||
MG_ESC(u->name), MG_ESC("token"), MG_ESC(u->token));
|
|
||||||
} else {
|
|
||||||
struct mg_http_serve_opts opts;
|
|
||||||
memset(&opts, 0, sizeof(opts));
|
|
||||||
#if 1
|
|
||||||
opts.root_dir = "/web_root";
|
|
||||||
opts.fs = &mg_fs_packed;
|
|
||||||
#else
|
|
||||||
opts.root_dir = "web_root";
|
|
||||||
#endif
|
|
||||||
mg_http_serve_dir(c, ev_data, &opts);
|
|
||||||
}
|
|
||||||
MG_DEBUG(("%lu %.*s %.*s -> %.*s", c->id, (int) hm->method.len,
|
|
||||||
hm->method.ptr, (int) hm->uri.len, hm->uri.ptr, (int) 3,
|
|
||||||
&c->send.buf[9]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large.
Load diff
Binary file not shown.
|
Before Width: | Height: | Size: 283 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 119 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 65 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 53 KiB |
@@ -1,385 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
import {Component, h, html, render, useEffect, useState, useRef} from './preact.min.js';
|
|
||||||
|
|
||||||
var devaddr = "address:port";
|
|
||||||
|
|
||||||
const MaxMetricsDataPoints = 50;
|
|
||||||
|
|
||||||
// This simple publish/subscribe is used to pass notifications that were
|
|
||||||
// received from the server, to all child components of the app.
|
|
||||||
var PubSub = (function() {
|
|
||||||
var handlers = {}, id = 0;
|
|
||||||
return {
|
|
||||||
subscribe: function(fn) {
|
|
||||||
handlers[id++] = fn;
|
|
||||||
},
|
|
||||||
unsubscribe: function(id) {
|
|
||||||
delete handlers[id];
|
|
||||||
},
|
|
||||||
publish: function(data) {
|
|
||||||
for (var k in handlers) handlers[k](data);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
|
|
||||||
const Nav = props => html`
|
|
||||||
<div style="background: #333; padding: 0.5em; color: #fff;">
|
|
||||||
<div class="container d-flex">
|
|
||||||
<div style="flex: 1 1 auto; display: flex; align-items: center;">
|
|
||||||
<b>Your Product</b>
|
|
||||||
</div>
|
|
||||||
<div style="display: flex; align-items: center; flex: 0 0 auto; ">
|
|
||||||
<span>Logged in as:</span>
|
|
||||||
<span style="padding: 0 0.5em;"><img src="user.png" height="22" /></span>
|
|
||||||
<span>${props.user}</span>
|
|
||||||
<a class="btn" onclick=${props.logout}
|
|
||||||
style="margin-left: 1em; font-size: 0.8em; background: #8aa;">logout</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>`;
|
|
||||||
|
|
||||||
|
|
||||||
const Hero = props => html`
|
|
||||||
<div class="section">
|
|
||||||
<div style="margin-top: 1em; background: #eee; padding: 1em; border-radius: 0.5em; color: #777; ">
|
|
||||||
<h1 style="margin: 0.2em 0;">Interactive Device Dashboard</h1>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
This device dashboard is developed using the modern and compact Preact framework,
|
|
||||||
in order to fit on very small devices. This is
|
|
||||||
a <a href="https://mongoose.ws/tutorials/http-server/">hybrid server</a> which
|
|
||||||
provides both static and dynamic content. Static files, like CSS/JS/HTML
|
|
||||||
or images, are compiled into the server binary.
|
|
||||||
|
|
||||||
This UI uses the REST API implemented by the device, which you can examine
|
|
||||||
using <code>curl</code> command-line utility:
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div><code>curl -u admin:pass0 ${devaddr}/api/config/get</code> </div>
|
|
||||||
<div><code>curl -u admin:pass0 ${devaddr}/api/config/set -d 'pub=mg/topic'</code> </div>
|
|
||||||
<div><code>curl -u admin:pass0 ${devaddr}/api/message/send -d 'message=hello'</code> </div>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
The device can send notifications to this dashboard at anytime. Notifications
|
|
||||||
are sent over WebSocket at URI <code>/api/watch</code> as JSON strings: <code>{"name": "..", "data": ...}</code>
|
|
||||||
<div>Try <code>wscat --auth user1:pass1 --connect ws://${devaddr}/api/watch</code></div>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>`;
|
|
||||||
|
|
||||||
const Login = function(props) {
|
|
||||||
const [user, setUser] = useState('');
|
|
||||||
const [pass, setPass] = useState('');
|
|
||||||
const login = ev =>
|
|
||||||
fetch(
|
|
||||||
'/api/login',
|
|
||||||
{headers: {Authorization: 'Basic ' + btoa(user + ':' + pass)}})
|
|
||||||
.then(r => r.json())
|
|
||||||
.then(r => r && props.login(r))
|
|
||||||
.catch(err => err);
|
|
||||||
return html`
|
|
||||||
<div class="rounded border" style="max-width: 480px; margin: 0 auto; margin-top: 5em; background: #eee; ">
|
|
||||||
<div style="padding: 2em; ">
|
|
||||||
<h1 style="color: #666;">Device Dashboard Login </h1>
|
|
||||||
<div style="margin: 0.5em 0;">
|
|
||||||
<input type='text' placeholder='Name' style="width: 100%;"
|
|
||||||
oninput=${ev => setUser(ev.target.value)} value=${user} />
|
|
||||||
</div>
|
|
||||||
<div style="margin: 0.5em 0;">
|
|
||||||
<input type="password" placeholder="Password" style="width: 100%;"
|
|
||||||
oninput=${ev => setPass(ev.target.value)} value=${pass}
|
|
||||||
onchange=${login} />
|
|
||||||
</div>
|
|
||||||
<div style="margin: 1em 0;">
|
|
||||||
<button class="btn" style="width: 100%; background: #8aa;"
|
|
||||||
disabled=${!user || !pass} onclick=${login}> Login </button>
|
|
||||||
</div>
|
|
||||||
<div style="color: #777; margin-top: 2em;">
|
|
||||||
Valid logins: admin:pass0, user1:pass1, user2:pass2
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>`;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const Configuration = function(props) {
|
|
||||||
const [url, setUrl] = useState(props.config.url || '');
|
|
||||||
const [pub, setPub] = useState(props.config.pub || '');
|
|
||||||
const [sub, setSub] = useState(props.config.sub || '');
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setUrl(props.config.url);
|
|
||||||
setPub(props.config.pub);
|
|
||||||
setSub(props.config.sub);
|
|
||||||
}, [props.config]);
|
|
||||||
|
|
||||||
const update = (name, val) => fetch('/api/config/set', {
|
|
||||||
method: 'post',
|
|
||||||
body: `${name}=${encodeURIComponent(val)}`
|
|
||||||
}).catch(err => err);
|
|
||||||
const updateurl = ev => update('url', url);
|
|
||||||
const updatepub = ev => update('pub', pub);
|
|
||||||
const updatesub = ev => update('sub', sub);
|
|
||||||
|
|
||||||
// console.log(props, [url, pub, sub]);
|
|
||||||
return html`
|
|
||||||
<div class="section">
|
|
||||||
<h3 style="background: #c03434; color: #fff; padding: 0.4em;">
|
|
||||||
Device Configuration</h3>
|
|
||||||
<div style="margin: 0.5em 0; display: flex;">
|
|
||||||
<span class="addon nowrap">MQTT server:</span>
|
|
||||||
<input type="text" style="flex: 1 100%;"
|
|
||||||
value=${url} onchange=${updateurl}
|
|
||||||
oninput=${ev => setUrl(ev.target.value)} />
|
|
||||||
<button class="btn" disabled=${!url} onclick=${updateurl}
|
|
||||||
style="margin-left: 1em; background: #8aa;">Update</button>
|
|
||||||
</div>
|
|
||||||
<div style="margin: 0.5em 0; display: flex; ">
|
|
||||||
<span class="addon nowrap">Subscribe topic:</span>
|
|
||||||
<input type="text" style="flex: 1 100%;"
|
|
||||||
value=${sub} onchange=${updatesub}
|
|
||||||
oninput=${ev => setSub(ev.target.value)} />
|
|
||||||
<button class="btn" disabled=${!sub} onclick=${updatesub}
|
|
||||||
style="margin-left: 1em; background: #8aa;">Update</button>
|
|
||||||
</div>
|
|
||||||
<div style="margin: 0.5em 0; display: flex;">
|
|
||||||
<span class="addon nowrap">Publish topic:</span>
|
|
||||||
<input type="text" style="flex: 1 100%;"
|
|
||||||
value=${pub} onchange=${updatepub}
|
|
||||||
oninput=${ev => setPub(ev.target.value)} />
|
|
||||||
<button class="btn" disabled=${!pub} onclick=${updatepub}
|
|
||||||
style="margin-left: 1em; background: #8aa;">Update</button>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
You can use <a href="http://www.hivemq.com/demos/websocket-client/">
|
|
||||||
HiveMQ Websocket web client</a> to send messages to this console.
|
|
||||||
</div>
|
|
||||||
<div class="msg">
|
|
||||||
The device keeps a persistent connection to the configured MQTT server.
|
|
||||||
Changes to this configuration are propagated to all dashboards: try
|
|
||||||
changing them in this dashboard and observe changes in other opened
|
|
||||||
dashboards.
|
|
||||||
</div><div class="msg">
|
|
||||||
Note: administrators can see this section and can change device
|
|
||||||
configuration, whilst users cannot.
|
|
||||||
</div>
|
|
||||||
</div>`;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const Message = m => html`<div style="margin: 0.5em 0;">
|
|
||||||
<span class="qos">qos: ${m.message.qos} </span>
|
|
||||||
<span class="topic">topic: ${m.message.topic} </span>
|
|
||||||
<span class="data">data: ${m.message.data}</span>
|
|
||||||
</div>`;
|
|
||||||
|
|
||||||
const Messages = function(props) {
|
|
||||||
const [messages, setMessages] = useState([]);
|
|
||||||
const [txt, setTxt] = useState('');
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const id = PubSub.subscribe(function(msg) {
|
|
||||||
if (msg.name == 'message') setMessages(x => x.concat([msg.data]));
|
|
||||||
});
|
|
||||||
return PubSub.unsubscribe(id);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const sendmessage = ev => fetch('/api/message/send', {
|
|
||||||
method: 'post',
|
|
||||||
body: `message=${encodeURIComponent(txt)}`
|
|
||||||
}).then(r => setTxt(''));
|
|
||||||
const routing = "connected" in props.config;
|
|
||||||
const connstatus = !routing ? 'This device has no MQTT functionality' : props.config.connected ? 'connected' : 'disconnected';
|
|
||||||
return html`
|
|
||||||
<div class="section">
|
|
||||||
<h3 style="background: #30c040; color: #fff; padding: 0.4em;">MQTT messages</h3>
|
|
||||||
<div>
|
|
||||||
MQTT server status: <b>${connstatus}</b>
|
|
||||||
</div>
|
|
||||||
<div style="height: 10em; overflow: auto; padding: 0.5em; " class="border">
|
|
||||||
${messages.map(message => h(Message, {message}))}
|
|
||||||
</div>
|
|
||||||
<div style="margin: 0.5em 0; display: flex">
|
|
||||||
<span class="addon nowrap">Publish message:</span>
|
|
||||||
<input placeholder="type and press enter..." style="flex: 1 100%;"
|
|
||||||
value=${txt} onchange=${sendmessage} disabled=${!routing}
|
|
||||||
oninput=${ev => setTxt(ev.target.value)} />
|
|
||||||
</div>
|
|
||||||
<div class="msg">
|
|
||||||
The message gets passed to the device via REST. Then the device sends it to
|
|
||||||
the MQTT server over MQTT. All MQTT messages on a subscribed topic
|
|
||||||
received by the device, are propagated to this dashboard via /api/watch.
|
|
||||||
</div>
|
|
||||||
</div>`;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Expected arguments:
|
|
||||||
// data: timeseries, e.g. [ [1654361352, 19], [1654361353, 18], ... ]
|
|
||||||
// width, height, yticks, xticks, ymin, ymax, xmin, xmax
|
|
||||||
const SVG = function(props) {
|
|
||||||
// w
|
|
||||||
// +---------------------+
|
|
||||||
// | h1 |
|
|
||||||
// | +-----------+ |
|
|
||||||
// | | | | h
|
|
||||||
// | w1 | | w2 |
|
|
||||||
// | +-----------+ |
|
|
||||||
// | h2 |
|
|
||||||
// +---------------------+
|
|
||||||
//
|
|
||||||
let w = props.width, h = props.height, w1 = 30, w2 = 0, h1 = 8, h2 = 18;
|
|
||||||
let yticks = props.yticks || 4, xticks = props.xticks || 5;
|
|
||||||
let data = props.data || [];
|
|
||||||
let ymin = props.ymin || 0;
|
|
||||||
let ymax = props.ymax || Math.max.apply(null, data.map(p => p[1]));
|
|
||||||
let xmin = props.xmin || Math.min.apply(null, data.map(p => p[0]));
|
|
||||||
let xmax = props.xmax || Math.max.apply(null, data.map(p => p[0]));
|
|
||||||
|
|
||||||
// Y-axis tick lines and labels
|
|
||||||
let yta = (new Array(yticks + 1)).fill(0).map((_, i) => i); // indices
|
|
||||||
let yti = i => h - h2 - (h - h1 - h2) * i / yticks; // index's Y
|
|
||||||
let ytv = i => (ymax - ymin) * i / yticks;
|
|
||||||
let ytl = y => html`<line x1=${w1} y1=${y} x2=${w} y2=${y} class="tick"/>`;
|
|
||||||
let ytt = (y, v) => html`<text x=0 y=${y + 5} class="label">${v}</text>`;
|
|
||||||
|
|
||||||
// X-axis tick lines and labels
|
|
||||||
let datefmt = unix => (new Date(unix * 1000)).toISOString().substr(14, 5);
|
|
||||||
let xta = (new Array(xticks + 1)).fill(0).map((_, i) => i); // indices
|
|
||||||
let xti = i => w1 + (w - w1 - w2) * i / xticks; // index's X
|
|
||||||
let xtv = i => datefmt(xmin + (xmax - xmin) * i / xticks);
|
|
||||||
let xtl = x => html`<path d="M ${x},${h1} L ${x},${h - h2}" class="tick"/>`;
|
|
||||||
let xtt = (x, v) =>
|
|
||||||
html`<text x=${x - 15} y=${h - 2} class="label">${v}</text>`;
|
|
||||||
|
|
||||||
// Transform data points array into coordinate
|
|
||||||
let dx = v => w1 + (v - xmin) / ((xmax - xmin) || 1) * (w - w1 - w2);
|
|
||||||
let dy = v => h - h2 - (v - ymin) / ((ymax - ymin) || 1) * (h - h1 - h2);
|
|
||||||
let dd = data.map(p => [Math.round(dx(p[0])), Math.round(dy(p[1]))]);
|
|
||||||
let ddl = dd.length;
|
|
||||||
// And plot the data as <path> element
|
|
||||||
let begin0 = ddl ? `M ${dd[0][0]},${dd[0][1]}` : `M 0,0`;
|
|
||||||
let begin = `M ${w1},${h - h2}`; // Initial point
|
|
||||||
let end = ddl ? `L ${dd[ddl - 1][0]},${h - h2}` : `L ${w1},${h - h2}`;
|
|
||||||
let series = ddl ? dd.map(p => `L ${p[0]} ${p[1]}`) : [];
|
|
||||||
|
|
||||||
return html`
|
|
||||||
<svg viewBox="0 0 ${w} ${h}">
|
|
||||||
<style>
|
|
||||||
.axis { stroke: #aaa; fill: none; }
|
|
||||||
.label { stroke: #aaa; font-size: 13px; }
|
|
||||||
.tick { stroke: #ccc; fill: none; stroke-dasharray: 5; }
|
|
||||||
.seriesbg { stroke: none; fill: rgba(200,225,255, 0.25)}
|
|
||||||
.series { stroke: #25a; fill: none; }
|
|
||||||
</style>
|
|
||||||
${yta.map(i => ytl(yti(i)))}
|
|
||||||
${yta.map(i => ytt(yti(i), ytv(i)))}
|
|
||||||
${xta.map(i => xtl(xti(i)))}
|
|
||||||
${data.length ? xta.map(i => xtt(xti(i), xtv(i))) : ''}
|
|
||||||
<path d="${begin} ${series.join(' ')} ${end}" class="seriesbg" />
|
|
||||||
<path d="${begin0} ${series.join(' ')}" class="series" />
|
|
||||||
</svg>`;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const Chart = function(props) {
|
|
||||||
const [data, setData] = useState([]);
|
|
||||||
useEffect(() => {
|
|
||||||
const id = PubSub.subscribe(function(msg) {
|
|
||||||
if (msg.name != 'metrics') return;
|
|
||||||
setData(x => x.concat([msg.data]).splice(-MaxMetricsDataPoints));
|
|
||||||
});
|
|
||||||
return PubSub.unsubscribe(id);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
let xmax = 0, missing = MaxMetricsDataPoints - data.length;
|
|
||||||
if (missing > 0) xmax = Math.round(Date.now() / 1000) + missing;
|
|
||||||
return html`
|
|
||||||
<div class="section">
|
|
||||||
<h3 style="background: #ec3; color: #fff; padding: 0.4em;">Data Chart</h3>
|
|
||||||
<div style="overflow: auto; padding: 0.5em;" class="">
|
|
||||||
<${SVG} height=240 width=600 ymin=0 ymax=20 xmax=${xmax} data=${data} />
|
|
||||||
</div>
|
|
||||||
<div class="msg">
|
|
||||||
This chart plots live sensor data, sent by the device via /api/watch.
|
|
||||||
</div>
|
|
||||||
</div>`;
|
|
||||||
};
|
|
||||||
|
|
||||||
const App = function(props) {
|
|
||||||
const [user, setUser] = useState('');
|
|
||||||
const [config, setConfig] = useState({});
|
|
||||||
|
|
||||||
const getconfig = () =>
|
|
||||||
fetch('/api/config/get', {headers: {Authorization: ''}})
|
|
||||||
.then(r => r.json())
|
|
||||||
.then(r => setConfig(r))
|
|
||||||
.catch(err => console.log(err));
|
|
||||||
|
|
||||||
// Watch for notifications. As soon as a notification arrives, pass it on
|
|
||||||
// to all subscribed components
|
|
||||||
const watch = function() {
|
|
||||||
var l = window.location, proto = l.protocol.replace('http', 'ws');
|
|
||||||
var tid, wsURI = proto + '//' + l.host + '/api/watch'
|
|
||||||
var reconnect = function() {
|
|
||||||
var ws = new WebSocket(wsURI);
|
|
||||||
// ws.onopen = () => console.log('ws connected');
|
|
||||||
ws.onmessage = function(ev) {
|
|
||||||
try {
|
|
||||||
var msg = JSON.parse(ev.data);
|
|
||||||
PubSub.publish(msg);
|
|
||||||
// if (msg.name != 'metrics') console.log('ws->', msg);
|
|
||||||
} catch (e) {
|
|
||||||
console.log('Invalid ws frame:', ev.data); // eslint-disable-line
|
|
||||||
}
|
|
||||||
};
|
|
||||||
ws.onclose = function() {
|
|
||||||
clearTimeout(tid);
|
|
||||||
tid = setTimeout(reconnect, 1000);
|
|
||||||
console.log('ws disconnected');
|
|
||||||
};
|
|
||||||
};
|
|
||||||
reconnect();
|
|
||||||
};
|
|
||||||
|
|
||||||
const login = function(u) {
|
|
||||||
document.cookie = `access_token=${u.token}; Secure, HttpOnly; SameSite=Lax; path=/; max-age=3600`;
|
|
||||||
setUser(u.user);
|
|
||||||
if (location.search.substring(1) == 'nows') {
|
|
||||||
// If query string is ?nows, then do not connect to websocket. For debug.
|
|
||||||
} else {
|
|
||||||
watch(); // Connect to websocket, receive constant graph updates
|
|
||||||
}
|
|
||||||
return getconfig();
|
|
||||||
};
|
|
||||||
|
|
||||||
const logout = ev => {
|
|
||||||
document.cookie = `access_token=; Secure, HttpOnly; SameSite=Lax; path=/; max-age=0`;
|
|
||||||
setUser('');
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
// Called once at init time
|
|
||||||
PubSub.subscribe(msg => msg.name == 'config' && getconfig());
|
|
||||||
fetch('/api/login', {headers: {Authorization: ''}})
|
|
||||||
.then(r => r.json())
|
|
||||||
.then(r => login(r))
|
|
||||||
.catch(err => setUser(''));
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
if (!user) return html`<${Login} login=${login} />`;
|
|
||||||
|
|
||||||
return html`
|
|
||||||
<${Nav} user=${user} logout=${logout} />
|
|
||||||
<div class="container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col col-6"><${Hero} /></div>
|
|
||||||
<div class="col col-6"><${Chart} /></div>
|
|
||||||
<div class="col col-6">
|
|
||||||
${user == 'admin' && h(Configuration, {config})}
|
|
||||||
</div>
|
|
||||||
<div class="col col-6"><${Messages} config=${config} /></div>
|
|
||||||
</div>
|
|
||||||
</div>`;
|
|
||||||
};
|
|
||||||
|
|
||||||
window.onload = () => render(h(App), document.body);
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
PROG ?= example # Program we are building
|
|
||||||
DELETE = rm -rf # Command to remove files
|
|
||||||
OUT ?= -o $(PROG) # Compiler argument for output file
|
|
||||||
SOURCES = main.c mongoose.c packed_fs.c # Source code files
|
|
||||||
CFLAGS = -W -Wall -Wextra -g -I. # Build options
|
|
||||||
PACK = ./pack # Utility to pack files into a packed filesystem
|
|
||||||
|
|
||||||
# Mongoose build options. See https://mongoose.ws/documentation/#build-options
|
|
||||||
CFLAGS_MONGOOSE += -DMG_ENABLE_PACKED_FS=1
|
|
||||||
|
|
||||||
FILES_TO_EMBED ?= $(wildcard web_root/*)
|
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT) # Windows settings. Assume MinGW compiler. To use VC: make CC=cl CFLAGS=/MD OUT=/Feprog.exe
|
|
||||||
PROG ?= example.exe # Use .exe suffix for the binary
|
|
||||||
CC = gcc # Use MinGW gcc compiler
|
|
||||||
CFLAGS += -lws2_32 # Link against Winsock library
|
|
||||||
DELETE = cmd /C del /Q /F /S # Command prompt command to delete files
|
|
||||||
OUT ?= -o $(PROG) # Build output
|
|
||||||
PACK = pack.exe
|
|
||||||
endif
|
|
||||||
|
|
||||||
all: $(PROG) # Default target. Build and run program
|
|
||||||
$(RUN) ./$(PROG) $(ARGS)
|
|
||||||
|
|
||||||
$(PROG): $(SOURCES) $(FILES_TO_EMBED) # Build program from sources
|
|
||||||
$(CC) ../../test/pack.c -o $(PACK)
|
|
||||||
$(PACK) $(FILES_TO_EMBED) > packed_fs.c
|
|
||||||
$(CC) $(SOURCES) $(CFLAGS) $(CFLAGS_MONGOOSE) $(CFLAGS_EXTRA) $(OUT)
|
|
||||||
|
|
||||||
clean: # Cleanup. Delete built program and all build artifacts
|
|
||||||
$(DELETE) $(PROG) *.dSYM $(PACK)
|
|
||||||
|
|
||||||
.PHONY: compress expand gzipped plain all
|
|
||||||
|
|
||||||
# See tutorial at https://mongoose.ws/tutorials/embedded-filesystem/#build-and-try
|
|
||||||
gzipped: compress
|
|
||||||
$(MAKE) all
|
|
||||||
|
|
||||||
plain: expand
|
|
||||||
$(MAKE) all
|
|
||||||
|
|
||||||
compress:
|
|
||||||
for file in $(FILES_TO_EMBED) ; do \
|
|
||||||
gzip -q $$file ; \
|
|
||||||
done
|
|
||||||
|
|
||||||
expand:
|
|
||||||
for file in $(FILES_TO_EMBED) ; do \
|
|
||||||
gunzip -q $$file ; \
|
|
||||||
done
|
|
||||||
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
See detailed tutorial at https://mongoose.ws/tutorials/embedded-filesystem/
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
// Copyright (c) 2022 Cesanta Software Limited
|
|
||||||
// All rights reserved
|
|
||||||
|
|
||||||
#include "mongoose.h"
|
|
||||||
|
|
||||||
const char *s_listening_url = "http://0.0.0.0:8000";
|
|
||||||
|
|
||||||
// HTTP request handler function
|
|
||||||
void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
|
||||||
if (ev == MG_EV_HTTP_MSG) {
|
|
||||||
struct mg_http_serve_opts opts = {
|
|
||||||
.root_dir = "/web_root",
|
|
||||||
.fs = &mg_fs_packed
|
|
||||||
};
|
|
||||||
mg_http_serve_dir(c, ev_data, &opts);
|
|
||||||
}
|
|
||||||
(void) fn_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void) {
|
|
||||||
struct mg_mgr mgr;
|
|
||||||
mg_log_set(MG_LL_INFO);
|
|
||||||
mg_mgr_init(&mgr);
|
|
||||||
mg_http_listen(&mgr, s_listening_url, fn, NULL);
|
|
||||||
while (true) mg_mgr_poll(&mgr, 500);
|
|
||||||
mg_mgr_free(&mgr);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -1,38 +0,0 @@
|
|||||||
THISDIR = $(realpath $(CURDIR))
|
|
||||||
ROOTDIR = $(realpath $(CURDIR)/../../..)
|
|
||||||
DOCKER ?= docker run --rm $(DA) -v $(ROOTDIR):$(ROOTDIR) -w $(THISDIR) espressif/idf
|
|
||||||
CMD ?= idf.py build
|
|
||||||
PORT ?= /dev/ttyUSB0
|
|
||||||
|
|
||||||
all: example
|
|
||||||
|
|
||||||
example:
|
|
||||||
true
|
|
||||||
|
|
||||||
build: Makefile $(wildcard main/*)
|
|
||||||
$(DOCKER) $(CMD)
|
|
||||||
|
|
||||||
flash:
|
|
||||||
flash: CMD = idf.py flash
|
|
||||||
flash: DA = --device $(PORT)
|
|
||||||
flash: build
|
|
||||||
|
|
||||||
.PHONY: build
|
|
||||||
|
|
||||||
dashboard.hex: build
|
|
||||||
esputil mkhex \
|
|
||||||
0x8000 build/partition_table/partition-table.bin \
|
|
||||||
0x1000 build/bootloader/bootloader.bin \
|
|
||||||
0x100000 build/mongoose-esp32-example.bin > $@
|
|
||||||
|
|
||||||
flash2: dashboard.hex
|
|
||||||
esputil -p $(PORT) -b 921600 -fp 0x220 flash dashboard.hex
|
|
||||||
esputil -p $(PORT) monitor
|
|
||||||
|
|
||||||
ESPTOOL ?= esptool.py
|
|
||||||
|
|
||||||
flash3:
|
|
||||||
cd build && $(ESPTOOL) --chip esp32 -p $(PORT) -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 2MB 0x8000 partition_table/partition-table.bin 0x1000 bootloader/bootloader.bin 0x100000 mongoose-esp32-example.bin
|
|
||||||
|
|
||||||
clean:
|
|
||||||
test -d build && $(DOCKER) rm -rf build sdkconfig || true
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
idf_component_register(SRCS "main.c"
|
|
||||||
"wifi.c"
|
|
||||||
"net.c"
|
|
||||||
"packed_fs.c"
|
|
||||||
"mongoose.c")
|
|
||||||
component_compile_options(-DMG_ENABLE_LINES)
|
|
||||||
component_compile_options(-DMG_ENABLE_PACKED_FS)
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
// Copyright (c) 2020 Cesanta Software Limited
|
|
||||||
// All rights reserved
|
|
||||||
|
|
||||||
#include "esp_spiffs.h"
|
|
||||||
//#include "freertos/FreeRTOS.h"
|
|
||||||
#include "mongoose.h"
|
|
||||||
|
|
||||||
const char *s_listening_url = "http://0.0.0.0:80";
|
|
||||||
void device_dashboard_fn(struct mg_connection *, int, void *, void *);
|
|
||||||
|
|
||||||
#define WIFI_SSID "YOUR_WIFI_NETWORK_NAME" // SET THIS!
|
|
||||||
#define WIFI_PASS "YOUR_WIFI_PASSWORD" // SET THIS!
|
|
||||||
#define FS_ROOT "/spiffs"
|
|
||||||
|
|
||||||
void app_main(void) {
|
|
||||||
// Mount filesystem
|
|
||||||
esp_vfs_spiffs_conf_t conf = {
|
|
||||||
.base_path = FS_ROOT, .max_files = 20, .format_if_mount_failed = true};
|
|
||||||
int res = esp_vfs_spiffs_register(&conf);
|
|
||||||
MG_INFO(("FS %s, %d", conf.base_path, res));
|
|
||||||
mg_file_printf(&mg_fs_posix, FS_ROOT "/hello.txt", "%s", "hello from ESP");
|
|
||||||
|
|
||||||
// Setup wifi. This function is implemented in wifi.c
|
|
||||||
// It blocks until connected to the configured WiFi network
|
|
||||||
void wifi_init(const char *ssid, const char *pass);
|
|
||||||
wifi_init(WIFI_SSID, WIFI_PASS);
|
|
||||||
|
|
||||||
// Connected to WiFi, now start HTTP server
|
|
||||||
struct mg_mgr mgr;
|
|
||||||
mg_log_set(MG_LL_DEBUG); // Set log level
|
|
||||||
mg_mgr_init(&mgr);
|
|
||||||
MG_INFO(("Mongoose v%s on %s", MG_VERSION, s_listening_url));
|
|
||||||
mg_http_listen(&mgr, s_listening_url, device_dashboard_fn, NULL);
|
|
||||||
for (;;) mg_mgr_poll(&mgr, 1000); // Infinite event loop
|
|
||||||
}
|
|
||||||
@@ -1,104 +0,0 @@
|
|||||||
// Code taken from the ESP32 IDF WiFi station Example
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include "esp_event.h"
|
|
||||||
#include "esp_log.h"
|
|
||||||
#include "esp_system.h"
|
|
||||||
#include "esp_wifi.h"
|
|
||||||
#include "freertos/FreeRTOS.h"
|
|
||||||
#include "freertos/event_groups.h"
|
|
||||||
#include "freertos/task.h"
|
|
||||||
#include "nvs_flash.h"
|
|
||||||
|
|
||||||
#include "lwip/err.h"
|
|
||||||
#include "lwip/sys.h"
|
|
||||||
|
|
||||||
#include "mongoose.h"
|
|
||||||
|
|
||||||
static EventGroupHandle_t s_wifi_event_group;
|
|
||||||
|
|
||||||
/* The event group allows multiple bits for each event, but we only care about
|
|
||||||
* two events:
|
|
||||||
* - we are connected to the AP with an IP
|
|
||||||
* - we failed to connect after the maximum amount of retries */
|
|
||||||
#define WIFI_CONNECTED_BIT BIT0
|
|
||||||
#define WIFI_FAIL_BIT BIT1
|
|
||||||
|
|
||||||
static int s_retry_num = 0;
|
|
||||||
|
|
||||||
static void event_handler(void *arg, esp_event_base_t event_base,
|
|
||||||
int32_t event_id, void *event_data) {
|
|
||||||
if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START) {
|
|
||||||
esp_wifi_connect();
|
|
||||||
} else if (event_base == WIFI_EVENT &&
|
|
||||||
event_id == WIFI_EVENT_STA_DISCONNECTED) {
|
|
||||||
if (s_retry_num < 3) {
|
|
||||||
esp_wifi_connect();
|
|
||||||
s_retry_num++;
|
|
||||||
MG_INFO(("retry to connect to the AP"));
|
|
||||||
} else {
|
|
||||||
xEventGroupSetBits(s_wifi_event_group, WIFI_FAIL_BIT);
|
|
||||||
}
|
|
||||||
MG_ERROR(("connect to the AP fail"));
|
|
||||||
} else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) {
|
|
||||||
ip_event_got_ip_t *event = (ip_event_got_ip_t *) event_data;
|
|
||||||
MG_INFO(("IP ADDRESS:" IPSTR, IP2STR(&event->ip_info.ip)));
|
|
||||||
s_retry_num = 0;
|
|
||||||
xEventGroupSetBits(s_wifi_event_group, WIFI_CONNECTED_BIT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wifi_init(const char *ssid, const char *pass) {
|
|
||||||
esp_err_t ret = nvs_flash_init();
|
|
||||||
if (ret == ESP_ERR_NVS_NO_FREE_PAGES ||
|
|
||||||
ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
|
||||||
ESP_ERROR_CHECK(nvs_flash_erase());
|
|
||||||
ret = nvs_flash_init();
|
|
||||||
}
|
|
||||||
ESP_ERROR_CHECK(ret);
|
|
||||||
|
|
||||||
s_wifi_event_group = xEventGroupCreate();
|
|
||||||
|
|
||||||
ESP_ERROR_CHECK(esp_netif_init());
|
|
||||||
|
|
||||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
|
||||||
esp_netif_create_default_wifi_sta();
|
|
||||||
|
|
||||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
|
||||||
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
|
|
||||||
|
|
||||||
esp_event_handler_instance_t instance_any_id;
|
|
||||||
esp_event_handler_instance_t instance_got_ip;
|
|
||||||
ESP_ERROR_CHECK(esp_event_handler_instance_register(
|
|
||||||
WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL, &instance_any_id));
|
|
||||||
ESP_ERROR_CHECK(esp_event_handler_instance_register(
|
|
||||||
IP_EVENT, IP_EVENT_STA_GOT_IP, &event_handler, NULL, &instance_got_ip));
|
|
||||||
|
|
||||||
wifi_config_t c = {.sta = {.threshold = {.authmode = WIFI_AUTH_WPA2_PSK},
|
|
||||||
.pmf_cfg = {.capable = true, .required = false}}};
|
|
||||||
snprintf((char *) c.sta.ssid, sizeof(c.sta.ssid), "%s", ssid);
|
|
||||||
snprintf((char *) c.sta.password, sizeof(c.sta.password), "%s", pass);
|
|
||||||
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
|
|
||||||
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &c));
|
|
||||||
ESP_ERROR_CHECK(esp_wifi_start());
|
|
||||||
MG_DEBUG(("wifi_init_sta finished."));
|
|
||||||
|
|
||||||
EventBits_t bits = xEventGroupWaitBits(s_wifi_event_group,
|
|
||||||
WIFI_CONNECTED_BIT | WIFI_FAIL_BIT,
|
|
||||||
pdFALSE, pdFALSE, portMAX_DELAY);
|
|
||||||
|
|
||||||
if (bits & WIFI_CONNECTED_BIT) {
|
|
||||||
MG_INFO(("connected to ap SSID:%s password:%s", ssid, pass));
|
|
||||||
} else if (bits & WIFI_FAIL_BIT) {
|
|
||||||
MG_ERROR(("Failed to connect to SSID:%s, password:%s", ssid, pass));
|
|
||||||
} else {
|
|
||||||
MG_ERROR(("UNEXPECTED EVENT"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The event will not be processed after unregister */
|
|
||||||
ESP_ERROR_CHECK(esp_event_handler_instance_unregister(
|
|
||||||
IP_EVENT, IP_EVENT_STA_GOT_IP, instance_got_ip));
|
|
||||||
ESP_ERROR_CHECK(esp_event_handler_instance_unregister(
|
|
||||||
WIFI_EVENT, ESP_EVENT_ANY_ID, instance_any_id));
|
|
||||||
vEventGroupDelete(s_wifi_event_group);
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
CWD = $(realpath $(CURDIR))
|
|
||||||
MNT = $(realpath $(CURDIR)/../../..)
|
|
||||||
PORT ?= /dev/ttyUSB0
|
|
||||||
CMD ?= build
|
|
||||||
|
|
||||||
all: example
|
|
||||||
|
|
||||||
example:
|
|
||||||
true
|
|
||||||
|
|
||||||
build: Makefile $(wildcard main/*)
|
|
||||||
docker run --rm $(DA) -v $(MNT):$(MNT) -w $(CWD) espressif/idf idf.py $(CMD)
|
|
||||||
|
|
||||||
flash:
|
|
||||||
flash: CMD = flash
|
|
||||||
flash: DA = --device $(PORT)
|
|
||||||
flash: build
|
|
||||||
|
|
||||||
.PHONY: build
|
|
||||||
|
|
||||||
bridge.hex: build
|
|
||||||
esputil mkhex \
|
|
||||||
0x8000 build/partition_table/partition-table.bin \
|
|
||||||
0x1000 build/bootloader/bootloader.bin \
|
|
||||||
0x100000 build/mongoose-esp32-example.bin > $@
|
|
||||||
|
|
||||||
flash2: bridge.hex
|
|
||||||
esputil -p $(PORT) -b 921600 -fp 0x220 flash bridge.hex
|
|
||||||
esputil -p $(PORT) monitor
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf build
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
idf_component_register(SRCS "main.c"
|
|
||||||
"wifi.c"
|
|
||||||
"uart.c"
|
|
||||||
"cli.c"
|
|
||||||
"net.c"
|
|
||||||
"packed_fs.c"
|
|
||||||
"mongoose.c")
|
|
||||||
component_compile_options(-DMG_ENABLE_LINES=1)
|
|
||||||
component_compile_options(-DMG_ENABLE_PACKED_FS=1)
|
|
||||||
component_compile_options(-DUART_API_IMPLEMENTED=1)
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
// Copyright (c) 2020 Cesanta Software Limited
|
|
||||||
// All rights reserved
|
|
||||||
|
|
||||||
#include "main.h"
|
|
||||||
|
|
||||||
const char *s_listening_url = "http://0.0.0.0:80";
|
|
||||||
|
|
||||||
char *config_read(void) {
|
|
||||||
return mg_file_read(&mg_fs_posix, FS_ROOT "/config.json", NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void config_write(struct mg_str config) {
|
|
||||||
mg_file_write(&mg_fs_posix, FS_ROOT "/config.json", config.ptr, config.len);
|
|
||||||
}
|
|
||||||
|
|
||||||
void app_main(void) {
|
|
||||||
// Mount filesystem
|
|
||||||
esp_vfs_spiffs_conf_t conf = {
|
|
||||||
.base_path = FS_ROOT, .max_files = 20, .format_if_mount_failed = true};
|
|
||||||
int res = esp_vfs_spiffs_register(&conf);
|
|
||||||
MG_INFO(("FS at %s initialised, status: %d", conf.base_path, res));
|
|
||||||
|
|
||||||
// Try to connect to wifi by using saved WiFi credentials
|
|
||||||
char *json = mg_file_read(&mg_fs_posix, WIFI_FILE, NULL);
|
|
||||||
if (json != NULL) {
|
|
||||||
char *ssid = mg_json_get_str(mg_str(json), "$.ssid");
|
|
||||||
char *pass = mg_json_get_str(mg_str(json), "$.pass");
|
|
||||||
while (!wifi_init(ssid, pass)) (void) 0;
|
|
||||||
free(ssid);
|
|
||||||
free(pass);
|
|
||||||
free(json);
|
|
||||||
} else {
|
|
||||||
// If WiFi is not configured, run CLI until configured
|
|
||||||
MG_INFO(("WiFi is not configured, running CLI. Press enter"));
|
|
||||||
cli_init();
|
|
||||||
for (;;) {
|
|
||||||
uint8_t ch = getchar();
|
|
||||||
cli(ch);
|
|
||||||
usleep(10000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Connected to WiFi, now start HTTP server
|
|
||||||
struct mg_mgr mgr;
|
|
||||||
mg_mgr_init(&mgr);
|
|
||||||
mg_log_set(MG_LL_DEBUG); // Set log level
|
|
||||||
MG_INFO(("Mongoose v%s on %s", MG_VERSION, s_listening_url));
|
|
||||||
mg_http_listen(&mgr, s_listening_url, uart_bridge_fn, &mgr);
|
|
||||||
for (;;) mg_mgr_poll(&mgr, 10); // Infinite event loop
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "mongoose.h"
|
|
||||||
|
|
||||||
#include "driver/gpio.h"
|
|
||||||
#include "driver/uart.h"
|
|
||||||
#include "esp_spiffs.h"
|
|
||||||
#include "freertos/FreeRTOS.h"
|
|
||||||
|
|
||||||
#define FS_ROOT "/spiffs"
|
|
||||||
#define WIFI_FILE FS_ROOT "/wifi.json"
|
|
||||||
#define UART_NO 1
|
|
||||||
|
|
||||||
void uart_bridge_fn(struct mg_connection *, int, void *, void *);
|
|
||||||
int uart_read(void *buf, size_t len);
|
|
||||||
bool wifi_init(const char *ssid, const char *pass);
|
|
||||||
void cli(uint8_t ch);
|
|
||||||
void cli_init(void);
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../../uart-bridge/net.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../../uart-bridge/packed_fs.c
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
// Code taken from the ESP32 IDF WiFi station Example
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include "esp_event.h"
|
|
||||||
#include "esp_log.h"
|
|
||||||
#include "esp_system.h"
|
|
||||||
#include "esp_wifi.h"
|
|
||||||
#include "freertos/FreeRTOS.h"
|
|
||||||
#include "freertos/event_groups.h"
|
|
||||||
#include "freertos/task.h"
|
|
||||||
#include "nvs_flash.h"
|
|
||||||
|
|
||||||
#include "lwip/err.h"
|
|
||||||
#include "lwip/sys.h"
|
|
||||||
|
|
||||||
#include "mongoose.h"
|
|
||||||
|
|
||||||
static EventGroupHandle_t s_wifi_event_group;
|
|
||||||
|
|
||||||
/* The event group allows multiple bits for each event, but we only care about
|
|
||||||
* two events:
|
|
||||||
* - we are connected to the AP with an IP
|
|
||||||
* - we failed to connect after the maximum amount of retries */
|
|
||||||
#define WIFI_CONNECTED_BIT BIT0
|
|
||||||
#define WIFI_FAIL_BIT BIT1
|
|
||||||
|
|
||||||
static int s_retry_num = 0;
|
|
||||||
|
|
||||||
static void event_handler(void *arg, esp_event_base_t event_base,
|
|
||||||
int32_t event_id, void *event_data) {
|
|
||||||
if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START) {
|
|
||||||
esp_wifi_connect();
|
|
||||||
} else if (event_base == WIFI_EVENT &&
|
|
||||||
event_id == WIFI_EVENT_STA_DISCONNECTED) {
|
|
||||||
if (s_retry_num < 3) {
|
|
||||||
esp_wifi_connect();
|
|
||||||
s_retry_num++;
|
|
||||||
MG_INFO(("retry to connect to the AP"));
|
|
||||||
} else {
|
|
||||||
xEventGroupSetBits(s_wifi_event_group, WIFI_FAIL_BIT);
|
|
||||||
}
|
|
||||||
MG_ERROR(("connect to the AP fail"));
|
|
||||||
} else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) {
|
|
||||||
ip_event_got_ip_t *event = (ip_event_got_ip_t *) event_data;
|
|
||||||
MG_INFO(("IP ADDRESS: " IPSTR ". Go to:", IP2STR(&event->ip_info.ip)));
|
|
||||||
MG_INFO(("http://" IPSTR, IP2STR(&event->ip_info.ip)));
|
|
||||||
s_retry_num = 0;
|
|
||||||
xEventGroupSetBits(s_wifi_event_group, WIFI_CONNECTED_BIT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wifi_init(const char *ssid, const char *pass) {
|
|
||||||
bool result = false;
|
|
||||||
esp_err_t ret = nvs_flash_init();
|
|
||||||
if (ret == ESP_ERR_NVS_NO_FREE_PAGES ||
|
|
||||||
ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
|
||||||
ESP_ERROR_CHECK(nvs_flash_erase());
|
|
||||||
ret = nvs_flash_init();
|
|
||||||
}
|
|
||||||
ESP_ERROR_CHECK(ret);
|
|
||||||
|
|
||||||
s_wifi_event_group = xEventGroupCreate();
|
|
||||||
|
|
||||||
ESP_ERROR_CHECK(esp_netif_init());
|
|
||||||
|
|
||||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
|
||||||
esp_netif_create_default_wifi_sta();
|
|
||||||
|
|
||||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
|
||||||
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
|
|
||||||
|
|
||||||
esp_event_handler_instance_t instance_any_id;
|
|
||||||
esp_event_handler_instance_t instance_got_ip;
|
|
||||||
ESP_ERROR_CHECK(esp_event_handler_instance_register(
|
|
||||||
WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL, &instance_any_id));
|
|
||||||
ESP_ERROR_CHECK(esp_event_handler_instance_register(
|
|
||||||
IP_EVENT, IP_EVENT_STA_GOT_IP, &event_handler, NULL, &instance_got_ip));
|
|
||||||
|
|
||||||
wifi_config_t c = {.sta = {.threshold = {.authmode = WIFI_AUTH_WPA2_PSK},
|
|
||||||
.pmf_cfg = {.capable = true, .required = false}}};
|
|
||||||
snprintf((char *) c.sta.ssid, sizeof(c.sta.ssid), "%s", ssid);
|
|
||||||
snprintf((char *) c.sta.password, sizeof(c.sta.password), "%s", pass);
|
|
||||||
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
|
|
||||||
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &c));
|
|
||||||
ESP_ERROR_CHECK(esp_wifi_start());
|
|
||||||
MG_DEBUG(("wifi_init_sta finished."));
|
|
||||||
|
|
||||||
EventBits_t bits = xEventGroupWaitBits(s_wifi_event_group,
|
|
||||||
WIFI_CONNECTED_BIT | WIFI_FAIL_BIT,
|
|
||||||
pdFALSE, pdFALSE, portMAX_DELAY);
|
|
||||||
|
|
||||||
if (bits & WIFI_CONNECTED_BIT) {
|
|
||||||
MG_INFO(("connected to ap SSID:%s", ssid));
|
|
||||||
result = true;
|
|
||||||
} else if (bits & WIFI_FAIL_BIT) {
|
|
||||||
MG_ERROR(("Failed to connect to SSID:%s, password:%s", ssid, pass));
|
|
||||||
} else {
|
|
||||||
MG_ERROR(("UNEXPECTED EVENT"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The event will not be processed after unregister */
|
|
||||||
ESP_ERROR_CHECK(esp_event_handler_instance_unregister(
|
|
||||||
IP_EVENT, IP_EVENT_STA_GOT_IP, instance_got_ip));
|
|
||||||
ESP_ERROR_CHECK(esp_event_handler_instance_unregister(
|
|
||||||
WIFI_EVENT, ESP_EVENT_ANY_ID, instance_any_id));
|
|
||||||
vEventGroupDelete(s_wifi_event_group);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
# Name, Type, SubType, Offset, Size, Flags
|
|
||||||
nvs, data, nvs, 0x9000, 0x6000,
|
|
||||||
phy_init, data, phy, 0xf000, 0x1000,
|
|
||||||
storage, data, spiffs, 0x10000, 0x10000,
|
|
||||||
factory, app, factory, 0x100000, 1M,
|
|
||||||
|
@@ -1,45 +0,0 @@
|
|||||||
THISDIR = $(realpath $(CURDIR))
|
|
||||||
ROOTDIR = $(realpath $(CURDIR)/../../..)
|
|
||||||
DOCKER ?= docker run --rm $(DA) -v $(ROOTDIR):$(ROOTDIR) -w $(THISDIR) docker.io/mdashnet/8266
|
|
||||||
CMD ?= make -C src defconfig app
|
|
||||||
PORT ?= /dev/ttyUSB0
|
|
||||||
|
|
||||||
all: example
|
|
||||||
|
|
||||||
example:
|
|
||||||
true
|
|
||||||
|
|
||||||
build: Makefile $(wildcard src/main/*)
|
|
||||||
$(DOCKER) $(CMD)
|
|
||||||
|
|
||||||
flash:
|
|
||||||
flash: CMD = python /esp/components/esptool_py/esptool/esptool.py \
|
|
||||||
--chip esp8266 --port $(PORT) --baud 115200 --before default_reset \
|
|
||||||
--after hard_reset write_flash -z --flash_mode dio --flash_freq 40m \
|
|
||||||
--flash_size 2MB 0x10000 $(THISDIR)/src/build/mongoose-example.bin
|
|
||||||
flash: DA = --device $(PORT)
|
|
||||||
flash: build
|
|
||||||
|
|
||||||
buildall:
|
|
||||||
buildall: CMD = make -C src all
|
|
||||||
buildall: build
|
|
||||||
|
|
||||||
flashall:
|
|
||||||
flashall: CMD = python /esp/components/esptool_py/esptool/esptool.py \
|
|
||||||
--chip esp8266 --port $(PORT) --baud 115200 --before default_reset \
|
|
||||||
--after hard_reset write_flash -z --flash_mode dio --flash_freq 40m \
|
|
||||||
--flash_size 2MB 0x0 $(THISDIR)/src/build/bootloader/bootloader.bin \
|
|
||||||
0x10000 $(THISDIR)/src/build/mongoose-example.bin \
|
|
||||||
0x8000 $(THISDIR)/src/build/partitions_singleapp.bin
|
|
||||||
flashall: DA = --device $(PORT)
|
|
||||||
flashall: build
|
|
||||||
|
|
||||||
monitor:
|
|
||||||
monitor: CMD = /esp/tools/idf_monitor.py --port $(PORT) $(THISDIR)/src/build/mongoose-example.elf
|
|
||||||
monitor: build
|
|
||||||
|
|
||||||
.PHONY: build
|
|
||||||
|
|
||||||
clean:
|
|
||||||
test -d src/build && $(DOCKER) rm -rf src/build || true
|
|
||||||
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
// Copyright (c) 2020 Cesanta Software Limited
|
|
||||||
// All rights reserved
|
|
||||||
|
|
||||||
#include "mongoose.h"
|
|
||||||
|
|
||||||
#define WIFI_SSID "WIFI_NETWORK" // SET THIS!
|
|
||||||
#define WIFI_PASS "WIFI_PASSWORD" // SET THIS!
|
|
||||||
|
|
||||||
#define SERVER_URL "http://0.0.0.0:80"
|
|
||||||
#define CLIENT_URL "http://info.cern.ch"
|
|
||||||
|
|
||||||
// Event handler for an server (accepted) connection
|
|
||||||
static void cb(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
|
||||||
if (ev == MG_EV_HTTP_MSG) {
|
|
||||||
mg_http_reply(c, 200, "", "Hello from ESP!\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Event handler for a client connection - fetch the first web page in history
|
|
||||||
// To enable TLS for HTTP,
|
|
||||||
// 1. Copy "ca.pem" file to the ESP8266 flash FS
|
|
||||||
// 2. Add TLS init snippet for the connection, see examples/http-client
|
|
||||||
static void cb2(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
|
||||||
if (ev == MG_EV_CONNECT) {
|
|
||||||
struct mg_str s = mg_url_host(CLIENT_URL);
|
|
||||||
mg_printf(c, "GET / HTTP/1.0\r\nHost: %.*s\r\n\r\n", (int) s.len, s.ptr);
|
|
||||||
} else if (ev == MG_EV_HTTP_MSG) {
|
|
||||||
struct mg_http_message *hm = ev_data; // Print HTTP response
|
|
||||||
MG_INFO(("Fetched:\n%.*s", (int) hm->message.len, hm->message.ptr));
|
|
||||||
c->is_closing = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called after we're connected to WiFi network
|
|
||||||
static void run_mongoose(void) {
|
|
||||||
struct mg_mgr mgr;
|
|
||||||
mg_log_set(MG_LL_DEBUG); // Set log level
|
|
||||||
mg_mgr_init(&mgr);
|
|
||||||
mg_http_listen(&mgr, SERVER_URL, cb, &mgr); // Listening server
|
|
||||||
mg_http_connect(&mgr, CLIENT_URL, cb2, &mgr); // Example client
|
|
||||||
MG_INFO(("Starting Mongoose web server v%s", MG_VERSION));
|
|
||||||
for (;;) mg_mgr_poll(&mgr, 1000);
|
|
||||||
mg_mgr_free(&mgr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void app_main(void) {
|
|
||||||
// Setup wifi. This function is implemented in wifi.c
|
|
||||||
// It blocks until connected to the configured WiFi network
|
|
||||||
void wifi_init(const char *ssid, const char *pass);
|
|
||||||
wifi_init(WIFI_SSID, WIFI_PASS);
|
|
||||||
|
|
||||||
// Done connecting to WiFi, now start HTTP server
|
|
||||||
run_mongoose();
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
See detailed tutorial at https://mongoose.ws/tutorials/file-uploads/
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
// Copyright (c) 2021 Cesanta Software Limited
|
|
||||||
// All rights reserved
|
|
||||||
|
|
||||||
#include "mongoose.h"
|
|
||||||
|
|
||||||
// HTTP request handler function. It implements the following endpoints:
|
|
||||||
// /upload - prints all submitted form elements
|
|
||||||
// all other URI - serves web_root/ directory
|
|
||||||
//
|
|
||||||
// ///////////////// IMPORTANT //////////////////////////
|
|
||||||
//
|
|
||||||
// Mongoose has a limit on input buffer, which also limits maximum upload size.
|
|
||||||
// It is controlled by the MG_MAX_RECV_SIZE constant, which is set by
|
|
||||||
// default to (3 * 1024 * 1024), i.e. 3 megabytes.
|
|
||||||
// Use -DMG_MAX_BUF_SIZE=NEW_LIMIT to override it.
|
|
||||||
//
|
|
||||||
// Also, consider changing -DMG_IO_SIZE=SOME_BIG_VALUE to increase IO buffer
|
|
||||||
// increment when reading data.
|
|
||||||
static void cb(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
|
||||||
if (ev == MG_EV_HTTP_MSG) {
|
|
||||||
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
|
||||||
MG_INFO(("New request to: [%.*s], body size: %lu", (int) hm->uri.len,
|
|
||||||
hm->uri.ptr, (unsigned long) hm->body.len));
|
|
||||||
if (mg_http_match_uri(hm, "/upload")) {
|
|
||||||
struct mg_http_part part;
|
|
||||||
size_t ofs = 0;
|
|
||||||
while ((ofs = mg_http_next_multipart(hm->body, ofs, &part)) > 0) {
|
|
||||||
MG_INFO(("Chunk name: [%.*s] filename: [%.*s] length: %lu bytes",
|
|
||||||
(int) part.name.len, part.name.ptr, (int) part.filename.len,
|
|
||||||
part.filename.ptr, (unsigned long) part.body.len));
|
|
||||||
}
|
|
||||||
mg_http_reply(c, 200, "", "Thank you!");
|
|
||||||
} else {
|
|
||||||
struct mg_http_serve_opts opts = {.root_dir = "web_root"};
|
|
||||||
mg_http_serve_dir(c, ev_data, &opts);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
(void) fn_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void) {
|
|
||||||
struct mg_mgr mgr;
|
|
||||||
|
|
||||||
mg_mgr_init(&mgr);
|
|
||||||
mg_log_set(MG_LL_DEBUG); // Set log level
|
|
||||||
mg_http_listen(&mgr, "http://localhost:8000", cb, NULL);
|
|
||||||
|
|
||||||
for (;;) mg_mgr_poll(&mgr, 50);
|
|
||||||
mg_mgr_free(&mgr);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
See detailed tutorial at https://mongoose.ws/tutorials/file-uploads/
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
// Copyright (c) 2020 Cesanta Software Limited
|
|
||||||
// All rights reserved
|
|
||||||
|
|
||||||
#include "mongoose.h"
|
|
||||||
|
|
||||||
// HTTP request handler function. It implements the following endpoints:
|
|
||||||
// /upload - Saves the next file chunk
|
|
||||||
// all other URI - serves web_root/ directory
|
|
||||||
static void cb(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
|
||||||
if (ev == MG_EV_HTTP_MSG) {
|
|
||||||
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
|
||||||
if (mg_http_match_uri(hm, "/upload")) {
|
|
||||||
char path[80], name[64];
|
|
||||||
mg_http_get_var(&hm->query, "name", name, sizeof(name));
|
|
||||||
if (name[0] == '\0') {
|
|
||||||
mg_http_reply(c, 400, "", "%s", "name required");
|
|
||||||
} else {
|
|
||||||
mg_snprintf(path, sizeof(path), "/tmp/%s", name);
|
|
||||||
mg_http_upload(c, hm, &mg_fs_posix, mg_remove_double_dots(path), 99999);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
struct mg_http_serve_opts opts = {.root_dir = "web_root"};
|
|
||||||
mg_http_serve_dir(c, ev_data, &opts);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
(void) fn_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void) {
|
|
||||||
struct mg_mgr mgr;
|
|
||||||
|
|
||||||
mg_mgr_init(&mgr);
|
|
||||||
mg_log_set(MG_LL_DEBUG); // Set log level
|
|
||||||
mg_http_listen(&mgr, "http://localhost:8000", cb, NULL);
|
|
||||||
|
|
||||||
for (;;) mg_mgr_poll(&mgr, 50);
|
|
||||||
mg_mgr_free(&mgr);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
See detailed tutorial at https://mongoose.ws/tutorials/file-uploads/
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
// Copyright (c) 2020 Cesanta Software Limited
|
|
||||||
// All rights reserved
|
|
||||||
//
|
|
||||||
// Streaming upload example. Demonstrates how to use MG_EV_HTTP_CHUNK events
|
|
||||||
// to send large payload in smaller chunks. To test, use curl utility:
|
|
||||||
//
|
|
||||||
// curl http://localhost:8000/upload?name=a.txt --data-binary @large_file.txt
|
|
||||||
|
|
||||||
#include "mongoose.h"
|
|
||||||
|
|
||||||
// HTTP request handler function. It implements the following endpoints:
|
|
||||||
// /upload - Saves the next file chunk
|
|
||||||
// all other URI - serves web_root/ directory
|
|
||||||
static void cb(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
|
||||||
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
|
||||||
if (ev == MG_EV_HTTP_CHUNK && mg_http_match_uri(hm, "/upload")) {
|
|
||||||
MG_INFO(("Got chunk len %lu", (unsigned long) hm->chunk.len));
|
|
||||||
MG_INFO(("Query string: [%.*s]", (int) hm->query.len, hm->query.ptr));
|
|
||||||
// MG_INFO(("Chunk data:\n%.*s", (int) hm->chunk.len, hm->chunk.ptr));
|
|
||||||
mg_http_delete_chunk(c, hm);
|
|
||||||
if (hm->chunk.len == 0) {
|
|
||||||
MG_INFO(("Last chunk received, sending response"));
|
|
||||||
mg_http_reply(c, 200, "", "ok (chunked)\n");
|
|
||||||
}
|
|
||||||
} else if (ev == MG_EV_HTTP_MSG) {
|
|
||||||
struct mg_http_serve_opts opts = {.root_dir = "web_root"};
|
|
||||||
mg_http_serve_dir(c, hm, &opts);
|
|
||||||
}
|
|
||||||
(void) fn_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void) {
|
|
||||||
struct mg_mgr mgr;
|
|
||||||
|
|
||||||
mg_mgr_init(&mgr);
|
|
||||||
mg_log_set(MG_LL_DEBUG); // Set debug log level
|
|
||||||
mg_http_listen(&mgr, "http://localhost:8000", cb, NULL);
|
|
||||||
|
|
||||||
for (;;) mg_mgr_poll(&mgr, 50);
|
|
||||||
mg_mgr_free(&mgr);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<title>example</title>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<style>
|
|
||||||
#container { margin-right: auto; margin-left: auto; max-width: 480px; }
|
|
||||||
#info { background: #e0f0f0; border-radius: .5em; padding: 2em; }
|
|
||||||
#wrapper { margin-top: 1em; }
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="container">
|
|
||||||
<div id="info">
|
|
||||||
Mongoose always buffers a full HTTP message before invoking
|
|
||||||
MG_EV_HTTP_MSG event. Big POST request require of lot
|
|
||||||
of RAM to buffer everything.
|
|
||||||
<br><br>
|
|
||||||
In order to upload large files to a memory-constrained system, use
|
|
||||||
<code>MG_EV_HTTP_CHUNK</code> on a server side. It fires when
|
|
||||||
a partial HTTP message has been received (or a chunk-encoded chunk).
|
|
||||||
Use <code>mg_http_delete_chunk()</code> to release chunk memory.
|
|
||||||
When 0-sized chunk is received, that's the end of the message.
|
|
||||||
Use <code>MG_MAX_RECV_SIZE</code> build constant to limit
|
|
||||||
maximum chunk size on a server side.
|
|
||||||
<br><br>
|
|
||||||
In this example, JavaScript code uses "fetch()" browser API.
|
|
||||||
Uploaded file is not saved, but rather printed by server side.
|
|
||||||
</div>
|
|
||||||
<div id="wrapper">
|
|
||||||
<input type="file" id="el1" style="display: none"/>
|
|
||||||
<button id="el2">choose file...</button>
|
|
||||||
<span>Selected file:</span> <span id="el4"></span> <br/>
|
|
||||||
<button id="el5" style="margin: 0.5em 0;" disabled>upload file</button>
|
|
||||||
<div id="el3" style="margin-top: 1em;"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
<script>
|
|
||||||
var f; // selected file
|
|
||||||
|
|
||||||
// When user clicks on a button, trigger file selection dialog
|
|
||||||
document.getElementById('el2').onclick = function(ev) {
|
|
||||||
document.getElementById('el1').click();
|
|
||||||
};
|
|
||||||
|
|
||||||
document.getElementById('el5').onclick = function(ev) {
|
|
||||||
var r = new FileReader();
|
|
||||||
r.readAsArrayBuffer(f);
|
|
||||||
r.onload = function() {
|
|
||||||
ev.target.value = '';
|
|
||||||
document.getElementById('el3').innerText = 'Uploading...';
|
|
||||||
fetch('/upload?name=' + encodeURIComponent(f.name), {
|
|
||||||
method: 'POST',
|
|
||||||
body: r.result,
|
|
||||||
}).then(function(res) {
|
|
||||||
document.getElementById('el3').innerText = 'Uploaded ' + r.result.byteLength + ' bytes';
|
|
||||||
});
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// If user selected a file, read it into memory and trigger sendFileData()
|
|
||||||
document.getElementById('el1').onchange = function(ev) {
|
|
||||||
f = ev.target.files[0];
|
|
||||||
if (!f) return;
|
|
||||||
document.getElementById('el4').innerText = f.name;
|
|
||||||
document.getElementById('el5').removeAttribute('disabled');
|
|
||||||
};
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</html>
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
PROG ?= example # Program we are building
|
|
||||||
DELETE = rm -rf # Command to remove files
|
|
||||||
OUT ?= -o $(PROG) # Compiler argument for output file
|
|
||||||
SOURCES = main.c mongoose.c # Source code files
|
|
||||||
CFLAGS = -W -Wall -Wextra -g -I. # Build options
|
|
||||||
|
|
||||||
# Mongoose build options. See https://mongoose.ws/documentation/#build-options
|
|
||||||
CFLAGS_MONGOOSE += -DMG_ENABLE_LINES=1
|
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT) # Windows settings. Assume MinGW compiler. To use VC: make CC=cl CFLAGS=/MD OUT=/Feprog.exe
|
|
||||||
PROG ?= example.exe # Use .exe suffix for the binary
|
|
||||||
CC = gcc # Use MinGW gcc compiler
|
|
||||||
CFLAGS += -lws2_32 # Link against Winsock library
|
|
||||||
DELETE = cmd /C del /Q /F /S # Command prompt command to delete files
|
|
||||||
OUT ?= -o $(PROG) # Build output
|
|
||||||
MAKE += WINDOWS=1 CC=$(CC)
|
|
||||||
endif
|
|
||||||
|
|
||||||
all: $(PROG) # Default target. Build and run program
|
|
||||||
$(RUN) ./$(PROG) $(ARGS)
|
|
||||||
|
|
||||||
$(PROG): $(SOURCES) # Build program from sources
|
|
||||||
$(CC) $(SOURCES) $(CFLAGS) $(CFLAGS_MONGOOSE) $(CFLAGS_EXTRA) $(OUT)
|
|
||||||
|
|
||||||
clean: # Cleanup. Delete built program and all build artifacts
|
|
||||||
$(DELETE) $(PROG) *.o *.obj *.exe *.dSYM mbedtls
|
|
||||||
|
|
||||||
# see https://mongoose.ws/tutorials/tls/#how-to-build for TLS build options
|
|
||||||
|
|
||||||
mbedtls: # Pull and build mbedTLS library
|
|
||||||
git clone --depth 1 -b v2.28.2 https://github.com/mbed-tls/mbedtls $@
|
|
||||||
$(MAKE) -C mbedtls/library
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
See detailed tutorial at https://mongoose.ws/tutorials/http-client/
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../test/data/ca.pem
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
// Copyright (c) 2021 Cesanta Software Limited
|
|
||||||
// All rights reserved
|
|
||||||
//
|
|
||||||
// Example HTTP client. Connect to `s_url`, send request, wait for a response,
|
|
||||||
// print the response and exit.
|
|
||||||
// You can change `s_url` from the command line by executing: ./example YOUR_URL
|
|
||||||
//
|
|
||||||
// To enable SSL/TLS, , see https://mongoose.ws/tutorials/tls/#how-to-build
|
|
||||||
|
|
||||||
#include "mongoose.h"
|
|
||||||
|
|
||||||
// The very first web page in history. You can replace it from command line
|
|
||||||
static const char *s_url = "http://info.cern.ch/";
|
|
||||||
static const char *s_post_data = NULL; // POST data
|
|
||||||
static const uint64_t s_timeout_ms = 1500; // Connect timeout in milliseconds
|
|
||||||
|
|
||||||
// Print HTTP response and signal that we're done
|
|
||||||
static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
|
||||||
if (ev == MG_EV_OPEN) {
|
|
||||||
// Connection created. Store connect expiration time in c->data
|
|
||||||
*(uint64_t *) c->data = mg_millis() + s_timeout_ms;
|
|
||||||
} else if (ev == MG_EV_POLL) {
|
|
||||||
if (mg_millis() > *(uint64_t *) c->data &&
|
|
||||||
(c->is_connecting || c->is_resolving)) {
|
|
||||||
mg_error(c, "Connect timeout");
|
|
||||||
}
|
|
||||||
} else if (ev == MG_EV_CONNECT) {
|
|
||||||
// Connected to server. Extract host name from URL
|
|
||||||
struct mg_str host = mg_url_host(s_url);
|
|
||||||
|
|
||||||
// If s_url is https://, tell client connection to use TLS
|
|
||||||
if (mg_url_is_ssl(s_url)) {
|
|
||||||
struct mg_tls_opts opts = {.ca = "ca.pem", .srvname = host};
|
|
||||||
mg_tls_init(c, &opts);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send request
|
|
||||||
int content_length = s_post_data ? strlen(s_post_data) : 0;
|
|
||||||
mg_printf(c,
|
|
||||||
"%s %s HTTP/1.0\r\n"
|
|
||||||
"Host: %.*s\r\n"
|
|
||||||
"Content-Type: octet-stream\r\n"
|
|
||||||
"Content-Length: %d\r\n"
|
|
||||||
"\r\n",
|
|
||||||
s_post_data ? "POST" : "GET", mg_url_uri(s_url), (int) host.len,
|
|
||||||
host.ptr, content_length);
|
|
||||||
mg_send(c, s_post_data, content_length);
|
|
||||||
} else if (ev == MG_EV_HTTP_MSG) {
|
|
||||||
// Response is received. Print it
|
|
||||||
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
|
||||||
printf("%.*s", (int) hm->message.len, hm->message.ptr);
|
|
||||||
c->is_closing = 1; // Tell mongoose to close this connection
|
|
||||||
*(bool *) fn_data = true; // Tell event loop to stop
|
|
||||||
} else if (ev == MG_EV_ERROR) {
|
|
||||||
*(bool *) fn_data = true; // Error, tell event loop to stop
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
|
||||||
const char *log_level = getenv("LOG_LEVEL"); // Allow user to set log level
|
|
||||||
if (log_level == NULL) log_level = "4"; // Default is verbose
|
|
||||||
|
|
||||||
struct mg_mgr mgr; // Event manager
|
|
||||||
bool done = false; // Event handler flips it to true
|
|
||||||
if (argc > 1) s_url = argv[1]; // Use URL provided in the command line
|
|
||||||
mg_log_set(atoi(log_level)); // Set to 0 to disable debug
|
|
||||||
mg_mgr_init(&mgr); // Initialise event manager
|
|
||||||
mg_http_connect(&mgr, s_url, fn, &done); // Create client connection
|
|
||||||
while (!done) mg_mgr_poll(&mgr, 50); // Event manager loops until 'done'
|
|
||||||
mg_mgr_free(&mgr); // Free resources
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
PROG ?= example # Program we are building
|
|
||||||
DELETE = rm -rf # Command to remove files
|
|
||||||
OUT ?= -o $(PROG) # Compiler argument for output file
|
|
||||||
SOURCES = main.c mongoose.c # Source code files
|
|
||||||
CFLAGS = -W -Wall -Wextra -g -I. # Build options
|
|
||||||
|
|
||||||
# Mongoose build options. See https://mongoose.ws/documentation/#build-options
|
|
||||||
#CFLAGS_MONGOOSE += -DMG_ENABLE_LINES=1
|
|
||||||
|
|
||||||
// see tutorial at https://mongoose.ws/tutorials/http-proxy-client/
|
|
||||||
ARGS ?= 167.235.63.238:3128 http://info.cern.ch/ # default call arguments
|
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT) # Windows settings. Assume MinGW compiler. To use VC: make CC=cl CFLAGS=/MD OUT=/Feprog.exe
|
|
||||||
PROG ?= example.exe # Use .exe suffix for the binary
|
|
||||||
CC = gcc # Use MinGW gcc compiler
|
|
||||||
CFLAGS += -lws2_32 # Link against Winsock library
|
|
||||||
DELETE = cmd /C del /Q /F /S # Command prompt command to delete files
|
|
||||||
OUT ?= -o $(PROG) # Build output
|
|
||||||
MAKE += WINDOWS=1 CC=$(CC)
|
|
||||||
endif
|
|
||||||
|
|
||||||
all: $(PROG) # Default target. Build and run program
|
|
||||||
$(RUN) ./$(PROG) $(ARGS)
|
|
||||||
|
|
||||||
$(PROG): $(SOURCES) # Build program from sources
|
|
||||||
$(CC) $(SOURCES) $(CFLAGS) $(CFLAGS_MONGOOSE) $(CFLAGS_EXTRA) $(OUT)
|
|
||||||
|
|
||||||
clean: # Cleanup. Delete built program and all build artifacts
|
|
||||||
$(DELETE) $(PROG) *.o *.obj *.exe *.dSYM mbedtls
|
|
||||||
|
|
||||||
# see https://mongoose.ws/tutorials/tls/#how-to-build for TLS build options
|
|
||||||
|
|
||||||
mbedtls: # Pull and build mbedTLS library
|
|
||||||
git clone --depth 1 -b v2.28.2 https://github.com/mbed-tls/mbedtls $@
|
|
||||||
$(MAKE) -C mbedtls/library
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
See detailed tutorial at https://mongoose.ws/tutorials/http-proxy-client/
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../test/data/ca.pem
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
// Copyright (c) 2020 Cesanta Software Limited
|
|
||||||
// All rights reserved
|
|
||||||
//
|
|
||||||
// Example HTTP client that uses a proxy server. Usage:
|
|
||||||
// make
|
|
||||||
// ./example PROXY:PORT http://www.ladyada.net
|
|
||||||
//
|
|
||||||
// To enable SSL/TLS, see https://mongoose.ws/tutorials/tls/#how-to-build
|
|
||||||
//
|
|
||||||
#include "mongoose.h"
|
|
||||||
|
|
||||||
// Print HTTP response and signal that we're done
|
|
||||||
static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
|
||||||
const char *url = fn_data;
|
|
||||||
static bool connected;
|
|
||||||
if (ev == MG_EV_HTTP_MSG) {
|
|
||||||
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
|
||||||
printf("%.*s", (int) hm->message.len, hm->message.ptr);
|
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
} else if (ev == MG_EV_CONNECT) {
|
|
||||||
// Proxy TCP connection established. Send CONNECT request
|
|
||||||
struct mg_str host = mg_url_host(url);
|
|
||||||
// c->is_hexdumping = 1;
|
|
||||||
mg_printf(c, "CONNECT %.*s:%hu HTTP/1.1\r\nHost: %.*s:%hu\r\n\r\n",
|
|
||||||
(int) host.len, host.ptr, mg_url_port(url), (int) host.len,
|
|
||||||
host.ptr, mg_url_port(url));
|
|
||||||
// If target URL is SSL/TLS, command client connection to use TLS
|
|
||||||
if (mg_url_is_ssl(url)) {
|
|
||||||
struct mg_tls_opts opts = {.ca = "ca.pem"};
|
|
||||||
mg_tls_init(c, &opts);
|
|
||||||
}
|
|
||||||
} else if (!connected && ev == MG_EV_READ) {
|
|
||||||
struct mg_http_message hm;
|
|
||||||
int n = mg_http_parse((char *) c->recv.buf, c->recv.len, &hm);
|
|
||||||
if (n > 0) {
|
|
||||||
struct mg_str host = mg_url_host(url);
|
|
||||||
// CONNECT response - tunnel is established
|
|
||||||
connected = true;
|
|
||||||
MG_DEBUG(
|
|
||||||
("Connected to proxy, status: %.*s", (int) hm.uri.len, hm.uri.ptr));
|
|
||||||
mg_iobuf_del(&c->recv, 0, n);
|
|
||||||
// Send request to the target server
|
|
||||||
mg_printf(c, "GET %s HTTP/1.0\r\n"
|
|
||||||
"Host: %.*s\r\n"
|
|
||||||
"\r\n",
|
|
||||||
mg_url_uri(url), (int) host.len, host.ptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
|
||||||
struct mg_mgr mgr;
|
|
||||||
|
|
||||||
if (argc != 3) {
|
|
||||||
fprintf(stderr, "Usage: %s PROXY_URL URL\n", argv[0]);
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
mg_mgr_init(&mgr); // Initialise event manager
|
|
||||||
mg_http_connect(&mgr, argv[1], fn, argv[2]); // Connect to the proxy
|
|
||||||
for (;;) mg_mgr_poll(&mgr, 1000); // Event loop
|
|
||||||
mg_mgr_free(&mgr);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
PROG ?= example # Program we are building
|
|
||||||
DELETE = rm -rf # Command to remove files
|
|
||||||
OUT ?= -o $(PROG) # Compiler argument for output file
|
|
||||||
SOURCES = main.c mongoose.c # Source code files
|
|
||||||
CFLAGS = -W -Wall -Wextra -g -I. # Build options
|
|
||||||
|
|
||||||
# Mongoose build options. See https://mongoose.ws/documentation/#build-options
|
|
||||||
CFLAGS_MONGOOSE += -DMG_ENABLE_LINES=1
|
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT) # Windows settings. Assume MinGW compiler. To use VC: make CC=cl CFLAGS=/MD OUT=/Feprog.exe
|
|
||||||
PROG ?= example.exe # Use .exe suffix for the binary
|
|
||||||
CC = gcc # Use MinGW gcc compiler
|
|
||||||
CFLAGS += -lws2_32 # Link against Winsock library
|
|
||||||
DELETE = cmd /C del /Q /F /S # Command prompt command to delete files
|
|
||||||
OUT ?= -o $(PROG) # Build output
|
|
||||||
MAKE += WINDOWS=1 CC=$(CC)
|
|
||||||
endif
|
|
||||||
|
|
||||||
all: $(PROG) # Default target. Build and run program
|
|
||||||
$(RUN) ./$(PROG) $(ARGS)
|
|
||||||
|
|
||||||
$(PROG): $(SOURCES) # Build program from sources
|
|
||||||
$(CC) $(SOURCES) $(CFLAGS) $(CFLAGS_MONGOOSE) $(CFLAGS_EXTRA) $(OUT)
|
|
||||||
|
|
||||||
clean: # Cleanup. Delete built program and all build artifacts
|
|
||||||
$(DELETE) $(PROG) *.o *.obj *.exe *.dSYM mbedtls
|
|
||||||
|
|
||||||
# see https://mongoose.ws/tutorials/tls/#how-to-build for TLS build options
|
|
||||||
|
|
||||||
mbedtls: # Pull and build mbedTLS library
|
|
||||||
git clone --depth 1 -b v2.28.2 https://github.com/mbed-tls/mbedtls $@
|
|
||||||
$(MAKE) -C mbedtls/library
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
See detailed tutorial at https://mongoose.ws/tutorials/http-server/
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../test/data/ca.pem
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
// Copyright (c) 2020 Cesanta Software Limited
|
|
||||||
// All rights reserved
|
|
||||||
//
|
|
||||||
// HTTP server example. This server serves both static and dynamic content.
|
|
||||||
// It opens two ports: plain HTTP on port 8000 and HTTP on port 8443.
|
|
||||||
// It implements the following endpoints:
|
|
||||||
// /api/stats - respond with free-formatted stats on current connections
|
|
||||||
// /api/f2/:id - wildcard example, respond with JSON string {"result": "URI"}
|
|
||||||
// any other URI serves static files from s_root_dir
|
|
||||||
//
|
|
||||||
// To enable SSL/TLS (using self-signed certificates in PEM files),
|
|
||||||
// 1. See https://mongoose.ws/tutorials/tls/#how-to-build
|
|
||||||
// 2. curl -k https://127.0.0.1:8443
|
|
||||||
|
|
||||||
#include "mongoose.h"
|
|
||||||
|
|
||||||
static const char *s_http_addr = "http://0.0.0.0:8000"; // HTTP port
|
|
||||||
static const char *s_https_addr = "https://0.0.0.0:8443"; // HTTPS port
|
|
||||||
static const char *s_root_dir = ".";
|
|
||||||
|
|
||||||
// We use the same event handler function for HTTP and HTTPS connections
|
|
||||||
// fn_data is NULL for plain HTTP, and non-NULL for HTTPS
|
|
||||||
static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
|
||||||
if (ev == MG_EV_ACCEPT && fn_data != NULL) {
|
|
||||||
struct mg_tls_opts opts = {
|
|
||||||
//.ca = "ca.pem", // Uncomment to enable two-way SSL
|
|
||||||
.cert = "server.pem", // Certificate PEM file
|
|
||||||
.certkey = "server.pem", // This pem contains both cert and key
|
|
||||||
};
|
|
||||||
mg_tls_init(c, &opts);
|
|
||||||
} else if (ev == MG_EV_HTTP_MSG) {
|
|
||||||
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
|
||||||
if (mg_http_match_uri(hm, "/api/stats")) {
|
|
||||||
// Print some statistics about currently established connections
|
|
||||||
mg_printf(c, "HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\n\r\n");
|
|
||||||
mg_http_printf_chunk(c, "ID PROTO TYPE LOCAL REMOTE\n");
|
|
||||||
for (struct mg_connection *t = c->mgr->conns; t != NULL; t = t->next) {
|
|
||||||
mg_http_printf_chunk(c, "%-3lu %4s %s %M %M\n", t->id,
|
|
||||||
t->is_udp ? "UDP" : "TCP",
|
|
||||||
t->is_listening ? "LISTENING"
|
|
||||||
: t->is_accepted ? "ACCEPTED "
|
|
||||||
: "CONNECTED",
|
|
||||||
mg_print_ip, &t->loc, mg_print_ip, &t->rem);
|
|
||||||
}
|
|
||||||
mg_http_printf_chunk(c, ""); // Don't forget the last empty chunk
|
|
||||||
} else if (mg_http_match_uri(hm, "/api/f2/*")) {
|
|
||||||
mg_http_reply(c, 200, "", "{\"result\": \"%.*s\"}\n", (int) hm->uri.len,
|
|
||||||
hm->uri.ptr);
|
|
||||||
} else {
|
|
||||||
struct mg_http_serve_opts opts = {.root_dir = s_root_dir};
|
|
||||||
mg_http_serve_dir(c, ev_data, &opts);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
(void) fn_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void) {
|
|
||||||
struct mg_mgr mgr; // Event manager
|
|
||||||
mg_log_set(MG_LL_DEBUG); // Set log level
|
|
||||||
mg_mgr_init(&mgr); // Initialise event manager
|
|
||||||
mg_http_listen(&mgr, s_http_addr, fn, NULL); // Create HTTP listener
|
|
||||||
mg_http_listen(&mgr, s_https_addr, fn, (void *) 1); // HTTPS listener
|
|
||||||
for (;;) mg_mgr_poll(&mgr, 1000); // Infinite event loop
|
|
||||||
mg_mgr_free(&mgr);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
PROG ?= example # Program we are building
|
|
||||||
DELETE = rm -rf # Command to remove files
|
|
||||||
OUT ?= -o $(PROG) # Compiler argument for output file
|
|
||||||
SOURCES = main.c mongoose.c # Source code files
|
|
||||||
CFLAGS = -W -Wall -Wextra -g -I. # Build options
|
|
||||||
|
|
||||||
# Mongoose build options. See https://mongoose.ws/documentation/#build-options
|
|
||||||
CFLAGS_MONGOOSE += -DMG_IO_SIZE=128 -DMG_ENABLE_LINES=1
|
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT) # Windows settings. Assume MinGW compiler. To use VC: make CC=cl CFLAGS=/MD OUT=/Feprog.exe
|
|
||||||
PROG ?= example.exe # Use .exe suffix for the binary
|
|
||||||
CC = gcc # Use MinGW gcc compiler
|
|
||||||
CFLAGS += -lws2_32 # Link against Winsock library
|
|
||||||
DELETE = cmd /C del /Q /F /S # Command prompt command to delete files
|
|
||||||
OUT ?= -o $(PROG) # Build output
|
|
||||||
MAKE += WINDOWS=1 CC=$(CC)
|
|
||||||
endif
|
|
||||||
|
|
||||||
all: $(PROG) # Default target. Build and run program
|
|
||||||
$(RUN) ./$(PROG) $(ARGS)
|
|
||||||
|
|
||||||
$(PROG): $(SOURCES) # Build program from sources
|
|
||||||
$(CC) $(SOURCES) $(CFLAGS) $(CFLAGS_MONGOOSE) $(CFLAGS_EXTRA) $(OUT)
|
|
||||||
|
|
||||||
clean: # Cleanup. Delete built program and all build artifacts
|
|
||||||
$(DELETE) $(PROG) *.o *.obj *.exe *.dSYM mbedtls
|
|
||||||
|
|
||||||
# see https://mongoose.ws/tutorials/tls/#how-to-build for TLS build options
|
|
||||||
|
|
||||||
mbedtls: # Pull and build mbedTLS library
|
|
||||||
git clone --depth 1 -b v2.28.2 https://github.com/mbed-tls/mbedtls $@
|
|
||||||
$(MAKE) -C mbedtls/library
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
See detailed tutorial at https://mongoose.ws/tutorials/http-reverse-proxy/
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../test/data/ca.pem
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
// Copyright (c) 2020 Cesanta Software Limited
|
|
||||||
// All rights reserved
|
|
||||||
//
|
|
||||||
// Example HTTP reverse proxy
|
|
||||||
// 1. Run `make`. This builds and starts a proxy on port 8000
|
|
||||||
// 2. Start your browser, go to https://localhost:8000
|
|
||||||
//
|
|
||||||
// To enable SSL/TLS, see https://mongoose.ws/tutorials/tls/#how-to-build
|
|
||||||
|
|
||||||
#include "mongoose.h"
|
|
||||||
|
|
||||||
static const char *s_backend_url =
|
|
||||||
#if MG_ENABLE_MBEDTLS || MG_ENABLE_OPENSSL
|
|
||||||
"https://cesanta.com";
|
|
||||||
#else
|
|
||||||
"http://info.cern.ch";
|
|
||||||
#endif
|
|
||||||
static const char *s_listen_url = "http://localhost:8000";
|
|
||||||
|
|
||||||
// Forward client request to the backend connection, rewriting the Host header
|
|
||||||
static void forward_request(struct mg_http_message *hm,
|
|
||||||
struct mg_connection *c) {
|
|
||||||
size_t i, max = sizeof(hm->headers) / sizeof(hm->headers[0]);
|
|
||||||
struct mg_str host = mg_url_host(s_backend_url);
|
|
||||||
mg_printf(c, "%.*s\r\n",
|
|
||||||
(int) (hm->proto.ptr + hm->proto.len - hm->message.ptr),
|
|
||||||
hm->message.ptr);
|
|
||||||
for (i = 0; i < max && hm->headers[i].name.len > 0; i++) {
|
|
||||||
struct mg_str *k = &hm->headers[i].name, *v = &hm->headers[i].value;
|
|
||||||
if (mg_strcmp(*k, mg_str("Host")) == 0) v = &host;
|
|
||||||
mg_printf(c, "%.*s: %.*s\r\n", (int) k->len, k->ptr, (int) v->len, v->ptr);
|
|
||||||
}
|
|
||||||
mg_send(c, "\r\n", 2);
|
|
||||||
mg_send(c, hm->body.ptr, hm->body.len);
|
|
||||||
MG_DEBUG(("FORWARDING: %.*s %.*s", (int) hm->method.len, hm->method.ptr,
|
|
||||||
(int) hm->uri.len, hm->uri.ptr));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void fn2(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
|
||||||
struct mg_connection *c2 = fn_data;
|
|
||||||
if (ev == MG_EV_READ) {
|
|
||||||
// All incoming data from the backend, forward to the client
|
|
||||||
if (c2 != NULL) mg_send(c2, c->recv.buf, c->recv.len);
|
|
||||||
mg_iobuf_del(&c->recv, 0, c->recv.len);
|
|
||||||
} else if (ev == MG_EV_CLOSE) {
|
|
||||||
if (c2 != NULL) c2->fn_data = NULL;
|
|
||||||
}
|
|
||||||
(void) ev_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
|
||||||
struct mg_connection *c2 = fn_data;
|
|
||||||
if (ev == MG_EV_HTTP_MSG) {
|
|
||||||
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
|
||||||
// Client request, create backend connection Note that we're passing
|
|
||||||
// client connection `c` as fn_data for the created backend connection.
|
|
||||||
c2 = mg_connect(c->mgr, s_backend_url, fn2, c);
|
|
||||||
if (c2 == NULL) {
|
|
||||||
mg_error(c, "Cannot create backend connection");
|
|
||||||
} else {
|
|
||||||
if (mg_url_is_ssl(s_backend_url)) {
|
|
||||||
struct mg_tls_opts opts = {.ca = "ca.pem"};
|
|
||||||
mg_tls_init(c2, &opts);
|
|
||||||
}
|
|
||||||
c->fn_data = c2;
|
|
||||||
forward_request(hm, c2);
|
|
||||||
c->is_resp = 0; // process further msgs in keep-alive connection
|
|
||||||
c2->is_hexdumping = 1;
|
|
||||||
}
|
|
||||||
} else if (ev == MG_EV_CLOSE) {
|
|
||||||
if (c2 != NULL) c2->is_closing = 1;
|
|
||||||
if (c2 != NULL) c2->fn_data = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void) {
|
|
||||||
struct mg_mgr mgr;
|
|
||||||
|
|
||||||
mg_log_set(MG_LL_DEBUG); // Set log level
|
|
||||||
mg_mgr_init(&mgr); // Initialise event manager
|
|
||||||
mg_http_listen(&mgr, s_listen_url, fn, NULL); // Start proxy
|
|
||||||
for (;;) mg_mgr_poll(&mgr, 1000); // Event loop
|
|
||||||
mg_mgr_free(&mgr);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
PROG ?= example # Program we are building
|
|
||||||
DELETE = rm -rf # Command to remove files
|
|
||||||
OUT ?= -o $(PROG) # Compiler argument for output file
|
|
||||||
SOURCES = main.c mongoose.c # Source code files
|
|
||||||
CFLAGS = -W -Wall -Wextra -g -I. # Build options
|
|
||||||
|
|
||||||
# Mongoose build options. See https://mongoose.ws/documentation/#build-options
|
|
||||||
CFLAGS_MONGOOSE += -DMG_HTTP_DIRLIST_TIME_FMT="%Y/%m/%d %H:%M:%S"
|
|
||||||
CFLAGS_MONGOOSE += -DMG_ENABLE_LINES=1 -DMG_ENABLE_IPV6=1 -DMG_ENABLE_SSI=1
|
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT) # Windows settings. Assume MinGW compiler. To use VC: make CC=cl CFLAGS=/MD OUT=/Feprog.exe
|
|
||||||
PROG ?= example.exe # Use .exe suffix for the binary
|
|
||||||
CC = gcc # Use MinGW gcc compiler
|
|
||||||
CFLAGS += -lws2_32 # Link against Winsock library
|
|
||||||
DELETE = cmd /C del /Q /F /S # Command prompt command to delete files
|
|
||||||
OUT ?= -o $(PROG) # Build output
|
|
||||||
endif
|
|
||||||
|
|
||||||
all: $(PROG) # Default target. Build and run program
|
|
||||||
$(RUN) ./$(PROG) $(ARGS)
|
|
||||||
|
|
||||||
$(PROG): $(SOURCES) # Build program from sources
|
|
||||||
$(CC) $(SOURCES) $(CFLAGS) $(CFLAGS_MONGOOSE) $(CFLAGS_EXTRA) $(OUT)
|
|
||||||
|
|
||||||
clean: # Cleanup. Delete built program and all build artifacts
|
|
||||||
$(DELETE) $(PROG) *.o *.obj *.exe *.dSYM
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
See detailed tutorial at https://mongoose.ws/tutorials/http-server/
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
// Copyright (c) 2020 Cesanta Software Limited
|
|
||||||
// All rights reserved
|
|
||||||
|
|
||||||
#include <signal.h>
|
|
||||||
#include "mongoose.h"
|
|
||||||
|
|
||||||
static int s_debug_level = MG_LL_INFO;
|
|
||||||
static const char *s_root_dir = ".";
|
|
||||||
static const char *s_listening_address = "http://0.0.0.0:8000";
|
|
||||||
static const char *s_enable_hexdump = "no";
|
|
||||||
static const char *s_ssi_pattern = "#.html";
|
|
||||||
|
|
||||||
// Handle interrupts, like Ctrl-C
|
|
||||||
static int s_signo;
|
|
||||||
static void signal_handler(int signo) {
|
|
||||||
s_signo = signo;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Event handler for the listening connection.
|
|
||||||
// Simply serve static files from `s_root_dir`
|
|
||||||
static void cb(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
|
||||||
if (ev == MG_EV_HTTP_MSG) {
|
|
||||||
struct mg_http_message *hm = ev_data, tmp = {0};
|
|
||||||
struct mg_str unknown = mg_str_n("?", 1), *cl;
|
|
||||||
struct mg_http_serve_opts opts = {0};
|
|
||||||
opts.root_dir = s_root_dir;
|
|
||||||
opts.ssi_pattern = s_ssi_pattern;
|
|
||||||
mg_http_serve_dir(c, hm, &opts);
|
|
||||||
mg_http_parse((char *) c->send.buf, c->send.len, &tmp);
|
|
||||||
cl = mg_http_get_header(&tmp, "Content-Length");
|
|
||||||
if (cl == NULL) cl = &unknown;
|
|
||||||
MG_INFO(("%.*s %.*s %.*s %.*s", (int) hm->method.len, hm->method.ptr,
|
|
||||||
(int) hm->uri.len, hm->uri.ptr, (int) tmp.uri.len, tmp.uri.ptr,
|
|
||||||
(int) cl->len, cl->ptr));
|
|
||||||
}
|
|
||||||
(void) fn_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void usage(const char *prog) {
|
|
||||||
fprintf(stderr,
|
|
||||||
"Mongoose v.%s\n"
|
|
||||||
"Usage: %s OPTIONS\n"
|
|
||||||
" -H yes|no - enable traffic hexdump, default: '%s'\n"
|
|
||||||
" -S PAT - SSI filename pattern, default: '%s'\n"
|
|
||||||
" -d DIR - directory to serve, default: '%s'\n"
|
|
||||||
" -l ADDR - listening address, default: '%s'\n"
|
|
||||||
" -v LEVEL - debug level, from 0 to 4, default: %d\n",
|
|
||||||
MG_VERSION, prog, s_enable_hexdump, s_ssi_pattern, s_root_dir,
|
|
||||||
s_listening_address, s_debug_level);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
|
||||||
char path[MG_PATH_MAX] = ".";
|
|
||||||
struct mg_mgr mgr;
|
|
||||||
struct mg_connection *c;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
// Parse command-line flags
|
|
||||||
for (i = 1; i < argc; i++) {
|
|
||||||
if (strcmp(argv[i], "-d") == 0) {
|
|
||||||
s_root_dir = argv[++i];
|
|
||||||
} else if (strcmp(argv[i], "-H") == 0) {
|
|
||||||
s_enable_hexdump = argv[++i];
|
|
||||||
} else if (strcmp(argv[i], "-S") == 0) {
|
|
||||||
s_ssi_pattern = argv[++i];
|
|
||||||
} else if (strcmp(argv[i], "-l") == 0) {
|
|
||||||
s_listening_address = argv[++i];
|
|
||||||
} else if (strcmp(argv[i], "-v") == 0) {
|
|
||||||
s_debug_level = atoi(argv[++i]);
|
|
||||||
} else {
|
|
||||||
usage(argv[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Root directory must not contain double dots. Make it absolute
|
|
||||||
// Do the conversion only if the root dir spec does not contain overrides
|
|
||||||
if (strchr(s_root_dir, ',') == NULL) {
|
|
||||||
realpath(s_root_dir, path);
|
|
||||||
s_root_dir = path;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialise stuff
|
|
||||||
signal(SIGINT, signal_handler);
|
|
||||||
signal(SIGTERM, signal_handler);
|
|
||||||
mg_log_set(s_debug_level);
|
|
||||||
mg_mgr_init(&mgr);
|
|
||||||
if ((c = mg_http_listen(&mgr, s_listening_address, cb, &mgr)) == NULL) {
|
|
||||||
MG_ERROR(("Cannot listen on %s. Use http://ADDR:PORT or :PORT",
|
|
||||||
s_listening_address));
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
if (mg_casecmp(s_enable_hexdump, "yes") == 0) c->is_hexdumping = 1;
|
|
||||||
|
|
||||||
// Start infinite event loop
|
|
||||||
MG_INFO(("Mongoose version : v%s", MG_VERSION));
|
|
||||||
MG_INFO(("Listening on : %s", s_listening_address));
|
|
||||||
MG_INFO(("Web root : [%s]", s_root_dir));
|
|
||||||
while (s_signo == 0) mg_mgr_poll(&mgr, 1000);
|
|
||||||
mg_mgr_free(&mgr);
|
|
||||||
MG_INFO(("Exiting on signal %d", s_signo));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
PROG ?= example # Program we are building
|
|
||||||
DELETE = rm -rf # Command to remove files
|
|
||||||
OUT ?= -o $(PROG) # Compiler argument for output file
|
|
||||||
SOURCES = main.c mongoose.c # Source code files
|
|
||||||
CFLAGS = -W -Wall -Wextra -g -I. # Build options
|
|
||||||
|
|
||||||
# Mongoose build options. See https://mongoose.ws/documentation/#build-options
|
|
||||||
CFLAGS_MONGOOSE += -DMG_ENABLE_LINES=1
|
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT) # Windows settings. Assume MinGW compiler. To use VC: make CC=cl CFLAGS=/MD OUT=/Feprog.exe
|
|
||||||
PROG ?= example.exe # Use .exe suffix for the binary
|
|
||||||
CC = gcc # Use MinGW gcc compiler
|
|
||||||
CFLAGS += -lws2_32 # Link against Winsock library
|
|
||||||
DELETE = cmd /C del /Q /F /S # Command prompt command to delete files
|
|
||||||
OUT ?= -o $(PROG) # Build output
|
|
||||||
MAKE += WINDOWS=1 CC=$(CC)
|
|
||||||
endif
|
|
||||||
|
|
||||||
all: $(PROG) # Default target. Build and run program
|
|
||||||
$(RUN) ./$(PROG) $(ARGS)
|
|
||||||
|
|
||||||
$(PROG): $(SOURCES) # Build program from sources
|
|
||||||
$(CC) $(SOURCES) $(CFLAGS) $(CFLAGS_MONGOOSE) $(CFLAGS_EXTRA) $(OUT)
|
|
||||||
|
|
||||||
clean: # Cleanup. Delete built program and all build artifacts
|
|
||||||
$(DELETE) $(PROG) *.o *.obj *.exe *.dSYM mbedtls
|
|
||||||
|
|
||||||
# see https://mongoose.ws/tutorials/tls/#how-to-build for TLS build options
|
|
||||||
|
|
||||||
mbedtls: # Pull and build mbedTLS library
|
|
||||||
git clone --depth 1 -b v2.28.2 https://github.com/mbed-tls/mbedtls $@
|
|
||||||
$(MAKE) -C mbedtls/library
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../test/data/ca.pem
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
// Copyright (c) 2021 Cesanta Software Limited
|
|
||||||
// All rights reserved
|
|
||||||
//
|
|
||||||
// Example HTTP client.
|
|
||||||
// Instead of buffering the whole HTTP response in memory and wait for the
|
|
||||||
// MG_EV_HTTP_MSG event, this client catches MG_EV_HTTP_CHUNK events and
|
|
||||||
// prints them. This is useful to download large content without spooling
|
|
||||||
// everything to memory, or catch chunked content.
|
|
||||||
//
|
|
||||||
// You can change `s_url` from the command line by executing: ./example YOUR_URL
|
|
||||||
//
|
|
||||||
// To enable SSL/TLS, see https://mongoose.ws/tutorials/tls/#how-to-build
|
|
||||||
|
|
||||||
#include "mongoose.h"
|
|
||||||
|
|
||||||
// The very first web page in history. You can replace it from command line
|
|
||||||
static const char *s_url = "http://info.cern.ch";
|
|
||||||
|
|
||||||
// Print HTTP response and signal that we're done
|
|
||||||
static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
|
||||||
if (ev == MG_EV_CONNECT) {
|
|
||||||
// Connected to server. Extract host name from URL
|
|
||||||
struct mg_str host = mg_url_host(s_url);
|
|
||||||
|
|
||||||
// If s_url is https://, tell client connection to use TLS
|
|
||||||
if (mg_url_is_ssl(s_url)) {
|
|
||||||
struct mg_tls_opts opts = {.ca = "ca.pem", .srvname = host};
|
|
||||||
mg_tls_init(c, &opts);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send request
|
|
||||||
mg_printf(c,
|
|
||||||
"GET %s HTTP/1.1\r\n"
|
|
||||||
"Connection: keep-alive\r\n"
|
|
||||||
"Keep-Alive: timeout=60\r\n"
|
|
||||||
"Host: %.*s\r\n"
|
|
||||||
"\r\n",
|
|
||||||
mg_url_uri(s_url), (int) host.len, host.ptr);
|
|
||||||
} else if (ev == MG_EV_HTTP_CHUNK) {
|
|
||||||
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
|
||||||
fwrite(hm->chunk.ptr, 1, hm->chunk.len, stdout);
|
|
||||||
// fprintf(stderr, "c %u\n", (unsigned) hm->chunk.len);
|
|
||||||
mg_http_delete_chunk(c, hm);
|
|
||||||
if (hm->chunk.len == 0) *(bool *) fn_data = true; // Last chunk
|
|
||||||
} else if (ev == MG_EV_HTTP_MSG) {
|
|
||||||
// Response is received. Print it
|
|
||||||
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
|
||||||
fwrite(hm->body.ptr, 1, hm->body.len, stdout);
|
|
||||||
c->is_closing = 1; // Tell mongoose to close this connection
|
|
||||||
*(bool *) fn_data = true; // Tell event loop to stop
|
|
||||||
} else if (ev == MG_EV_ERROR) {
|
|
||||||
*(bool *) fn_data = true; // Error, tell event loop to stop
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
|
||||||
struct mg_mgr mgr; // Event manager
|
|
||||||
bool done = false; // Event handler flips it to true
|
|
||||||
const char *log_level = getenv("V"); // Log level
|
|
||||||
if (log_level == NULL) log_level = "3"; // If not set, set to DEBUG
|
|
||||||
mg_log_set(atoi(log_level)); // Set to 0 to disable debug log
|
|
||||||
if (argc > 1) s_url = argv[1]; // Use URL from command line
|
|
||||||
mg_mgr_init(&mgr); // Initialise event manager
|
|
||||||
mg_http_connect(&mgr, s_url, fn, &done); // Create client connection
|
|
||||||
while (!done) mg_mgr_poll(&mgr, 1000); // Infinite event loop
|
|
||||||
mg_mgr_free(&mgr); // Free resources
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Loaded 100 of 4902 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user