├── LICENSE ├── actor_model ├── CMakeLists.txt ├── actor_model.fbs ├── lib │ ├── delegate │ │ └── delegate.hpp │ └── simple_match │ │ ├── LICENSE_1_0.txt │ │ └── include │ │ └── simple_match │ │ ├── implementation │ │ └── some_none.hpp │ │ ├── simple_match.hpp │ │ └── utility.hpp └── src │ ├── actor.cpp │ ├── actor.h │ ├── actor_model.cpp │ ├── actor_model.h │ ├── behaviour.h │ ├── gen │ └── .PLACEHOLDER │ ├── mailbox.cpp │ ├── mailbox.h │ ├── node.cpp │ ├── node.h │ ├── oom_killer_actor_behaviour.cpp │ ├── oom_killer_actor_behaviour.h │ ├── pid.cpp │ ├── pid.h │ ├── process.cpp │ ├── process.h │ ├── received_message.cpp │ ├── received_message.h │ ├── supervisor_actor_behaviour.cpp │ └── supervisor_actor_behaviour.h ├── base64 ├── CMakeLists.txt ├── lib │ └── libb64 │ │ ├── LICENSE │ │ ├── include │ │ └── b64 │ │ │ ├── cdecode.h │ │ │ ├── cencode.h │ │ │ ├── decode.h │ │ │ └── encode.h │ │ └── src │ │ ├── cdecode.c │ │ └── cencode.c └── src │ ├── base64.cpp │ └── base64.h ├── captive_portal ├── lib │ └── dns_server │ │ ├── LICENSE │ │ ├── dns_server.cpp │ │ ├── dns_server.h │ │ ├── dns_types.h │ │ └── library.properties └── src │ ├── dns_server_actor.cpp │ └── dns_server_actor.h ├── curl ├── CMakeLists.txt └── lib │ ├── curl │ ├── COPYING │ ├── include │ │ └── curl │ │ │ ├── curl.h │ │ │ ├── curlver.h │ │ │ ├── easy.h │ │ │ ├── header.h │ │ │ ├── mprintf.h │ │ │ ├── multi.h │ │ │ ├── options.h │ │ │ ├── stdcheaders.h │ │ │ ├── system.h │ │ │ ├── typecheck-gcc.h │ │ │ └── urlapi.h │ └── lib │ │ ├── altsvc.c │ │ ├── altsvc.h │ │ ├── amigaos.c │ │ ├── amigaos.h │ │ ├── asyn.h │ │ ├── base64.c │ │ ├── bufref.h │ │ ├── c-hyper.h │ │ ├── conncache.c │ │ ├── conncache.h │ │ ├── connect.c │ │ ├── connect.h │ │ ├── content_encoding.c │ │ ├── content_encoding.h │ │ ├── cookie.c │ │ ├── cookie.h │ │ ├── curl_addrinfo.c │ │ ├── curl_addrinfo.h │ │ ├── curl_base64.h │ │ ├── curl_ctype.c │ │ ├── curl_ctype.h │ │ ├── curl_des.h │ │ ├── curl_endian.h │ │ ├── curl_fnmatch.h │ │ ├── curl_get_line.c │ │ ├── curl_get_line.h │ │ ├── curl_gethostname.h │ │ ├── curl_hmac.h │ │ ├── curl_ldap.h │ │ ├── curl_md4.h │ │ ├── curl_md5.h │ │ ├── curl_memory.h │ │ ├── curl_memrchr.h │ │ ├── curl_multibyte.h │ │ ├── curl_ntlm_wb.h │ │ ├── curl_path.h │ │ ├── curl_printf.h │ │ ├── curl_range.h │ │ ├── curl_rtmp.h │ │ ├── curl_sasl.h │ │ ├── curl_setup.h │ │ ├── curl_setup_once.h │ │ ├── curl_sha256.h │ │ ├── curl_threads.h │ │ ├── curlx.h │ │ ├── dict.h │ │ ├── doh.c │ │ ├── doh.h │ │ ├── dotdot.c │ │ ├── dotdot.h │ │ ├── dynbuf.c │ │ ├── dynbuf.h │ │ ├── easy.c │ │ ├── easy_lock.h │ │ ├── easyif.h │ │ ├── easyoptions.h │ │ ├── escape.c │ │ ├── escape.h │ │ ├── file.h │ │ ├── fileinfo.h │ │ ├── fopen.c │ │ ├── fopen.h │ │ ├── formdata.c │ │ ├── formdata.h │ │ ├── ftp.h │ │ ├── ftplistparser.h │ │ ├── getenv.c │ │ ├── getinfo.c │ │ ├── getinfo.h │ │ ├── gopher.c │ │ ├── gopher.h │ │ ├── h2h3.h │ │ ├── hash.c │ │ ├── hash.h │ │ ├── headers.c │ │ ├── headers.h │ │ ├── hostip.c │ │ ├── hostip.h │ │ ├── hostip4.c │ │ ├── hostip6.c │ │ ├── hsts.c │ │ ├── hsts.h │ │ ├── http.c │ │ ├── http.h │ │ ├── http2.h │ │ ├── http_aws_sigv4.h │ │ ├── http_chunks.c │ │ ├── http_chunks.h │ │ ├── http_digest.h │ │ ├── http_negotiate.h │ │ ├── http_ntlm.h │ │ ├── http_proxy.c │ │ ├── http_proxy.h │ │ ├── if2ip.c │ │ ├── if2ip.h │ │ ├── imap.h │ │ ├── inet_ntop.h │ │ ├── inet_pton.h │ │ ├── llist.c │ │ ├── llist.h │ │ ├── memdebug.h │ │ ├── mime.c │ │ ├── mime.h │ │ ├── mprintf.c │ │ ├── mqtt.c │ │ ├── mqtt.h │ │ ├── multi.c │ │ ├── multihandle.h │ │ ├── multiif.h │ │ ├── netrc.c │ │ ├── netrc.h │ │ ├── nonblock.c │ │ ├── nonblock.h │ │ ├── parsedate.c │ │ ├── parsedate.h │ │ ├── pingpong.h │ │ ├── pop3.h │ │ ├── progress.c │ │ ├── progress.h │ │ ├── psl.h │ │ ├── quic.h │ │ ├── rand.c │ │ ├── rand.h │ │ ├── rename.c │ │ ├── rename.h │ │ ├── rtsp.h │ │ ├── select.c │ │ ├── select.h │ │ ├── sendf.c │ │ ├── sendf.h │ │ ├── setopt.c │ │ ├── setopt.h │ │ ├── share.c │ │ ├── share.h │ │ ├── sigpipe.h │ │ ├── slist.c │ │ ├── slist.h │ │ ├── smb.h │ │ ├── smtp.h │ │ ├── sockaddr.h │ │ ├── socketpair.c │ │ ├── socketpair.h │ │ ├── socks.h │ │ ├── speedcheck.c │ │ ├── speedcheck.h │ │ ├── splay.c │ │ ├── splay.h │ │ ├── strcase.c │ │ ├── strcase.h │ │ ├── strdup.c │ │ ├── strdup.h │ │ ├── strerror.c │ │ ├── strerror.h │ │ ├── strtok.h │ │ ├── strtoofft.c │ │ ├── strtoofft.h │ │ ├── system_win32.c │ │ ├── system_win32.h │ │ ├── telnet.c │ │ ├── telnet.h │ │ ├── tftp.h │ │ ├── timediff.c │ │ ├── timediff.h │ │ ├── timeval.c │ │ ├── timeval.h │ │ ├── transfer.c │ │ ├── transfer.h │ │ ├── url.c │ │ ├── url.h │ │ ├── urlapi-int.h │ │ ├── urlapi.c │ │ ├── urldata.h │ │ ├── vauth │ │ ├── digest.h │ │ └── vauth.h │ │ ├── version_win32.h │ │ ├── vssh │ │ └── ssh.h │ │ ├── vtls │ │ ├── gskit.h │ │ ├── mbedtls.c │ │ ├── mbedtls.h │ │ ├── mbedtls_threadlock.h │ │ ├── vtls.c │ │ └── vtls.h │ │ ├── warnless.c │ │ ├── warnless.h │ │ └── wildcard.h │ ├── curl_config.h │ ├── posix_shims.c │ └── zlib │ ├── LICENSE │ ├── adler32.c │ ├── compress.c │ ├── crc32.c │ ├── crc32.h │ ├── deflate.c │ ├── deflate.h │ ├── gzclose.c │ ├── gzguts.h │ ├── gzlib.c │ ├── gzread.c │ ├── gzwrite.c │ ├── infback.c │ ├── inffast.c │ ├── inffast.h │ ├── inffixed.h │ ├── inflate.c │ ├── inflate.h │ ├── inftrees.c │ ├── inftrees.h │ ├── trees.c │ ├── trees.h │ ├── uncompr.c │ ├── zconf.h │ ├── zlib.h │ ├── zutil.c │ └── zutil.h ├── embedded_files ├── CMakeLists.txt └── src │ └── embedded_files_string_view_wrapper.h ├── fatfs_image ├── CMakeLists.txt ├── Kconfig.projbuild ├── get_port_args.cmake ├── run_cmd.cmake └── run_esptool.cmake ├── firmware_update ├── .gitignore ├── CMakeLists.txt ├── Kconfig.projbuild ├── firmware_update.fbs ├── project_include.cmake ├── src │ ├── firmware_update.cpp │ ├── firmware_update.h │ ├── firmware_update_actor.cpp │ ├── firmware_update_actor.h │ └── gen │ │ └── .PLACEHOLDER └── templates │ └── latest.fw.json.tpl ├── flatbuffers ├── CMakeLists.txt ├── lib │ └── flatbuffers │ │ ├── LICENSE.txt │ │ ├── include │ │ └── flatbuffers │ │ │ ├── allocator.h │ │ │ ├── array.h │ │ │ ├── base.h │ │ │ ├── bfbs_generator.h │ │ │ ├── buffer.h │ │ │ ├── buffer_ref.h │ │ │ ├── code_generators.h │ │ │ ├── default_allocator.h │ │ │ ├── detached_buffer.h │ │ │ ├── flatbuffer_builder.h │ │ │ ├── flatbuffers.h │ │ │ ├── flatc.h │ │ │ ├── flex_flat_util.h │ │ │ ├── flexbuffers.h │ │ │ ├── grpc.h │ │ │ ├── hash.h │ │ │ ├── idl.h │ │ │ ├── minireflect.h │ │ │ ├── pch │ │ │ ├── flatc_pch.h │ │ │ └── pch.h │ │ │ ├── reflection.h │ │ │ ├── reflection_generated.h │ │ │ ├── registry.h │ │ │ ├── stl_emulation.h │ │ │ ├── string.h │ │ │ ├── struct.h │ │ │ ├── table.h │ │ │ ├── util.h │ │ │ ├── vector.h │ │ │ ├── vector_downward.h │ │ │ └── verifier.h │ │ └── src │ │ ├── reflection.cpp │ │ └── util.cpp ├── project_include.cmake └── src │ ├── flatbuffers_utils.cpp │ └── flatbuffers_utils.h ├── googleapis ├── CMakeLists.txt ├── assets │ ├── spreadsheet_insert_row_request_intent.req.json │ └── visualization_query_request_intent.req.json ├── sheets.fbs ├── src │ ├── gen │ │ └── .PLACEHOLDER │ ├── googleapis.cpp │ ├── googleapis.h │ ├── spreadsheet_insert_row_actor.cpp │ ├── spreadsheet_insert_row_actor.h │ ├── visualization_query_actor.cpp │ └── visualization_query_actor.h └── visualization.fbs ├── gsl ├── CMakeLists.txt └── lib │ └── GSL │ ├── LICENSE │ └── include │ └── gsl │ ├── gsl │ ├── gsl_algorithm │ ├── gsl_assert │ ├── gsl_byte │ ├── gsl_util │ ├── multi_span │ ├── pointers │ ├── span │ └── string_span ├── http_server ├── CMakeLists.txt ├── http_server.fbs └── src │ ├── http_server_actor.cpp │ └── http_server_actor.h ├── json_flatbuffers ├── CMakeLists.txt ├── lib │ └── flatbuffers │ │ ├── LICENSE.txt │ │ └── src │ │ └── idl_parser.cpp └── src │ ├── flatbuffer_to_json_converter.h │ ├── json_to_flatbuffers_converter.cpp │ └── json_to_flatbuffers_converter.h ├── json_streaming ├── CMakeLists.txt ├── lib │ └── yajl │ │ ├── COPYING │ │ ├── include │ │ └── yajl │ │ ├── src │ │ ├── api │ │ │ ├── yajl_common.h │ │ │ ├── yajl_gen.h │ │ │ ├── yajl_parse.h │ │ │ └── yajl_tree.h │ │ ├── yajl.c │ │ ├── yajl_alloc.c │ │ ├── yajl_alloc.h │ │ ├── yajl_buf.c │ │ ├── yajl_buf.h │ │ ├── yajl_bytestack.h │ │ ├── yajl_encode.c │ │ ├── yajl_encode.h │ │ ├── yajl_gen.c │ │ ├── yajl_lex.c │ │ ├── yajl_lex.h │ │ ├── yajl_parser.c │ │ ├── yajl_parser.h │ │ ├── yajl_tree.c │ │ └── yajl_version.c │ │ └── yajl_version.h └── src │ ├── json_emitter.cpp │ └── json_emitter.h ├── jwt ├── CMakeLists.txt └── src │ ├── jwt.cpp │ └── jwt.h ├── module_manager ├── .gitignore ├── CMakeLists.txt ├── Kconfig.projbuild ├── compile-esp32-elf.sh ├── gen_symbols_c.py ├── lib │ └── libelfin │ │ ├── LICENSE │ │ └── elf │ │ ├── .gitignore │ │ ├── common.hh │ │ ├── data.hh │ │ ├── elf++.hh │ │ ├── elf.cc │ │ ├── to_hex.hh │ │ └── to_string.cc ├── project_include.cmake └── src │ ├── buffer_view_loader.cpp │ ├── buffer_view_loader.h │ ├── executable.cpp │ ├── executable.h │ ├── file_buffer_loader.cpp │ ├── file_buffer_loader.h │ ├── gen │ ├── .PLACEHOLDER │ └── symbols.c │ ├── loader.cpp │ ├── loader.h │ ├── sym.h │ └── xtensa_elf.h ├── mqtt_client ├── CMakeLists.txt ├── Kconfig.projbuild ├── mqtt.fbs ├── project_include.cmake └── src │ ├── mqtt.cpp │ ├── mqtt.h │ ├── mqtt_client_actor.cpp │ └── mqtt_client_actor.h ├── network_manager ├── .gitignore ├── CMakeLists.txt ├── Kconfig.projbuild ├── lib │ └── date │ │ ├── LICENSE.txt │ │ └── include │ │ └── date │ │ ├── date.h │ │ ├── ios.mm │ │ ├── ptz.h │ │ └── tz.h ├── network_manager.fbs └── src │ ├── mdns_actor.cpp │ ├── mdns_actor.h │ ├── network_check_actor.cpp │ ├── network_check_actor.h │ ├── network_manager.cpp │ ├── network_manager.h │ ├── ntp.cpp │ ├── ntp.h │ ├── ntp_actor.cpp │ ├── ntp_actor.h │ ├── wifi_actor.cpp │ └── wifi_actor.h ├── osc ├── CMakeLists.txt ├── lib │ └── tinyosc │ │ ├── LICENSE │ │ ├── tinyosc.c │ │ └── tinyosc.h └── src │ ├── htonll_ntohll.h │ ├── osc.cpp │ └── osc.h ├── requests ├── .gitignore ├── CMakeLists.txt ├── lib │ └── cpp17_headers │ │ ├── LICENSE_1_0.txt │ │ └── include │ │ └── stx │ │ └── variant.hpp ├── project_include.cmake ├── requests.fbs └── src │ ├── curl_library_info.cpp │ ├── curl_library_info.h │ ├── gen │ └── .PLACEHOLDER │ ├── http_utils.cpp │ ├── http_utils.h │ ├── queued_endpoint_actor.cpp │ ├── queued_endpoint_actor.h │ ├── request_handler.cpp │ ├── request_handler.h │ ├── request_manager.cpp │ ├── request_manager.h │ ├── request_manager_actor.cpp │ ├── request_manager_actor.h │ ├── requests.cpp │ ├── requests.h │ ├── server_sent_events_emitter.cpp │ └── server_sent_events_emitter.h ├── sh2lib ├── CMakeLists.txt ├── LICENSE ├── idf_component.yml ├── sh2lib.c └── sh2lib.h ├── statsd ├── CMakeLists.txt ├── Kconfig.projbuild └── src │ ├── timing_metric.cpp │ └── timing_metric.h ├── udp_server ├── CMakeLists.txt ├── src │ ├── udp_server_actor.cpp │ └── udp_server_actor.h └── udp_server.fbs ├── utils ├── CMakeLists.txt └── src │ ├── delay.h │ ├── filesystem.cpp │ ├── filesystem.h │ ├── timestamp.cpp │ ├── timestamp.h │ ├── trace.cpp │ └── trace.h └── uuid ├── CMakeLists.txt ├── lib └── sole │ ├── LICENSE │ └── sole.hpp ├── src ├── uuid.cpp └── uuid.h └── uuid.fbs /actor_model/lib/simple_match/LICENSE_1_0.txt: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /actor_model/lib/simple_match/include/simple_match/utility.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // Copyright 2015 John R. Bandela 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | #pragma once 8 | 9 | #ifndef SIMPLE_MATCH_UTILITY_HPP_JRB_2015_09_11 10 | #define SIMPLE_MATCH_UTILITY_HPP_JRB_2015_09_11 11 | #include "simple_match.hpp" 12 | namespace simple_match { 13 | // tagged_tuple 14 | 15 | template 16 | struct tagged_tuple :std::tuple { 17 | using base = std::tuple; 18 | template 19 | tagged_tuple(A&&... a) :base{ std::forward(a)... } {} 20 | }; 21 | 22 | // inheriting_tagged_tuple 23 | 24 | template 25 | struct inheriting_tagged_tuple :Base,tagged_tuple { 26 | using base = tagged_tuple; 27 | template 28 | inheriting_tagged_tuple(A&&... a) :base{ std::forward(a)... } {} 29 | }; 30 | 31 | 32 | } 33 | 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /actor_model/src/actor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "behaviour.h" 14 | #include "process.h" 15 | 16 | namespace ActorModel { 17 | 18 | // Single actor behaviour convenience function 19 | auto spawn( 20 | const ActorBehaviour&& _actor_behaviour, 21 | const ExecConfigCallback&& _exec_config_callback = nullptr 22 | ) -> Pid; 23 | 24 | auto spawn_link( 25 | const Pid& _initial_link_pid, 26 | const ActorBehaviour&& _actor_behaviour, 27 | const ExecConfigCallback&& _exec_config_callback = nullptr 28 | ) -> Pid; 29 | 30 | // Multiple chained actor behaviours 31 | auto spawn( 32 | const ActorBehaviours&& _actor_behaviours, 33 | const ExecConfigCallback&& _exec_config_callback = nullptr 34 | ) -> Pid; 35 | 36 | auto spawn_link( 37 | const Pid& _initial_link_pid, 38 | const ActorBehaviours&& _actor_behaviours, 39 | const ExecConfigCallback&& _exec_config_callback = nullptr 40 | ) -> Pid; 41 | 42 | } // namespace ActorModel 43 | -------------------------------------------------------------------------------- /actor_model/src/gen/.PLACEHOLDER: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulreimer/esp32-network-lib/b219dce0d739e19ae150dd4ed6e6b3750d750d7f/actor_model/src/gen/.PLACEHOLDER -------------------------------------------------------------------------------- /actor_model/src/oom_killer_actor_behaviour.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "actor_model.h" 14 | 15 | namespace ActorModel { 16 | 17 | auto oom_killer_actor_behaviour( 18 | const ActorModel::Pid& self, 19 | ActorModel::StatePtr& state, 20 | const ActorModel::Message& message 21 | ) -> ActorModel::ResultUnion; 22 | 23 | } // namespace ActorModel 24 | -------------------------------------------------------------------------------- /actor_model/src/pid.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #include "pid.h" 12 | 13 | namespace ActorModel { 14 | 15 | } // namespace ActorModel 16 | -------------------------------------------------------------------------------- /actor_model/src/pid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "uuid.h" 14 | 15 | #include 16 | 17 | namespace ActorModel { 18 | 19 | using Pid = UUID::UUID; 20 | using MaybePid = std::optional; 21 | 22 | static Pid& NullPid = UUID::NullUUID; 23 | 24 | } // namespace ActorModel 25 | -------------------------------------------------------------------------------- /actor_model/src/received_message.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #include "received_message.h" 12 | 13 | namespace ActorModel { 14 | 15 | ReceivedMessage::ReceivedMessage( 16 | Mailbox& _mailbox, 17 | const BufferView& _message, 18 | const bool _verify 19 | ) 20 | : mailbox(_mailbox) 21 | , message(_message) 22 | , verify(_verify) 23 | { 24 | if (verify) 25 | { 26 | flatbuffers::Verifier verifier(message.data(), message.size()); 27 | verified = VerifyMessageBuffer(verifier); 28 | } 29 | } 30 | 31 | ReceivedMessage::~ReceivedMessage() 32 | { 33 | // Release the memory back to the buffer 34 | mailbox.release(message); 35 | } 36 | 37 | auto ReceivedMessage::ref() 38 | -> BufferView 39 | { 40 | if (verified or not verify) 41 | { 42 | return message; 43 | } 44 | 45 | return {}; 46 | } 47 | 48 | } // namespace ActorModel 49 | -------------------------------------------------------------------------------- /actor_model/src/received_message.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "actor_model_generated.h" 14 | 15 | #include "mailbox.h" 16 | 17 | #include 18 | 19 | namespace ActorModel { 20 | using BufferView = std::span; 21 | 22 | class Mailbox; 23 | 24 | class ReceivedMessage 25 | { 26 | public: 27 | ReceivedMessage( 28 | Mailbox& _mailbox, 29 | const BufferView& _message, 30 | const bool verify = true 31 | ); 32 | 33 | ReceivedMessage() = delete; 34 | ReceivedMessage(const ReceivedMessage&) = delete; 35 | 36 | ~ReceivedMessage(); 37 | 38 | auto ref() 39 | -> BufferView; 40 | 41 | protected: 42 | Mailbox& mailbox; 43 | const BufferView message; 44 | const bool verify; 45 | bool verified = false; 46 | }; 47 | 48 | } // namespace ActorModel 49 | -------------------------------------------------------------------------------- /actor_model/src/supervisor_actor_behaviour.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "actor_model.h" 14 | 15 | namespace ActorModel { 16 | 17 | auto supervisor_actor_behaviour( 18 | const ActorModel::Pid& self, 19 | ActorModel::StatePtr& state, 20 | const ActorModel::Message& message 21 | ) -> ActorModel::ResultUnion; 22 | 23 | } // namespace ActorModel 24 | -------------------------------------------------------------------------------- /base64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register( 2 | SRCS 3 | "lib/libb64/src/cdecode.c" 4 | "lib/libb64/src/cencode.c" 5 | "src/base64.cpp" 6 | INCLUDE_DIRS 7 | "lib/libb64/include" 8 | "src" 9 | ) 10 | 11 | 12 | target_compile_options( 13 | ${COMPONENT_LIB} 14 | PRIVATE 15 | $<$:${EXTRA_CXX_WARNING_FLAGS}> 16 | ) 17 | 18 | set_source_files_properties( 19 | SOURCE 20 | "lib/libb64/src/cdecode.c" 21 | APPEND PROPERTIES 22 | COMPILE_OPTIONS 23 | "-Wno-implicit-fallthrough;-Wno-sign-conversion;-Wno-conversion;" 24 | ) 25 | 26 | set_source_files_properties( 27 | SOURCE 28 | "lib/libb64/src/cencode.c" 29 | APPEND PROPERTIES 30 | COMPILE_OPTIONS 31 | "-Wno-implicit-fallthrough;" 32 | ) 33 | -------------------------------------------------------------------------------- /base64/lib/libb64/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright-Only Dedication (based on United States law) 2 | or Public Domain Certification 3 | 4 | The person or persons who have associated work with this document (the 5 | "Dedicator" or "Certifier") hereby either (a) certifies that, to the best of 6 | his knowledge, the work of authorship identified is in the public domain of the 7 | country from which the work is published, or (b) hereby dedicates whatever 8 | copyright the dedicators holds in the work of authorship identified below (the 9 | "Work") to the public domain. A certifier, moreover, dedicates any copyright 10 | interest he may have in the associated work, and for these purposes, is 11 | described as a "dedicator" below. 12 | 13 | A certifier has taken reasonable steps to verify the copyright status of this 14 | work. Certifier recognizes that his good faith efforts may not shield him from 15 | liability if in fact the work certified is not in the public domain. 16 | 17 | Dedicator makes this dedication for the benefit of the public at large and to 18 | the detriment of the Dedicator's heirs and successors. Dedicator intends this 19 | dedication to be an overt act of relinquishment in perpetuity of all present 20 | and future rights under copyright law, whether vested or contingent, in the 21 | Work. Dedicator understands that such relinquishment of all rights includes 22 | the relinquishment of all rights to enforce (by lawsuit or otherwise) those 23 | copyrights in the Work. 24 | 25 | Dedicator recognizes that, once placed in the public domain, the Work may be 26 | freely reproduced, distributed, transmitted, used, modified, built upon, or 27 | otherwise exploited by anyone for any purpose, commercial or non-commercial, 28 | and in any way, including by methods that have not yet been invented or 29 | conceived. -------------------------------------------------------------------------------- /base64/lib/libb64/include/b64/cdecode.h: -------------------------------------------------------------------------------- 1 | /* 2 | cdecode.h - c header for a base64 decoding algorithm 3 | 4 | This is part of the libb64 project, and has been placed in the public domain. 5 | For details, see http://sourceforge.net/projects/libb64 6 | */ 7 | 8 | #ifndef BASE64_CDECODE_H 9 | #define BASE64_CDECODE_H 10 | 11 | typedef enum 12 | { 13 | step_a, step_b, step_c, step_d 14 | } base64_decodestep; 15 | 16 | typedef struct 17 | { 18 | base64_decodestep step; 19 | char plainchar; 20 | } base64_decodestate; 21 | 22 | void base64_init_decodestate(base64_decodestate* state_in); 23 | 24 | int base64_decode_value(signed char value_in); 25 | 26 | int base64_decode_block(const char* code_in, const int length_in, char* plaintext_out, base64_decodestate* state_in); 27 | 28 | #endif /* BASE64_CDECODE_H */ 29 | 30 | -------------------------------------------------------------------------------- /base64/lib/libb64/include/b64/cencode.h: -------------------------------------------------------------------------------- 1 | /* 2 | cencode.h - c header for a base64 encoding algorithm 3 | 4 | This is part of the libb64 project, and has been placed in the public domain. 5 | For details, see http://sourceforge.net/projects/libb64 6 | */ 7 | 8 | #ifndef BASE64_CENCODE_H 9 | #define BASE64_CENCODE_H 10 | 11 | typedef enum 12 | { 13 | step_A, step_B, step_C 14 | } base64_encodestep; 15 | 16 | typedef struct 17 | { 18 | base64_encodestep step; 19 | char result; 20 | } base64_encodestate; 21 | 22 | void base64_init_encodestate(base64_encodestate* state_in); 23 | 24 | char base64_encode_value(char value_in); 25 | 26 | int base64_encode_block(const char* plaintext_in, int length_in, char* code_out, base64_encodestate* state_in); 27 | 28 | int base64_encode_blockend(char* code_out, base64_encodestate* state_in); 29 | 30 | #endif /* BASE64_CENCODE_H */ 31 | 32 | -------------------------------------------------------------------------------- /base64/lib/libb64/include/b64/decode.h: -------------------------------------------------------------------------------- 1 | // :mode=c++: 2 | /* 3 | decode.h - c++ wrapper for a base64 decoding algorithm 4 | 5 | This is part of the libb64 project, and has been placed in the public domain. 6 | For details, see http://sourceforge.net/projects/libb64 7 | */ 8 | #ifndef BASE64_DECODE_H 9 | #define BASE64_DECODE_H 10 | 11 | #include 12 | 13 | namespace base64 14 | { 15 | extern "C" 16 | { 17 | #include "cdecode.h" 18 | } 19 | 20 | struct decoder 21 | { 22 | base64_decodestate _state; 23 | int _buffersize; 24 | 25 | decoder(int buffersize_in = BUFFERSIZE) 26 | : _buffersize(buffersize_in) 27 | {} 28 | 29 | int decode(char value_in) 30 | { 31 | return base64_decode_value(value_in); 32 | } 33 | 34 | int decode(const char* code_in, const int length_in, char* plaintext_out) 35 | { 36 | return base64_decode_block(code_in, length_in, plaintext_out, &_state); 37 | } 38 | 39 | void decode(std::istream& istream_in, std::ostream& ostream_in) 40 | { 41 | base64_init_decodestate(&_state); 42 | // 43 | const int N = _buffersize; 44 | char* code = new char[N]; 45 | char* plaintext = new char[N]; 46 | int codelength; 47 | int plainlength; 48 | 49 | do 50 | { 51 | istream_in.read((char*)code, N); 52 | codelength = istream_in.gcount(); 53 | plainlength = decode(code, codelength, plaintext); 54 | ostream_in.write((const char*)plaintext, plainlength); 55 | } 56 | while (istream_in.good() && codelength > 0); 57 | // 58 | base64_init_decodestate(&_state); 59 | 60 | delete [] code; 61 | delete [] plaintext; 62 | } 63 | }; 64 | 65 | } // namespace base64 66 | 67 | 68 | 69 | #endif // BASE64_DECODE_H 70 | 71 | -------------------------------------------------------------------------------- /base64/lib/libb64/include/b64/encode.h: -------------------------------------------------------------------------------- 1 | // :mode=c++: 2 | /* 3 | encode.h - c++ wrapper for a base64 encoding algorithm 4 | 5 | This is part of the libb64 project, and has been placed in the public domain. 6 | For details, see http://sourceforge.net/projects/libb64 7 | */ 8 | #ifndef BASE64_ENCODE_H 9 | #define BASE64_ENCODE_H 10 | 11 | #include 12 | 13 | namespace base64 14 | { 15 | extern "C" 16 | { 17 | #include "cencode.h" 18 | } 19 | 20 | struct encoder 21 | { 22 | base64_encodestate _state; 23 | int _buffersize; 24 | 25 | encoder(int buffersize_in = BUFFERSIZE) 26 | : _buffersize(buffersize_in) 27 | {} 28 | 29 | int encode(char value_in) 30 | { 31 | return base64_encode_value(value_in); 32 | } 33 | 34 | int encode(const char* code_in, const int length_in, char* plaintext_out) 35 | { 36 | return base64_encode_block(code_in, length_in, plaintext_out, &_state); 37 | } 38 | 39 | int encode_end(char* plaintext_out) 40 | { 41 | return base64_encode_blockend(plaintext_out, &_state); 42 | } 43 | 44 | void encode(std::istream& istream_in, std::ostream& ostream_in) 45 | { 46 | base64_init_encodestate(&_state); 47 | // 48 | const int N = _buffersize; 49 | char* plaintext = new char[N]; 50 | char* code = new char[2*N]; 51 | int plainlength; 52 | int codelength; 53 | 54 | do 55 | { 56 | istream_in.read(plaintext, N); 57 | plainlength = istream_in.gcount(); 58 | // 59 | codelength = encode(plaintext, plainlength, code); 60 | ostream_in.write(code, codelength); 61 | } 62 | while (istream_in.good() && plainlength > 0); 63 | 64 | codelength = encode_end(code); 65 | ostream_in.write(code, codelength); 66 | // 67 | base64_init_encodestate(&_state); 68 | 69 | delete [] code; 70 | delete [] plaintext; 71 | } 72 | }; 73 | 74 | } // namespace base64 75 | 76 | #endif // BASE64_ENCODE_H 77 | 78 | -------------------------------------------------------------------------------- /base64/src/base64.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2017 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #include "base64.h" 12 | 13 | extern "C" { 14 | #include "b64/cdecode.h" 15 | #include "b64/cencode.h" 16 | } 17 | 18 | namespace base64 { 19 | auto encode(BufferView in) 20 | -> Buffer 21 | { 22 | Buffer out; 23 | 24 | base64_encodestate state; 25 | base64_init_encodestate(&state); 26 | 27 | // Worst case size is 2x after encoding 28 | out.resize(in.size() * 2); 29 | 30 | // Do the encoding 31 | auto encoded_len = base64_encode_block( 32 | reinterpret_cast(in.data()), 33 | in.size(), 34 | reinterpret_cast(&out[0]), 35 | &state 36 | ); 37 | 38 | // Add trailing/padding '='s if necessary 39 | encoded_len += base64_encode_blockend( 40 | reinterpret_cast(&out[encoded_len]), &state 41 | ); 42 | 43 | // Resize to actual size 44 | out.resize(encoded_len); 45 | 46 | return out; 47 | } 48 | 49 | auto decode(BufferView in) 50 | -> Buffer 51 | { 52 | Buffer out; 53 | 54 | base64_decodestate state; 55 | base64_init_decodestate(&state); 56 | 57 | // Worst case size is same size after decoding 58 | out.resize(in.size()); 59 | 60 | // Do the decoding 61 | auto decoded_len = base64_decode_block( 62 | reinterpret_cast(in.data()), 63 | in.size(), 64 | reinterpret_cast(&out[0]), 65 | &state 66 | ); 67 | 68 | // Resize to actual size 69 | out.resize(decoded_len); 70 | 71 | return out; 72 | } 73 | } // namespace base64 74 | -------------------------------------------------------------------------------- /base64/src/base64.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2017 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | #pragma once 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | namespace base64 { 18 | using Buffer = std::vector; 19 | using BufferView = std::span; 20 | 21 | auto encode(BufferView in) 22 | -> Buffer; 23 | 24 | auto decode(BufferView in) 25 | -> Buffer; 26 | } // namespace base64 27 | -------------------------------------------------------------------------------- /captive_portal/lib/dns_server/LICENSE: -------------------------------------------------------------------------------- 1 | From: https://github.com/bbx10/DNSServer_tng 2 | Modified by: Paul Reimer 2018 3 | -------------------------------------------------------------------------------- /captive_portal/lib/dns_server/dns_server.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "dns_types.h" 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | class DNSServer 11 | { 12 | public: 13 | DNSServer() = default; 14 | 15 | auto set_error_reply_code(DNSReplyCode _error_reply_code) 16 | -> void; 17 | auto set_ttl(uint32_t _ttl) 18 | -> void; 19 | 20 | auto start( 21 | uint16_t _port, 22 | uint32_t _resolved_ip 23 | ) -> bool; 24 | 25 | auto stop() 26 | -> void; 27 | 28 | auto process_next_request() 29 | -> bool; 30 | 31 | protected: 32 | auto request_includes_only_one_question() 33 | -> bool; 34 | 35 | auto reply_with_ip( 36 | struct sockaddr_in* to_addr, 37 | int to_addr_len, 38 | uint32_t answer_ip 39 | ) 40 | -> bool; 41 | 42 | auto reply_with_custom_code( 43 | struct sockaddr_in* to_addr, 44 | int to_addr_len 45 | ) 46 | -> bool; 47 | 48 | private: 49 | int sockfd = -1; 50 | uint16_t port = 53; 51 | uint32_t resolved_ip; 52 | uint32_t null_ip = 0; 53 | 54 | static constexpr int rx_buffer_len = 1460; 55 | uint8_t rx_buffer[rx_buffer_len]; 56 | 57 | static constexpr int tx_buffer_len = 1460; 58 | uint8_t tx_buffer[tx_buffer_len]; 59 | 60 | DNSHeader dns_header; 61 | uint32_t ttl = htonl(DNS_DEFAULT_TTL); 62 | DNSReplyCode error_reply_code = DNSReplyCode::NonExistentDomain; 63 | DNSQuestion dns_question; 64 | }; 65 | -------------------------------------------------------------------------------- /captive_portal/lib/dns_server/library.properties: -------------------------------------------------------------------------------- 1 | name=DNSServer 2 | version=1.1.0 3 | author=Kristijan Novoselić 4 | maintainer=Kristijan Novoselić, 5 | sentence=A simple DNS server for ESP32. 6 | paragraph=This library implements a simple DNS server. 7 | category=Communication 8 | url= 9 | architectures=esp32 10 | -------------------------------------------------------------------------------- /captive_portal/src/dns_server_actor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "actor_model.h" 14 | 15 | namespace CaptivePortal { 16 | 17 | auto dns_server_actor_behaviour( 18 | const ActorModel::Pid& self, 19 | ActorModel::StatePtr& state, 20 | const ActorModel::Message& message 21 | ) -> ActorModel::ResultUnion; 22 | 23 | } // namespace CaptivePortal 24 | -------------------------------------------------------------------------------- /curl/lib/curl/COPYING: -------------------------------------------------------------------------------- 1 | COPYRIGHT AND PERMISSION NOTICE 2 | 3 | Copyright (c) 1996 - 2022, Daniel Stenberg, , and many 4 | contributors, see the THANKS file. 5 | 6 | All rights reserved. 7 | 8 | Permission to use, copy, modify, and distribute this software for any purpose 9 | with or without fee is hereby granted, provided that the above copyright 10 | notice and this permission notice appear in all copies. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN 15 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 16 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 17 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 18 | OR OTHER DEALINGS IN THE SOFTWARE. 19 | 20 | Except as contained in this notice, the name of a copyright holder shall not 21 | be used in advertising or otherwise to promote the sale, use or other dealings 22 | in this Software without prior written authorization of the copyright holder. 23 | -------------------------------------------------------------------------------- /curl/lib/curl/include/curl/stdcheaders.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_STDCHEADERS_H 2 | #define CURLINC_STDCHEADERS_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include 28 | 29 | size_t fread(void *, size_t, size_t, FILE *); 30 | size_t fwrite(const void *, size_t, size_t, FILE *); 31 | 32 | int strcasecmp(const char *, const char *); 33 | int strncasecmp(const char *, const char *, size_t); 34 | 35 | #endif /* CURLINC_STDCHEADERS_H */ 36 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/amigaos.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_AMIGAOS_H 2 | #define HEADER_CURL_AMIGAOS_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | #include "curl_setup.h" 27 | 28 | #if defined(__AMIGA__) && defined(HAVE_PROTO_BSDSOCKET_H) && \ 29 | (!defined(USE_AMISSL) || defined(__amigaos4__)) 30 | 31 | CURLcode Curl_amiga_init(void); 32 | void Curl_amiga_cleanup(void); 33 | 34 | #else 35 | 36 | #define Curl_amiga_init() CURLE_OK 37 | #define Curl_amiga_cleanup() Curl_nop_stmt 38 | 39 | #endif 40 | 41 | #endif /* HEADER_CURL_AMIGAOS_H */ 42 | 43 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/curl_base64.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_BASE64_H 2 | #define HEADER_CURL_BASE64_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | CURLcode Curl_base64_encode(const char *inputbuff, size_t insize, 28 | char **outptr, size_t *outlen); 29 | CURLcode Curl_base64url_encode(const char *inputbuff, size_t insize, 30 | char **outptr, size_t *outlen); 31 | CURLcode Curl_base64_decode(const char *src, 32 | unsigned char **outptr, size_t *outlen); 33 | 34 | #endif /* HEADER_CURL_BASE64_H */ 35 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/curl_des.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_DES_H 2 | #define HEADER_CURL_DES_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 2015 - 2022, Steve Holme, . 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include "curl_setup.h" 28 | 29 | #if defined(USE_CURL_NTLM_CORE) && !defined(USE_WOLFSSL) && \ 30 | (defined(USE_GNUTLS) || \ 31 | defined(USE_NSS) || \ 32 | defined(USE_SECTRANSP) || \ 33 | defined(USE_OS400CRYPTO) || \ 34 | defined(USE_WIN32_CRYPTO)) 35 | 36 | /* Applies odd parity to the given byte array */ 37 | void Curl_des_set_odd_parity(unsigned char *bytes, size_t length); 38 | 39 | #endif 40 | 41 | #endif /* HEADER_CURL_DES_H */ 42 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/curl_endian.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_ENDIAN_H 2 | #define HEADER_CURL_ENDIAN_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | /* Converts a 16-bit integer from little endian */ 28 | unsigned short Curl_read16_le(const unsigned char *buf); 29 | 30 | /* Converts a 32-bit integer from little endian */ 31 | unsigned int Curl_read32_le(const unsigned char *buf); 32 | 33 | /* Converts a 16-bit integer from big endian */ 34 | unsigned short Curl_read16_be(const unsigned char *buf); 35 | 36 | #if (SIZEOF_CURL_OFF_T > 4) 37 | /* Converts a 64-bit integer to little endian */ 38 | #if defined(HAVE_LONGLONG) 39 | void Curl_write64_le(const long long value, unsigned char *buffer); 40 | #else 41 | void Curl_write64_le(const __int64 value, unsigned char *buffer); 42 | #endif 43 | #endif 44 | 45 | #endif /* HEADER_CURL_ENDIAN_H */ 46 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/curl_get_line.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_GET_LINE_H 2 | #define HEADER_CURL_GET_LINE_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | /* get_line() makes sure to only return complete whole lines that fit in 'len' 28 | * bytes and end with a newline. */ 29 | char *Curl_get_line(char *buf, int len, FILE *input); 30 | 31 | #endif /* HEADER_CURL_GET_LINE_H */ 32 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/curl_gethostname.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_GETHOSTNAME_H 2 | #define HEADER_CURL_GETHOSTNAME_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | /* Hostname buffer size */ 28 | #define HOSTNAME_MAX 1024 29 | 30 | /* This returns the local machine's un-qualified hostname */ 31 | int Curl_gethostname(char * const name, GETHOSTNAME_TYPE_ARG2 namelen); 32 | 33 | #endif /* HEADER_CURL_GETHOSTNAME_H */ 34 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/curl_ldap.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_LDAP_H 2 | #define HEADER_CURL_LDAP_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | #ifndef CURL_DISABLE_LDAP 27 | extern const struct Curl_handler Curl_handler_ldap; 28 | 29 | #if !defined(CURL_DISABLE_LDAPS) && \ 30 | ((defined(USE_OPENLDAP) && defined(USE_SSL)) || \ 31 | (!defined(USE_OPENLDAP) && defined(HAVE_LDAP_SSL))) 32 | extern const struct Curl_handler Curl_handler_ldaps; 33 | #endif 34 | 35 | #endif 36 | #endif /* HEADER_CURL_LDAP_H */ 37 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/curl_md4.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_MD4_H 2 | #define HEADER_CURL_MD4_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include "curl_setup.h" 28 | 29 | #if !defined(CURL_DISABLE_CRYPTO_AUTH) 30 | 31 | #define MD4_DIGEST_LENGTH 16 32 | 33 | void Curl_md4it(unsigned char *output, const unsigned char *input, 34 | const size_t len); 35 | 36 | #endif /* !defined(CURL_DISABLE_CRYPTO_AUTH) */ 37 | 38 | #endif /* HEADER_CURL_MD4_H */ 39 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/curl_memrchr.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_MEMRCHR_H 2 | #define HEADER_CURL_MEMRCHR_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include "curl_setup.h" 28 | 29 | #ifdef HAVE_MEMRCHR 30 | 31 | #ifdef HAVE_STRING_H 32 | # include 33 | #endif 34 | #ifdef HAVE_STRINGS_H 35 | # include 36 | #endif 37 | 38 | #else /* HAVE_MEMRCHR */ 39 | 40 | void *Curl_memrchr(const void *s, int c, size_t n); 41 | 42 | #define memrchr(x,y,z) Curl_memrchr((x),(y),(z)) 43 | 44 | #endif /* HAVE_MEMRCHR */ 45 | 46 | #endif /* HEADER_CURL_MEMRCHR_H */ 47 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/curl_ntlm_wb.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_NTLM_WB_H 2 | #define HEADER_CURL_NTLM_WB_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include "curl_setup.h" 28 | 29 | #if !defined(CURL_DISABLE_HTTP) && defined(USE_NTLM) && \ 30 | defined(NTLM_WB_ENABLED) 31 | 32 | /* this is for ntlm header input */ 33 | CURLcode Curl_input_ntlm_wb(struct Curl_easy *data, 34 | struct connectdata *conn, bool proxy, 35 | const char *header); 36 | 37 | /* this is for creating ntlm header output */ 38 | CURLcode Curl_output_ntlm_wb(struct Curl_easy *data, struct connectdata *conn, 39 | bool proxy); 40 | 41 | void Curl_http_auth_cleanup_ntlm_wb(struct connectdata *conn); 42 | 43 | #endif /* !CURL_DISABLE_HTTP && USE_NTLM && NTLM_WB_ENABLED */ 44 | 45 | #endif /* HEADER_CURL_NTLM_WB_H */ 46 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/curl_path.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_PATH_H 2 | #define HEADER_CURL_PATH_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include "curl_setup.h" 28 | #include 29 | #include "urldata.h" 30 | 31 | #ifdef WIN32 32 | # undef PATH_MAX 33 | # define PATH_MAX MAX_PATH 34 | # ifndef R_OK 35 | # define R_OK 4 36 | # endif 37 | #endif 38 | 39 | #ifndef PATH_MAX 40 | #define PATH_MAX 1024 /* just an extra precaution since there are systems that 41 | have their definition hidden well */ 42 | #endif 43 | 44 | CURLcode Curl_getworkingpath(struct Curl_easy *data, 45 | char *homedir, 46 | char **path); 47 | 48 | CURLcode Curl_get_pathname(const char **cpp, char **path, char *homedir); 49 | #endif /* HEADER_CURL_PATH_H */ 50 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/curl_printf.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_PRINTF_H 2 | #define HEADER_CURL_PRINTF_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | /* 28 | * This header should be included by ALL code in libcurl that uses any 29 | * *rintf() functions. 30 | */ 31 | 32 | #include 33 | 34 | # undef printf 35 | # undef fprintf 36 | # undef msnprintf 37 | # undef vprintf 38 | # undef vfprintf 39 | # undef vsnprintf 40 | # undef aprintf 41 | # undef vaprintf 42 | # define printf curl_mprintf 43 | # define fprintf curl_mfprintf 44 | # define msnprintf curl_msnprintf 45 | # define vprintf curl_mvprintf 46 | # define vfprintf curl_mvfprintf 47 | # define mvsnprintf curl_mvsnprintf 48 | # define aprintf curl_maprintf 49 | # define vaprintf curl_mvaprintf 50 | #endif /* HEADER_CURL_PRINTF_H */ 51 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/curl_range.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_RANGE_H 2 | #define HEADER_CURL_RANGE_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include "curl_setup.h" 28 | #include "urldata.h" 29 | 30 | CURLcode Curl_range(struct Curl_easy *data); 31 | #endif /* HEADER_CURL_RANGE_H */ 32 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/curl_rtmp.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_RTMP_H 2 | #define HEADER_CURL_RTMP_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 2010 - 2022, Howard Chu, 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | #ifdef USE_LIBRTMP 27 | extern const struct Curl_handler Curl_handler_rtmp; 28 | extern const struct Curl_handler Curl_handler_rtmpt; 29 | extern const struct Curl_handler Curl_handler_rtmpe; 30 | extern const struct Curl_handler Curl_handler_rtmpte; 31 | extern const struct Curl_handler Curl_handler_rtmps; 32 | extern const struct Curl_handler Curl_handler_rtmpts; 33 | #endif 34 | 35 | #endif /* HEADER_CURL_RTMP_H */ 36 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/curl_sha256.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_SHA256_H 2 | #define HEADER_CURL_SHA256_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 2017, Florin Petriuc, 11 | * Copyright (C) 2018 - 2022, Daniel Stenberg, , et al. 12 | * 13 | * This software is licensed as described in the file COPYING, which 14 | * you should have received as part of this distribution. The terms 15 | * are also available at https://curl.se/docs/copyright.html. 16 | * 17 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 18 | * copies of the Software, and permit persons to whom the Software is 19 | * furnished to do so, under the terms of the COPYING file. 20 | * 21 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 22 | * KIND, either express or implied. 23 | * 24 | * SPDX-License-Identifier: curl 25 | * 26 | ***************************************************************************/ 27 | 28 | #ifndef CURL_DISABLE_CRYPTO_AUTH 29 | #include "curl_hmac.h" 30 | 31 | extern const struct HMAC_params Curl_HMAC_SHA256[1]; 32 | 33 | #ifdef USE_WOLFSSL 34 | /* SHA256_DIGEST_LENGTH is an enum value in wolfSSL. Need to import it from 35 | * sha.h*/ 36 | #include 37 | #include 38 | #else 39 | #define SHA256_DIGEST_LENGTH 32 40 | #endif 41 | 42 | CURLcode Curl_sha256it(unsigned char *outbuffer, const unsigned char *input, 43 | const size_t len); 44 | 45 | #endif 46 | 47 | #endif /* HEADER_CURL_SHA256_H */ 48 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/dict.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_DICT_H 2 | #define HEADER_CURL_DICT_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #ifndef CURL_DISABLE_DICT 28 | extern const struct Curl_handler Curl_handler_dict; 29 | #endif 30 | 31 | #endif /* HEADER_CURL_DICT_H */ 32 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/dotdot.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_DOTDOT_H 2 | #define HEADER_CURL_DOTDOT_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | char *Curl_dedotdotify(const char *input); 27 | #endif /* HEADER_CURL_DOTDOT_H */ 28 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/easyif.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_EASYIF_H 2 | #define HEADER_CURL_EASYIF_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | /* 28 | * Prototypes for library-wide functions provided by easy.c 29 | */ 30 | #ifdef CURLDEBUG 31 | CURL_EXTERN CURLcode curl_easy_perform_ev(struct Curl_easy *easy); 32 | #endif 33 | 34 | #endif /* HEADER_CURL_EASYIF_H */ 35 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/easyoptions.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_EASYOPTIONS_H 2 | #define HEADER_CURL_EASYOPTIONS_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | /* should probably go into the public header */ 28 | 29 | #include 30 | 31 | /* generated table with all easy options */ 32 | extern struct curl_easyoption Curl_easyopts[]; 33 | 34 | #ifdef DEBUGBUILD 35 | int Curl_easyopts_check(void); 36 | #endif 37 | #endif 38 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/escape.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_ESCAPE_H 2 | #define HEADER_CURL_ESCAPE_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | /* Escape and unescape URL encoding in strings. The functions return a new 27 | * allocated string or NULL if an error occurred. */ 28 | 29 | bool Curl_isunreserved(unsigned char in); 30 | 31 | enum urlreject { 32 | REJECT_NADA = 2, 33 | REJECT_CTRL, 34 | REJECT_ZERO 35 | }; 36 | 37 | CURLcode Curl_urldecode(const char *string, size_t length, 38 | char **ostring, size_t *olen, 39 | enum urlreject ctrl); 40 | 41 | #endif /* HEADER_CURL_ESCAPE_H */ 42 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/file.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_FILE_H 2 | #define HEADER_CURL_FILE_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | 28 | /**************************************************************************** 29 | * FILE unique setup 30 | ***************************************************************************/ 31 | struct FILEPROTO { 32 | char *path; /* the path we operate on */ 33 | char *freepath; /* pointer to the allocated block we must free, this might 34 | differ from the 'path' pointer */ 35 | int fd; /* open file descriptor to read from! */ 36 | }; 37 | 38 | #ifndef CURL_DISABLE_FILE 39 | extern const struct Curl_handler Curl_handler_file; 40 | #endif 41 | 42 | #endif /* HEADER_CURL_FILE_H */ 43 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/fileinfo.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_FILEINFO_H 2 | #define HEADER_CURL_FILEINFO_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 2010 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include 28 | #include "llist.h" 29 | 30 | struct fileinfo { 31 | struct curl_fileinfo info; 32 | struct Curl_llist_element list; 33 | }; 34 | 35 | struct fileinfo *Curl_fileinfo_alloc(void); 36 | void Curl_fileinfo_cleanup(struct fileinfo *finfo); 37 | 38 | #endif /* HEADER_CURL_FILEINFO_H */ 39 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/fopen.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_FOPEN_H 2 | #define HEADER_CURL_FOPEN_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | CURLcode Curl_fopen(struct Curl_easy *data, const char *filename, 28 | FILE **fh, char **tempname); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/ftplistparser.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_FTPLISTPARSER_H 2 | #define HEADER_CURL_FTPLISTPARSER_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | #include "curl_setup.h" 27 | 28 | #ifndef CURL_DISABLE_FTP 29 | 30 | /* WRITEFUNCTION callback for parsing LIST responses */ 31 | size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb, 32 | void *connptr); 33 | 34 | struct ftp_parselist_data; /* defined inside ftplibparser.c */ 35 | 36 | CURLcode Curl_ftp_parselist_geterror(struct ftp_parselist_data *pl_data); 37 | 38 | struct ftp_parselist_data *Curl_ftp_parselist_data_alloc(void); 39 | 40 | void Curl_ftp_parselist_data_free(struct ftp_parselist_data **pl_data); 41 | 42 | #endif /* CURL_DISABLE_FTP */ 43 | #endif /* HEADER_CURL_FTPLISTPARSER_H */ 44 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/getinfo.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_GETINFO_H 2 | #define HEADER_CURL_GETINFO_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | CURLcode Curl_getinfo(struct Curl_easy *data, CURLINFO info, ...); 27 | CURLcode Curl_initinfo(struct Curl_easy *data); 28 | 29 | #endif /* HEADER_CURL_GETINFO_H */ 30 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/gopher.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_GOPHER_H 2 | #define HEADER_CURL_GOPHER_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #ifndef CURL_DISABLE_GOPHER 28 | extern const struct Curl_handler Curl_handler_gopher; 29 | #ifdef USE_SSL 30 | extern const struct Curl_handler Curl_handler_gophers; 31 | #endif 32 | #endif 33 | 34 | #endif /* HEADER_CURL_GOPHER_H */ 35 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/http_aws_sigv4.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_HTTP_AWS_SIGV4_H 2 | #define HEADER_CURL_HTTP_AWS_SIGV4_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | #include "curl_setup.h" 27 | 28 | /* this is for creating aws_sigv4 header output */ 29 | CURLcode Curl_output_aws_sigv4(struct Curl_easy *data, bool proxy); 30 | 31 | #endif /* HEADER_CURL_HTTP_AWS_SIGV4_H */ 32 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/http_digest.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_HTTP_DIGEST_H 2 | #define HEADER_CURL_HTTP_DIGEST_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | #include "curl_setup.h" 27 | 28 | #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH) 29 | 30 | /* this is for digest header input */ 31 | CURLcode Curl_input_digest(struct Curl_easy *data, 32 | bool proxy, const char *header); 33 | 34 | /* this is for creating digest header output */ 35 | CURLcode Curl_output_digest(struct Curl_easy *data, 36 | bool proxy, 37 | const unsigned char *request, 38 | const unsigned char *uripath); 39 | 40 | void Curl_http_auth_cleanup_digest(struct Curl_easy *data); 41 | 42 | #endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_CRYPTO_AUTH */ 43 | 44 | #endif /* HEADER_CURL_HTTP_DIGEST_H */ 45 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/http_negotiate.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_HTTP_NEGOTIATE_H 2 | #define HEADER_CURL_HTTP_NEGOTIATE_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #if !defined(CURL_DISABLE_HTTP) && defined(USE_SPNEGO) 28 | 29 | /* this is for Negotiate header input */ 30 | CURLcode Curl_input_negotiate(struct Curl_easy *data, struct connectdata *conn, 31 | bool proxy, const char *header); 32 | 33 | /* this is for creating Negotiate header output */ 34 | CURLcode Curl_output_negotiate(struct Curl_easy *data, 35 | struct connectdata *conn, bool proxy); 36 | 37 | void Curl_http_auth_cleanup_negotiate(struct connectdata *conn); 38 | 39 | #else /* !CURL_DISABLE_HTTP && USE_SPNEGO */ 40 | #define Curl_http_auth_cleanup_negotiate(x) 41 | #endif 42 | 43 | #endif /* HEADER_CURL_HTTP_NEGOTIATE_H */ 44 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/http_ntlm.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_HTTP_NTLM_H 2 | #define HEADER_CURL_HTTP_NTLM_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include "curl_setup.h" 28 | 29 | #if !defined(CURL_DISABLE_HTTP) && defined(USE_NTLM) 30 | 31 | /* this is for ntlm header input */ 32 | CURLcode Curl_input_ntlm(struct Curl_easy *data, bool proxy, 33 | const char *header); 34 | 35 | /* this is for creating ntlm header output */ 36 | CURLcode Curl_output_ntlm(struct Curl_easy *data, bool proxy); 37 | 38 | void Curl_http_auth_cleanup_ntlm(struct connectdata *conn); 39 | 40 | #else /* !CURL_DISABLE_HTTP && USE_NTLM */ 41 | #define Curl_http_auth_cleanup_ntlm(x) 42 | #endif 43 | 44 | #endif /* HEADER_CURL_HTTP_NTLM_H */ 45 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/inet_ntop.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_INET_NTOP_H 2 | #define HEADER_CURL_INET_NTOP_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include "curl_setup.h" 28 | 29 | char *Curl_inet_ntop(int af, const void *addr, char *buf, size_t size); 30 | 31 | #ifdef HAVE_INET_NTOP 32 | #ifdef HAVE_ARPA_INET_H 33 | #include 34 | #endif 35 | #define Curl_inet_ntop(af,addr,buf,size) \ 36 | inet_ntop(af, addr, buf, (curl_socklen_t)size) 37 | #endif 38 | 39 | #endif /* HEADER_CURL_INET_NTOP_H */ 40 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/inet_pton.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_INET_PTON_H 2 | #define HEADER_CURL_INET_PTON_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include "curl_setup.h" 28 | 29 | int Curl_inet_pton(int, const char *, void *); 30 | 31 | #ifdef HAVE_INET_PTON 32 | #ifdef HAVE_ARPA_INET_H 33 | #include 34 | #elif defined(HAVE_WS2TCPIP_H) 35 | /* inet_pton() exists in Vista or later */ 36 | #include 37 | #endif 38 | #define Curl_inet_pton(x,y,z) inet_pton(x,y,z) 39 | #endif 40 | 41 | #endif /* HEADER_CURL_INET_PTON_H */ 42 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/nonblock.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_NONBLOCK_H 2 | #define HEADER_CURL_NONBLOCK_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include /* for curl_socket_t */ 28 | 29 | int curlx_nonblock(curl_socket_t sockfd, /* operate on this */ 30 | int nonblock /* TRUE or FALSE */); 31 | 32 | #endif /* HEADER_CURL_NONBLOCK_H */ 33 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/parsedate.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_PARSEDATE_H 2 | #define HEADER_CURL_PARSEDATE_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | extern const char * const Curl_wkday[7]; 28 | extern const char * const Curl_month[12]; 29 | 30 | CURLcode Curl_gmtime(time_t intime, struct tm *store); 31 | 32 | /* Curl_getdate_capped() differs from curl_getdate() in that this will return 33 | TIME_T_MAX in case the parsed time value was too big, instead of an 34 | error. */ 35 | 36 | time_t Curl_getdate_capped(const char *p); 37 | 38 | #endif /* HEADER_CURL_PARSEDATE_H */ 39 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/psl.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_PSL_H 2 | #define HEADER_PSL_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #ifdef USE_LIBPSL 28 | #include 29 | 30 | #define PSL_TTL (72 * 3600) /* PSL time to live before a refresh. */ 31 | 32 | struct PslCache { 33 | const psl_ctx_t *psl; /* The PSL. */ 34 | time_t expires; /* Time this PSL life expires. */ 35 | bool dynamic; /* PSL should be released when no longer needed. */ 36 | }; 37 | 38 | const psl_ctx_t *Curl_psl_use(struct Curl_easy *easy); 39 | void Curl_psl_release(struct Curl_easy *easy); 40 | void Curl_psl_destroy(struct PslCache *pslcache); 41 | 42 | #else 43 | 44 | #define Curl_psl_use(easy) NULL 45 | #define Curl_psl_release(easy) 46 | #define Curl_psl_destroy(pslcache) 47 | 48 | #endif /* USE_LIBPSL */ 49 | #endif /* HEADER_PSL_H */ 50 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/rename.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_RENAME_H 2 | #define HEADER_CURL_RENAME_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 2020 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | int Curl_rename(const char *oldpath, const char *newpath); 28 | 29 | #endif /* HEADER_CURL_RENAME_H */ 30 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/setopt.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_SETOPT_H 2 | #define HEADER_CURL_SETOPT_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | CURLcode Curl_setstropt(char **charp, const char *s); 28 | CURLcode Curl_setblobopt(struct curl_blob **blobp, 29 | const struct curl_blob *blob); 30 | CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list arg); 31 | 32 | #endif /* HEADER_CURL_SETOPT_H */ 33 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/slist.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_SLIST_H 2 | #define HEADER_CURL_SLIST_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | /* 28 | * Curl_slist_duplicate() duplicates a linked list. It always returns the 29 | * address of the first record of the cloned list or NULL in case of an 30 | * error (or if the input list was NULL). 31 | */ 32 | struct curl_slist *Curl_slist_duplicate(struct curl_slist *inlist); 33 | 34 | /* 35 | * Curl_slist_append_nodup() takes ownership of the given string and appends 36 | * it to the list. 37 | */ 38 | struct curl_slist *Curl_slist_append_nodup(struct curl_slist *list, 39 | char *data); 40 | 41 | #endif /* HEADER_CURL_SLIST_H */ 42 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/sockaddr.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_SOCKADDR_H 2 | #define HEADER_CURL_SOCKADDR_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include "curl_setup.h" 28 | 29 | struct Curl_sockaddr_storage { 30 | union { 31 | struct sockaddr sa; 32 | struct sockaddr_in sa_in; 33 | #ifdef ENABLE_IPV6 34 | struct sockaddr_in6 sa_in6; 35 | #endif 36 | #ifdef HAVE_STRUCT_SOCKADDR_STORAGE 37 | struct sockaddr_storage sa_stor; 38 | #else 39 | char cbuf[256]; /* this should be big enough to fit a lot */ 40 | #endif 41 | } buffer; 42 | }; 43 | 44 | #endif /* HEADER_CURL_SOCKADDR_H */ 45 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/socketpair.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_SOCKETPAIR_H 2 | #define HEADER_CURL_SOCKETPAIR_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 2019 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include "curl_setup.h" 28 | #ifndef HAVE_SOCKETPAIR 29 | int Curl_socketpair(int domain, int type, int protocol, 30 | curl_socket_t socks[2]); 31 | #else 32 | #define Curl_socketpair(a,b,c,d) socketpair(a,b,c,d) 33 | #endif 34 | 35 | #endif /* HEADER_CURL_SOCKETPAIR_H */ 36 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/speedcheck.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_SPEEDCHECK_H 2 | #define HEADER_CURL_SPEEDCHECK_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include "curl_setup.h" 28 | 29 | #include "timeval.h" 30 | 31 | void Curl_speedinit(struct Curl_easy *data); 32 | CURLcode Curl_speedcheck(struct Curl_easy *data, 33 | struct curltime now); 34 | 35 | #endif /* HEADER_CURL_SPEEDCHECK_H */ 36 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/strdup.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_STRDUP_H 2 | #define HEADER_CURL_STRDUP_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | #include "curl_setup.h" 27 | 28 | #ifndef HAVE_STRDUP 29 | extern char *curlx_strdup(const char *str); 30 | #endif 31 | #ifdef WIN32 32 | wchar_t* Curl_wcsdup(const wchar_t* src); 33 | #endif 34 | void *Curl_memdup(const void *src, size_t buffer_length); 35 | void *Curl_saferealloc(void *ptr, size_t size); 36 | 37 | #endif /* HEADER_CURL_STRDUP_H */ 38 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/strerror.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_STRERROR_H 2 | #define HEADER_CURL_STRERROR_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include "urldata.h" 28 | 29 | #define STRERROR_LEN 256 /* a suitable length */ 30 | 31 | const char *Curl_strerror(int err, char *buf, size_t buflen); 32 | #if defined(WIN32) || defined(_WIN32_WCE) 33 | const char *Curl_winapi_strerror(DWORD err, char *buf, size_t buflen); 34 | #endif 35 | #ifdef USE_WINDOWS_SSPI 36 | const char *Curl_sspi_strerror(int err, char *buf, size_t buflen); 37 | #endif 38 | 39 | #endif /* HEADER_CURL_STRERROR_H */ 40 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/strtok.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_STRTOK_H 2 | #define HEADER_CURL_STRTOK_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | #include "curl_setup.h" 27 | #include 28 | 29 | #ifndef HAVE_STRTOK_R 30 | char *Curl_strtok_r(char *s, const char *delim, char **last); 31 | #define strtok_r Curl_strtok_r 32 | #else 33 | #include 34 | #endif 35 | 36 | #endif /* HEADER_CURL_STRTOK_H */ 37 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/system_win32.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_SYSTEM_WIN32_H 2 | #define HEADER_CURL_SYSTEM_WIN32_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 2016 - 2022, Steve Holme, . 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include "curl_setup.h" 28 | 29 | #if defined(WIN32) 30 | 31 | extern LARGE_INTEGER Curl_freq; 32 | extern bool Curl_isVistaOrGreater; 33 | 34 | CURLcode Curl_win32_init(long flags); 35 | void Curl_win32_cleanup(long init_flags); 36 | 37 | /* We use our own typedef here since some headers might lack this */ 38 | typedef unsigned int(WINAPI *IF_NAMETOINDEX_FN)(const char *); 39 | 40 | /* This is used instead of if_nametoindex if available on Windows */ 41 | extern IF_NAMETOINDEX_FN Curl_if_nametoindex; 42 | 43 | /* This is used to dynamically load DLLs */ 44 | HMODULE Curl_load_library(LPCTSTR filename); 45 | 46 | #endif /* WIN32 */ 47 | 48 | #endif /* HEADER_CURL_SYSTEM_WIN32_H */ 49 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/telnet.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_TELNET_H 2 | #define HEADER_CURL_TELNET_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | #ifndef CURL_DISABLE_TELNET 27 | extern const struct Curl_handler Curl_handler_telnet; 28 | #endif 29 | 30 | #endif /* HEADER_CURL_TELNET_H */ 31 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/tftp.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_TFTP_H 2 | #define HEADER_CURL_TFTP_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | #ifndef CURL_DISABLE_TFTP 27 | extern const struct Curl_handler Curl_handler_tftp; 28 | #endif 29 | 30 | #endif /* HEADER_CURL_TFTP_H */ 31 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/urlapi-int.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_URLAPI_INT_H 2 | #define HEADER_CURL_URLAPI_INT_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | #include "curl_setup.h" 27 | 28 | bool Curl_is_absolute_url(const char *url, char *scheme, size_t buflen); 29 | 30 | #ifdef DEBUGBUILD 31 | CURLUcode Curl_parse_port(struct Curl_URL *u, char *hostname, bool); 32 | #endif 33 | 34 | #endif /* HEADER_CURL_URLAPI_INT_H */ 35 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/vauth/digest.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_DIGEST_H 2 | #define HEADER_CURL_DIGEST_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include 28 | 29 | #if !defined(CURL_DISABLE_CRYPTO_AUTH) 30 | 31 | #define DIGEST_MAX_VALUE_LENGTH 256 32 | #define DIGEST_MAX_CONTENT_LENGTH 1024 33 | 34 | /* This is used to extract the realm from a challenge message */ 35 | bool Curl_auth_digest_get_pair(const char *str, char *value, char *content, 36 | const char **endptr); 37 | 38 | #endif 39 | 40 | #endif /* HEADER_CURL_DIGEST_H */ 41 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/vtls/gskit.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_GSKIT_H 2 | #define HEADER_CURL_GSKIT_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | #include "curl_setup.h" 27 | 28 | /* 29 | * This header should only be needed to get included by vtls.c and gskit.c 30 | */ 31 | 32 | #include "urldata.h" 33 | 34 | #ifdef USE_GSKIT 35 | 36 | extern const struct Curl_ssl Curl_ssl_gskit; 37 | 38 | #endif /* USE_GSKIT */ 39 | 40 | #endif /* HEADER_CURL_GSKIT_H */ 41 | -------------------------------------------------------------------------------- /curl/lib/curl/lib/vtls/mbedtls.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_MBEDTLS_H 2 | #define HEADER_CURL_MBEDTLS_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 2012 - 2022, Daniel Stenberg, , et al. 11 | * Copyright (C) 2010, Hoi-Ho Chan, 12 | * 13 | * This software is licensed as described in the file COPYING, which 14 | * you should have received as part of this distribution. The terms 15 | * are also available at https://curl.se/docs/copyright.html. 16 | * 17 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 18 | * copies of the Software, and permit persons to whom the Software is 19 | * furnished to do so, under the terms of the COPYING file. 20 | * 21 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 22 | * KIND, either express or implied. 23 | * 24 | * SPDX-License-Identifier: curl 25 | * 26 | ***************************************************************************/ 27 | #include "curl_setup.h" 28 | 29 | #ifdef USE_MBEDTLS 30 | 31 | extern const struct Curl_ssl Curl_ssl_mbedtls; 32 | 33 | #endif /* USE_MBEDTLS */ 34 | #endif /* HEADER_CURL_MBEDTLS_H */ 35 | -------------------------------------------------------------------------------- /curl/lib/posix_shims.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int 6 | access(const char *path, int mode) 7 | { 8 | struct stat buf; 9 | if (stat(path, &buf) != -1) 10 | { 11 | return 0; 12 | } 13 | else { 14 | errno = ENOENT; 15 | } 16 | 17 | return -1; 18 | } 19 | -------------------------------------------------------------------------------- /curl/lib/zlib/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 2. Altered source versions must be plainly marked as such, and must not be 16 | misrepresented as being the original software. 17 | 3. This notice may not be removed or altered from any source distribution. 18 | 19 | Jean-loup Gailly Mark Adler 20 | jloup@gzip.org madler@alumni.caltech.edu 21 | 22 | 23 | The data format used by the zlib library is described by RFCs (Request for 24 | Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 25 | (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). 26 | -------------------------------------------------------------------------------- /curl/lib/zlib/gzclose.c: -------------------------------------------------------------------------------- 1 | /* gzclose.c -- zlib gzclose() function 2 | * Copyright (C) 2004, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | #include "gzguts.h" 7 | 8 | /* gzclose() is in a separate file so that it is linked in only if it is used. 9 | That way the other gzclose functions can be used instead to avoid linking in 10 | unneeded compression or decompression routines. */ 11 | int ZEXPORT gzclose(file) 12 | gzFile file; 13 | { 14 | #ifndef NO_GZCOMPRESS 15 | gz_statep state; 16 | 17 | if (file == NULL) 18 | return Z_STREAM_ERROR; 19 | state = (gz_statep)file; 20 | 21 | return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); 22 | #else 23 | return gzclose_r(file); 24 | #endif 25 | } 26 | -------------------------------------------------------------------------------- /curl/lib/zlib/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); 12 | -------------------------------------------------------------------------------- /embedded_files/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register( 2 | INCLUDE_DIRS 3 | "src" 4 | ) 5 | -------------------------------------------------------------------------------- /embedded_files/src/embedded_files_string_view_wrapper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include 14 | #include 15 | 16 | #define DECLARE_STRING_VIEW_WRAPPER(file_name_with_ext) \ 17 | extern const char file_name_with_ext ## _start[] \ 18 | asm("_binary_" #file_name_with_ext "_start"); \ 19 | extern const char file_name_with_ext ## _end[] \ 20 | asm("_binary_" #file_name_with_ext "_end"); \ 21 | const std::string_view file_name_with_ext( \ 22 | file_name_with_ext ## _start, \ 23 | file_name_with_ext ## _end - file_name_with_ext ## _start \ 24 | ) 25 | 26 | #define DECLARE_BUFFER_VIEW_WRAPPER(file_name_with_ext) \ 27 | extern const uint8_t file_name_with_ext ## _start[] \ 28 | asm("_binary_" #file_name_with_ext "_start"); \ 29 | extern const uint8_t file_name_with_ext ## _end[] \ 30 | asm("_binary_" #file_name_with_ext "_end"); \ 31 | const std::span file_name_with_ext( \ 32 | file_name_with_ext ## _start, \ 33 | file_name_with_ext ## _end - file_name_with_ext ## _start \ 34 | ) 35 | -------------------------------------------------------------------------------- /fatfs_image/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | register_config_only_component() 2 | 3 | idf_build_get_property(build_dir BUILD_DIR) 4 | 5 | set (FATFS_IMAGE "${build_dir}/fatfs_image.img") 6 | 7 | add_custom_command( 8 | OUTPUT 9 | "${FATFS_IMAGE}" 10 | COMMAND 11 | mkfatfs 12 | -c "${build_dir}/fs" 13 | -s "${CONFIG_FATFS_PARTITION_SIZE}" 14 | "${FATFS_IMAGE}" 15 | DEPENDS 16 | "${build_dir}/fs" 17 | VERBATIM 18 | ) 19 | 20 | add_custom_target(fatfs_image DEPENDS "${FATFS_IMAGE}") 21 | 22 | set_property( 23 | DIRECTORY 24 | APPEND PROPERTY 25 | ADDITIONAL_MAKE_CLEAN_FILES 26 | "${FATFS_IMAGE}" 27 | ) 28 | 29 | esptool_py_custom_target(fatfs_image-flash fatfs_image "fatfs_image") 30 | esptool_py_flash_target_image( 31 | fatfs_image-flash 32 | fatfs_image 33 | "${CONFIG_FATFS_PARTITION_BASE_ADDR}" 34 | "${FATFS_IMAGE}" 35 | ) 36 | -------------------------------------------------------------------------------- /fatfs_image/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "FATFS Partition Image Configuration" 2 | 3 | config FATFS_PARTITION_BASE_ADDR 4 | hex "FATFS partition base address" 5 | range 100000 33546240 6 | default 110000 7 | help 8 | Starting address of the FATFS partition 9 | 10 | config FATFS_PARTITION_SIZE 11 | int "FATFS partition size in bytes" 12 | range 131072 16777216 13 | default 131072 14 | help 15 | Total size of the FATFS parition in bytes 16 | 17 | endmenu 18 | -------------------------------------------------------------------------------- /fatfs_image/get_port_args.cmake: -------------------------------------------------------------------------------- 1 | # Note: we can't expand these environment variables in the main IDF CMake build, 2 | # because we want to expand them at flashing time not at CMake runtime (so they can change 3 | # without needing a CMake re-run) 4 | set(ESPPORT $ENV{ESPPORT}) 5 | if(NOT ESPPORT) 6 | message("Note: ${TOOL} will search for a serial port. To specify a port, set the ESPPORT environment variable.") 7 | else() 8 | set(port_arg "-p ${ESPPORT}") 9 | endif() 10 | 11 | set(ESPBAUD $ENV{ESPBAUD}) 12 | if(NOT ESPBAUD) 13 | message("Note: ${TOOL} will attempt to set baud rate automatically. " 14 | "To specify a baud rate, set the ESPBAUD environment variable.") 15 | else() 16 | set(baud_arg "-b ${ESPBAUD}") 17 | endif() 18 | 19 | -------------------------------------------------------------------------------- /fatfs_image/run_cmd.cmake: -------------------------------------------------------------------------------- 1 | if(NOT IDF_PATH) 2 | message(FATAL_ERROR "IDF_PATH not set.") 3 | endif() 4 | include("${IDF_PATH}/tools/cmake/utilities.cmake") 5 | spaces2list(CMD) 6 | 7 | execute_process(COMMAND ${CMD} 8 | WORKING_DIRECTORY "${WORKING_DIRECTORY}" 9 | RESULT_VARIABLE result 10 | ) 11 | 12 | if(${result}) 13 | # No way to have CMake silently fail, unfortunately 14 | message(FATAL_ERROR "${TOOL} failed") 15 | endif() 16 | -------------------------------------------------------------------------------- /fatfs_image/run_esptool.cmake: -------------------------------------------------------------------------------- 1 | # A CMake script to run esptool commands from within ninja or make 2 | # or another cmake-based build runner 3 | # 4 | # (Needed to expand environment variables, for backwards compatibility.) 5 | # 6 | # It is recommended to NOT USE this CMake script if you have the option of 7 | # running esptool.py directly. This script exists only for use inside CMake builds. 8 | # 9 | cmake_minimum_required(VERSION 3.5) 10 | 11 | set(TOOL "esptool.py") 12 | 13 | if(NOT ESPTOOLPY OR NOT ESPTOOL_ARGS) 14 | message(FATAL_ERROR "ESPTOOLPY and ESPTOOL_ARGS must " 15 | "be specified on the CMake command line. For direct execution, it is " 16 | "strongly recommended to run ${TOOL} directly.") 17 | endif() 18 | 19 | include("${CMAKE_CURRENT_LIST_DIR}/get_port_args.cmake") 20 | set(CMD "${ESPTOOLPY} ${port_arg} ${baud_arg} ${ESPTOOL_ARGS}") 21 | include("${CMAKE_CURRENT_LIST_DIR}/run_cmd.cmake") -------------------------------------------------------------------------------- /firmware_update/.gitignore: -------------------------------------------------------------------------------- 1 | test/*_test 2 | test/test_runner 3 | src/gen 4 | -------------------------------------------------------------------------------- /firmware_update/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/src/gen") 2 | 3 | idf_component_register( 4 | SRCS 5 | "src/firmware_update.cpp" 6 | "src/firmware_update_actor.cpp" 7 | INCLUDE_DIRS 8 | "src" 9 | "${CMAKE_CURRENT_BINARY_DIR}/src/gen" 10 | REQUIRES 11 | "app_update" 12 | PRIV_REQUIRES 13 | "actor_model" 14 | "driver" 15 | "flatbuffers" 16 | "mbedtls" 17 | "requests" 18 | "spi_flash" 19 | "utils" 20 | ) 21 | 22 | idf_build_get_property(build_dir BUILD_DIR) 23 | 24 | target_compile_options( 25 | ${COMPONENT_LIB} 26 | PRIVATE 27 | $<$:${EXTRA_CXX_WARNING_FLAGS}> 28 | ) 29 | 30 | set_source_files_properties( 31 | SOURCE 32 | "src/firmware_update_actor.cpp" 33 | APPEND PROPERTIES 34 | COMPILE_OPTIONS 35 | "-Wno-old-style-cast;-Wno-sign-compare;" 36 | ) 37 | 38 | FLATBUFFERS_GENERATE_GENERATED_H(firmware_update_generated_h firmware_update.fbs) 39 | 40 | set_property( 41 | SOURCE 42 | "src/firmware_update.cpp" 43 | "src/firmware_update_actor.cpp" 44 | APPEND PROPERTY 45 | OBJECT_DEPENDS 46 | "${firmware_update_generated_h_OUTPUTS}" 47 | ) 48 | add_dependencies(${COMPONENT_LIB} firmware_update_generated_h_TARGET) 49 | 50 | set_property( 51 | SOURCE 52 | "src/firmware_update.cpp" 53 | APPEND PROPERTY 54 | OBJECT_DEPENDS 55 | "${build_dir}/VERSION" 56 | ) 57 | add_custom_target(VERSION_FILE_TARGET DEPENDS "${build_dir}/VERSION") 58 | add_dependencies(${COMPONENT_LIB} VERSION_FILE_TARGET) 59 | 60 | add_definitions( 61 | -DFIRMWARE_UPDATE_ACTOR_TASK_STACK_SIZE=4096 62 | -DFIRMWARE_UPDATE_ACTOR_MAILBOX_SIZE=8192 63 | -DFIRMWARE_UPDATE_CURRENT_VERSION=${FIRMWARE_UPDATE_CURRENT_VERSION} 64 | ) 65 | -------------------------------------------------------------------------------- /firmware_update/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Firmware Update / OTA Configuration" 2 | 3 | config FIRMWARE_UPDATE_RECOVERY_URL 4 | string "Firmware Recovery URL" 5 | default "https://..." 6 | help 7 | HTTP(S) URL for "recovery" firmware image. 8 | Expects response containing image bin. 9 | 10 | config FIRMWARE_UPDATE_LATEST_URL 11 | string "Firmware Update Latest Version URL" 12 | default "https://..." 13 | help 14 | HTTP(S) URL for "latest" firmware image. 15 | Expects response containing image bin. 16 | 17 | config FIRMWARE_UPDATE_CHECK_URL 18 | string "Firmware Update Check URL" 19 | default "https://..." 20 | help 21 | HTTP(s) URL for firmware update checks. 22 | Expects response containing firmware flatbuffer. 23 | 24 | config FIRMWARE_UPDATE_CHECK_INTERVAL_SECONDS 25 | int "Firmware Update Check Interval (seconds)" 26 | range 1 1209600 27 | default 60 28 | help 29 | Number of seconds to wait between firmware update checks. 30 | 31 | config FIRMWARE_UPDATE_GDRIVE_FOLDER_ID 32 | string "Firmware Update Google Drive Folder ID" 33 | default "" 34 | help 35 | Google Drive Folder ID that holds the per-device config files. 36 | 37 | endmenu 38 | -------------------------------------------------------------------------------- /firmware_update/firmware_update.fbs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | namespace Firmware; 12 | 13 | table FileMetadata { 14 | path:string (key); 15 | checksum:string; 16 | url:string; 17 | } 18 | 19 | table FirmwareMetadata { 20 | version:uint (key); 21 | checksum:string; 22 | url:string; 23 | interval:uint = 3600; 24 | files:[FileMetadata]; 25 | } 26 | 27 | root_type FirmwareMetadata; 28 | file_identifier "FWUP"; 29 | file_extension "fb"; 30 | -------------------------------------------------------------------------------- /firmware_update/project_include.cmake: -------------------------------------------------------------------------------- 1 | idf_build_get_property(build_dir BUILD_DIR) 2 | 3 | execute_process( 4 | COMMAND cat "${build_dir}/VERSION" 5 | OUTPUT_VARIABLE VERSION_FILE_CONTENTS 6 | ) 7 | 8 | string(STRIP "${VERSION_FILE_CONTENTS}" FIRMWARE_UPDATE_CURRENT_VERSION) 9 | -------------------------------------------------------------------------------- /firmware_update/src/firmware_update.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | #include "firmware_update_generated.h" 18 | 19 | #include "esp_ota_ops.h" 20 | #include "esp_partition.h" 21 | 22 | namespace FirmwareUpdate { 23 | using string = std::string; 24 | using string_view = std::string_view; 25 | 26 | using MD5Sum = std::array; 27 | using FirmwareVersion = uint64_t; 28 | 29 | auto get_current_partition() 30 | -> const esp_partition_t*; 31 | 32 | auto get_next_ota_partition() 33 | -> const esp_partition_t*; 34 | 35 | auto get_factory_partition() 36 | -> const esp_partition_t*; 37 | 38 | auto compare_partitions(const esp_partition_t* lhs, const esp_partition_t* rhs) 39 | -> bool; 40 | 41 | auto factory_reset() 42 | -> void; 43 | 44 | auto reboot() 45 | -> void; 46 | 47 | auto get_current_firmware_version() 48 | -> FirmwareVersion; 49 | 50 | auto checksum_partition_md5( 51 | const esp_partition_t* partition, 52 | const size_t partition_size 53 | ) -> MD5Sum; 54 | 55 | auto checksum_file_md5( 56 | const string_view path 57 | ) -> MD5Sum; 58 | 59 | auto get_md5sum_hex_str(const MD5Sum& md5sum) 60 | -> string; 61 | 62 | } // namespace FirmwareUpdate 63 | -------------------------------------------------------------------------------- /firmware_update/src/firmware_update_actor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "actor_model.h" 14 | 15 | namespace FirmwareUpdate { 16 | 17 | auto firmware_update_actor_behaviour( 18 | const ActorModel::Pid& self, 19 | ActorModel::StatePtr& state, 20 | const ActorModel::Message& message 21 | ) -> ActorModel::ResultUnion; 22 | 23 | } // namespace FirmwareUpdate 24 | -------------------------------------------------------------------------------- /firmware_update/src/gen/.PLACEHOLDER: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulreimer/esp32-network-lib/b219dce0d739e19ae150dd4ed6e6b3750d750d7f/firmware_update/src/gen/.PLACEHOLDER -------------------------------------------------------------------------------- /firmware_update/templates/latest.fw.json.tpl: -------------------------------------------------------------------------------- 1 | { 2 | "version": @FIRMWARE_UPDATE_CURRENT_VERSION@, 3 | "checksum": "@FIRMWARE_UPDATE_LATEST_CHECKSUM@", 4 | "url": "@CONFIG_FIRMWARE_UPDATE_LATEST_URL@", 5 | "interval": @CONFIG_FIRMWARE_UPDATE_CHECK_INTERVAL_SECONDS@ 6 | } 7 | -------------------------------------------------------------------------------- /flatbuffers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register( 2 | SRCS 3 | "lib/flatbuffers/src/reflection.cpp" 4 | "lib/flatbuffers/src/util.cpp" 5 | "src/flatbuffers_utils.cpp" 6 | INCLUDE_DIRS 7 | "lib/flatbuffers/include" 8 | "src" 9 | ) 10 | 11 | target_compile_options( 12 | ${COMPONENT_LIB} 13 | PRIVATE 14 | $<$:${EXTRA_CXX_WARNING_FLAGS}> 15 | ) 16 | 17 | add_definitions( 18 | -DFLATBUFFERS_NO_ABSOLUTE_PATH_RESOLUTION 19 | -DFLATBUFFERS_PLATFORM_NO_FILE_SUPPORT 20 | -DFLATBUFFERS_PREFER_PRINTF 21 | ) 22 | 23 | set_source_files_properties( 24 | SOURCE 25 | "lib/flatbuffers/src/reflection.cpp" 26 | APPEND PROPERTIES 27 | COMPILE_OPTIONS 28 | "-Wno-missing-declarations;-Wno-float-conversion;-Wno-conversion;-Wno-format-nonliteral;" 29 | ) 30 | 31 | set_source_files_properties( 32 | SOURCE 33 | "lib/flatbuffers/src/util.cpp" 34 | "src/flatbuffers_utils.cpp" 35 | APPEND PROPERTIES 36 | COMPILE_OPTIONS 37 | "-Wno-missing-declarations;-Wno-float-conversion;-Wno-format-nonliteral;" 38 | ) 39 | -------------------------------------------------------------------------------- /flatbuffers/lib/flatbuffers/include/flatbuffers/bfbs_generator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef FLATBUFFERS_BFBS_GENERATOR_H_ 18 | #define FLATBUFFERS_BFBS_GENERATOR_H_ 19 | 20 | #include 21 | 22 | namespace flatbuffers { 23 | 24 | enum GeneratorStatus { 25 | OK, 26 | FAILED, 27 | FAILED_VERIFICATION, 28 | }; 29 | 30 | // A Flatbuffer Code Generator that receives a binary serialized reflection.fbs 31 | // and generates code from it. 32 | class BfbsGenerator { 33 | public: 34 | virtual ~BfbsGenerator() {} 35 | 36 | // Generate code from the provided `buffer` of given `length`. The buffer is 37 | // a serialized reflection.fbs. 38 | virtual GeneratorStatus Generate(const uint8_t *buffer, int64_t length) = 0; 39 | }; 40 | 41 | } // namespace flatbuffers 42 | 43 | #endif // FLATBUFFERS_BFBS_GENERATOR_H_ 44 | -------------------------------------------------------------------------------- /flatbuffers/lib/flatbuffers/include/flatbuffers/buffer_ref.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef FLATBUFFERS_BUFFER_REF_H_ 18 | #define FLATBUFFERS_BUFFER_REF_H_ 19 | 20 | #include "flatbuffers/base.h" 21 | #include "flatbuffers/verifier.h" 22 | 23 | namespace flatbuffers { 24 | 25 | // Convenient way to bundle a buffer and its length, to pass it around 26 | // typed by its root. 27 | // A BufferRef does not own its buffer. 28 | struct BufferRefBase {}; // for std::is_base_of 29 | 30 | template struct BufferRef : BufferRefBase { 31 | BufferRef() : buf(nullptr), len(0), must_free(false) {} 32 | BufferRef(uint8_t *_buf, uoffset_t _len) 33 | : buf(_buf), len(_len), must_free(false) {} 34 | 35 | ~BufferRef() { 36 | if (must_free) free(buf); 37 | } 38 | 39 | const T *GetRoot() const { return flatbuffers::GetRoot(buf); } 40 | 41 | bool Verify() { 42 | Verifier verifier(buf, len); 43 | return verifier.VerifyBuffer(nullptr); 44 | } 45 | 46 | uint8_t *buf; 47 | uoffset_t len; 48 | bool must_free; 49 | }; 50 | 51 | } // namespace flatbuffers 52 | 53 | #endif // FLATBUFFERS_BUFFER_REF_H_ -------------------------------------------------------------------------------- /flatbuffers/lib/flatbuffers/include/flatbuffers/flex_flat_util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef FLATBUFFERS_FLEX_FLAT_UTIL_H_ 18 | #define FLATBUFFERS_FLEX_FLAT_UTIL_H_ 19 | 20 | #include "flatbuffers/flatbuffers.h" 21 | #include "flatbuffers/flexbuffers.h" 22 | 23 | namespace flexbuffers { 24 | 25 | // Verifies the `nested` flexbuffer within a flatbuffer vector is valid. 26 | inline bool VerifyNestedFlexBuffer( 27 | const flatbuffers::Vector *const nested, 28 | flatbuffers::Verifier &verifier) { 29 | if (!nested) return true; 30 | return verifier.Check(flexbuffers::VerifyBuffer( 31 | nested->data(), nested->size(), verifier.GetFlexReuseTracker())); 32 | } 33 | 34 | } // namespace flexbuffers 35 | 36 | #endif // FLATBUFFERS_FLEX_FLAT_UTIL_H_ 37 | -------------------------------------------------------------------------------- /flatbuffers/lib/flatbuffers/include/flatbuffers/pch/flatc_pch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef FLATBUFFERS_FLATC_PCH_H_ 18 | #define FLATBUFFERS_FLATC_PCH_H_ 19 | 20 | // stl 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | // flatbuffers 33 | #include "flatbuffers/pch/pch.h" 34 | #include "flatbuffers/code_generators.h" 35 | #include "flatbuffers/flatbuffers.h" 36 | #include "flatbuffers/flexbuffers.h" 37 | #include "flatbuffers/idl.h" 38 | 39 | #endif // FLATBUFFERS_FLATC_PCH_H_ 40 | -------------------------------------------------------------------------------- /flatbuffers/lib/flatbuffers/include/flatbuffers/pch/pch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef FLATBUFFERS_PCH_H_ 18 | #define FLATBUFFERS_PCH_H_ 19 | 20 | // stl 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | // flatbuffers 36 | #include "flatbuffers/util.h" 37 | 38 | #endif // FLATBUFFERS_PCH_H_ 39 | -------------------------------------------------------------------------------- /flatbuffers/lib/flatbuffers/include/flatbuffers/struct.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef FLATBUFFERS_STRUCT_H_ 18 | #define FLATBUFFERS_STRUCT_H_ 19 | 20 | #include "flatbuffers/base.h" 21 | 22 | namespace flatbuffers { 23 | 24 | // "structs" are flat structures that do not have an offset table, thus 25 | // always have all members present and do not support forwards/backwards 26 | // compatible extensions. 27 | 28 | class Struct FLATBUFFERS_FINAL_CLASS { 29 | public: 30 | template T GetField(uoffset_t o) const { 31 | return ReadScalar(&data_[o]); 32 | } 33 | 34 | template T GetStruct(uoffset_t o) const { 35 | return reinterpret_cast(&data_[o]); 36 | } 37 | 38 | const uint8_t *GetAddressOf(uoffset_t o) const { return &data_[o]; } 39 | uint8_t *GetAddressOf(uoffset_t o) { return &data_[o]; } 40 | 41 | private: 42 | // private constructor & copy constructor: you obtain instances of this 43 | // class by pointing to existing data only 44 | Struct(); 45 | Struct(const Struct &); 46 | Struct &operator=(const Struct &); 47 | 48 | uint8_t data_[1]; 49 | }; 50 | 51 | } // namespace flatbuffers 52 | 53 | #endif // FLATBUFFERS_STRUCT_H_ -------------------------------------------------------------------------------- /flatbuffers/src/flatbuffers_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | #pragma once 11 | 12 | #include 13 | #include 14 | 15 | using GenericFlatbuffer = std::span; 16 | using FlatbufferSchema = std::string_view; 17 | 18 | struct Bounds 19 | { 20 | float min = 0.0f; 21 | float max = 1.0f; 22 | }; 23 | 24 | auto get_bounds_for_flatbuffer_field( 25 | const FlatbufferSchema& flatbuffer_bfbs, 26 | const size_t field_idx 27 | ) -> Bounds; 28 | 29 | template 30 | auto get_value_for_flatbuffer_field( 31 | const GenericFlatbuffer& flatbuffer_buf, 32 | const FlatbufferSchema& flatbuffer_bfbs, 33 | const size_t field_idx 34 | ) -> T; 35 | -------------------------------------------------------------------------------- /googleapis/assets/spreadsheet_insert_row_request_intent.req.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": {"ab": 0, "cd": 0}, 3 | "to_pid": {"ab": 0, "cd": 0}, 4 | "request": { 5 | "method": "POST", 6 | "uri": "", 7 | "query": [ 8 | { "k": "insertDataOption", "v": "INSERT_ROWS" }, 9 | { "k": "valueInputOption", "v": "USER_ENTERED" } 10 | ], 11 | "headers": [ 12 | { "k": "Content-Type", "v": "application/json" } 13 | ], 14 | "body": [] 15 | }, 16 | "desired_format": "JsonPath", 17 | "object_path": ".updates.updatedRows" 18 | } 19 | -------------------------------------------------------------------------------- /googleapis/assets/visualization_query_request_intent.req.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": {"ab": 0, "cd": 0}, 3 | "to_pid": {"ab": 0, "cd": 0}, 4 | "request": { 5 | "method": "GET", 6 | "uri": "", 7 | "query": [ 8 | { "k": "gid", "v": "0" }, 9 | { "k": "tq", "v": "limit 0" } 10 | ], 11 | "headers": [ 12 | { "k": "X-DataSource-Auth", "v": "force-json-workaround" } 13 | ] 14 | }, 15 | "desired_format": "JsonPathAsFlatbuffers", 16 | "object_path": ".table", 17 | "root_type": "googleapis.Visualization.Datatable", 18 | "schema_text": "namespace googleapis.Visualization;\n\nenum DatatableColumnType : byte\n{\n boolean,\n number,\n string,\n date,\n datetime,\n timeofday,\n}\n\ntable DatatableCell\n{\n v: string;\n}\n\ntable DatatableRow\n{\n c: [DatatableCell];\n}\n\ntable DatatableColumn\n{\n id: string;\n label: string;\n pattern: string;\n type: DatatableColumnType;\n // p: ?\n}\n\ntable Datatable\n{\n rows: [DatatableRow];\n cols: [DatatableColumn];\n}\n\ntable DatatableResponse\n{\n version: string;\n reqId: string;\n status: string;\n sig: string;\n table: Datatable;\n}\n\nfile_identifier \"Dtab\";\n\u0000" 19 | } 20 | -------------------------------------------------------------------------------- /googleapis/sheets.fbs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | include "uuid.fbs"; 12 | 13 | namespace googleapis.Sheets; 14 | 15 | table InsertRowIntent 16 | { 17 | id:UUID.UUID; 18 | to_pid:UUID.UUID; 19 | spreadsheet_id:string (required); 20 | sheet_name:string (required); 21 | values_json:string (required); 22 | } 23 | -------------------------------------------------------------------------------- /googleapis/src/gen/.PLACEHOLDER: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulreimer/esp32-network-lib/b219dce0d739e19ae150dd4ed6e6b3750d750d7f/googleapis/src/gen/.PLACEHOLDER -------------------------------------------------------------------------------- /googleapis/src/spreadsheet_insert_row_actor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "actor_model.h" 14 | 15 | namespace googleapis { 16 | namespace Sheets { 17 | 18 | auto spreadsheet_insert_row_actor_behaviour( 19 | const ActorModel::Pid& self, 20 | ActorModel::StatePtr& state, 21 | const ActorModel::Message& message 22 | ) -> ActorModel::ResultUnion; 23 | 24 | } // namespace Sheets 25 | } // namespace googleapis 26 | -------------------------------------------------------------------------------- /googleapis/src/visualization_query_actor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "actor_model.h" 14 | 15 | namespace googleapis { 16 | namespace Visualization { 17 | 18 | auto visualization_query_actor_behaviour( 19 | const ActorModel::Pid& self, 20 | ActorModel::StatePtr& state, 21 | const ActorModel::Message& message 22 | ) -> ActorModel::ResultUnion; 23 | 24 | } // namespace Visualization 25 | } // namespace googleapis 26 | -------------------------------------------------------------------------------- /gsl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register( 2 | INCLUDE_DIRS 3 | "lib/GSL/include" 4 | ) 5 | -------------------------------------------------------------------------------- /gsl/lib/GSL/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Microsoft Corporation. All rights reserved. 2 | 3 | This code is licensed under the MIT License (MIT). 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | of the Software, and to permit persons to whom the Software is furnished to do 10 | so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /gsl/lib/GSL/include/gsl/gsl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2015 Microsoft Corporation. All rights reserved. 4 | // 5 | // This code is licensed under the MIT License (MIT). 6 | // 7 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 10 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 11 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 12 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 13 | // THE SOFTWARE. 14 | // 15 | /////////////////////////////////////////////////////////////////////////////// 16 | 17 | #ifndef GSL_GSL_H 18 | #define GSL_GSL_H 19 | 20 | #include // copy 21 | #include // Ensures/Expects 22 | #include // byte 23 | #include // finally()/narrow()/narrow_cast()... 24 | #include // multi_span, strided_span... 25 | #include // owner, not_null 26 | #include // span 27 | #include // zstring, string_span, zstring_builder... 28 | 29 | #endif // GSL_GSL_H 30 | -------------------------------------------------------------------------------- /http_server/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/src/gen") 2 | 3 | idf_component_register( 4 | SRCS 5 | "src/http_server_actor.cpp" 6 | INCLUDE_DIRS 7 | "src" 8 | "${CMAKE_CURRENT_BINARY_DIR}/src/gen" 9 | PRIV_REQUIRES 10 | "actor_model" 11 | "lwip" 12 | "utils" 13 | ) 14 | 15 | target_compile_options( 16 | ${COMPONENT_LIB} 17 | PRIVATE 18 | $<$:${EXTRA_CXX_WARNING_FLAGS}> 19 | ) 20 | 21 | set_source_files_properties( 22 | SOURCE 23 | "src/http_server_actor.cpp" 24 | APPEND PROPERTIES 25 | COMPILE_OPTIONS 26 | "-Wno-old-style-cast;-Wno-sign-compare;" 27 | ) 28 | 29 | FLATBUFFERS_GENERATE_GENERATED_H(http_server_generated_h http_server.fbs) 30 | 31 | set_property( 32 | SOURCE 33 | "src/http_server_actor.cpp" 34 | APPEND PROPERTY 35 | OBJECT_DEPENDS 36 | "${http_server_generated_h_OUTPUTS}" 37 | ) 38 | add_dependencies(${COMPONENT_LIB} http_server_generated_h_TARGET) 39 | -------------------------------------------------------------------------------- /http_server/http_server.fbs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | include "uuid.fbs"; 12 | 13 | table HTTPServerConfiguration 14 | { 15 | port:uint16 = 80; 16 | to_pid:UUID.UUID; 17 | } 18 | 19 | namespace HTTPServer; 20 | 21 | root_type HTTPServerConfiguration; 22 | file_extension "fb"; 23 | file_identifier "H11S"; 24 | -------------------------------------------------------------------------------- /http_server/src/http_server_actor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "actor_model.h" 14 | 15 | namespace HTTPServer { 16 | 17 | auto http_server_actor_behaviour( 18 | const ActorModel::Pid& self, 19 | ActorModel::StatePtr& state, 20 | const ActorModel::Message& message 21 | ) -> ActorModel::ResultUnion; 22 | 23 | } // namespace HTTPServer 24 | -------------------------------------------------------------------------------- /json_flatbuffers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register( 2 | SRCS 3 | "lib/flatbuffers/src/idl_parser.cpp" 4 | "src/json_to_flatbuffers_converter.cpp" 5 | INCLUDE_DIRS 6 | "src" 7 | PRIV_REQUIRES 8 | "flatbuffers" 9 | "json_streaming" 10 | ) 11 | 12 | target_compile_options( 13 | ${COMPONENT_LIB} 14 | PRIVATE 15 | $<$:${EXTRA_CXX_WARNING_FLAGS}> 16 | ) 17 | 18 | set_source_files_properties( 19 | SOURCE 20 | "src/json_to_flatbuffers_converter.cpp" 21 | APPEND PROPERTIES 22 | COMPILE_OPTIONS 23 | "-Wno-conversion;" 24 | ) 25 | 26 | set_source_files_properties( 27 | SOURCE 28 | "lib/flatbuffers/src/idl_parser.cpp" 29 | APPEND PROPERTIES 30 | COMPILE_OPTIONS 31 | "-Wno-missing-declarations;-Wno-conversion;" 32 | ) 33 | -------------------------------------------------------------------------------- /json_streaming/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register( 2 | SRCS 3 | "lib/yajl/src/yajl.c" 4 | "lib/yajl/src/yajl_alloc.c" 5 | "lib/yajl/src/yajl_buf.c" 6 | "lib/yajl/src/yajl_encode.c" 7 | "lib/yajl/src/yajl_gen.c" 8 | "lib/yajl/src/yajl_lex.c" 9 | "lib/yajl/src/yajl_parser.c" 10 | "lib/yajl/src/yajl_tree.c" 11 | "lib/yajl/src/yajl_version.c" 12 | "src/json_emitter.cpp" 13 | INCLUDE_DIRS 14 | "lib/yajl/include" 15 | "src" 16 | PRIV_INCLUDE_DIRS 17 | "lib" 18 | "lib/yajl" 19 | REQUIRES 20 | "actor_model" 21 | "requests" 22 | ) 23 | 24 | target_compile_options( 25 | ${COMPONENT_LIB} 26 | PRIVATE 27 | $<$:${EXTRA_CXX_WARNING_FLAGS}> 28 | ) 29 | 30 | set_source_files_properties( 31 | SOURCE 32 | "src/json_emitter.cpp" 33 | APPEND PROPERTIES 34 | COMPILE_DEFINITIONS 35 | "_GLIBCXX_USE_C99=1" 36 | ) 37 | 38 | set_source_files_properties( 39 | SOURCE 40 | "lib/yajl/src/yajl_parser.c" 41 | APPEND PROPERTIES 42 | COMPILE_OPTIONS 43 | "-Wno-implicit-fallthrough;" 44 | ) 45 | 46 | set_source_files_properties( 47 | SOURCE 48 | "lib/yajl/src/yajl_encode.c" 49 | APPEND PROPERTIES 50 | COMPILE_OPTIONS 51 | "-Wno-conversion;" 52 | ) 53 | 54 | set_source_files_properties( 55 | SOURCE 56 | "lib/yajl/src/yajl_lex.c" 57 | APPEND PROPERTIES 58 | COMPILE_OPTIONS 59 | "-Wno-sign-conversion;" 60 | ) 61 | -------------------------------------------------------------------------------- /json_streaming/lib/yajl/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2007-2014, Lloyd Hilaiel 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any 4 | purpose with or without fee is hereby granted, provided that the above 5 | copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /json_streaming/lib/yajl/include/yajl: -------------------------------------------------------------------------------- 1 | ../src/api -------------------------------------------------------------------------------- /json_streaming/lib/yajl/src/yajl_alloc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007-2014, Lloyd Hilaiel 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /** 18 | * \file yajl_alloc.h 19 | * default memory allocation routines for yajl which use malloc/realloc and 20 | * free 21 | */ 22 | 23 | #include "yajl_alloc.h" 24 | #include 25 | 26 | static void * yajl_internal_malloc(void *ctx, size_t sz) 27 | { 28 | (void)ctx; 29 | return malloc(sz); 30 | } 31 | 32 | static void * yajl_internal_realloc(void *ctx, void * previous, 33 | size_t sz) 34 | { 35 | (void)ctx; 36 | return realloc(previous, sz); 37 | } 38 | 39 | static void yajl_internal_free(void *ctx, void * ptr) 40 | { 41 | (void)ctx; 42 | free(ptr); 43 | } 44 | 45 | void yajl_set_default_alloc_funcs(yajl_alloc_funcs * yaf) 46 | { 47 | yaf->malloc = yajl_internal_malloc; 48 | yaf->free = yajl_internal_free; 49 | yaf->realloc = yajl_internal_realloc; 50 | yaf->ctx = NULL; 51 | } 52 | 53 | -------------------------------------------------------------------------------- /json_streaming/lib/yajl/src/yajl_alloc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007-2014, Lloyd Hilaiel 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /** 18 | * \file yajl_alloc.h 19 | * default memory allocation routines for yajl which use malloc/realloc and 20 | * free 21 | */ 22 | 23 | #ifndef __YAJL_ALLOC_H__ 24 | #define __YAJL_ALLOC_H__ 25 | 26 | #include "api/yajl_common.h" 27 | 28 | #define YA_MALLOC(afs, sz) (afs)->malloc((afs)->ctx, (sz)) 29 | #define YA_FREE(afs, ptr) (afs)->free((afs)->ctx, (ptr)) 30 | #define YA_REALLOC(afs, ptr, sz) (afs)->realloc((afs)->ctx, (ptr), (sz)) 31 | 32 | void yajl_set_default_alloc_funcs(yajl_alloc_funcs * yaf); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /json_streaming/lib/yajl/src/yajl_encode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007-2014, Lloyd Hilaiel 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef __YAJL_ENCODE_H__ 18 | #define __YAJL_ENCODE_H__ 19 | 20 | #include "yajl_buf.h" 21 | #include "api/yajl_gen.h" 22 | 23 | void yajl_string_encode(const yajl_print_t printer, 24 | void * ctx, 25 | const unsigned char * str, 26 | size_t length, 27 | int escape_solidus); 28 | 29 | void yajl_string_decode(yajl_buf buf, const unsigned char * str, 30 | size_t length); 31 | 32 | int yajl_string_validate_utf8(const unsigned char * s, size_t len); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /json_streaming/lib/yajl/src/yajl_version.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int yajl_version(void) 4 | { 5 | return YAJL_VERSION; 6 | } 7 | 8 | -------------------------------------------------------------------------------- /json_streaming/lib/yajl/yajl_version.h: -------------------------------------------------------------------------------- 1 | #ifndef YAJL_VERSION_H_ 2 | #define YAJL_VERSION_H_ 3 | 4 | #include 5 | 6 | #define YAJL_MAJOR 2 7 | #define YAJL_MINOR 1 8 | #define YAJL_MICRO 0 9 | 10 | #define YAJL_VERSION ((YAJL_MAJOR * 10000) + (YAJL_MINOR * 100) + YAJL_MICRO) 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | extern int YAJL_API yajl_version(void); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | 22 | #endif /* YAJL_VERSION_H_ */ 23 | 24 | -------------------------------------------------------------------------------- /jwt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register( 2 | SRCS 3 | "src/jwt.cpp" 4 | INCLUDE_DIRS 5 | "src" 6 | PRIV_REQUIRES 7 | "base64" 8 | "mbedtls" 9 | ) 10 | 11 | target_compile_options( 12 | ${COMPONENT_LIB} 13 | PRIVATE 14 | $<$:${EXTRA_CXX_WARNING_FLAGS}> 15 | ) 16 | -------------------------------------------------------------------------------- /jwt/src/jwt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2017 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | #pragma once 11 | 12 | #include 13 | #include 14 | 15 | #include "mbedtls/pk.h" 16 | #include "mbedtls/ctr_drbg.h" 17 | 18 | namespace JWT { 19 | using Buffer = std::vector; 20 | using BufferView = std::span; 21 | 22 | class JWTGenerator 23 | { 24 | public: 25 | enum Alg { 26 | RS256, 27 | HS256, // Not supported 28 | ES256, // Not supported 29 | }; 30 | 31 | JWTGenerator(BufferView privkey_pem, Alg _alg=RS256); 32 | 33 | ~JWTGenerator(); 34 | 35 | Alg alg = RS256; 36 | 37 | Buffer mint(BufferView payload); 38 | Buffer sign(BufferView jwt_header_and_payload); 39 | bool verify(); 40 | 41 | private: 42 | Buffer sign_RS256(BufferView jwt_header_and_payload); 43 | 44 | mbedtls_pk_context ctx; 45 | mbedtls_ctr_drbg_context ctr_drbg; 46 | bool valid = false; 47 | }; 48 | } // namespace JWT 49 | -------------------------------------------------------------------------------- /module_manager/.gitignore: -------------------------------------------------------------------------------- 1 | src/gen/symbols.c 2 | -------------------------------------------------------------------------------- /module_manager/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "esp32-network-lib Module Manager" 2 | 3 | config CONFIG_MODULE_MANAGER_GENERATE_SYMBOLS_C 4 | bool "Enable generation of symbols.c" 5 | help 6 | Select this option to enable support for loading ELF executables 7 | dynamically from file or memory buffer. Generates a list of all symbols 8 | in the last-known-good binary image, updates/embeds it in future builds. 9 | 10 | endmenu 11 | -------------------------------------------------------------------------------- /module_manager/compile-esp32-elf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | # This script is executed from the top-level project root 6 | DEPLOY_ROOT="$(pwd)" 7 | 8 | # This is the CMake out-of-tree build dir 9 | BUILD_DIR="/tmp/build" 10 | # This is an esp-idf component dir (added to project EXTRA_COMPONENT_DIRS) 11 | MODULE_DIR="/tmp" 12 | 13 | # Remove first arg, treat the rest as SRCS 14 | MOD_NAME="$1" 15 | shift 16 | SRCS="$@" 17 | 18 | export IDF_PROJECT_PATH="${DEPLOY_ROOT}/firmware" 19 | 20 | export PATH="${IDF_PROJECT_PATH}/xtensa-esp32-elf/bin:${PATH}" 21 | 22 | export IDF_PATH="${IDF_PROJECT_PATH}/esp-idf" 23 | 24 | cat << EOF > ${MODULE_DIR}/CMakeLists.txt 25 | set(COMPONENT_REQUIRES actor_model) 26 | set(COMPONENT_SRCS ${SRCS}) 27 | register_component() 28 | MODULE_GENERATE_ELF(module_elf ${MOD_NAME} ${SRCS}) 29 | EOF 30 | 31 | cat ${MODULE_DIR}/CMakeLists.txt 32 | 33 | # Navigate to the firmware build directory 34 | mkdir -p "${BUILD_DIR}" 35 | cd "${BUILD_DIR}" 36 | 37 | # Copy config settings to build dir 38 | cp -r "${IDF_PROJECT_PATH}/build/sdkconfig" "${BUILD_DIR}" 39 | 40 | # Generate cmake build files 41 | ${IDF_PROJECT_PATH}/build/bin/cmake \ 42 | -DSDKCONFIG="${BUILD_DIR}/sdkconfig" \ 43 | -DPYTHON_DEPS_CHECKED:BOOL=ON \ 44 | -DGIT_FOUND:BOOL=OFF \ 45 | \ 46 | "${IDF_PROJECT_PATH}" 47 | 48 | # Build the elf 49 | make "module_elf_TARGET" 50 | -------------------------------------------------------------------------------- /module_manager/lib/libelfin/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Austin T. Clements 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /module_manager/lib/libelfin/elf/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | to_string.cc 3 | libelf++.a 4 | libelf++.so 5 | libelf++.so.* 6 | libelf++.pc 7 | -------------------------------------------------------------------------------- /module_manager/lib/libelfin/elf/to_hex.hh: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Austin T. Clements. All rights reserved. 2 | // Use of this source code is governed by an MIT license 3 | // that can be found in the LICENSE file. 4 | 5 | #ifndef _ELFPP_TO_HEX_HH_ 6 | #define _ELFPP_TO_HEX_HH_ 7 | 8 | #include 9 | #include 10 | 11 | template 12 | std::string 13 | to_hex(T v) 14 | { 15 | static_assert(std::is_integral::value, 16 | "to_hex applied to non-integral type"); 17 | if (v == 0) 18 | return std::string("0"); 19 | char buf[sizeof(T)*2 + 1]; 20 | char *pos = &buf[sizeof(buf)-1]; 21 | *pos-- = '\0'; 22 | while (v && pos >= buf) { 23 | int digit = v & 0xf; 24 | if (digit < 10) 25 | *pos = '0' + digit; 26 | else 27 | *pos = 'a' + (digit - 10); 28 | pos--; 29 | v >>= 4; 30 | } 31 | return std::string(pos + 1); 32 | } 33 | 34 | #endif // _ELFPP_TO_HEX_HH_ 35 | -------------------------------------------------------------------------------- /module_manager/project_include.cmake: -------------------------------------------------------------------------------- 1 | function(MODULE_GENERATE_ELF target_prefix mod_name) 2 | idf_build_get_property(build_dir BUILD_DIR) 3 | 4 | set(OUT "${build_dir}/${mod_name}.elf") 5 | 6 | set_property( 7 | DIRECTORY 8 | APPEND PROPERTY 9 | ADDITIONAL_MAKE_CLEAN_FILES "${OUT}" 10 | ) 11 | 12 | add_library(${mod_name}_LIBRARY OBJECT "${ARGN}") 13 | 14 | target_compile_options( 15 | ${mod_name}_LIBRARY 16 | PRIVATE 17 | -fvisibility=hidden -mlongcalls -mtext-section-literals -O2 18 | ) 19 | 20 | target_include_directories( 21 | ${mod_name}_LIBRARY 22 | PRIVATE "$" 23 | ) 24 | 25 | add_custom_command( 26 | OUTPUT "${OUT}" 27 | COMMAND 28 | "${CMAKE_CXX_COMPILER}" 29 | -nostdlib 30 | -Wl,-z,relro 31 | -Wl,-z,now 32 | -Wl,-shared "$" 33 | -o "${OUT}" 34 | DEPENDS "${mod_name}_LIBRARY" 35 | COMMENT "Generating ELF binary from object file ${FILE}" 36 | WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" 37 | ) 38 | 39 | add_custom_target( 40 | ${target_prefix}_ELF_STRIPPED 41 | COMMAND 42 | "${CMAKE_STRIP}" 43 | --discard-all 44 | --discard-locals 45 | --remove-section=.comment 46 | --remove-section=.interp 47 | --remove-section=.literal 48 | --remove-section=.strtab 49 | --remove-section=.symtab 50 | --remove-section=.xtensa.info 51 | --remove-section=.xt.lit 52 | --remove-section=.xt.prop 53 | --strip-debug 54 | --strip-unneeded 55 | "${OUT}" 56 | DEPENDS "${OUT}" 57 | COMMENT "Stripping ELF binary ${OUT}" 58 | WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" 59 | ) 60 | 61 | add_custom_target( 62 | ${target_prefix}_TARGET 63 | DEPENDS ${OUT} ${target_prefix}_ELF_STRIPPED 64 | ) 65 | endfunction() 66 | -------------------------------------------------------------------------------- /module_manager/src/buffer_view_loader.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2020 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #include "buffer_view_loader.h" 12 | 13 | #include "esp_log.h" 14 | 15 | namespace ModuleManager { 16 | 17 | BufferViewLoader::BufferViewLoader(const BufferView _buffer) 18 | : buffer(_buffer) 19 | {} 20 | 21 | auto BufferViewLoader::load(const off_t offset, const size_t size) 22 | -> const void* 23 | { 24 | auto in_range = ((offset + size) <= buffer.size()); 25 | if (not in_range) 26 | { 27 | ESP_LOGE("BufferViewLoader", "offset exceeds file size"); 28 | } 29 | 30 | return in_range? &buffer[offset] : nullptr; 31 | } 32 | 33 | } // namespace ModuleManager 34 | -------------------------------------------------------------------------------- /module_manager/src/buffer_view_loader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2020 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | #include "elf/elf++.hh" 16 | 17 | namespace ModuleManager { 18 | 19 | class BufferViewLoader 20 | : public elf::loader 21 | { 22 | using BufferView = std::span; 23 | const BufferView buffer; 24 | public: 25 | 26 | explicit BufferViewLoader(const BufferView _buffer); 27 | auto load(const off_t offset, const size_t size) 28 | -> const void* override; 29 | }; 30 | 31 | } // namespace ModuleManager 32 | -------------------------------------------------------------------------------- /module_manager/src/executable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "file_buffer_loader.h" 14 | 15 | #include "elf/elf++.hh" 16 | 17 | #include 18 | #include 19 | 20 | #include 21 | 22 | namespace ModuleManager { 23 | 24 | class Loader; 25 | 26 | class Executable 27 | { 28 | friend class Loader; 29 | public: 30 | using string = std::string; 31 | using string_view = std::string_view; 32 | using ModuleFlatbuffer = std::vector; 33 | 34 | using Address = uint32_t; 35 | using SymbolMap = std::unordered_map; 36 | using SegmentFlags = elf::pf; 37 | using Segments = std::vector>; 38 | 39 | static constexpr Address NullAddress = 0; 40 | 41 | Executable(); 42 | ~Executable(); 43 | 44 | auto get_symbol_address(const string_view name) 45 | -> Address; 46 | 47 | protected: 48 | auto clear() 49 | -> bool; 50 | 51 | SymbolMap symbols; 52 | Segments segments; 53 | 54 | uint8_t* loaded_executable_segment_addr = nullptr; 55 | 56 | ssize_t executable_segment_idx = -1; 57 | size_t executable_segment_size = 0; 58 | size_t executable_segment_aligned_size = 0; 59 | }; 60 | 61 | } // namespace ModuleManager 62 | -------------------------------------------------------------------------------- /module_manager/src/gen/.PLACEHOLDER: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulreimer/esp32-network-lib/b219dce0d739e19ae150dd4ed6e6b3750d750d7f/module_manager/src/gen/.PLACEHOLDER -------------------------------------------------------------------------------- /module_manager/src/gen/symbols.c: -------------------------------------------------------------------------------- 1 | 2 | #ifdef __cplusplus 3 | extern "C" { 4 | #endif // __cplusplus 5 | #include "sym.h" 6 | 7 | 8 | 9 | const int sym_objects_count = 0; 10 | const struct symbol sym_objects[0] = { 11 | }; 12 | 13 | 14 | 15 | // built-ins 16 | int printf(const char *, ...); 17 | int sprintf(char *, const char *, ...); 18 | void *malloc(); 19 | //void *memcpy(); 20 | void *memset(); 21 | void *memmove(); 22 | char *strcpy(); 23 | 24 | double sin(); 25 | double cos(); 26 | float sinf(float); 27 | float cosf(float); 28 | 29 | const int sym_functions_count = 0; 30 | const struct symbol sym_functions[0] = { 31 | }; 32 | #ifdef __cplusplus 33 | } // extern "C" 34 | #endif // __cplusplus 35 | -------------------------------------------------------------------------------- /module_manager/src/loader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "executable.h" 14 | 15 | #include "sym.h" 16 | 17 | #include "buffer_view_loader.h" 18 | #include "file_buffer_loader.h" 19 | 20 | #include "elf/elf++.hh" 21 | 22 | #include 23 | 24 | namespace ModuleManager { 25 | using BufferView = std::span; 26 | using string_view = std::string_view; 27 | 28 | class Loader 29 | { 30 | public: 31 | 32 | auto load(const BufferView elf_bin) 33 | -> Executable; 34 | auto load_from_path(const string_view path) 35 | -> Executable; 36 | auto load(const elf::elf& parsed_elf) 37 | -> Executable; 38 | 39 | auto resolve(const string_view name) 40 | -> Executable::Address; 41 | 42 | protected: 43 | auto validate(const elf::elf& parsed_elf) 44 | -> bool; 45 | auto apply_relocs(const elf::elf& parsed_elf, Executable& executable) 46 | -> bool; 47 | auto extract_symbols(const elf::elf& parsed_elf, Executable& executable) 48 | -> bool; 49 | 50 | auto _resolve( 51 | const string_view name, 52 | const struct symbol* symbols = sym_functions, 53 | const int symbols_count = sym_functions_count 54 | ) -> Executable::Address; 55 | 56 | private: 57 | auto _apply_relocs_for_section( 58 | const elf::elf& parsed_elf, 59 | const elf::section& reloc_section, 60 | Executable& executable, 61 | uint8_t* reloc_segment_wip 62 | ) -> bool; 63 | 64 | auto _segment_idx_for_reloc_offset( 65 | const elf::elf& parsed_elf, 66 | size_t offset 67 | ) -> int; 68 | }; 69 | 70 | } // namespace ModuleManager 71 | -------------------------------------------------------------------------------- /module_manager/src/sym.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif // __cplusplus 16 | 17 | typedef void (*fn)(); 18 | 19 | union sym_ref { 20 | void *obj; 21 | fn func; 22 | }; 23 | 24 | struct symbol { 25 | const char *name; 26 | union sym_ref u; 27 | }; 28 | 29 | extern const int sym_objects_count; 30 | extern const int sym_functions_count; 31 | 32 | extern const struct symbol sym_objects[]; 33 | extern const struct symbol sym_functions[]; 34 | 35 | #ifdef __cplusplus 36 | } // extern "C" 37 | #endif // __cplusplus 38 | 39 | -------------------------------------------------------------------------------- /mqtt_client/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/src/gen") 2 | 3 | idf_component_register( 4 | SRCS 5 | "src/mqtt.cpp" 6 | "src/mqtt_client_actor.cpp" 7 | INCLUDE_DIRS 8 | "src" 9 | "${CMAKE_CURRENT_BINARY_DIR}/src/gen" 10 | PRIV_REQUIRES 11 | "actor_model" 12 | "embedded_files" 13 | "jwt" 14 | "mqtt" 15 | "utils" 16 | "uuid" 17 | EMBED_FILES 18 | "${CMAKE_CURRENT_BINARY_DIR}/src/gen/mqtt.bfbs" 19 | ) 20 | 21 | target_compile_options( 22 | ${COMPONENT_LIB} 23 | PRIVATE 24 | $<$:${EXTRA_CXX_WARNING_FLAGS}> 25 | ) 26 | 27 | set_property( 28 | SOURCE 29 | "src/mqtt_client_actor.cpp" 30 | APPEND PROPERTY 31 | COMPILE_DEFINITIONS 32 | "_GLIBCXX_USE_C99=1" 33 | ) 34 | 35 | set_source_files_properties( 36 | SOURCE 37 | "src/mqtt_client_actor.cpp" 38 | APPEND PROPERTIES 39 | COMPILE_OPTIONS 40 | "-Wno-conversion;-Wno-suggest-override;-Wno-sign-compare;" 41 | ) 42 | 43 | FLATBUFFERS_GENERATE_GENERATED_H(mqtt_generated_h mqtt.fbs) 44 | FLATBUFFERS_GENERATE_BFBS(mqtt_bfbs mqtt.fbs) 45 | 46 | set_property( 47 | SOURCE 48 | "src/mqtt.cpp" 49 | "src/mqtt_client_actor.cpp" 50 | APPEND PROPERTY 51 | OBJECT_DEPENDS 52 | "${mqtt_generated_h_OUTPUTS}" 53 | ) 54 | add_dependencies(${COMPONENT_LIB} mqtt_generated_h_TARGET) 55 | 56 | set_property( 57 | SOURCE 58 | "src/mqtt.cpp" 59 | APPEND PROPERTY 60 | OBJECT_DEPENDS 61 | "${mqtt_bfbs_OUTPUTS}" 62 | ) 63 | add_dependencies(${COMPONENT_LIB} mqtt_bfbs_TARGET) 64 | -------------------------------------------------------------------------------- /mqtt_client/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "MQTT Client Configuration" 2 | 3 | config MQTT 4 | bool "MQTT Enabled" 5 | default y 6 | 7 | config MQTT_HOST 8 | string "MQTT Hostname/IP address" 9 | depends on MQTT 10 | default "mqtt.googleapis.com" 11 | 12 | config MQTT_PORT 13 | int "MQTT port" 14 | depends on MQTT 15 | default 443 16 | 17 | config MQTT_CLIENT_ID 18 | string "MQTT Client ID" 19 | depends on MQTT 20 | default "projects/{project-id}/locations/{cloud-region}/registries/{registry-id}/devices/{device-id}" 21 | 22 | config MQTT_CLIENT_USERNAME 23 | string "MQTT Client Username" 24 | depends on MQTT 25 | default "unused" 26 | 27 | config MQTT_CLIENT_PASSWORD 28 | string "MQTT Client Password" 29 | depends on MQTT 30 | default "" 31 | 32 | config MQTT_CLIENT_CERTIFICATE_PATH 33 | string "Client Certificate Path" 34 | depends on MQTT 35 | default "/spiflash/mqtt_client_certificate.pem" 36 | 37 | config MQTT_CLIENT_PRIVATE_KEY_PATH 38 | string "Client Private Key Path" 39 | depends on MQTT 40 | default "/spiflash/mqtt_client_private_key.pem" 41 | 42 | config MQTT_ROOT_CERTIFICATE_PATH 43 | string "Root/CA Certificate Path" 44 | depends on MQTT 45 | default "/spiflash/mqtt_root_certificate.pem" 46 | 47 | config MQTT_INITIAL_SUBSCRIPTION_TOPIC 48 | string "Initial MQTT Subscription Topic" 49 | depends on MQTT 50 | default "/devices//config" 51 | 52 | endmenu 53 | -------------------------------------------------------------------------------- /mqtt_client/mqtt.fbs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | include "uuid.fbs"; 12 | 13 | namespace MQTT; 14 | 15 | enum MQTT_QOS : byte { 16 | AtMostOnce=0, 17 | AtLeastOnce=1, 18 | ExactlyOnce=2, 19 | } 20 | 21 | table Subscription { 22 | topic:string; 23 | qos:MQTT_QOS = AtMostOnce; 24 | } 25 | 26 | table SubscriptionBuffer { 27 | subscription:[ubyte] (nested_flatbuffer: "Subscription"); 28 | } 29 | 30 | table MQTTClientConfiguration { 31 | host:string (required); 32 | port:uint16; 33 | client_id:string; 34 | client_username:string; 35 | client_password:string; 36 | client_certificate_path:string; 37 | client_private_key_path:string; 38 | root_certificate_path:string; 39 | subscriptions:[SubscriptionBuffer]; 40 | } 41 | 42 | /* 43 | table MQTTRequest { 44 | id:UUID.UUID; 45 | to_pid:UUID.UUID; 46 | topic:string; 47 | payload:string (required); 48 | } 49 | 50 | table MQTTResponse { 51 | id:UUID.UUID; 52 | request_id:UUID.UUID; 53 | to_pid:UUID.UUID; 54 | topic:string; 55 | payload:string (required); 56 | } 57 | */ 58 | 59 | table MQTTMessage { 60 | topic:string (required); 61 | payload:string (required); 62 | qos:MQTT_QOS = AtMostOnce; 63 | retain:bool = false; 64 | } 65 | 66 | root_type MQTTClientConfiguration; 67 | file_identifier "mqtt"; 68 | file_extension "fb"; 69 | -------------------------------------------------------------------------------- /mqtt_client/src/mqtt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "mqtt_generated.h" 14 | 15 | #include 16 | #include 17 | 18 | namespace MQTT { 19 | 20 | using MutableMQTTClientConfigurationFlatbuffer = std::vector; 21 | 22 | auto set_mqtt_client_id( 23 | MutableMQTTClientConfigurationFlatbuffer& request_intent_mutable_buf, 24 | const std::string_view mqtt_client_id 25 | ) -> bool; 26 | 27 | auto set_mqtt_client_password( 28 | MutableMQTTClientConfigurationFlatbuffer& request_intent_mutable_buf, 29 | const std::string_view mqtt_client_password 30 | ) -> bool; 31 | 32 | } // namespace MQTT 33 | -------------------------------------------------------------------------------- /mqtt_client/src/mqtt_client_actor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "actor_model.h" 14 | 15 | namespace MQTT { 16 | 17 | auto mqtt_client_actor_behaviour( 18 | const ActorModel::Pid& self, 19 | ActorModel::StatePtr& state, 20 | const ActorModel::Message& message 21 | ) -> ActorModel::ResultUnion; 22 | 23 | } // namespace MQTT 24 | -------------------------------------------------------------------------------- /network_manager/.gitignore: -------------------------------------------------------------------------------- 1 | test/*_test 2 | test/test_runner 3 | src/gen 4 | -------------------------------------------------------------------------------- /network_manager/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Network Configuration" 2 | 3 | config WIFI_SSID 4 | string "Wifi SSID" 5 | default "myssid" 6 | help 7 | SSID (network name) for the example to connect to. 8 | 9 | config WIFI_PASSWORD 10 | string "Wifi Password" 11 | default "myssid" 12 | help 13 | WiFi password (WPA or WPA2) for the example to use. 14 | 15 | Can be left blank if the network has no security set. 16 | 17 | config MDNS_HOSTNAME 18 | string "mDNS Hostname" 19 | default "esp32-mdns" 20 | help 21 | mDNS Hostname when publishing services 22 | 23 | Typically, the .local domain will be appended to this name 24 | for clients to connect to. 25 | 26 | config MDNS_INSTANCE 27 | string "mDNS Instance Name" 28 | default "ESP32 with mDNS" 29 | help 30 | mDNS Instance Name when publishing services 31 | 32 | endmenu 33 | -------------------------------------------------------------------------------- /network_manager/lib/date/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The source code in this project is released using the MIT License. There is no 2 | global license for the project because each file is licensed individually with 3 | different author names and/or dates. 4 | 5 | If you contribute to this project, please add your name to the license of each 6 | file you modify. If you have already contributed to this project and forgot to 7 | add your name to the license, please feel free to submit a new P/R to add your 8 | name to the license in each file you modified. 9 | 10 | For convenience, here is a copy of the MIT license found in each file except 11 | without author names or dates: 12 | 13 | The MIT License (MIT) 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | -------------------------------------------------------------------------------- /network_manager/network_manager.fbs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | namespace NetworkManager; 12 | 13 | table WifiConfiguration 14 | { 15 | ssid:string; 16 | password:string; 17 | } 18 | 19 | table NTPConfiguration 20 | { 21 | ntp_server:string; 22 | posix_timezone:string; 23 | } 24 | 25 | table NetworkCheckConfiguration 26 | { 27 | upstream_ping_ip:uint32; 28 | } 29 | 30 | table mDNSTXTRecord 31 | { 32 | k:string; 33 | v:string; 34 | } 35 | 36 | table mDNSService 37 | { 38 | instance:string; 39 | name:string; 40 | protocol:string; 41 | port:uint16; 42 | txt_records:[mDNSTXTRecord]; 43 | } 44 | 45 | table mDNSConfiguration 46 | { 47 | hostname:string; 48 | instance:string; 49 | domain:string; 50 | services:[mDNSService]; 51 | } 52 | 53 | table NetworkConnectionIntent 54 | { 55 | wifi:WifiConfiguration; 56 | ntp:NTPConfiguration; 57 | network_check:NetworkCheckConfiguration; 58 | mdns:mDNSConfiguration; 59 | } 60 | 61 | root_type NetworkConnectionIntent; 62 | file_extension "fb"; 63 | file_identifier "Netw"; 64 | -------------------------------------------------------------------------------- /network_manager/src/mdns_actor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "actor_model.h" 14 | 15 | namespace NetworkManager { 16 | 17 | auto mdns_actor_behaviour( 18 | const ActorModel::Pid& self, 19 | ActorModel::StatePtr& state, 20 | const ActorModel::Message& message 21 | ) -> ActorModel::ResultUnion; 22 | 23 | } // namespace NetworkManager 24 | -------------------------------------------------------------------------------- /network_manager/src/network_check_actor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "actor_model.h" 14 | 15 | namespace NetworkManager { 16 | 17 | auto network_check_actor_behaviour( 18 | const ActorModel::Pid& self, 19 | ActorModel::StatePtr& state, 20 | const ActorModel::Message& message 21 | ) -> ActorModel::ResultUnion; 22 | 23 | } // namespace NetworkManager 24 | -------------------------------------------------------------------------------- /network_manager/src/network_manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "network_manager_generated.h" 14 | 15 | #include "freertos/FreeRTOS.h" 16 | #include "freertos/event_groups.h" 17 | 18 | #include "lwip/ip4_addr.h" 19 | #include "esp_netif_ip_addr.h" 20 | 21 | #include "esp_event.h" 22 | 23 | namespace NetworkManager { 24 | 25 | struct NetworkInterfaceDetails 26 | { 27 | esp_ip4_addr_t ip; 28 | esp_ip4_addr_t gw; 29 | esp_ip4_addr_t netmask; 30 | }; 31 | 32 | auto wait_for_network(const EventBits_t bits, const TickType_t ticks_to_wait) 33 | -> EventBits_t; 34 | 35 | auto set_network(const EventBits_t bits) 36 | -> EventBits_t; 37 | 38 | auto reset_network(const EventBits_t bits) 39 | -> EventBits_t; 40 | 41 | auto get_network_details() 42 | -> NetworkInterfaceDetails; 43 | 44 | auto get_wifi_connection_rssi(const size_t samples) 45 | -> int; 46 | 47 | auto event_handler( 48 | void* arg, 49 | esp_event_base_t 50 | event_base, 51 | int32_t event_id, 52 | void* event_data 53 | ) -> void; 54 | 55 | // The event group allows multiple bits for each event, 56 | // but we only care about one event - are we connected 57 | // to the AP with an IP? 58 | constexpr int NETWORK_IS_CONNECTED = (1<<0); 59 | constexpr int NETWORK_IS_CONNECTED_IPV4 = (1<<1); 60 | constexpr int NETWORK_IS_CONNECTED_IPV6 = (1<<2); 61 | constexpr int NETWORK_TIME_AVAILABLE = (1<<3); 62 | 63 | } // namespace NetworkManager 64 | -------------------------------------------------------------------------------- /network_manager/src/ntp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "date/ptz.h" 14 | 15 | #include 16 | #include 17 | 18 | namespace NetworkManager { 19 | 20 | using TimeZone = date::zoned_time< 21 | std::chrono::system_clock::duration, 22 | Posix::time_zone 23 | >; 24 | 25 | auto is_time_set() 26 | -> bool; 27 | 28 | auto to_tm(const TimeZone tp) 29 | -> std::tm; 30 | 31 | auto format_time(const TimeZone& tp, const std::string& fmt) 32 | -> std::string; 33 | 34 | auto format_time(const std::tm* const & timeinfo, const std::string& fmt) 35 | -> std::string; 36 | 37 | } // namespace NetworkManager 38 | -------------------------------------------------------------------------------- /network_manager/src/ntp_actor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "actor_model.h" 14 | 15 | namespace NetworkManager { 16 | 17 | auto ntp_actor_behaviour( 18 | const ActorModel::Pid& self, 19 | ActorModel::StatePtr& state, 20 | const ActorModel::Message& message 21 | ) -> ActorModel::ResultUnion; 22 | 23 | } // namespace NetworkManager 24 | -------------------------------------------------------------------------------- /network_manager/src/wifi_actor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "actor_model.h" 14 | 15 | namespace NetworkManager { 16 | 17 | auto wifi_actor_behaviour( 18 | const ActorModel::Pid& self, 19 | ActorModel::StatePtr& state, 20 | const ActorModel::Message& message 21 | ) -> ActorModel::ResultUnion; 22 | 23 | } // namespace NetworkManager 24 | -------------------------------------------------------------------------------- /osc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register( 2 | SRCS 3 | "lib/tinyosc/tinyosc.c" 4 | "src/osc.cpp" 5 | INCLUDE_DIRS 6 | "lib/tinyosc" 7 | "src" 8 | PRIV_REQUIRES 9 | "flatbuffers" 10 | "uuid" 11 | ) 12 | 13 | target_compile_options( 14 | ${COMPONENT_LIB} 15 | PRIVATE 16 | $<$:${EXTRA_CXX_WARNING_FLAGS}> 17 | ) 18 | 19 | set_source_files_properties( 20 | SOURCE 21 | "lib/tinyosc/tinyosc.c" 22 | APPEND PROPERTIES 23 | COMPILE_OPTIONS 24 | "-include;${COMPONENT_PATH}/src/htonll_ntohll.h;-Wno-overflow;-Wno-sign-conversion;-Wno-sign-compare;-Wno-double-promotion;-Wno-conversion;-Wno-format;" 25 | ) 26 | -------------------------------------------------------------------------------- /osc/lib/tinyosc/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Martin Roth 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any 4 | purpose with or without fee is hereby granted, provided that the above 5 | copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | 15 | -------------------------------------------------------------------------------- /osc/src/htonll_ntohll.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define htonll(x) ((((uint64_t)htonl(x) & 0xFFFFFFFF) << 32) + htonl((x) >> 32)) 4 | #define ntohll(x) ((((uint64_t)ntohl(x) & 0xFFFFFFFF) << 32) + ntohl((x) >> 32)) 5 | -------------------------------------------------------------------------------- /osc/src/osc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "uuid.h" 14 | 15 | #include "flatbuffers/flatbuffers.h" 16 | 17 | #include 18 | #include 19 | 20 | namespace OSC { 21 | using Buffer = std::vector; 22 | using BufferView = std::span; 23 | 24 | using MutableGenericFlatbuffer = std::vector; 25 | 26 | // Update flatbuffers field from osc message 27 | auto update_flatbuffer_from_osc_message( 28 | MutableGenericFlatbuffer& flatbuffer_mutable_buf, 29 | const Buffer& flatbuffer_bfbs, 30 | const BufferView osc_packet 31 | ) -> bool; 32 | 33 | } // namespace OSC 34 | -------------------------------------------------------------------------------- /requests/.gitignore: -------------------------------------------------------------------------------- 1 | test/*_test 2 | test/test_runner 3 | src/gen 4 | -------------------------------------------------------------------------------- /requests/lib/cpp17_headers/LICENSE_1_0.txt: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /requests/src/curl_library_info.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #include "curl_library_info.h" 12 | 13 | #include "curl/curl.h" 14 | 15 | namespace Requests { 16 | 17 | auto print_curl_library_info() 18 | -> void 19 | { 20 | curl_version_info_data *data = curl_version_info(CURLVERSION_NOW); 21 | 22 | auto TAG = "cURL"; 23 | ESP_LOGI(TAG, "Version info:"); 24 | ESP_LOGI(TAG, "version: %s - %d", data->version, data->version_num); 25 | ESP_LOGI(TAG, "host: %s", data->host); 26 | 27 | print_check_feature(TAG, data->features, CURL_VERSION_IPV6, "IPv6"); 28 | print_check_feature(TAG, data->features, CURL_VERSION_SSL, "SSL"); 29 | print_check_feature(TAG, data->features, CURL_VERSION_HTTP2, "HTTP2"); 30 | print_check_feature(TAG, data->features, CURL_VERSION_LIBZ, "LIBZ"); 31 | print_check_feature(TAG, data->features, CURL_VERSION_NTLM, "NTLM"); 32 | print_check_feature(TAG, data->features, CURL_VERSION_DEBUG, "DEBUG"); 33 | print_check_feature(TAG, data->features, CURL_VERSION_UNIX_SOCKETS, "UNIX sockets"); 34 | 35 | ESP_LOGI(TAG, "Protocols:"); 36 | int i=0; 37 | while (data->protocols[i] != nullptr) 38 | { 39 | ESP_LOGI(TAG, "- %s", data->protocols[i]); 40 | i++; 41 | } 42 | } 43 | 44 | } // namespace Requests 45 | -------------------------------------------------------------------------------- /requests/src/curl_library_info.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "esp_log.h" 14 | 15 | namespace Requests { 16 | 17 | auto has_feature = [](const auto features, const auto feature_flag) 18 | -> bool 19 | { 20 | return (features & feature_flag); 21 | }; 22 | 23 | auto print_check_feature = []( 24 | const auto TAG, 25 | const auto features, 26 | const auto feature_flag, 27 | const auto feature_name 28 | ) -> bool 29 | { 30 | auto supported = has_feature(features, feature_flag); 31 | ESP_LOGI(TAG, "- %s%s supported", feature_name, supported? "" : " NOT"); 32 | 33 | return supported; 34 | }; 35 | 36 | auto print_curl_library_info() 37 | -> void; 38 | 39 | } // namespace Requests 40 | -------------------------------------------------------------------------------- /requests/src/gen/.PLACEHOLDER: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulreimer/esp32-network-lib/b219dce0d739e19ae150dd4ed6e6b3750d750d7f/requests/src/gen/.PLACEHOLDER -------------------------------------------------------------------------------- /requests/src/http_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include 14 | #include 15 | 16 | namespace Requests { 17 | 18 | auto parse_http_status_line(const std::string_view chunk) 19 | -> int; 20 | 21 | auto is_char_url_safe(const char c) 22 | -> bool; 23 | 24 | auto urlencode(const std::string_view raw_str) 25 | -> std::string; 26 | 27 | } // namespace Requests 28 | -------------------------------------------------------------------------------- /requests/src/queued_endpoint_actor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "actor_model.h" 14 | 15 | namespace Requests { 16 | 17 | auto queued_endpoint_actor_behaviour( 18 | const ActorModel::Pid& self, 19 | ActorModel::StatePtr& state, 20 | const ActorModel::Message& message 21 | ) -> ActorModel::ResultUnion; 22 | 23 | } // namespace Requests 24 | -------------------------------------------------------------------------------- /requests/src/request_manager_actor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "actor_model.h" 14 | 15 | namespace Requests { 16 | 17 | auto request_manager_actor_behaviour( 18 | const ActorModel::Pid& self, 19 | ActorModel::StatePtr& state, 20 | const ActorModel::Message& message 21 | ) -> ActorModel::ResultUnion; 22 | 23 | } // namespace Requests 24 | -------------------------------------------------------------------------------- /requests/src/server_sent_events_emitter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "delegate.hpp" 14 | 15 | #include "requests_generated.h" 16 | 17 | #include 18 | #include 19 | 20 | namespace Requests { 21 | 22 | class ServerSentEventsEmitter 23 | { 24 | public: 25 | using string_view = std::string_view; 26 | using string = std::string; 27 | 28 | using PostCallbackAction = bool; 29 | using Callback = delegate; 30 | static constexpr PostCallbackAction AbortProcessing = false; 31 | static constexpr PostCallbackAction ContinueProcessing = true; 32 | 33 | ServerSentEventsEmitter() = default; 34 | ~ServerSentEventsEmitter() = default; 35 | 36 | auto parse( 37 | const string_view chunk, 38 | Callback&& _callback 39 | ) -> bool; 40 | 41 | private: 42 | string response_buffer; 43 | string last_id; 44 | bool first_chunk = true; 45 | }; 46 | 47 | } // namespace Requests 48 | -------------------------------------------------------------------------------- /sh2lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRCS "sh2lib.c" 2 | INCLUDE_DIRS . 3 | REQUIRES http_parser 4 | PRIV_REQUIRES lwip esp-tls) 5 | target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") 6 | -------------------------------------------------------------------------------- /sh2lib/idf_component.yml: -------------------------------------------------------------------------------- 1 | version: "1.0.3" 2 | description: HTTP2 TLS Abstraction Layer 3 | url: https://github.com/espressif/idf-extra-components/tree/master/sh2lib 4 | dependencies: 5 | idf: ">=5.0" 6 | espressif/nghttp: ">=1.41.0" 7 | -------------------------------------------------------------------------------- /statsd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register( 2 | SRCS 3 | "src/timing_metric.cpp" 4 | INCLUDE_DIRS 5 | "src" 6 | PRIV_REQUIRES 7 | "esp_hw_support" 8 | ) 9 | 10 | target_compile_options( 11 | ${COMPONENT_LIB} 12 | PRIVATE 13 | $<$:${EXTRA_CXX_WARNING_FLAGS}> 14 | ) 15 | 16 | set_source_files_properties( 17 | SOURCE 18 | "src/timing_metric.cpp" 19 | APPEND PROPERTIES 20 | COMPILE_OPTIONS 21 | "-Wno-old-style-cast;-Wno-sign-compare;" 22 | ) 23 | -------------------------------------------------------------------------------- /statsd/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "StatsD Configuration" 2 | 3 | config STATSD_SERVER_IP 4 | string "StatsD Server IP" 5 | default "127.0.0.1" 6 | help 7 | StatsD Server IP for uploading metrics to. 8 | 9 | config STATSD_SERVER_PORT 10 | int "StatsD Server Port" 11 | default "8125" 12 | help 13 | StatsD port to connect to. 14 | Should be chosen not to conflict with any other port used 15 | on the system. 16 | 17 | config STATSD_MAX_PKTSIZE 18 | int "StatsD max packet size" 19 | default "512" 20 | help 21 | Aggregate metrics until this packet size is reached, 22 | or no more metrics can be added within it. 23 | Send the packet at the point this condition is reached, 24 | then reset the buffer and begin collecting again. 25 | endmenu 26 | -------------------------------------------------------------------------------- /statsd/src/timing_metric.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "freertos/FreeRTOS.h" 14 | #include "freertos/queue.h" 15 | 16 | namespace statsd { 17 | 18 | class TimingMetric 19 | { 20 | public: 21 | TimingMetric(const char* _name); 22 | ~TimingMetric(); 23 | 24 | static QueueHandle_t statsd_queue; 25 | 26 | static constexpr auto statsd_buffer_size_max = 64U; 27 | static constexpr auto statsd_buffer_max_wait_millis = 10U; 28 | static constexpr auto statsd_buffer_overhead_size = 8U; 29 | static constexpr auto statsd_queue_length_max = 10U; 30 | 31 | private: 32 | const char* name; 33 | 34 | unsigned long long ccount_before = 0; 35 | unsigned long long ccount_after = 0; 36 | 37 | char statsd_buffer[statsd_buffer_size_max]; 38 | }; 39 | 40 | } // namespace statsd 41 | -------------------------------------------------------------------------------- /udp_server/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/src/gen") 2 | 3 | idf_component_register( 4 | SRCS 5 | "src/udp_server_actor.cpp" 6 | INCLUDE_DIRS 7 | "src" 8 | "${CMAKE_CURRENT_BINARY_DIR}/src/gen" 9 | PRIV_REQUIRES 10 | "actor_model" 11 | "lwip" 12 | "utils" 13 | ) 14 | 15 | target_compile_options( 16 | ${COMPONENT_LIB} 17 | PRIVATE 18 | $<$:${EXTRA_CXX_WARNING_FLAGS}> 19 | ) 20 | 21 | set_source_files_properties( 22 | SOURCE 23 | "src/udp_server_actor.cpp" 24 | APPEND PROPERTIES 25 | COMPILE_OPTIONS 26 | "-Wno-old-style-cast;-Wno-sign-compare;" 27 | ) 28 | 29 | FLATBUFFERS_GENERATE_GENERATED_H(udp_server_generated_h udp_server.fbs) 30 | 31 | set_property( 32 | SOURCE 33 | "src/udp_server_actor.cpp" 34 | APPEND PROPERTY 35 | OBJECT_DEPENDS 36 | "${udp_server_generated_h_OUTPUTS}" 37 | ) 38 | add_dependencies(${COMPONENT_LIB} udp_server_generated_h_TARGET) 39 | -------------------------------------------------------------------------------- /udp_server/src/udp_server_actor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "actor_model.h" 14 | 15 | namespace UDPServer { 16 | 17 | auto udp_server_actor_behaviour( 18 | const ActorModel::Pid& self, 19 | ActorModel::StatePtr& state, 20 | const ActorModel::Message& message 21 | ) -> ActorModel::ResultUnion; 22 | 23 | } // namespace UDPServer 24 | -------------------------------------------------------------------------------- /udp_server/udp_server.fbs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | include "uuid.fbs"; 12 | 13 | table UDPServerConfiguration 14 | { 15 | port:uint16 = 12345; 16 | to_pid:UUID.UUID; 17 | } 18 | 19 | namespace UDPServer; 20 | 21 | root_type UDPServerConfiguration; 22 | file_extension "fb"; 23 | file_identifier "UDPS"; 24 | -------------------------------------------------------------------------------- /utils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register( 2 | SRCS 3 | "src/filesystem.cpp" 4 | "src/timestamp.cpp" 5 | "src/trace.cpp" 6 | INCLUDE_DIRS 7 | "src" 8 | PRIV_REQUIRES 9 | "esp_timer" 10 | ) 11 | 12 | target_compile_options( 13 | ${COMPONENT_LIB} 14 | PRIVATE 15 | $<$:${EXTRA_CXX_WARNING_FLAGS}> 16 | ) 17 | 18 | set_source_files_properties( 19 | SOURCE 20 | "src/delay.cpp" 21 | "src/trace.cpp" 22 | APPEND PROPERTIES 23 | COMPILE_OPTIONS 24 | "-Wno-sign-compare;" 25 | ) 26 | -------------------------------------------------------------------------------- /utils/src/delay.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | #include "freertos/FreeRTOS.h" 16 | #include "freertos/task.h" 17 | 18 | namespace utils { 19 | auto timeout( 20 | const auto duration, 21 | const TickType_t time_base = portTICK_PERIOD_MS 22 | ) -> TickType_t 23 | { 24 | return ( 25 | static_cast(std::chrono::milliseconds(duration).count()) 26 | / time_base 27 | ); 28 | }; 29 | 30 | auto delay(const auto duration) 31 | { 32 | vTaskDelay(timeout(duration)); 33 | }; 34 | } 35 | -------------------------------------------------------------------------------- /utils/src/filesystem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | namespace utils { 18 | using Buffer = std::vector; 19 | using BufferView = std::span; 20 | using string_view = std::string_view; 21 | 22 | auto filesystem_exists( 23 | string_view path 24 | ) -> bool; 25 | 26 | auto filesystem_read( 27 | string_view path 28 | ) -> Buffer; 29 | 30 | auto filesystem_write( 31 | string_view path, 32 | const Buffer& contents 33 | ) -> bool; 34 | 35 | auto filesystem_write( 36 | string_view path, 37 | BufferView contents 38 | ) -> bool; 39 | } 40 | -------------------------------------------------------------------------------- /utils/src/timestamp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #include "timestamp.h" 12 | 13 | #include "esp_timer.h" 14 | 15 | namespace utils { 16 | auto IRAM_ATTR get_elapsed_microseconds() 17 | -> TimeDuration 18 | { 19 | //return std::chrono::system_clock::now(); 20 | return TimeDuration{esp_timer_get_time()}; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /utils/src/timestamp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | #include "esp_attr.h" 16 | 17 | namespace utils { 18 | using Timestamp = std::chrono::time_point; 19 | //using TimeDuration = std::chrono::duration; 20 | using TimeDuration = std::chrono::microseconds; 21 | //using Timestamp = int64_t; 22 | //using TimeDuration = int64_t; 23 | 24 | auto IRAM_ATTR get_elapsed_microseconds() 25 | -> TimeDuration; 26 | 27 | auto IRAM_ATTR get_interval_microseconds(const auto duration) 28 | -> int64_t 29 | { 30 | return TimeDuration(duration).count(); 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /utils/src/trace.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #include "trace.h" 12 | 13 | #include "freertos/FreeRTOS.h" 14 | 15 | namespace utils { 16 | auto get_free_heap_size() 17 | -> size_t 18 | { 19 | return xPortGetFreeHeapSize(); 20 | } 21 | 22 | auto heap_check(string_view msg) 23 | -> void 24 | { 25 | printf( 26 | "%.*s (%d heap bytes remaining)\n", 27 | msg.size(), 28 | msg.data(), 29 | get_free_heap_size() 30 | ); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /utils/src/trace.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | #include 16 | 17 | namespace utils { 18 | using string_view = std::string_view; 19 | 20 | auto get_free_heap_size() 21 | -> size_t; 22 | 23 | auto heap_check(string_view msg) 24 | -> void; 25 | } 26 | -------------------------------------------------------------------------------- /uuid/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/src/gen") 2 | 3 | idf_component_register( 4 | SRCS 5 | "src/uuid.cpp" 6 | INCLUDE_DIRS 7 | "lib/sole" 8 | "src" 9 | "${CMAKE_CURRENT_BINARY_DIR}/src/gen" 10 | REQUIRES 11 | "flatbuffers" 12 | ) 13 | 14 | target_compile_options( 15 | ${COMPONENT_LIB} 16 | PRIVATE 17 | $<$:${EXTRA_CXX_WARNING_FLAGS}> 18 | ) 19 | 20 | FLATBUFFERS_GENERATE_GENERATED_H(uuid_generated_h uuid.fbs) 21 | 22 | set_property( 23 | SOURCE 24 | "src/uuid.cpp" 25 | APPEND PROPERTY 26 | OBJECT_DEPENDS 27 | "${uuid_generated_h_OUTPUTS}" 28 | ) 29 | add_dependencies(${COMPONENT_LIB} uuid_generated_h_TARGET) 30 | 31 | set_source_files_properties( 32 | SOURCE 33 | "src/uuid.cpp" 34 | APPEND PROPERTIES 35 | COMPILE_OPTIONS 36 | "-Wno-conversion;-Wno-old-style-cast;-Wno-sign-compare;" 37 | ) 38 | -------------------------------------------------------------------------------- /uuid/lib/sole/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 r-lyeh (https://github.com/r-lyeh) 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 2. Altered source versions must be plainly marked as such, and must not be 16 | misrepresented as being the original software. 17 | 3. This notice may not be removed or altered from any source distribution. 18 | -------------------------------------------------------------------------------- /uuid/src/uuid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "uuid_generated.h" 14 | 15 | #include 16 | #include 17 | 18 | namespace UUID { 19 | 20 | static UUID NullUUID = UUID(0, 0); 21 | 22 | struct UUIDHashFunc 23 | { 24 | auto operator()(const UUID& uuid) const 25 | -> size_t; 26 | }; 27 | 28 | struct UUIDEqualFunc 29 | { 30 | auto operator()(const UUID& lhs, const UUID& rhs) const 31 | -> bool; 32 | }; 33 | 34 | auto compare_uuids( 35 | const UUID* lhs, 36 | const UUID* rhs 37 | ) -> bool; 38 | 39 | auto compare_uuids( 40 | const UUID& lhs, 41 | const UUID& rhs 42 | ) -> bool; 43 | 44 | auto compare_uuids( 45 | const std::unique_ptr& lhs, 46 | const std::unique_ptr& rhs 47 | ) -> bool; 48 | 49 | auto uuid_valid(const UUID* uuid) 50 | -> bool; 51 | 52 | auto uuid_valid(const UUID& uuid) 53 | -> bool; 54 | 55 | auto uuidgen() 56 | -> UUID; 57 | 58 | auto uuidgen(std::unique_ptr& uuid_ptr) 59 | -> void; 60 | 61 | auto uuidgen(UUID* uuid_ptr) 62 | -> void; 63 | 64 | auto update_uuid(std::unique_ptr& to_uuid_ptr, const UUID& from_uuid) 65 | -> void; 66 | 67 | auto update_uuid(UUID* to_uuid_ptr, const UUID& from_uuid) 68 | -> void; 69 | 70 | auto update_uuid(UUID& to_uuid_ptr, const UUID* from_uuid) 71 | -> void; 72 | 73 | auto get_uuid_str(const UUID& uuid) 74 | -> std::string; 75 | 76 | } // namespace UUID 77 | -------------------------------------------------------------------------------- /uuid/uuid.fbs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Paul Reimer, 2018 3 | * 4 | * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License. 5 | * To view a copy of this license, visit 6 | * https://creativecommons.org/licenses/by-nc-sa/4.0/ 7 | * or send a letter to 8 | * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 9 | */ 10 | 11 | namespace UUID; 12 | 13 | struct UUID 14 | { 15 | ab:ulong; 16 | cd:ulong; 17 | } 18 | --------------------------------------------------------------------------------