├── LICENSE ├── README.md ├── buildfs.bat ├── discover-prop.png ├── discover.png ├── files.png ├── form.png ├── info.png ├── lwip-port └── win32 │ ├── arch │ ├── bpstruct.h │ ├── cc.h │ ├── cpu.h │ ├── epstruct.h │ ├── port.h │ ├── port_device.c │ ├── port_file.c │ ├── sys_arch.c │ └── sys_arch.h │ ├── lwip_api.c │ ├── lwip_cert.c │ ├── lwipopts.h │ └── netif │ ├── ethernetif.c │ └── ethernetif.h ├── lwip └── src │ ├── FILES │ ├── api │ ├── api_lib.c │ ├── api_msg.c │ ├── err.c │ ├── if_api.c │ ├── netbuf.c │ ├── netdb.c │ ├── netifapi.c │ ├── sockets.c │ └── tcpip.c │ ├── apps │ ├── altcp_tls │ │ ├── altcp_tls_mbedtls.c │ │ ├── altcp_tls_mbedtls_mem.c │ │ ├── altcp_tls_mbedtls_mem.h │ │ └── altcp_tls_mbedtls_structs.h │ ├── lwiperf │ │ └── lwiperf.c │ ├── mdns │ │ ├── mdns.c │ │ ├── mdns_domain.c │ │ └── mdns_out.c │ ├── mqtt │ │ └── mqtt.c │ ├── netbiosns │ │ └── netbiosns.c │ ├── smtp │ │ └── smtp.c │ ├── sntp │ │ └── sntp.c │ └── tftp │ │ └── tftp.c │ ├── core │ ├── altcp.c │ ├── altcp_alloc.c │ ├── altcp_tcp.c │ ├── def.c │ ├── dns.c │ ├── inet_chksum.c │ ├── init.c │ ├── ip.c │ ├── ipv4 │ │ ├── acd.c │ │ ├── autoip.c │ │ ├── dhcp.c │ │ ├── etharp.c │ │ ├── icmp.c │ │ ├── igmp.c │ │ ├── ip4.c │ │ ├── ip4_addr.c │ │ └── ip4_frag.c │ ├── ipv6 │ │ ├── dhcp6.c │ │ ├── ethip6.c │ │ ├── icmp6.c │ │ ├── inet6.c │ │ ├── ip6.c │ │ ├── ip6_addr.c │ │ ├── ip6_frag.c │ │ ├── mld6.c │ │ └── nd6.c │ ├── mem.c │ ├── memp.c │ ├── netif.c │ ├── pbuf.c │ ├── raw.c │ ├── stats.c │ ├── sys.c │ ├── tcp.c │ ├── tcp_in.c │ ├── tcp_out.c │ ├── timeouts.c │ └── udp.c │ ├── include │ ├── lwip │ │ ├── acd.h │ │ ├── altcp.h │ │ ├── altcp_tcp.h │ │ ├── altcp_tls.h │ │ ├── api.h │ │ ├── apps │ │ │ ├── FILES │ │ │ ├── altcp_proxyconnect.h │ │ │ ├── altcp_tls_mbedtls_opts.h │ │ │ ├── fs.h │ │ │ ├── http_client.h │ │ │ ├── lwiperf.h │ │ │ ├── mdns.h │ │ │ ├── mdns_domain.h │ │ │ ├── mdns_opts.h │ │ │ ├── mdns_out.h │ │ │ ├── mdns_priv.h │ │ │ ├── mqtt.h │ │ │ ├── mqtt_opts.h │ │ │ ├── mqtt_priv.h │ │ │ ├── netbiosns.h │ │ │ ├── netbiosns_opts.h │ │ │ ├── smtp.h │ │ │ ├── smtp_opts.h │ │ │ ├── sntp.h │ │ │ ├── sntp_opts.h │ │ │ ├── tftp_client.h │ │ │ ├── tftp_common.h │ │ │ ├── tftp_opts.h │ │ │ └── tftp_server.h │ │ ├── arch.h │ │ ├── autoip.h │ │ ├── debug.h │ │ ├── def.h │ │ ├── dhcp.h │ │ ├── dhcp6.h │ │ ├── dns.h │ │ ├── err.h │ │ ├── errno.h │ │ ├── etharp.h │ │ ├── ethip6.h │ │ ├── icmp.h │ │ ├── icmp6.h │ │ ├── if_api.h │ │ ├── igmp.h │ │ ├── inet.h │ │ ├── inet_chksum.h │ │ ├── init.h │ │ ├── init.h.cmake.in │ │ ├── ip.h │ │ ├── ip4.h │ │ ├── ip4_addr.h │ │ ├── ip4_frag.h │ │ ├── ip6.h │ │ ├── ip6_addr.h │ │ ├── ip6_frag.h │ │ ├── ip6_zone.h │ │ ├── ip_addr.h │ │ ├── mem.h │ │ ├── memp.h │ │ ├── mld6.h │ │ ├── nd6.h │ │ ├── netbuf.h │ │ ├── netdb.h │ │ ├── netif.h │ │ ├── netifapi.h │ │ ├── opt.h │ │ ├── pbuf.h │ │ ├── priv │ │ │ ├── altcp_priv.h │ │ │ ├── api_msg.h │ │ │ ├── mem_priv.h │ │ │ ├── memp_priv.h │ │ │ ├── memp_std.h │ │ │ ├── nd6_priv.h │ │ │ ├── raw_priv.h │ │ │ ├── sockets_priv.h │ │ │ ├── tcp_priv.h │ │ │ └── tcpip_priv.h │ │ ├── prot │ │ │ ├── acd.h │ │ │ ├── autoip.h │ │ │ ├── dhcp.h │ │ │ ├── dhcp6.h │ │ │ ├── dns.h │ │ │ ├── etharp.h │ │ │ ├── ethernet.h │ │ │ ├── iana.h │ │ │ ├── icmp.h │ │ │ ├── icmp6.h │ │ │ ├── ieee.h │ │ │ ├── igmp.h │ │ │ ├── ip.h │ │ │ ├── ip4.h │ │ │ ├── ip6.h │ │ │ ├── mld6.h │ │ │ ├── nd6.h │ │ │ ├── tcp.h │ │ │ └── udp.h │ │ ├── raw.h │ │ ├── sio.h │ │ ├── snmp.h │ │ ├── sockets.h │ │ ├── stats.h │ │ ├── sys.h │ │ ├── tcp.h │ │ ├── tcpbase.h │ │ ├── tcpip.h │ │ ├── timeouts.h │ │ └── udp.h │ └── netif │ │ ├── bridgeif.h │ │ ├── bridgeif_opts.h │ │ ├── etharp.h │ │ ├── ethernet.h │ │ ├── ieee802154.h │ │ ├── lowpan6.h │ │ ├── lowpan6_ble.h │ │ ├── lowpan6_common.h │ │ ├── lowpan6_opts.h │ │ ├── ppp │ │ ├── ccp.h │ │ ├── chap-md5.h │ │ ├── chap-new.h │ │ ├── chap_ms.h │ │ ├── eap.h │ │ ├── ecp.h │ │ ├── eui64.h │ │ ├── fsm.h │ │ ├── ipcp.h │ │ ├── ipv6cp.h │ │ ├── lcp.h │ │ ├── magic.h │ │ ├── mppe.h │ │ ├── polarssl │ │ │ ├── arc4.h │ │ │ ├── des.h │ │ │ ├── md4.h │ │ │ ├── md5.h │ │ │ └── sha1.h │ │ ├── ppp.h │ │ ├── ppp_impl.h │ │ ├── ppp_opts.h │ │ ├── pppapi.h │ │ ├── pppcrypt.h │ │ ├── pppdebug.h │ │ ├── pppoe.h │ │ ├── pppol2tp.h │ │ ├── pppos.h │ │ ├── upap.h │ │ └── vj.h │ │ ├── slipif.h │ │ └── zepif.h │ └── netif │ ├── FILES │ ├── bridgeif.c │ ├── bridgeif_fdb.c │ ├── ethernet.c │ ├── lowpan6.c │ ├── lowpan6_ble.c │ ├── lowpan6_common.c │ ├── slipif.c │ └── zepif.c ├── makecert.bat ├── makecert.exe ├── mbedtls ├── configs │ ├── README.txt │ ├── config-ccm-psk-tls1_2.h │ ├── config-mini-tls1_1.h │ ├── config-no-entropy.h │ ├── config-psa-crypto.h │ ├── config-suite-b.h │ ├── config-symmetric-only.h │ └── config-thread.h ├── include │ ├── mbedtls │ │ ├── aes.h │ │ ├── aesni.h │ │ ├── arc4.h │ │ ├── aria.h │ │ ├── asn1.h │ │ ├── asn1write.h │ │ ├── base64.h │ │ ├── bignum.h │ │ ├── blowfish.h │ │ ├── bn_mul.h │ │ ├── camellia.h │ │ ├── ccm.h │ │ ├── certs.h │ │ ├── chacha20.h │ │ ├── chachapoly.h │ │ ├── check_config.h │ │ ├── cipher.h │ │ ├── cipher_internal.h │ │ ├── cmac.h │ │ ├── compat-1.3.h │ │ ├── config-pic32.h │ │ ├── config.h │ │ ├── config_org.h │ │ ├── config_user.h │ │ ├── ctr_drbg.h │ │ ├── debug.h │ │ ├── des.h │ │ ├── dhm.h │ │ ├── ecdh.h │ │ ├── ecdsa.h │ │ ├── ecjpake.h │ │ ├── ecp.h │ │ ├── ecp_internal.h │ │ ├── entropy.h │ │ ├── entropy_poll.h │ │ ├── error.h │ │ ├── gcm.h │ │ ├── havege.h │ │ ├── hkdf.h │ │ ├── hmac_drbg.h │ │ ├── md.h │ │ ├── md2.h │ │ ├── md4.h │ │ ├── md5.h │ │ ├── md_internal.h │ │ ├── memory_buffer_alloc.h │ │ ├── net.h │ │ ├── net_sockets.h │ │ ├── nist_kw.h │ │ ├── oid.h │ │ ├── padlock.h │ │ ├── pem.h │ │ ├── pk.h │ │ ├── pk_internal.h │ │ ├── pkcs11.h │ │ ├── pkcs12.h │ │ ├── pkcs5.h │ │ ├── platform.h │ │ ├── platform_time.h │ │ ├── platform_util.h │ │ ├── poly1305.h │ │ ├── psa_util.h │ │ ├── ripemd160.h │ │ ├── rsa.h │ │ ├── rsa_internal.h │ │ ├── sha1.h │ │ ├── sha256.h │ │ ├── sha512.h │ │ ├── ssl.h │ │ ├── ssl_cache.h │ │ ├── ssl_ciphersuites.h │ │ ├── ssl_cookie.h │ │ ├── ssl_internal.h │ │ ├── ssl_ticket.h │ │ ├── threading.h │ │ ├── timing.h │ │ ├── version.h │ │ ├── x509.h │ │ ├── x509_crl.h │ │ ├── x509_crt.h │ │ ├── x509_csr.h │ │ └── xtea.h │ └── psa │ │ ├── crypto.h │ │ ├── crypto_accel_driver.h │ │ ├── crypto_compat.h │ │ ├── crypto_driver_common.h │ │ ├── crypto_entropy_driver.h │ │ ├── crypto_extra.h │ │ ├── crypto_platform.h │ │ ├── crypto_se_driver.h │ │ ├── crypto_sizes.h │ │ ├── crypto_struct.h │ │ ├── crypto_types.h │ │ └── crypto_values.h └── library │ ├── aes.c │ ├── aesni.c │ ├── arc4.c │ ├── aria.c │ ├── asn1parse.c │ ├── asn1write.c │ ├── base64.c │ ├── bignum.c │ ├── blowfish.c │ ├── camellia.c │ ├── ccm.c │ ├── certs.c │ ├── chacha20.c │ ├── chachapoly.c │ ├── cipher.c │ ├── cipher_wrap.c │ ├── cmac.c │ ├── common.h │ ├── ctr_drbg.c │ ├── debug.c │ ├── des.c │ ├── dhm.c │ ├── ecdh.c │ ├── ecdsa.c │ ├── ecjpake.c │ ├── ecp.c │ ├── ecp_curves.c │ ├── entropy.c │ ├── entropy_poll.c │ ├── error.c │ ├── gcm.c │ ├── havege.c │ ├── hkdf.c │ ├── hmac_drbg.c │ ├── md.c │ ├── md2.c │ ├── md4.c │ ├── md5.c │ ├── memory_buffer_alloc.c │ ├── net_sockets.c │ ├── nist_kw.c │ ├── oid.c │ ├── padlock.c │ ├── pem.c │ ├── pk.c │ ├── pk_wrap.c │ ├── pkcs11.c │ ├── pkcs12.c │ ├── pkcs5.c │ ├── pkparse.c │ ├── pkwrite.c │ ├── platform.c │ ├── platform_util.c │ ├── poly1305.c │ ├── psa_crypto.c │ ├── psa_crypto_core.h │ ├── psa_crypto_invasive.h │ ├── psa_crypto_its.h │ ├── psa_crypto_se.c │ ├── psa_crypto_se.h │ ├── psa_crypto_service_integration.h │ ├── psa_crypto_slot_management.c │ ├── psa_crypto_slot_management.h │ ├── psa_crypto_storage.c │ ├── psa_crypto_storage.h │ ├── psa_its_file.c │ ├── ripemd160.c │ ├── rsa.c │ ├── rsa_internal.c │ ├── sha1.c │ ├── sha256.c │ ├── sha512.c │ ├── ssl_cache.c │ ├── ssl_ciphersuites.c │ ├── ssl_cli.c │ ├── ssl_cookie.c │ ├── ssl_msg.c │ ├── ssl_srv.c │ ├── ssl_ticket.c │ ├── ssl_tls.c │ ├── threading.c │ ├── timing.c │ ├── version.c │ ├── version_features.c │ ├── x509.c │ ├── x509_create.c │ ├── x509_crl.c │ ├── x509_crt.c │ ├── x509_csr.c │ ├── x509write_crt.c │ ├── x509write_csr.c │ └── xtea.c ├── pcap ├── Include │ ├── Packet32.h │ ├── pcap-bpf.h │ ├── pcap-namedb.h │ ├── pcap.h │ └── pcap │ │ ├── bluetooth.h │ │ ├── bpf.h │ │ ├── can_socketcan.h │ │ ├── compiler-tests.h │ │ ├── dlt.h │ │ ├── funcattrs.h │ │ ├── ipnet.h │ │ ├── namedb.h │ │ ├── nflog.h │ │ ├── pcap-inttypes.h │ │ ├── pcap.h │ │ ├── sll.h │ │ ├── socket.h │ │ ├── usb.h │ │ └── vlan.h └── lib │ ├── Packet.lib │ ├── wpcap.lib │ └── x64 │ ├── Packet.lib │ └── wpcap.lib ├── pvk2pfx.exe ├── server.cer ├── server.pem ├── server.pfx ├── server.pvk ├── signin.png ├── stack.png ├── straight-buildfs.exe ├── straight-httpd ├── Debug │ ├── Packet.dll │ └── wpcap.dll ├── straight-buildfs │ ├── pch.cpp │ ├── pch.h │ ├── straight-buildfs.cpp │ └── straight-buildfs.vcxproj ├── straight-httpd.sln └── straight-httpd │ ├── httpd │ ├── cgi │ │ ├── cgi_auth.c │ │ ├── cgi_files.c │ │ ├── cgi_form.c │ │ ├── cgi_ssdp.c │ │ ├── cgi_ssi.c │ │ ├── cgi_upload.c │ │ └── cgi_web.c │ ├── cncweb │ │ ├── app │ │ │ ├── css │ │ │ │ └── share.css │ │ │ ├── files.shtml │ │ │ ├── form.shtml │ │ │ ├── index.shtml │ │ │ ├── js │ │ │ │ ├── base64js.min.js │ │ │ │ ├── qrcodegen.js │ │ │ │ └── share.js │ │ │ ├── plugin │ │ │ │ ├── fileList │ │ │ │ │ ├── file.png │ │ │ │ │ ├── fileList.css │ │ │ │ │ ├── fileList.js │ │ │ │ │ └── folder.png │ │ │ │ └── fileTransfer │ │ │ │ │ ├── fileTransfer.css │ │ │ │ │ └── fileTransfer.js │ │ │ └── upload.shtml │ │ └── auth │ │ │ └── login.html │ ├── fs_data.c │ ├── http_cgi.c │ ├── http_cgi.h │ ├── http_core.c │ ├── http_core.h │ ├── http_fs.c │ ├── http_fs.h │ ├── http_session.c │ ├── http_session.h │ ├── http_web.c │ └── http_web.h │ ├── ssdp │ ├── ssdp.c │ └── ssdp.h │ ├── straight-httpd.c │ ├── straight-httpd.vcxproj │ ├── straight-httpd.vcxproj.filters │ ├── utils.c │ └── utils.h ├── tasks.png ├── upload.png └── work-flow.png /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 straight-coding 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 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do 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 THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /buildfs.bat: -------------------------------------------------------------------------------- 1 | straight-buildfs.exe "straight-httpd\straight-httpd\httpd\cncweb" "straight-httpd\straight-httpd\httpd" 2 | pause 3 | -------------------------------------------------------------------------------- /discover-prop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/straight-coding/straight-httpd-lwip-mbedtls-simulator/d74c483f00cf7f1a8db0cd4d16fd48be3c43bdfe/discover-prop.png -------------------------------------------------------------------------------- /discover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/straight-coding/straight-httpd-lwip-mbedtls-simulator/d74c483f00cf7f1a8db0cd4d16fd48be3c43bdfe/discover.png -------------------------------------------------------------------------------- /files.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/straight-coding/straight-httpd-lwip-mbedtls-simulator/d74c483f00cf7f1a8db0cd4d16fd48be3c43bdfe/files.png -------------------------------------------------------------------------------- /form.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/straight-coding/straight-httpd-lwip-mbedtls-simulator/d74c483f00cf7f1a8db0cd4d16fd48be3c43bdfe/form.png -------------------------------------------------------------------------------- /info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/straight-coding/straight-httpd-lwip-mbedtls-simulator/d74c483f00cf7f1a8db0cd4d16fd48be3c43bdfe/info.png -------------------------------------------------------------------------------- /lwip-port/win32/arch/bpstruct.h: -------------------------------------------------------------------------------- 1 | #pragma pack(push,1) 2 | -------------------------------------------------------------------------------- /lwip-port/win32/arch/cc.h: -------------------------------------------------------------------------------- 1 | #ifndef __CC_H__ 2 | #define __CC_H__ 3 | 4 | #include "cpu.h" 5 | #include "stdio.h" 6 | 7 | /*-------------data type------------------------------------------------------*/ 8 | 9 | typedef unsigned char u8_t; /* Unsigned 8 bit quantity */ 10 | typedef signed char s8_t; /* Signed 8 bit quantity */ 11 | typedef unsigned short u16_t; /* Unsigned 16 bit quantity */ 12 | typedef signed short s16_t; /* Signed 16 bit quantity */ 13 | typedef unsigned long u32_t; /* Unsigned 32 bit quantity */ 14 | typedef signed long s32_t; /* Signed 32 bit quantity */ 15 | 16 | typedef signed long mem_ptr_t; /* Unsigned 32 bit quantity */ 17 | 18 | /*----------------------------------------------------------------------------*/ 19 | 20 | /* define compiler specific symbols */ 21 | #if defined (WIN32) 22 | 23 | #define PACK_STRUCT_BEGIN 24 | #define PACK_STRUCT_STRUCT 25 | #define PACK_STRUCT_END 26 | #define PACK_STRUCT_FIELD(x) x 27 | 28 | #elif defined (__ICCARM__) 29 | 30 | #define PACK_STRUCT_BEGIN 31 | #define PACK_STRUCT_STRUCT 32 | #define PACK_STRUCT_END 33 | #define PACK_STRUCT_FIELD(x) x 34 | #define PACK_STRUCT_USE_INCLUDES 35 | 36 | #elif defined (__CC_ARM) 37 | 38 | #define PACK_STRUCT_BEGIN __packed 39 | #define PACK_STRUCT_STRUCT 40 | #define PACK_STRUCT_END 41 | #define PACK_STRUCT_FIELD(x) x 42 | 43 | #elif defined (__GNUC__) 44 | 45 | #define PACK_STRUCT_BEGIN 46 | #define PACK_STRUCT_STRUCT __attribute__ ((__packed__)) 47 | #define PACK_STRUCT_END 48 | #define PACK_STRUCT_FIELD(x) x 49 | 50 | #elif defined (__TASKING__) 51 | 52 | #define PACK_STRUCT_BEGIN 53 | #define PACK_STRUCT_STRUCT 54 | #define PACK_STRUCT_END 55 | #define PACK_STRUCT_FIELD(x) x 56 | 57 | #endif 58 | 59 | /*---define (sn)printf formatters for these lwip types, for lwip DEBUG/STATS--*/ 60 | 61 | #define U16_F "4d" 62 | #define S16_F "4d" 63 | #define X16_F "4x" 64 | #define U32_F "8ld" 65 | #define S32_F "8ld" 66 | #define X32_F "8lx" 67 | 68 | #define PRIx8 "hhx" 69 | #define PRIx16 "hx" 70 | #define PRIx32 "x" 71 | #define PRIx64 "llx" 72 | 73 | #define PRIu8 "hhu" 74 | #define PRIu16 "hu" 75 | #define PRIu32 "u" 76 | #define PRIu64 "llu" 77 | 78 | #ifdef _WIN64 79 | #define PRIuPTR PRIu64 80 | #else 81 | #define PRIuPTR PRIu32 82 | #endif 83 | 84 | #ifndef X8_F 85 | #define X8_F "02" PRIx8 86 | #endif 87 | #ifndef U16_F 88 | #define U16_F PRIu16 89 | #endif 90 | #ifndef S16_F 91 | #define S16_F PRId16 92 | #endif 93 | #ifndef X16_F 94 | #define X16_F PRIx16 95 | #endif 96 | #ifndef U32_F 97 | #define U32_F PRIu32 98 | #endif 99 | #ifndef S32_F 100 | #define S32_F PRId32 101 | #endif 102 | #ifndef X32_F 103 | #define X32_F PRIx32 104 | #endif 105 | #ifndef SZT_F 106 | #define SZT_F PRIuPTR 107 | #endif 108 | 109 | /*--------------macros--------------------------------------------------------*/ 110 | #ifndef LWIP_PLATFORM_ASSERT 111 | #define LWIP_PLATFORM_ASSERT(x) do {LwipLogPrint(x);} while(0) 112 | //#define LWIP_PLATFORM_ASSERT(x) \ 113 | // do \ 114 | // { printf("Assertion \"%s\" failed at line %d in %s\n", x, __LINE__, __FILE__); \ 115 | // } while(0) 116 | #endif 117 | 118 | #ifndef LWIP_PLATFORM_DIAG 119 | #define LWIP_PLATFORM_DIAG(x) do {LwipLogPrint x;} while(0) 120 | //#define LWIP_PLATFORM_DIAG(x) \ 121 | // do \ 122 | // { printf("Assertion \"%s\" failed at line %d in %s\n", x, __LINE__, __FILE__); \ 123 | // } while(0) 124 | #endif 125 | 126 | #endif /* __CC_H__ */ 127 | -------------------------------------------------------------------------------- /lwip-port/win32/arch/cpu.h: -------------------------------------------------------------------------------- 1 | #ifndef __CPU_H__ 2 | #define __CPU_H__ 3 | 4 | #define BYTE_ORDER LITTLE_ENDIAN 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /lwip-port/win32/arch/epstruct.h: -------------------------------------------------------------------------------- 1 | #pragma pack(pop) 2 | -------------------------------------------------------------------------------- /lwip-port/win32/lwip_cert.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | //Date: 2020-11-15, created by https://github.com/straight-coding/EmbedTools 6 | 7 | //Issuer: CN=Straight RootCA 8 | //Subject: CN=Straight Server 9 | 10 | const char *privkey = "-----BEGIN PRIVATE KEY-----\n"\ 11 | "MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEAhD0FKNdH91c8Vis0\n"\ 12 | "T7Pli3Grb+BM5xA1V/iNTGer5WSwJlAab6lJ6NNh7R15AXOO7XODOs58ikmEqgWi\n"\ 13 | "wacQfwIDAQABAkAG4KeSirPO/OYB80hKtugC2xwX+vn08IZdt2sd5Kxvhzvmp9eM\n"\ 14 | "F4QhlQLHOMrk5LkM7FF0G3FgZHlOAZAVbQTtAiEA6SOLWEpnCCEkkCLMmZTcwzV0\n"\ 15 | "cX9c7ngnOF/xwIn8IT0CIQCRNJVZ3YcJoXFuOCdUid8qOqdatCDkV8TQNxXxPVSc\n"\ 16 | "awIgR1fIMXl7NAKoZK8xeyIRuG7oNj8qWhNMtTSvDyNqk2UCIGgVWi0ldwN3Pviz\n"\ 17 | "tbWKcnYxvv5sedtT8pcRtV/MB5drAiBZSqkW9Ha37EObdrctWBvBvHtUp8k9XOy6\n"\ 18 | "1X0wxUy5BQ==\n"\ 19 | "-----END PRIVATE KEY-----\n"; 20 | 21 | const char *cert = "-----BEGIN CERTIFICATE-----\n"\ 22 | "MIIB2jCCAYSgAwIBAgIIU3U2E0/GMUowDQYJKoZIhvcNAQELBQAwGjEYMBYGA1UE\n"\ 23 | "AwwPU3RyYWlnaHQgUm9vdENBMB4XDTIwMTExNTAwMDAwMFoXDTQwMTExNTAwMDAw\n"\ 24 | "MFowGjEYMBYGA1UEAwwPU3RyYWlnaHQgU2VydmVyMFwwDQYJKoZIhvcNAQEBBQAD\n"\ 25 | "SwAwSAJBAIQ9BSjXR/dXPFYrNE+z5Ytxq2/gTOcQNVf4jUxnq+VksCZQGm+pSejT\n"\ 26 | "Ye0deQFzju1zgzrOfIpJhKoFosGnEH8CAwEAAaOBrTCBqjBJBgNVHSMEQjBAgBSD\n"\ 27 | "hOKzs+3Mo56OeliOMM0gQZgafKEepBwwGjEYMBYGA1UEAwwPU3RyYWlnaHQgUm9v\n"\ 28 | "dENBgghnEtSASbZ0HDAdBgNVHQ4EFgQUGroKNtRTXQ7nxeYSQlZq35oVQDQwDAYD\n"\ 29 | "VR0TAQH/BAIwADATBgNVHSUEDDAKBggrBgEFBQcDATAbBgNVHREEFDASggZzZXJ2\n"\ 30 | "ZXKCCHN0cmFpZ2h0MA0GCSqGSIb3DQEBCwUAA0EAO02jJwxokR4CeA8DDJqp/9Qk\n"\ 31 | "0dim//+cjVTjxqIgUS5ykNW2CAIRuP5rVyzNv6U02F0q92Vs/754/ep+TyT70w==\n"\ 32 | "-----END CERTIFICATE-----\n"; 33 | -------------------------------------------------------------------------------- /lwip-port/win32/netif/ethernetif.c: -------------------------------------------------------------------------------- 1 | /* 2 | ethernetif.c 3 | Author: Straight Coder 4 | Date: April 12, 2020 5 | */ 6 | 7 | #include "lwip/opt.h" 8 | #include "lwip/sys.h" 9 | 10 | #include "netif/etharp.h" 11 | #include "ethernetif.h" 12 | 13 | #include "arch/port.h" //NIC interfaces 14 | 15 | static err_t low_level_init(struct netif *netif) 16 | { 17 | u8_t* pMac; 18 | struct ethernetif *ethernetif = netif->state; 19 | 20 | netif->hwaddr_len = ETHARP_HWADDR_LEN; 21 | pMac = GetMyMAC(); 22 | 23 | netif->hwaddr[0] = pMac[0]; 24 | netif->hwaddr[1] = pMac[1]; 25 | netif->hwaddr[2] = pMac[2]; 26 | netif->hwaddr[3] = pMac[3]; 27 | netif->hwaddr[4] = pMac[4]; 28 | netif->hwaddr[5] = pMac[5]; 29 | 30 | netif->mtu = 1500; 31 | netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_IGMP | NETIF_FLAG_LINK_UP; 32 | 33 | return ERR_OK; //ERR_IF 34 | } 35 | 36 | err_t low_level_output(struct netif *netif, struct pbuf *p) 37 | { 38 | struct pbuf *q; 39 | int l = 0; 40 | u8_t* buffer = NULL; 41 | 42 | SYS_ARCH_DECL_PROTECT(sr); 43 | SYS_ARCH_PROTECT(sr); 44 | 45 | buffer = NIC_GetBuffer(1600); 46 | if (buffer != NULL) 47 | { 48 | for (q = p; q != NULL; q = q->next) 49 | { 50 | MEMCPY((u8_t*)&buffer[l], q->payload, q->len); 51 | l = l + q->len; 52 | } 53 | NIC_Send(buffer, l); 54 | } 55 | 56 | SYS_ARCH_UNPROTECT(sr); 57 | 58 | return ERR_OK; 59 | } 60 | 61 | pbuf_t* low_level_input(struct netif *netif) 62 | { 63 | struct pbuf *p, *q; 64 | int len = 0; 65 | int l = 0; 66 | struct packet_wrapper* pkt = NULL; 67 | u8_t *buffer; 68 | 69 | p = NULL; 70 | 71 | pkt = DMA_pop(); 72 | if (pkt != NULL) 73 | { 74 | len = pkt->len; 75 | buffer = (u8_t *)pkt->packet; 76 | 77 | p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL); 78 | if (p != NULL) 79 | { 80 | for (q = p; q != 0; q = q->next) 81 | { 82 | MEMCPY((u8_t*)q->payload, (u8_t*)&buffer[l], q->len); 83 | l = l + q->len; 84 | } 85 | } 86 | } 87 | if (pkt != NULL) 88 | DMA_free(pkt); 89 | 90 | return p; 91 | } 92 | 93 | err_t ethernetif_input(struct netif *inp) 94 | { 95 | err_t err; 96 | struct pbuf *p; 97 | SYS_ARCH_DECL_PROTECT(sr); 98 | 99 | SYS_ARCH_PROTECT(sr); 100 | p = low_level_input(inp); 101 | SYS_ARCH_UNPROTECT(sr); 102 | 103 | if (p == NULL) 104 | return ERR_MEM; 105 | 106 | err = inp->input(p, inp); 107 | if (err != ERR_OK) 108 | { 109 | LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_input: IP input error\n")); 110 | pbuf_free(p); 111 | p = NULL; 112 | } 113 | 114 | return err; 115 | } 116 | 117 | err_t ethernetif_init(struct netif *netif) 118 | { 119 | netif->output = etharp_output; //defined: lwip\src\core\ipv4\etharp.c 120 | netif->linkoutput = low_level_output; 121 | 122 | return low_level_init(netif); 123 | } 124 | -------------------------------------------------------------------------------- /lwip-port/win32/netif/ethernetif.h: -------------------------------------------------------------------------------- 1 | /* 2 | ethernetif.h 3 | Author: Straight Coder 4 | Date: April 12, 2020 5 | */ 6 | 7 | #ifndef _ETHERNETIF_H 8 | #define _ETHERNETIF_H 9 | 10 | #include "lwip/err.h" 11 | #include "lwip/inet.h" 12 | #include "lwip/netif.h" 13 | #include "lwip/pbuf.h" 14 | 15 | typedef struct pbuf pbuf_t; 16 | typedef struct netif netif_t; 17 | 18 | err_t ethernetif_input(struct netif *inp); 19 | err_t ethernetif_init(struct netif *net); 20 | pbuf_t* low_level_input(struct netif *netif); 21 | err_t low_level_output(struct netif *netif, struct pbuf *p); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /lwip/src/FILES: -------------------------------------------------------------------------------- 1 | api/ - The code for the high-level wrapper API. Not needed if 2 | you use the lowel-level call-back/raw API. 3 | 4 | apps/ - Higher layer applications that are specifically programmed 5 | with the lwIP low-level raw API. 6 | 7 | core/ - The core of the TPC/IP stack; protocol implementations, 8 | memory and buffer management, and the low-level raw API. 9 | 10 | include/ - lwIP include files. 11 | 12 | netif/ - Generic network interface device drivers are kept here. 13 | 14 | For more information on the various subdirectories, check the FILES 15 | file in each directory. 16 | -------------------------------------------------------------------------------- /lwip/src/apps/altcp_tls/altcp_tls_mbedtls_mem.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Application layered TCP/TLS connection API (to be used from TCPIP thread) 4 | * 5 | * This file contains memory management function prototypes for a TLS layer using mbedTLS. 6 | * 7 | * Memory management contains: 8 | * - allocating/freeing altcp_mbedtls_state_t 9 | * - allocating/freeing memory used in the mbedTLS library 10 | */ 11 | 12 | /* 13 | * Copyright (c) 2017 Simon Goldschmidt 14 | * All rights reserved. 15 | * 16 | * Redistribution and use in source and binary forms, with or without modification, 17 | * are permitted provided that the following conditions are met: 18 | * 19 | * 1. Redistributions of source code must retain the above copyright notice, 20 | * this list of conditions and the following disclaimer. 21 | * 2. Redistributions in binary form must reproduce the above copyright notice, 22 | * this list of conditions and the following disclaimer in the documentation 23 | * and/or other materials provided with the distribution. 24 | * 3. The name of the author may not be used to endorse or promote products 25 | * derived from this software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 28 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 29 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 30 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 31 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 32 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 35 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 36 | * OF SUCH DAMAGE. 37 | * 38 | * This file is part of the lwIP TCP/IP stack. 39 | * 40 | * Author: Simon Goldschmidt 41 | * 42 | */ 43 | #ifndef LWIP_HDR_ALTCP_MBEDTLS_MEM_H 44 | #define LWIP_HDR_ALTCP_MBEDTLS_MEM_H 45 | 46 | #include "lwip/opt.h" 47 | 48 | #if LWIP_ALTCP /* don't build if not configured for use in lwipopts.h */ 49 | 50 | #include "lwip/apps/altcp_tls_mbedtls_opts.h" 51 | 52 | #if LWIP_ALTCP_TLS && LWIP_ALTCP_TLS_MBEDTLS 53 | 54 | #include "altcp_tls_mbedtls_structs.h" 55 | 56 | #ifdef __cplusplus 57 | extern "C" { 58 | #endif 59 | 60 | void altcp_mbedtls_mem_init(void); 61 | altcp_mbedtls_state_t *altcp_mbedtls_alloc(void *conf); 62 | void altcp_mbedtls_free(void *conf, altcp_mbedtls_state_t *state); 63 | void *altcp_mbedtls_alloc_config(size_t size); 64 | void altcp_mbedtls_free_config(void *item); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif /* LWIP_ALTCP_TLS && LWIP_ALTCP_TLS_MBEDTLS */ 71 | #endif /* LWIP_ALTCP */ 72 | #endif /* LWIP_HDR_ALTCP_MBEDTLS_MEM_H */ 73 | -------------------------------------------------------------------------------- /lwip/src/apps/altcp_tls/altcp_tls_mbedtls_structs.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Application layered TCP/TLS connection API (to be used from TCPIP thread) 4 | * 5 | * This file contains structure definitions for a TLS layer using mbedTLS. 6 | */ 7 | 8 | /* 9 | * Copyright (c) 2017 Simon Goldschmidt 10 | * All rights reserved. 11 | * 12 | * Redistribution and use in source and binary forms, with or without modification, 13 | * are permitted provided that the following conditions are met: 14 | * 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. The name of the author may not be used to endorse or promote products 21 | * derived from this software without specific prior written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 24 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 25 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 26 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 28 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 31 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | * OF SUCH DAMAGE. 33 | * 34 | * This file is part of the lwIP TCP/IP stack. 35 | * 36 | * Author: Simon Goldschmidt 37 | * 38 | */ 39 | #ifndef LWIP_HDR_ALTCP_MBEDTLS_STRUCTS_H 40 | #define LWIP_HDR_ALTCP_MBEDTLS_STRUCTS_H 41 | 42 | #include "lwip/opt.h" 43 | 44 | #if LWIP_ALTCP /* don't build if not configured for use in lwipopts.h */ 45 | 46 | #include "lwip/apps/altcp_tls_mbedtls_opts.h" 47 | 48 | #if LWIP_ALTCP_TLS && LWIP_ALTCP_TLS_MBEDTLS 49 | 50 | #include "lwip/altcp.h" 51 | #include "lwip/pbuf.h" 52 | 53 | #include "mbedtls/ssl.h" 54 | 55 | #ifdef __cplusplus 56 | extern "C" { 57 | #endif 58 | 59 | #define ALTCP_MBEDTLS_FLAGS_HANDSHAKE_DONE 0x01 60 | #define ALTCP_MBEDTLS_FLAGS_UPPER_CALLED 0x02 61 | #define ALTCP_MBEDTLS_FLAGS_RX_CLOSE_QUEUED 0x04 62 | #define ALTCP_MBEDTLS_FLAGS_RX_CLOSED 0x08 63 | 64 | typedef struct altcp_mbedtls_state_s { 65 | void *conf; 66 | mbedtls_ssl_context ssl_context; 67 | /* chain of rx pbufs (before decryption) */ 68 | struct pbuf *rx; 69 | struct pbuf *rx_app; 70 | u8_t flags; 71 | int rx_passed_unrecved; 72 | int bio_bytes_read; 73 | int bio_bytes_appl; 74 | int overhead_bytes_adjust; 75 | } altcp_mbedtls_state_t; 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | 81 | #endif /* LWIP_ALTCP_TLS && LWIP_ALTCP_TLS_MBEDTLS */ 82 | #endif /* LWIP_ALTCP */ 83 | #endif /* LWIP_HDR_ALTCP_MBEDTLS_STRUCTS_H */ 84 | -------------------------------------------------------------------------------- /lwip/src/core/altcp_alloc.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Application layered TCP connection API (to be used from TCPIP thread)
4 | * This interface mimics the tcp callback API to the application while preventing 5 | * direct linking (much like virtual functions). 6 | * This way, an application can make use of other application layer protocols 7 | * on top of TCP without knowing the details (e.g. TLS, proxy connection). 8 | * 9 | * This file contains allocation implementation that combine several layers. 10 | */ 11 | 12 | /* 13 | * Copyright (c) 2017 Simon Goldschmidt 14 | * All rights reserved. 15 | * 16 | * Redistribution and use in source and binary forms, with or without modification, 17 | * are permitted provided that the following conditions are met: 18 | * 19 | * 1. Redistributions of source code must retain the above copyright notice, 20 | * this list of conditions and the following disclaimer. 21 | * 2. Redistributions in binary form must reproduce the above copyright notice, 22 | * this list of conditions and the following disclaimer in the documentation 23 | * and/or other materials provided with the distribution. 24 | * 3. The name of the author may not be used to endorse or promote products 25 | * derived from this software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 28 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 29 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 30 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 31 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 32 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 35 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 36 | * OF SUCH DAMAGE. 37 | * 38 | * This file is part of the lwIP TCP/IP stack. 39 | * 40 | * Author: Simon Goldschmidt 41 | * 42 | */ 43 | 44 | #include "lwip/opt.h" 45 | 46 | #if LWIP_ALTCP /* don't build if not configured for use in lwipopts.h */ 47 | 48 | #include "lwip/altcp.h" 49 | #include "lwip/altcp_tcp.h" 50 | #include "lwip/altcp_tls.h" 51 | #include "lwip/priv/altcp_priv.h" 52 | #include "lwip/mem.h" 53 | 54 | #include 55 | 56 | #if LWIP_ALTCP_TLS 57 | 58 | /** This standard allocator function creates an altcp pcb for 59 | * TLS over TCP */ 60 | struct altcp_pcb * 61 | altcp_tls_new(struct altcp_tls_config *config, u8_t ip_type) 62 | { 63 | struct altcp_pcb *inner_conn, *ret; 64 | LWIP_UNUSED_ARG(ip_type); 65 | 66 | inner_conn = altcp_tcp_new_ip_type(ip_type); 67 | if (inner_conn == NULL) { 68 | return NULL; 69 | } 70 | ret = altcp_tls_wrap(config, inner_conn); 71 | if (ret == NULL) { 72 | altcp_close(inner_conn); 73 | } 74 | return ret; 75 | } 76 | 77 | /** This standard allocator function creates an altcp pcb for 78 | * TLS over TCP */ 79 | struct altcp_pcb * 80 | altcp_tls_alloc(void *arg, u8_t ip_type) 81 | { 82 | return altcp_tls_new((struct altcp_tls_config *)arg, ip_type); 83 | } 84 | 85 | #endif /* LWIP_ALTCP_TLS */ 86 | 87 | #endif /* LWIP_ALTCP */ 88 | -------------------------------------------------------------------------------- /lwip/src/core/ipv6/inet6.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * 4 | * INET v6 addresses. 5 | */ 6 | 7 | /* 8 | * Copyright (c) 2010 Inico Technologies Ltd. 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright notice, 15 | * this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 3. The name of the author may not be used to endorse or promote products 20 | * derived from this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31 | * OF SUCH DAMAGE. 32 | * 33 | * This file is part of the lwIP TCP/IP stack. 34 | * 35 | * Author: Ivan Delamer 36 | * 37 | * 38 | * Please coordinate changes and requests with Ivan Delamer 39 | * 40 | */ 41 | 42 | #include "lwip/opt.h" 43 | 44 | #if LWIP_IPV6 && LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */ 45 | 46 | #include "lwip/def.h" 47 | #include "lwip/inet.h" 48 | 49 | /** This variable is initialized by the system to contain the wildcard IPv6 address. 50 | */ 51 | const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT; 52 | 53 | #endif /* LWIP_IPV6 */ 54 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/altcp_tcp.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Application layered TCP connection API (to be used from TCPIP thread)
4 | * This interface mimics the tcp callback API to the application while preventing 5 | * direct linking (much like virtual functions). 6 | * This way, an application can make use of other application layer protocols 7 | * on top of TCP without knowing the details (e.g. TLS, proxy connection). 8 | * 9 | * This file contains the base implementation calling into tcp. 10 | */ 11 | 12 | /* 13 | * Copyright (c) 2017 Simon Goldschmidt 14 | * All rights reserved. 15 | * 16 | * Redistribution and use in source and binary forms, with or without modification, 17 | * are permitted provided that the following conditions are met: 18 | * 19 | * 1. Redistributions of source code must retain the above copyright notice, 20 | * this list of conditions and the following disclaimer. 21 | * 2. Redistributions in binary form must reproduce the above copyright notice, 22 | * this list of conditions and the following disclaimer in the documentation 23 | * and/or other materials provided with the distribution. 24 | * 3. The name of the author may not be used to endorse or promote products 25 | * derived from this software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 28 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 29 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 30 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 31 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 32 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 35 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 36 | * OF SUCH DAMAGE. 37 | * 38 | * This file is part of the lwIP TCP/IP stack. 39 | * 40 | * Author: Simon Goldschmidt 41 | * 42 | */ 43 | #ifndef LWIP_HDR_ALTCP_TCP_H 44 | #define LWIP_HDR_ALTCP_TCP_H 45 | 46 | #include "lwip/opt.h" 47 | 48 | #if LWIP_ALTCP /* don't build if not configured for use in lwipopts.h */ 49 | 50 | #include "lwip/altcp.h" 51 | 52 | #ifdef __cplusplus 53 | extern "C" { 54 | #endif 55 | 56 | struct altcp_pcb *altcp_tcp_new_ip_type(u8_t ip_type); 57 | 58 | #define altcp_tcp_new() altcp_tcp_new_ip_type(IPADDR_TYPE_V4) 59 | #define altcp_tcp_new_ip6() altcp_tcp_new_ip_type(IPADDR_TYPE_V6) 60 | 61 | struct altcp_pcb *altcp_tcp_alloc(void *arg, u8_t ip_type); 62 | 63 | struct tcp_pcb; 64 | struct altcp_pcb *altcp_tcp_wrap(struct tcp_pcb *tpcb); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif /* LWIP_ALTCP */ 71 | 72 | #endif /* LWIP_HDR_ALTCP_TCP_H */ 73 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/apps/FILES: -------------------------------------------------------------------------------- 1 | This directory contains application headers. 2 | Every application shall provide one api file APP.h and optionally one options file APP_opts.h 3 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/apps/altcp_proxyconnect.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Application layered TCP connection API that executes a proxy-connect. 4 | * 5 | * This file provides a starting layer that executes a proxy-connect e.g. to 6 | * set up TLS connections through a http proxy. 7 | */ 8 | 9 | /* 10 | * Copyright (c) 2018 Simon Goldschmidt 11 | * All rights reserved. 12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 16 | * 1. Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 3. The name of the author may not be used to endorse or promote products 22 | * derived from this software without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 25 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 26 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 27 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 28 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 29 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 32 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 33 | * OF SUCH DAMAGE. 34 | * 35 | * This file is part of the lwIP TCP/IP stack. 36 | * 37 | * Author: Simon Goldschmidt 38 | * 39 | */ 40 | 41 | #ifndef LWIP_HDR_APPS_ALTCP_PROXYCONNECT_H 42 | #define LWIP_HDR_APPS_ALTCP_PROXYCONNECT_H 43 | 44 | #include "lwip/opt.h" 45 | 46 | #if LWIP_ALTCP /* don't build if not configured for use in lwipopts.h */ 47 | 48 | #include "lwip/ip_addr.h" 49 | 50 | #ifdef __cplusplus 51 | extern "C" { 52 | #endif 53 | 54 | struct altcp_proxyconnect_config { 55 | ip_addr_t proxy_addr; 56 | u16_t proxy_port; 57 | }; 58 | 59 | 60 | struct altcp_pcb *altcp_proxyconnect_new(struct altcp_proxyconnect_config *config, struct altcp_pcb *inner_pcb); 61 | struct altcp_pcb *altcp_proxyconnect_new_tcp(struct altcp_proxyconnect_config *config, u8_t ip_type); 62 | 63 | struct altcp_pcb *altcp_proxyconnect_alloc(void *arg, u8_t ip_type); 64 | 65 | #if LWIP_ALTCP_TLS 66 | struct altcp_proxyconnect_tls_config { 67 | struct altcp_proxyconnect_config proxy; 68 | struct altcp_tls_config *tls_config; 69 | }; 70 | 71 | struct altcp_pcb *altcp_proxyconnect_tls_alloc(void *arg, u8_t ip_type); 72 | #endif /* LWIP_ALTCP_TLS */ 73 | 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | 78 | #endif /* LWIP_ALTCP */ 79 | #endif /* LWIP_HDR_APPS_ALTCP_PROXYCONNECT_H */ 80 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/apps/mqtt_opts.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * MQTT client options 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2016 Erik Andersson 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | * Author: Erik Andersson 35 | * 36 | */ 37 | #ifndef LWIP_HDR_APPS_MQTT_OPTS_H 38 | #define LWIP_HDR_APPS_MQTT_OPTS_H 39 | 40 | #include "lwip/opt.h" 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /** 47 | * @defgroup mqtt_opts Options 48 | * @ingroup mqtt 49 | * @{ 50 | */ 51 | 52 | /** 53 | * Output ring-buffer size, must be able to fit largest outgoing publish message topic+payloads 54 | */ 55 | #ifndef MQTT_OUTPUT_RINGBUF_SIZE 56 | #define MQTT_OUTPUT_RINGBUF_SIZE 256 57 | #endif 58 | 59 | /** 60 | * Number of bytes in receive buffer, must be at least the size of the longest incoming topic + 8 61 | * If one wants to avoid fragmented incoming publish, set length to max incoming topic length + max payload length + 8 62 | */ 63 | #ifndef MQTT_VAR_HEADER_BUFFER_LEN 64 | #define MQTT_VAR_HEADER_BUFFER_LEN 128 65 | #endif 66 | 67 | /** 68 | * Maximum number of pending subscribe, unsubscribe and publish requests to server . 69 | */ 70 | #ifndef MQTT_REQ_MAX_IN_FLIGHT 71 | #define MQTT_REQ_MAX_IN_FLIGHT 4 72 | #endif 73 | 74 | /** 75 | * Seconds between each cyclic timer call. 76 | */ 77 | #ifndef MQTT_CYCLIC_TIMER_INTERVAL 78 | #define MQTT_CYCLIC_TIMER_INTERVAL 5 79 | #endif 80 | 81 | /** 82 | * Publish, subscribe and unsubscribe request timeout in seconds. 83 | */ 84 | #ifndef MQTT_REQ_TIMEOUT 85 | #define MQTT_REQ_TIMEOUT 30 86 | #endif 87 | 88 | /** 89 | * Seconds for MQTT connect response timeout after sending connect request 90 | */ 91 | #ifndef MQTT_CONNECT_TIMOUT 92 | #define MQTT_CONNECT_TIMOUT 100 93 | #endif 94 | 95 | /** 96 | * @} 97 | */ 98 | 99 | #ifdef __cplusplus 100 | } 101 | #endif 102 | 103 | #endif /* LWIP_HDR_APPS_MQTT_OPTS_H */ 104 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/apps/netbiosns.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * NETBIOS name service responder 4 | */ 5 | 6 | /* 7 | * Redistribution and use in source and binary forms, with or without modification, 8 | * are permitted provided that the following conditions are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 3. The name of the author may not be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 19 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 21 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 23 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 26 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 27 | * OF SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | */ 32 | #ifndef LWIP_HDR_APPS_NETBIOS_H 33 | #define LWIP_HDR_APPS_NETBIOS_H 34 | 35 | #include "lwip/apps/netbiosns_opts.h" 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | void netbiosns_init(void); 42 | #ifndef NETBIOS_LWIP_NAME 43 | void netbiosns_set_name(const char* hostname); 44 | #endif 45 | void netbiosns_stop(void); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif /* LWIP_HDR_APPS_NETBIOS_H */ 52 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/apps/netbiosns_opts.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * NETBIOS name service responder options 4 | */ 5 | 6 | /* 7 | * Redistribution and use in source and binary forms, with or without modification, 8 | * are permitted provided that the following conditions are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 3. The name of the author may not be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 19 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 21 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 23 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 26 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 27 | * OF SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | */ 32 | #ifndef LWIP_HDR_APPS_NETBIOS_OPTS_H 33 | #define LWIP_HDR_APPS_NETBIOS_OPTS_H 34 | 35 | #include "lwip/opt.h" 36 | 37 | /** 38 | * @defgroup netbiosns_opts Options 39 | * @ingroup netbiosns 40 | * @{ 41 | */ 42 | 43 | /** NetBIOS name of lwip device 44 | * This must be uppercase until NETBIOS_STRCMP() is defined to a string 45 | * comparison function that is case insensitive. 46 | * If you want to use the netif's hostname, use this (with LWIP_NETIF_HOSTNAME): 47 | * (ip_current_netif() != NULL ? ip_current_netif()->hostname != NULL ? ip_current_netif()->hostname : "" : "") 48 | * 49 | * If this is not defined, netbiosns_set_name() can be called at runtime to change the name. 50 | */ 51 | #ifdef __DOXYGEN__ 52 | #define NETBIOS_LWIP_NAME "NETBIOSLWIPDEV" 53 | #endif 54 | 55 | /** Respond to NetBIOS name queries 56 | * Default is disabled 57 | */ 58 | #if !defined LWIP_NETBIOS_RESPOND_NAME_QUERY || defined __DOXYGEN__ 59 | #define LWIP_NETBIOS_RESPOND_NAME_QUERY 0 60 | #endif 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | #endif /* LWIP_HDR_APPS_NETBIOS_OPTS_H */ 67 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/apps/smtp_opts.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_APPS_SMTP_OPTS_H 2 | #define LWIP_HDR_APPS_SMTP_OPTS_H 3 | 4 | #include "lwip/opt.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | /** 11 | * @defgroup smtp_opts Options 12 | * @ingroup smtp 13 | * 14 | * @{ 15 | */ 16 | 17 | /** Set this to 1 to enable data handler callback on BODY */ 18 | #ifndef SMTP_BODYDH 19 | #define SMTP_BODYDH 0 20 | #endif 21 | 22 | /** SMTP_DEBUG: Enable debugging for SNTP. */ 23 | #ifndef SMTP_DEBUG 24 | #define SMTP_DEBUG LWIP_DBG_OFF 25 | #endif 26 | 27 | /** Maximum length reserved for server name including terminating 0 byte */ 28 | #ifndef SMTP_MAX_SERVERNAME_LEN 29 | #define SMTP_MAX_SERVERNAME_LEN 256 30 | #endif 31 | 32 | /** Maximum length reserved for username */ 33 | #ifndef SMTP_MAX_USERNAME_LEN 34 | #define SMTP_MAX_USERNAME_LEN 32 35 | #endif 36 | 37 | /** Maximum length reserved for password */ 38 | #ifndef SMTP_MAX_PASS_LEN 39 | #define SMTP_MAX_PASS_LEN 32 40 | #endif 41 | 42 | /** Set this to 0 if you know the authentication data will not change 43 | * during the smtp session, which saves some heap space. */ 44 | #ifndef SMTP_COPY_AUTHDATA 45 | #define SMTP_COPY_AUTHDATA 1 46 | #endif 47 | 48 | /** Set this to 0 to save some code space if you know for sure that all data 49 | * passed to this module conforms to the requirements in the SMTP RFC. 50 | * WARNING: use this with care! 51 | */ 52 | #ifndef SMTP_CHECK_DATA 53 | #define SMTP_CHECK_DATA 1 54 | #endif 55 | 56 | /** Set this to 1 to enable AUTH PLAIN support */ 57 | #ifndef SMTP_SUPPORT_AUTH_PLAIN 58 | #define SMTP_SUPPORT_AUTH_PLAIN 1 59 | #endif 60 | 61 | /** Set this to 1 to enable AUTH LOGIN support */ 62 | #ifndef SMTP_SUPPORT_AUTH_LOGIN 63 | #define SMTP_SUPPORT_AUTH_LOGIN 1 64 | #endif 65 | 66 | /* Memory allocation/deallocation can be overridden... */ 67 | #ifndef SMTP_STATE_MALLOC 68 | #define SMTP_STATE_MALLOC(size) mem_malloc(size) 69 | #define SMTP_STATE_FREE(ptr) mem_free(ptr) 70 | #endif 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | 80 | #endif /* SMTP_OPTS_H */ 81 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/apps/sntp.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * SNTP client API 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2007-2009 Frédéric Bernon, Simon Goldschmidt 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | * Author: Frédéric Bernon, Simon Goldschmidt 35 | * 36 | */ 37 | #ifndef LWIP_HDR_APPS_SNTP_H 38 | #define LWIP_HDR_APPS_SNTP_H 39 | 40 | #include "lwip/apps/sntp_opts.h" 41 | #include "lwip/ip_addr.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /* SNTP operating modes: default is to poll using unicast. 48 | The mode has to be set before calling sntp_init(). */ 49 | #define SNTP_OPMODE_POLL 0 50 | #define SNTP_OPMODE_LISTENONLY 1 51 | void sntp_setoperatingmode(u8_t operating_mode); 52 | u8_t sntp_getoperatingmode(void); 53 | 54 | void sntp_init(void); 55 | void sntp_stop(void); 56 | u8_t sntp_enabled(void); 57 | 58 | void sntp_setserver(u8_t idx, const ip_addr_t *addr); 59 | const ip_addr_t* sntp_getserver(u8_t idx); 60 | u8_t sntp_getkodreceived(u8_t idx); 61 | 62 | #if SNTP_MONITOR_SERVER_REACHABILITY 63 | u8_t sntp_getreachability(u8_t idx); 64 | #endif /* SNTP_MONITOR_SERVER_REACHABILITY */ 65 | 66 | #if SNTP_SERVER_DNS 67 | void sntp_setservername(u8_t idx, const char *server); 68 | const char *sntp_getservername(u8_t idx); 69 | #endif /* SNTP_SERVER_DNS */ 70 | 71 | #if SNTP_GET_SERVERS_FROM_DHCP || SNTP_GET_SERVERS_FROM_DHCPV6 72 | void sntp_servermode_dhcp(int set_servers_from_dhcp); 73 | #else /* SNTP_GET_SERVERS_FROM_DHCP || SNTP_GET_SERVERS_FROM_DHCPV6 */ 74 | #define sntp_servermode_dhcp(x) 75 | #endif /* SNTP_GET_SERVERS_FROM_DHCP || SNTP_GET_SERVERS_FROM_DHCPV6 */ 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | 81 | #endif /* LWIP_HDR_APPS_SNTP_H */ 82 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/apps/tftp_client.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * @file tftp_client.h 4 | * TFTP client header 5 | * 6 | */ 7 | 8 | /* 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification,are permitted provided that the following conditions are met: 11 | * 12 | * 1. Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * 3. The name of the author may not be used to endorse or promote products 18 | * derived from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 22 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 23 | * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 25 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | * This file is part of the lwIP TCP/IP stack. 32 | * 33 | */ 34 | 35 | #ifndef LWIP_HDR_APPS_TFTP_CLIENT_H 36 | #define LWIP_HDR_APPS_TFTP_CLIENT_H 37 | 38 | #include "lwip/apps/tftp_common.h" 39 | 40 | enum tftp_transfer_mode { 41 | TFTP_MODE_OCTET, 42 | TFTP_MODE_NETASCII, 43 | TFTP_MODE_BINARY /* used in old versions only */ 44 | }; 45 | 46 | err_t tftp_init_client(const struct tftp_context* ctx); 47 | err_t tftp_get(void* handle, const ip_addr_t *addr, u16_t port, const char* fname, enum tftp_transfer_mode mode); 48 | err_t tftp_put(void* handle, const ip_addr_t *addr, u16_t port, const char* fname, enum tftp_transfer_mode mode); 49 | 50 | #endif /* LWIP_HDR_APPS_TFTP_CLIENT_H */ 51 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/apps/tftp_opts.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * @file tftp_opts.h 4 | * 5 | * @author Logan Gunthorpe 6 | * 7 | * @brief Trivial File Transfer Protocol (RFC 1350) implementation options 8 | * 9 | * Copyright (c) Deltatee Enterprises Ltd. 2013 10 | * All rights reserved. 11 | * 12 | */ 13 | 14 | /* 15 | * Redistribution and use in source and binary forms, with or without 16 | * modification,are permitted provided that the following conditions are met: 17 | * 18 | * 1. Redistributions of source code must retain the above copyright notice, 19 | * this list of conditions and the following disclaimer. 20 | * 2. Redistributions in binary form must reproduce the above copyright notice, 21 | * this list of conditions and the following disclaimer in the documentation 22 | * and/or other materials provided with the distribution. 23 | * 3. The name of the author may not be used to endorse or promote products 24 | * derived from this software without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 28 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 29 | * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 31 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 32 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 33 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 34 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | * 37 | * Author: Logan Gunthorpe 38 | * 39 | */ 40 | 41 | #ifndef LWIP_HDR_APPS_TFTP_OPTS_H 42 | #define LWIP_HDR_APPS_TFTP_OPTS_H 43 | 44 | #include "lwip/opt.h" 45 | #include "lwip/prot/iana.h" 46 | 47 | /** 48 | * @defgroup tftp_opts Options 49 | * @ingroup tftp 50 | * @{ 51 | */ 52 | 53 | /** 54 | * Enable TFTP debug messages 55 | */ 56 | #if !defined TFTP_DEBUG || defined __DOXYGEN__ 57 | #define TFTP_DEBUG LWIP_DBG_OFF 58 | #endif 59 | 60 | /** 61 | * TFTP server port 62 | */ 63 | #if !defined TFTP_PORT || defined __DOXYGEN__ 64 | #define TFTP_PORT LWIP_IANA_PORT_TFTP 65 | #endif 66 | 67 | /** 68 | * TFTP timeout 69 | */ 70 | #if !defined TFTP_TIMEOUT_MSECS || defined __DOXYGEN__ 71 | #define TFTP_TIMEOUT_MSECS 10000 72 | #endif 73 | 74 | /** 75 | * Max. number of retries when a file is read from server 76 | */ 77 | #if !defined TFTP_MAX_RETRIES || defined __DOXYGEN__ 78 | #define TFTP_MAX_RETRIES 5 79 | #endif 80 | 81 | /** 82 | * TFTP timer cyclic interval 83 | */ 84 | #if !defined TFTP_TIMER_MSECS || defined __DOXYGEN__ 85 | #define TFTP_TIMER_MSECS (TFTP_TIMEOUT_MSECS / 10) 86 | #endif 87 | 88 | /** 89 | * Max. length of TFTP filename 90 | */ 91 | #if !defined TFTP_MAX_FILENAME_LEN || defined __DOXYGEN__ 92 | #define TFTP_MAX_FILENAME_LEN 20 93 | #endif 94 | 95 | /** 96 | * Max. length of TFTP mode 97 | */ 98 | #if !defined TFTP_MAX_MODE_LEN || defined __DOXYGEN__ 99 | #define TFTP_MAX_MODE_LEN 10 100 | #endif 101 | 102 | /** 103 | * @} 104 | */ 105 | 106 | #endif /* LWIP_HDR_APPS_TFTP_OPTS_H */ 107 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/apps/tftp_server.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * @file tftp_server.h 4 | * TFTP server header 5 | * 6 | */ 7 | 8 | /* 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification,are permitted provided that the following conditions are met: 11 | * 12 | * 1. Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * 3. The name of the author may not be used to endorse or promote products 18 | * derived from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 22 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 23 | * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 25 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | * This file is part of the lwIP TCP/IP stack. 32 | * 33 | */ 34 | 35 | #ifndef LWIP_HDR_APPS_TFTP_SERVER_H 36 | #define LWIP_HDR_APPS_TFTP_SERVER_H 37 | 38 | #include "lwip/apps/tftp_common.h" 39 | 40 | err_t tftp_init_server(const struct tftp_context* ctx); 41 | 42 | #endif /* LWIP_HDR_APPS_TFTP_SERVER_H */ 43 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/autoip.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * 4 | * AutoIP Automatic LinkLocal IP Configuration 5 | */ 6 | 7 | /* 8 | * 9 | * Copyright (c) 2007 Dominik Spies 10 | * All rights reserved. 11 | * 12 | * Redistribution and use in source and binary forms, with or without modification, 13 | * are permitted provided that the following conditions are met: 14 | * 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. The name of the author may not be used to endorse or promote products 21 | * derived from this software without specific prior written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 24 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 25 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 26 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 28 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 31 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | * OF SUCH DAMAGE. 33 | * 34 | * Author: Dominik Spies 35 | * 36 | * This is a AutoIP implementation for the lwIP TCP/IP stack. It aims to conform 37 | * with RFC 3927. 38 | * 39 | */ 40 | 41 | #ifndef LWIP_HDR_AUTOIP_H 42 | #define LWIP_HDR_AUTOIP_H 43 | 44 | #include "lwip/opt.h" 45 | 46 | #if LWIP_IPV4 && LWIP_AUTOIP /* don't build if not configured for use in lwipopts.h */ 47 | 48 | #include "lwip/netif.h" 49 | /* #include "lwip/udp.h" */ 50 | #include "lwip/etharp.h" 51 | #include "lwip/acd.h" 52 | 53 | #ifdef __cplusplus 54 | extern "C" { 55 | #endif 56 | 57 | /** AutoIP state information per netif */ 58 | struct autoip 59 | { 60 | /** the currently selected, probed, announced or used LL IP-Address */ 61 | ip4_addr_t llipaddr; 62 | /** current AutoIP state machine state */ 63 | u8_t state; 64 | /** total number of probed/used Link Local IP-Addresses */ 65 | u8_t tried_llipaddr; 66 | /** acd struct */ 67 | struct acd acd; 68 | }; 69 | 70 | 71 | void autoip_set_struct(struct netif *netif, struct autoip *autoip); 72 | void autoip_remove_struct(struct netif *netif); 73 | err_t autoip_start(struct netif *netif); 74 | err_t autoip_stop(struct netif *netif); 75 | void autoip_network_changed_link_up(struct netif *netif); 76 | void autoip_network_changed_link_down(struct netif *netif); 77 | u8_t autoip_supplied_address(struct netif *netif); 78 | 79 | /* for lwIP internal use by ip4.c */ 80 | u8_t autoip_accept_packet(struct netif *netif, const ip4_addr_t *addr); 81 | 82 | #define netif_autoip_data(netif) ((struct autoip*)netif_get_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_AUTOIP)) 83 | 84 | #ifdef __cplusplus 85 | } 86 | #endif 87 | 88 | #endif /* LWIP_IPV4 && LWIP_AUTOIP */ 89 | 90 | #endif /* LWIP_HDR_AUTOIP_H */ 91 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/ethip6.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * 4 | * Ethernet output for IPv6. Uses ND tables for link-layer addressing. 5 | */ 6 | 7 | /* 8 | * Copyright (c) 2010 Inico Technologies Ltd. 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright notice, 15 | * this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 3. The name of the author may not be used to endorse or promote products 20 | * derived from this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31 | * OF SUCH DAMAGE. 32 | * 33 | * This file is part of the lwIP TCP/IP stack. 34 | * 35 | * Author: Ivan Delamer 36 | * 37 | * 38 | * Please coordinate changes and requests with Ivan Delamer 39 | * 40 | */ 41 | 42 | #ifndef LWIP_HDR_ETHIP6_H 43 | #define LWIP_HDR_ETHIP6_H 44 | 45 | #include "lwip/opt.h" 46 | 47 | #if LWIP_IPV6 && LWIP_ETHERNET /* don't build if not configured for use in lwipopts.h */ 48 | 49 | #include "lwip/pbuf.h" 50 | #include "lwip/ip6.h" 51 | #include "lwip/ip6_addr.h" 52 | #include "lwip/netif.h" 53 | 54 | 55 | #ifdef __cplusplus 56 | extern "C" { 57 | #endif 58 | 59 | 60 | err_t ethip6_output(struct netif *netif, struct pbuf *q, const ip6_addr_t *ip6addr); 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | #endif /* LWIP_IPV6 && LWIP_ETHERNET */ 67 | 68 | #endif /* LWIP_HDR_ETHIP6_H */ 69 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/icmp6.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * 4 | * IPv6 version of ICMP, as per RFC 4443. 5 | */ 6 | 7 | /* 8 | * Copyright (c) 2010 Inico Technologies Ltd. 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright notice, 15 | * this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 3. The name of the author may not be used to endorse or promote products 20 | * derived from this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31 | * OF SUCH DAMAGE. 32 | * 33 | * This file is part of the lwIP TCP/IP stack. 34 | * 35 | * Author: Ivan Delamer 36 | * 37 | * 38 | * Please coordinate changes and requests with Ivan Delamer 39 | * 40 | */ 41 | #ifndef LWIP_HDR_ICMP6_H 42 | #define LWIP_HDR_ICMP6_H 43 | 44 | #include "lwip/opt.h" 45 | #include "lwip/pbuf.h" 46 | #include "lwip/ip6_addr.h" 47 | #include "lwip/netif.h" 48 | #include "lwip/prot/icmp6.h" 49 | 50 | #ifdef __cplusplus 51 | extern "C" { 52 | #endif 53 | 54 | #if LWIP_ICMP6 && LWIP_IPV6 /* don't build if not configured for use in lwipopts.h */ 55 | 56 | void icmp6_input(struct pbuf *p, struct netif *inp); 57 | void icmp6_dest_unreach(struct pbuf *p, enum icmp6_dur_code c); 58 | void icmp6_packet_too_big(struct pbuf *p, u32_t mtu); 59 | void icmp6_time_exceeded(struct pbuf *p, enum icmp6_te_code c); 60 | void icmp6_time_exceeded_with_addrs(struct pbuf *p, enum icmp6_te_code c, 61 | const ip6_addr_t *src_addr, const ip6_addr_t *dest_addr); 62 | void icmp6_param_problem(struct pbuf *p, enum icmp6_pp_code c, const void *pointer); 63 | 64 | #endif /* LWIP_ICMP6 && LWIP_IPV6 */ 65 | 66 | 67 | #ifdef __cplusplus 68 | } 69 | #endif 70 | 71 | 72 | #endif /* LWIP_HDR_ICMP6_H */ 73 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/if_api.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Interface Identification APIs from: 4 | * RFC 3493: Basic Socket Interface Extensions for IPv6 5 | * Section 4: Interface Identification 6 | */ 7 | 8 | /* 9 | * Copyright (c) 2017 Joel Cunningham, Garmin International, Inc. 10 | * All rights reserved. 11 | * 12 | * Redistribution and use in source and binary forms, with or without modification, 13 | * are permitted provided that the following conditions are met: 14 | * 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. The name of the author may not be used to endorse or promote products 21 | * derived from this software without specific prior written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 24 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 25 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 26 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 28 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 31 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | * OF SUCH DAMAGE. 33 | * 34 | * This file is part of the lwIP TCP/IP stack. 35 | * 36 | * Author: Joel Cunningham 37 | * 38 | */ 39 | #ifndef LWIP_HDR_IF_H 40 | #define LWIP_HDR_IF_H 41 | 42 | #include "lwip/opt.h" 43 | 44 | #if LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */ 45 | 46 | #include "lwip/netif.h" 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | #ifndef IF_NAMESIZE 53 | #define IF_NAMESIZE NETIF_NAMESIZE 54 | #endif 55 | 56 | char * lwip_if_indextoname(unsigned int ifindex, char *ifname); 57 | unsigned int lwip_if_nametoindex(const char *ifname); 58 | 59 | #if LWIP_COMPAT_SOCKETS 60 | #define if_indextoname(ifindex, ifname) lwip_if_indextoname(ifindex,ifname) 61 | #define if_nametoindex(ifname) lwip_if_nametoindex(ifname) 62 | #endif /* LWIP_COMPAT_SOCKETS */ 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | 68 | #endif /* LWIP_SOCKET */ 69 | 70 | #endif /* LWIP_HDR_IF_H */ 71 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/mem.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Heap API 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | * Author: Adam Dunkels 35 | * 36 | */ 37 | #ifndef LWIP_HDR_MEM_H 38 | #define LWIP_HDR_MEM_H 39 | 40 | #include "lwip/opt.h" 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #if MEM_LIBC_MALLOC 47 | 48 | #include "lwip/arch.h" 49 | 50 | typedef size_t mem_size_t; 51 | #define MEM_SIZE_F SZT_F 52 | 53 | #elif MEM_USE_POOLS 54 | 55 | typedef u16_t mem_size_t; 56 | #define MEM_SIZE_F U16_F 57 | 58 | #else 59 | 60 | /* MEM_SIZE would have to be aligned, but using 64000 here instead of 61 | * 65535 leaves some room for alignment... 62 | */ 63 | #if MEM_SIZE > 64000L 64 | typedef u32_t mem_size_t; 65 | #define MEM_SIZE_F U32_F 66 | #else 67 | typedef u16_t mem_size_t; 68 | #define MEM_SIZE_F U16_F 69 | #endif /* MEM_SIZE > 64000 */ 70 | #endif 71 | 72 | void mem_init(void); 73 | void *mem_trim(void *mem, mem_size_t size); 74 | void *mem_malloc(mem_size_t size); 75 | void *mem_calloc(mem_size_t count, mem_size_t size); 76 | void mem_free(void *mem); 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | 82 | #endif /* LWIP_HDR_MEM_H */ 83 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/nd6.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * 4 | * Neighbor discovery and stateless address autoconfiguration for IPv6. 5 | * Aims to be compliant with RFC 4861 (Neighbor discovery) and RFC 4862 6 | * (Address autoconfiguration). 7 | */ 8 | 9 | /* 10 | * Copyright (c) 2010 Inico Technologies Ltd. 11 | * All rights reserved. 12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 16 | * 1. Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 3. The name of the author may not be used to endorse or promote products 22 | * derived from this software without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 25 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 26 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 27 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 28 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 29 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 32 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 33 | * OF SUCH DAMAGE. 34 | * 35 | * This file is part of the lwIP TCP/IP stack. 36 | * 37 | * Author: Ivan Delamer 38 | * 39 | * 40 | * Please coordinate changes and requests with Ivan Delamer 41 | * 42 | */ 43 | 44 | #ifndef LWIP_HDR_ND6_H 45 | #define LWIP_HDR_ND6_H 46 | 47 | #include "lwip/opt.h" 48 | 49 | #if LWIP_IPV6 /* don't build if not configured for use in lwipopts.h */ 50 | 51 | #include "lwip/ip6_addr.h" 52 | #include "lwip/err.h" 53 | 54 | #ifdef __cplusplus 55 | extern "C" { 56 | #endif 57 | 58 | /** 1 second period */ 59 | #define ND6_TMR_INTERVAL 1000 60 | 61 | /** Router solicitations are sent in 4 second intervals (see RFC 4861, ch. 6.3.7) */ 62 | #ifndef ND6_RTR_SOLICITATION_INTERVAL 63 | #define ND6_RTR_SOLICITATION_INTERVAL 4000 64 | #endif 65 | 66 | struct pbuf; 67 | struct netif; 68 | 69 | void nd6_tmr(void); 70 | void nd6_input(struct pbuf *p, struct netif *inp); 71 | void nd6_clear_destination_cache(void); 72 | struct netif *nd6_find_route(const ip6_addr_t *ip6addr); 73 | err_t nd6_get_next_hop_addr_or_queue(struct netif *netif, struct pbuf *q, const ip6_addr_t *ip6addr, const u8_t **hwaddrp); 74 | u16_t nd6_get_destination_mtu(const ip6_addr_t *ip6addr, struct netif *netif); 75 | #if LWIP_ND6_TCP_REACHABILITY_HINTS 76 | void nd6_reachability_hint(const ip6_addr_t *ip6addr); 77 | #endif /* LWIP_ND6_TCP_REACHABILITY_HINTS */ 78 | void nd6_cleanup_netif(struct netif *netif); 79 | #if LWIP_IPV6_MLD 80 | void nd6_adjust_mld_membership(struct netif *netif, s8_t addr_idx, u8_t new_state); 81 | #endif /* LWIP_IPV6_MLD */ 82 | void nd6_restart_netif(struct netif *netif); 83 | 84 | #ifdef __cplusplus 85 | } 86 | #endif 87 | 88 | #endif /* LWIP_IPV6 */ 89 | 90 | #endif /* LWIP_HDR_ND6_H */ 91 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/priv/raw_priv.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * raw API internal implementations (do not use in application code) 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | * Author: Adam Dunkels 35 | * 36 | */ 37 | #ifndef LWIP_HDR_RAW_PRIV_H 38 | #define LWIP_HDR_RAW_PRIV_H 39 | 40 | #include "lwip/opt.h" 41 | 42 | #if LWIP_RAW /* don't build if not configured for use in lwipopts.h */ 43 | 44 | #include "lwip/raw.h" 45 | 46 | #ifdef __cplusplus 47 | extern "C" { 48 | #endif 49 | 50 | /** return codes for raw_input */ 51 | typedef enum raw_input_state 52 | { 53 | RAW_INPUT_NONE = 0, /* pbuf did not match any pcbs */ 54 | RAW_INPUT_EATEN, /* pbuf handed off and delivered to pcb */ 55 | RAW_INPUT_DELIVERED /* pbuf only delivered to pcb (pbuf can still be referenced) */ 56 | } raw_input_state_t; 57 | 58 | /* The following functions are the lower layer interface to RAW. */ 59 | raw_input_state_t raw_input(struct pbuf *p, struct netif *inp); 60 | 61 | void raw_netif_ip_addr_changed(const ip_addr_t* old_addr, const ip_addr_t* new_addr); 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #endif /* LWIP_RAW */ 68 | 69 | #endif /* LWIP_HDR_RAW_PRIV_H */ 70 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/prot/autoip.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * AutoIP protocol definitions 4 | */ 5 | 6 | /* 7 | * 8 | * Copyright (c) 2007 Dominik Spies 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright notice, 15 | * this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 3. The name of the author may not be used to endorse or promote products 20 | * derived from this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31 | * OF SUCH DAMAGE. 32 | * 33 | * Author: Dominik Spies 34 | * 35 | * This is a AutoIP implementation for the lwIP TCP/IP stack. It aims to conform 36 | * with RFC 3927. 37 | * 38 | */ 39 | 40 | #ifndef LWIP_HDR_PROT_AUTOIP_H 41 | #define LWIP_HDR_PROT_AUTOIP_H 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /* 169.254.0.0 */ 48 | #define AUTOIP_NET 0xA9FE0000 49 | /* 169.254.1.0 */ 50 | #define AUTOIP_RANGE_START (AUTOIP_NET | 0x0100) 51 | /* 169.254.254.255 */ 52 | #define AUTOIP_RANGE_END (AUTOIP_NET | 0xFEFF) 53 | 54 | /* AutoIP client states */ 55 | typedef enum { 56 | AUTOIP_STATE_OFF, 57 | AUTOIP_STATE_CHECKING, 58 | AUTOIP_STATE_BOUND 59 | } autoip_state_enum_t; 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif /* LWIP_HDR_PROT_AUTOIP_H */ 66 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/prot/iana.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * IANA assigned numbers (RFC 1700 and successors) 4 | * 5 | * @defgroup iana IANA assigned numbers 6 | * @ingroup infrastructure 7 | */ 8 | 9 | /* 10 | * Copyright (c) 2017 Dirk Ziegelmeier. 11 | * All rights reserved. 12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 16 | * 1. Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 3. The name of the author may not be used to endorse or promote products 22 | * derived from this software without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 25 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 26 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 27 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 28 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 29 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 32 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 33 | * OF SUCH DAMAGE. 34 | * 35 | * This file is part of the lwIP TCP/IP stack. 36 | * 37 | * Author: Dirk Ziegelmeier 38 | * 39 | */ 40 | 41 | #ifndef LWIP_HDR_PROT_IANA_H 42 | #define LWIP_HDR_PROT_IANA_H 43 | 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif 47 | 48 | /** 49 | * @ingroup iana 50 | * Hardware types 51 | */ 52 | enum lwip_iana_hwtype { 53 | /** Ethernet */ 54 | LWIP_IANA_HWTYPE_ETHERNET = 1 55 | }; 56 | 57 | /** 58 | * @ingroup iana 59 | * Port numbers 60 | * https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.txt 61 | */ 62 | enum lwip_iana_port_number { 63 | /** SMTP */ 64 | LWIP_IANA_PORT_SMTP = 25, 65 | /** DHCP server */ 66 | LWIP_IANA_PORT_DHCP_SERVER = 67, 67 | /** DHCP client */ 68 | LWIP_IANA_PORT_DHCP_CLIENT = 68, 69 | /** TFTP */ 70 | LWIP_IANA_PORT_TFTP = 69, 71 | /** HTTP */ 72 | LWIP_IANA_PORT_HTTP = 80, 73 | /** SNTP */ 74 | LWIP_IANA_PORT_SNTP = 123, 75 | /** NETBIOS */ 76 | LWIP_IANA_PORT_NETBIOS = 137, 77 | /** SNMP */ 78 | LWIP_IANA_PORT_SNMP = 161, 79 | /** SNMP traps */ 80 | LWIP_IANA_PORT_SNMP_TRAP = 162, 81 | /** HTTPS */ 82 | LWIP_IANA_PORT_HTTPS = 443, 83 | /** SMTPS */ 84 | LWIP_IANA_PORT_SMTPS = 465, 85 | /** MQTT */ 86 | LWIP_IANA_PORT_MQTT = 1883, 87 | /** MDNS */ 88 | LWIP_IANA_PORT_MDNS = 5353, 89 | /** Secure MQTT */ 90 | LWIP_IANA_PORT_SECURE_MQTT = 8883 91 | }; 92 | 93 | #ifdef __cplusplus 94 | } 95 | #endif 96 | 97 | #endif /* LWIP_HDR_PROT_IANA_H */ 98 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/prot/ieee.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * IEEE assigned numbers 4 | * 5 | * @defgroup ieee IEEE assigned numbers 6 | * @ingroup infrastructure 7 | */ 8 | 9 | /* 10 | * Copyright (c) 2017 Dirk Ziegelmeier. 11 | * All rights reserved. 12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 16 | * 1. Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 3. The name of the author may not be used to endorse or promote products 22 | * derived from this software without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 25 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 26 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 27 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 28 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 29 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 32 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 33 | * OF SUCH DAMAGE. 34 | * 35 | * This file is part of the lwIP TCP/IP stack. 36 | * 37 | * Author: Dirk Ziegelmeier 38 | * 39 | */ 40 | 41 | #ifndef LWIP_HDR_PROT_IEEE_H 42 | #define LWIP_HDR_PROT_IEEE_H 43 | 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif 47 | 48 | /** 49 | * @ingroup ieee 50 | * A list of often ethtypes (although lwIP does not use all of them). 51 | */ 52 | enum lwip_ieee_eth_type { 53 | /** Internet protocol v4 */ 54 | ETHTYPE_IP = 0x0800U, 55 | /** Address resolution protocol */ 56 | ETHTYPE_ARP = 0x0806U, 57 | /** Wake on lan */ 58 | ETHTYPE_WOL = 0x0842U, 59 | /** RARP */ 60 | ETHTYPE_RARP = 0x8035U, 61 | /** Virtual local area network */ 62 | ETHTYPE_VLAN = 0x8100U, 63 | /** Internet protocol v6 */ 64 | ETHTYPE_IPV6 = 0x86DDU, 65 | /** PPP Over Ethernet Discovery Stage */ 66 | ETHTYPE_PPPOEDISC = 0x8863U, 67 | /** PPP Over Ethernet Session Stage */ 68 | ETHTYPE_PPPOE = 0x8864U, 69 | /** Jumbo Frames */ 70 | ETHTYPE_JUMBO = 0x8870U, 71 | /** Process field network */ 72 | ETHTYPE_PROFINET = 0x8892U, 73 | /** Ethernet for control automation technology */ 74 | ETHTYPE_ETHERCAT = 0x88A4U, 75 | /** Link layer discovery protocol */ 76 | ETHTYPE_LLDP = 0x88CCU, 77 | /** Serial real-time communication system */ 78 | ETHTYPE_SERCOS = 0x88CDU, 79 | /** Media redundancy protocol */ 80 | ETHTYPE_MRP = 0x88E3U, 81 | /** Precision time protocol */ 82 | ETHTYPE_PTP = 0x88F7U, 83 | /** Q-in-Q, 802.1ad */ 84 | ETHTYPE_QINQ = 0x9100U 85 | }; 86 | 87 | #ifdef __cplusplus 88 | } 89 | #endif 90 | 91 | #endif /* LWIP_HDR_PROT_IEEE_H */ 92 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/prot/igmp.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * IGMP protocol definitions 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | * Author: Adam Dunkels 35 | * 36 | */ 37 | #ifndef LWIP_HDR_PROT_IGMP_H 38 | #define LWIP_HDR_PROT_IGMP_H 39 | 40 | #include "lwip/arch.h" 41 | #include "lwip/prot/ip4.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /* 48 | * IGMP constants 49 | */ 50 | #define IGMP_TTL 1 51 | #define IGMP_MINLEN 8 52 | #define ROUTER_ALERT 0x9404U 53 | #define ROUTER_ALERTLEN 4 54 | 55 | /* 56 | * IGMP message types, including version number. 57 | */ 58 | #define IGMP_MEMB_QUERY 0x11 /* Membership query */ 59 | #define IGMP_V1_MEMB_REPORT 0x12 /* Ver. 1 membership report */ 60 | #define IGMP_V2_MEMB_REPORT 0x16 /* Ver. 2 membership report */ 61 | #define IGMP_LEAVE_GROUP 0x17 /* Leave-group message */ 62 | 63 | /* Group membership states */ 64 | #define IGMP_GROUP_NON_MEMBER 0 65 | #define IGMP_GROUP_DELAYING_MEMBER 1 66 | #define IGMP_GROUP_IDLE_MEMBER 2 67 | 68 | /** 69 | * IGMP packet format. 70 | */ 71 | #ifdef PACK_STRUCT_USE_INCLUDES 72 | # include "arch/bpstruct.h" 73 | #endif 74 | PACK_STRUCT_BEGIN 75 | struct igmp_msg { 76 | PACK_STRUCT_FLD_8(u8_t igmp_msgtype); 77 | PACK_STRUCT_FLD_8(u8_t igmp_maxresp); 78 | PACK_STRUCT_FIELD(u16_t igmp_checksum); 79 | PACK_STRUCT_FLD_S(ip4_addr_p_t igmp_group_address); 80 | } PACK_STRUCT_STRUCT; 81 | PACK_STRUCT_END 82 | #ifdef PACK_STRUCT_USE_INCLUDES 83 | # include "arch/epstruct.h" 84 | #endif 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | #endif /* LWIP_HDR_PROT_IGMP_H */ 91 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/prot/ip.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * IP protocol definitions 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | * Author: Adam Dunkels 35 | * 36 | */ 37 | #ifndef LWIP_HDR_PROT_IP_H 38 | #define LWIP_HDR_PROT_IP_H 39 | 40 | #include "lwip/arch.h" 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #define IP_PROTO_ICMP 1 47 | #define IP_PROTO_IGMP 2 48 | #define IP_PROTO_UDP 17 49 | #define IP_PROTO_UDPLITE 136 50 | #define IP_PROTO_TCP 6 51 | 52 | /** This operates on a void* by loading the first byte */ 53 | #define IP_HDR_GET_VERSION(ptr) ((*(u8_t*)(ptr)) >> 4) 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | #endif /* LWIP_HDR_PROT_IP_H */ 60 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/prot/mld6.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * MLD6 protocol definitions 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | * Author: Adam Dunkels 35 | * 36 | */ 37 | #ifndef LWIP_HDR_PROT_MLD6_H 38 | #define LWIP_HDR_PROT_MLD6_H 39 | 40 | #include "lwip/arch.h" 41 | #include "lwip/prot/ip6.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | #define MLD6_HBH_HLEN 8 48 | /** Multicast listener report/query/done message header. */ 49 | #ifdef PACK_STRUCT_USE_INCLUDES 50 | # include "arch/bpstruct.h" 51 | #endif 52 | PACK_STRUCT_BEGIN 53 | struct mld_header { 54 | PACK_STRUCT_FLD_8(u8_t type); 55 | PACK_STRUCT_FLD_8(u8_t code); 56 | PACK_STRUCT_FIELD(u16_t chksum); 57 | PACK_STRUCT_FIELD(u16_t max_resp_delay); 58 | PACK_STRUCT_FIELD(u16_t reserved); 59 | PACK_STRUCT_FLD_S(ip6_addr_p_t multicast_address); 60 | /* Options follow. */ 61 | } PACK_STRUCT_STRUCT; 62 | PACK_STRUCT_END 63 | #ifdef PACK_STRUCT_USE_INCLUDES 64 | # include "arch/epstruct.h" 65 | #endif 66 | 67 | #ifdef __cplusplus 68 | } 69 | #endif 70 | 71 | #endif /* LWIP_HDR_PROT_MLD6_H */ 72 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/prot/udp.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * UDP protocol definitions 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | * Author: Adam Dunkels 35 | * 36 | */ 37 | #ifndef LWIP_HDR_PROT_UDP_H 38 | #define LWIP_HDR_PROT_UDP_H 39 | 40 | #include "lwip/arch.h" 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #define UDP_HLEN 8 47 | 48 | /* Fields are (of course) in network byte order. */ 49 | #ifdef PACK_STRUCT_USE_INCLUDES 50 | #include "arch/bpstruct.h" 51 | #endif 52 | PACK_STRUCT_BEGIN 53 | struct udp_hdr { 54 | PACK_STRUCT_FIELD(u16_t src); 55 | PACK_STRUCT_FIELD(u16_t dest); /* src/dest UDP ports */ 56 | PACK_STRUCT_FIELD(u16_t len); 57 | PACK_STRUCT_FIELD(u16_t chksum); 58 | } PACK_STRUCT_STRUCT; 59 | PACK_STRUCT_END 60 | #ifdef PACK_STRUCT_USE_INCLUDES 61 | #include "arch/epstruct.h" 62 | #endif 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | 68 | #endif /* LWIP_HDR_PROT_UDP_H */ 69 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/tcpbase.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Base TCP API definitions shared by TCP and ALTCP
4 | * See also @ref tcp_raw 5 | */ 6 | 7 | /* 8 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright notice, 15 | * this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 3. The name of the author may not be used to endorse or promote products 20 | * derived from this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31 | * OF SUCH DAMAGE. 32 | * 33 | * This file is part of the lwIP TCP/IP stack. 34 | * 35 | * Author: Adam Dunkels 36 | * 37 | */ 38 | #ifndef LWIP_HDR_TCPBASE_H 39 | #define LWIP_HDR_TCPBASE_H 40 | 41 | #include "lwip/opt.h" 42 | 43 | #if LWIP_TCP /* don't build if not configured for use in lwipopts.h */ 44 | 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | 50 | #if LWIP_WND_SCALE 51 | typedef u32_t tcpwnd_size_t; 52 | #else 53 | typedef u16_t tcpwnd_size_t; 54 | #endif 55 | 56 | enum tcp_state { 57 | CLOSED = 0, 58 | LISTEN = 1, 59 | SYN_SENT = 2, 60 | SYN_RCVD = 3, 61 | ESTABLISHED = 4, 62 | FIN_WAIT_1 = 5, 63 | FIN_WAIT_2 = 6, 64 | CLOSE_WAIT = 7, 65 | CLOSING = 8, 66 | LAST_ACK = 9, 67 | TIME_WAIT = 10 68 | }; 69 | /* ATTENTION: this depends on state number ordering! */ 70 | #define TCP_STATE_IS_CLOSING(state) ((state) >= FIN_WAIT_1) 71 | 72 | /* Flags for "apiflags" parameter in tcp_write */ 73 | #define TCP_WRITE_FLAG_COPY 0x01 74 | #define TCP_WRITE_FLAG_MORE 0x02 75 | 76 | #define TCP_PRIO_MIN 1 77 | #define TCP_PRIO_NORMAL 64 78 | #define TCP_PRIO_MAX 127 79 | 80 | const char* tcp_debug_state_str(enum tcp_state s); 81 | 82 | #ifdef __cplusplus 83 | } 84 | #endif 85 | 86 | #endif /* LWIP_TCP */ 87 | 88 | #endif /* LWIP_HDR_TCPBASE_H */ 89 | -------------------------------------------------------------------------------- /lwip/src/include/netif/etharp.h: -------------------------------------------------------------------------------- 1 | /* ARP has been moved to core/ipv4, provide this #include for compatibility only */ 2 | #include "lwip/etharp.h" 3 | #include "netif/ethernet.h" 4 | -------------------------------------------------------------------------------- /lwip/src/include/netif/ethernet.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Ethernet input function - handles INCOMING ethernet level traffic 4 | * To be used in most low-level netif implementations 5 | */ 6 | 7 | /* 8 | * Copyright (c) 2001-2003 Swedish Institute of Computer Science. 9 | * Copyright (c) 2003-2004 Leon Woestenberg 10 | * Copyright (c) 2003-2004 Axon Digital Design B.V., The Netherlands. 11 | * All rights reserved. 12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 16 | * 1. Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 3. The name of the author may not be used to endorse or promote products 22 | * derived from this software without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 25 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 26 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 27 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 28 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 29 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 32 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 33 | * OF SUCH DAMAGE. 34 | * 35 | * This file is part of the lwIP TCP/IP stack. 36 | * 37 | * Author: Adam Dunkels 38 | * 39 | */ 40 | 41 | #ifndef LWIP_HDR_NETIF_ETHERNET_H 42 | #define LWIP_HDR_NETIF_ETHERNET_H 43 | 44 | #include "lwip/opt.h" 45 | 46 | #include "lwip/pbuf.h" 47 | #include "lwip/netif.h" 48 | #include "lwip/prot/ethernet.h" 49 | 50 | #ifdef __cplusplus 51 | extern "C" { 52 | #endif 53 | 54 | #if LWIP_ARP || LWIP_ETHERNET 55 | 56 | /** Define this to 1 and define LWIP_ARP_FILTER_NETIF_FN(pbuf, netif, type) 57 | * to a filter function that returns the correct netif when using multiple 58 | * netifs on one hardware interface where the netif's low-level receive 59 | * routine cannot decide for the correct netif (e.g. when mapping multiple 60 | * IP addresses to one hardware interface). 61 | */ 62 | #ifndef LWIP_ARP_FILTER_NETIF 63 | #define LWIP_ARP_FILTER_NETIF 0 64 | #endif 65 | 66 | err_t ethernet_input(struct pbuf *p, struct netif *netif); 67 | err_t ethernet_output(struct netif* netif, struct pbuf* p, const struct eth_addr* src, const struct eth_addr* dst, u16_t eth_type); 68 | 69 | extern const struct eth_addr ethbroadcast, ethzero; 70 | 71 | #endif /* LWIP_ARP || LWIP_ETHERNET */ 72 | 73 | #ifdef __cplusplus 74 | } 75 | #endif 76 | 77 | #endif /* LWIP_HDR_NETIF_ETHERNET_H */ 78 | -------------------------------------------------------------------------------- /lwip/src/include/netif/lowpan6.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * 4 | * 6LowPAN output for IPv6. Uses ND tables for link-layer addressing. Fragments packets to 6LowPAN units. 5 | */ 6 | 7 | /* 8 | * Copyright (c) 2015 Inico Technologies Ltd. 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright notice, 15 | * this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 3. The name of the author may not be used to endorse or promote products 20 | * derived from this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31 | * OF SUCH DAMAGE. 32 | * 33 | * This file is part of the lwIP TCP/IP stack. 34 | * 35 | * Author: Ivan Delamer 36 | * 37 | * 38 | * Please coordinate changes and requests with Ivan Delamer 39 | * 40 | */ 41 | 42 | #ifndef LWIP_HDR_LOWPAN6_H 43 | #define LWIP_HDR_LOWPAN6_H 44 | 45 | #include "netif/lowpan6_opts.h" 46 | 47 | #if LWIP_IPV6 48 | 49 | #include "netif/lowpan6_common.h" 50 | #include "lwip/pbuf.h" 51 | #include "lwip/ip.h" 52 | #include "lwip/ip_addr.h" 53 | #include "lwip/netif.h" 54 | 55 | #ifdef __cplusplus 56 | extern "C" { 57 | #endif 58 | 59 | /** 1 second period for reassembly */ 60 | #define LOWPAN6_TMR_INTERVAL 1000 61 | 62 | void lowpan6_tmr(void); 63 | 64 | err_t lowpan6_set_context(u8_t idx, const ip6_addr_t * context); 65 | err_t lowpan6_set_short_addr(u8_t addr_high, u8_t addr_low); 66 | 67 | #if LWIP_IPV4 68 | err_t lowpan4_output(struct netif *netif, struct pbuf *q, const ip4_addr_t *ipaddr); 69 | #endif /* LWIP_IPV4 */ 70 | err_t lowpan6_output(struct netif *netif, struct pbuf *q, const ip6_addr_t *ip6addr); 71 | err_t lowpan6_input(struct pbuf * p, struct netif *netif); 72 | err_t lowpan6_if_init(struct netif *netif); 73 | 74 | /* pan_id in network byte order. */ 75 | err_t lowpan6_set_pan_id(u16_t pan_id); 76 | 77 | u16_t lowpan6_calc_crc(const void *buf, u16_t len); 78 | 79 | #if !NO_SYS 80 | err_t tcpip_6lowpan_input(struct pbuf *p, struct netif *inp); 81 | #endif /* !NO_SYS */ 82 | 83 | #ifdef __cplusplus 84 | } 85 | #endif 86 | 87 | #endif /* LWIP_IPV6 */ 88 | 89 | #endif /* LWIP_HDR_LOWPAN6_H */ 90 | -------------------------------------------------------------------------------- /lwip/src/include/netif/lowpan6_ble.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * 6LowPAN over BLE for IPv6 (RFC7668). 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2017 Benjamin Aigner 8 | * Copyright (c) 2015 Inico Technologies Ltd. , Author: Ivan Delamer 9 | * 10 | * All rights reserved. 11 | * 12 | * Redistribution and use in source and binary forms, with or without modification, 13 | * are permitted provided that the following conditions are met: 14 | * 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. The name of the author may not be used to endorse or promote products 21 | * derived from this software without specific prior written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 24 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 25 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 26 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 28 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 31 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | * OF SUCH DAMAGE. 33 | * 34 | * Author: Benjamin Aigner 35 | * 36 | * Based on the original 6lowpan implementation of lwIP ( @see 6lowpan.c) 37 | */ 38 | 39 | #ifndef LWIP_HDR_LOWPAN6_BLE_H 40 | #define LWIP_HDR_LOWPAN6_BLE_H 41 | 42 | #include "netif/lowpan6_opts.h" 43 | 44 | #if LWIP_IPV6 /* don't build if not configured for use in lwipopts.h */ 45 | 46 | #include "netif/lowpan6_common.h" 47 | #include "lwip/pbuf.h" 48 | #include "lwip/ip.h" 49 | #include "lwip/ip_addr.h" 50 | #include "lwip/netif.h" 51 | 52 | #ifdef __cplusplus 53 | extern "C" { 54 | #endif 55 | 56 | err_t rfc7668_output(struct netif *netif, struct pbuf *q, const ip6_addr_t *ip6addr); 57 | err_t rfc7668_input(struct pbuf * p, struct netif *netif); 58 | err_t rfc7668_set_local_addr_eui64(struct netif *netif, const u8_t *local_addr, size_t local_addr_len); 59 | err_t rfc7668_set_local_addr_mac48(struct netif *netif, const u8_t *local_addr, size_t local_addr_len, int is_public_addr); 60 | err_t rfc7668_set_peer_addr_eui64(struct netif *netif, const u8_t *peer_addr, size_t peer_addr_len); 61 | err_t rfc7668_set_peer_addr_mac48(struct netif *netif, const u8_t *peer_addr, size_t peer_addr_len, int is_public_addr); 62 | err_t rfc7668_set_context(u8_t index, const ip6_addr_t * context); 63 | err_t rfc7668_if_init(struct netif *netif); 64 | 65 | #if !NO_SYS 66 | err_t tcpip_rfc7668_input(struct pbuf *p, struct netif *inp); 67 | #endif 68 | 69 | void ble_addr_to_eui64(u8_t *dst, const u8_t *src, int public_addr); 70 | void eui64_to_ble_addr(u8_t *dst, const u8_t *src); 71 | 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | 76 | #endif /* LWIP_IPV6 */ 77 | 78 | #endif /* LWIP_HDR_LOWPAN6_BLE_H */ 79 | -------------------------------------------------------------------------------- /lwip/src/include/netif/lowpan6_common.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * 4 | * Common 6LowPAN routines for IPv6. Uses ND tables for link-layer addressing. Fragments packets to 6LowPAN units. 5 | */ 6 | 7 | /* 8 | * Copyright (c) 2015 Inico Technologies Ltd. 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright notice, 15 | * this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 3. The name of the author may not be used to endorse or promote products 20 | * derived from this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31 | * OF SUCH DAMAGE. 32 | * 33 | * This file is part of the lwIP TCP/IP stack. 34 | * 35 | * Author: Ivan Delamer 36 | * 37 | * 38 | * Please coordinate changes and requests with Ivan Delamer 39 | * 40 | */ 41 | 42 | #ifndef LWIP_HDR_LOWPAN6_COMMON_H 43 | #define LWIP_HDR_LOWPAN6_COMMON_H 44 | 45 | #include "netif/lowpan6_opts.h" 46 | 47 | #if LWIP_IPV6 /* don't build if IPv6 is disabled in lwipopts.h */ 48 | 49 | #include "lwip/pbuf.h" 50 | #include "lwip/ip.h" 51 | #include "lwip/ip6_addr.h" 52 | #include "lwip/netif.h" 53 | 54 | #ifdef __cplusplus 55 | extern "C" { 56 | #endif 57 | 58 | /** Helper define for a link layer address, which can be encoded as 0, 2 or 8 bytes */ 59 | struct lowpan6_link_addr { 60 | /* encoded length of the address */ 61 | u8_t addr_len; 62 | /* address bytes */ 63 | u8_t addr[8]; 64 | }; 65 | 66 | s8_t lowpan6_get_address_mode(const ip6_addr_t *ip6addr, const struct lowpan6_link_addr *mac_addr); 67 | 68 | #if LWIP_6LOWPAN_IPHC 69 | err_t lowpan6_compress_headers(struct netif *netif, u8_t *inbuf, size_t inbuf_size, u8_t *outbuf, size_t outbuf_size, 70 | u8_t *lowpan6_header_len_out, u8_t *hidden_header_len_out, ip6_addr_t *lowpan6_contexts, 71 | const struct lowpan6_link_addr *src, const struct lowpan6_link_addr *dst); 72 | struct pbuf *lowpan6_decompress(struct pbuf *p, u16_t datagram_size, ip6_addr_t *lowpan6_contexts, 73 | struct lowpan6_link_addr *src, struct lowpan6_link_addr *dest); 74 | #endif /* LWIP_6LOWPAN_IPHC */ 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | 80 | #endif /* LWIP_IPV6 */ 81 | 82 | #endif /* LWIP_HDR_LOWPAN6_COMMON_H */ 83 | -------------------------------------------------------------------------------- /lwip/src/include/netif/ppp/chap-md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * chap-md5.h - New CHAP/MD5 implementation. 3 | * 4 | * Copyright (c) 2003 Paul Mackerras. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. The name(s) of the authors of this software must not be used to 14 | * endorse or promote products derived from this software without 15 | * prior written permission. 16 | * 17 | * 3. Redistributions of any form whatsoever must retain the following 18 | * acknowledgment: 19 | * "This product includes software developed by Paul Mackerras 20 | * ". 21 | * 22 | * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO 23 | * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 24 | * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 25 | * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 26 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 27 | * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 28 | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 29 | */ 30 | 31 | #include "netif/ppp/ppp_opts.h" 32 | #if PPP_SUPPORT && CHAP_SUPPORT /* don't build if not configured for use in lwipopts.h */ 33 | 34 | extern const struct chap_digest_type md5_digest; 35 | 36 | #endif /* PPP_SUPPORT && CHAP_SUPPORT */ 37 | -------------------------------------------------------------------------------- /lwip/src/include/netif/ppp/chap_ms.h: -------------------------------------------------------------------------------- 1 | /* 2 | * chap_ms.h - Challenge Handshake Authentication Protocol definitions. 3 | * 4 | * Copyright (c) 1995 Eric Rosenquist. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * 3. The name(s) of the authors of this software must not be used to 19 | * endorse or promote products derived from this software without 20 | * prior written permission. 21 | * 22 | * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO 23 | * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 24 | * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 25 | * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 26 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 27 | * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 28 | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 29 | * 30 | * $Id: chap_ms.h,v 1.13 2004/11/15 22:13:26 paulus Exp $ 31 | */ 32 | 33 | #include "netif/ppp/ppp_opts.h" 34 | #if PPP_SUPPORT && MSCHAP_SUPPORT /* don't build if not configured for use in lwipopts.h */ 35 | 36 | #ifndef CHAPMS_INCLUDE 37 | #define CHAPMS_INCLUDE 38 | 39 | extern const struct chap_digest_type chapms_digest; 40 | extern const struct chap_digest_type chapms2_digest; 41 | 42 | #endif /* CHAPMS_INCLUDE */ 43 | 44 | #endif /* PPP_SUPPORT && MSCHAP_SUPPORT */ 45 | -------------------------------------------------------------------------------- /lwip/src/include/netif/ppp/ecp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ecp.h - Definitions for PPP Encryption Control Protocol. 3 | * 4 | * Copyright (c) 2002 Google, Inc. 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in 16 | * the documentation and/or other materials provided with the 17 | * distribution. 18 | * 19 | * 3. The name(s) of the authors of this software must not be used to 20 | * endorse or promote products derived from this software without 21 | * prior written permission. 22 | * 23 | * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO 24 | * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 25 | * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 26 | * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 27 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 28 | * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 29 | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 30 | * 31 | * $Id: ecp.h,v 1.2 2003/01/10 07:12:36 fcusack Exp $ 32 | */ 33 | 34 | #include "netif/ppp/ppp_opts.h" 35 | #if PPP_SUPPORT && ECP_SUPPORT /* don't build if not configured for use in lwipopts.h */ 36 | 37 | #ifndef ECP_H 38 | #define ECP_H 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | typedef struct ecp_options { 45 | bool required; /* Is ECP required? */ 46 | unsigned enctype; /* Encryption type */ 47 | } ecp_options; 48 | 49 | extern fsm ecp_fsm[]; 50 | extern ecp_options ecp_wantoptions[]; 51 | extern ecp_options ecp_gotoptions[]; 52 | extern ecp_options ecp_allowoptions[]; 53 | extern ecp_options ecp_hisoptions[]; 54 | 55 | extern const struct protent ecp_protent; 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | #endif /* ECP_H */ 62 | #endif /* PPP_SUPPORT && ECP_SUPPORT */ 63 | -------------------------------------------------------------------------------- /lwip/src/include/netif/ppp/polarssl/arc4.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file arc4.h 3 | * 4 | * Based on XySSL: Copyright (C) 2006-2008 Christophe Devine 5 | * 6 | * Copyright (C) 2009 Paul Bakker 7 | * 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 14 | * * Redistributions of source code must retain the above copyright 15 | * notice, this list of conditions and the following disclaimer. 16 | * * Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in the 18 | * documentation and/or other materials provided with the distribution. 19 | * * Neither the names of PolarSSL or XySSL nor the names of its contributors 20 | * may be used to endorse or promote products derived from this software 21 | * without specific prior written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 29 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #include "netif/ppp/ppp_opts.h" 37 | #if LWIP_INCLUDED_POLARSSL_ARC4 38 | 39 | #ifndef LWIP_INCLUDED_POLARSSL_ARC4_H 40 | #define LWIP_INCLUDED_POLARSSL_ARC4_H 41 | 42 | /** 43 | * \brief ARC4 context structure 44 | */ 45 | typedef struct 46 | { 47 | int x; /*!< permutation index */ 48 | int y; /*!< permutation index */ 49 | unsigned char m[256]; /*!< permutation table */ 50 | } 51 | arc4_context; 52 | 53 | #ifdef __cplusplus 54 | extern "C" { 55 | #endif 56 | 57 | /** 58 | * \brief ARC4 key schedule 59 | * 60 | * \param ctx ARC4 context to be initialized 61 | * \param key the secret key 62 | * \param keylen length of the key 63 | */ 64 | void arc4_setup( arc4_context *ctx, unsigned char *key, int keylen ); 65 | 66 | /** 67 | * \brief ARC4 cipher function 68 | * 69 | * \param ctx ARC4 context 70 | * \param buf buffer to be processed 71 | * \param buflen amount of data in buf 72 | */ 73 | void arc4_crypt( arc4_context *ctx, unsigned char *buf, int buflen ); 74 | 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | 79 | #endif /* LWIP_INCLUDED_POLARSSL_ARC4_H */ 80 | 81 | #endif /* LWIP_INCLUDED_POLARSSL_ARC4 */ 82 | -------------------------------------------------------------------------------- /lwip/src/include/netif/ppp/polarssl/des.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file des.h 3 | * 4 | * Based on XySSL: Copyright (C) 2006-2008 Christophe Devine 5 | * 6 | * Copyright (C) 2009 Paul Bakker 7 | * 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 14 | * * Redistributions of source code must retain the above copyright 15 | * notice, this list of conditions and the following disclaimer. 16 | * * Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in the 18 | * documentation and/or other materials provided with the distribution. 19 | * * Neither the names of PolarSSL or XySSL nor the names of its contributors 20 | * may be used to endorse or promote products derived from this software 21 | * without specific prior written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 29 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #include "netif/ppp/ppp_opts.h" 37 | #if LWIP_INCLUDED_POLARSSL_DES 38 | 39 | #ifndef LWIP_INCLUDED_POLARSSL_DES_H 40 | #define LWIP_INCLUDED_POLARSSL_DES_H 41 | 42 | #define DES_ENCRYPT 1 43 | #define DES_DECRYPT 0 44 | 45 | /** 46 | * \brief DES context structure 47 | */ 48 | typedef struct 49 | { 50 | int mode; /*!< encrypt/decrypt */ 51 | unsigned long sk[32]; /*!< DES subkeys */ 52 | } 53 | des_context; 54 | 55 | #ifdef __cplusplus 56 | extern "C" { 57 | #endif 58 | 59 | /** 60 | * \brief DES key schedule (56-bit, encryption) 61 | * 62 | * \param ctx DES context to be initialized 63 | * \param key 8-byte secret key 64 | */ 65 | void des_setkey_enc( des_context *ctx, unsigned char key[8] ); 66 | 67 | /** 68 | * \brief DES key schedule (56-bit, decryption) 69 | * 70 | * \param ctx DES context to be initialized 71 | * \param key 8-byte secret key 72 | */ 73 | void des_setkey_dec( des_context *ctx, unsigned char key[8] ); 74 | 75 | /** 76 | * \brief DES-ECB block encryption/decryption 77 | * 78 | * \param ctx DES context 79 | * \param input 64-bit input block 80 | * \param output 64-bit output block 81 | */ 82 | void des_crypt_ecb( des_context *ctx, 83 | const unsigned char input[8], 84 | unsigned char output[8] ); 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | #endif /* LWIP_INCLUDED_POLARSSL_DES_H */ 91 | 92 | #endif /* LWIP_INCLUDED_POLARSSL_DES */ 93 | -------------------------------------------------------------------------------- /lwip/src/include/netif/ppp/polarssl/md4.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file md4.h 3 | * 4 | * Based on XySSL: Copyright (C) 2006-2008 Christophe Devine 5 | * 6 | * Copyright (C) 2009 Paul Bakker 7 | * 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 14 | * * Redistributions of source code must retain the above copyright 15 | * notice, this list of conditions and the following disclaimer. 16 | * * Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in the 18 | * documentation and/or other materials provided with the distribution. 19 | * * Neither the names of PolarSSL or XySSL nor the names of its contributors 20 | * may be used to endorse or promote products derived from this software 21 | * without specific prior written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 29 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #include "netif/ppp/ppp_opts.h" 37 | #if LWIP_INCLUDED_POLARSSL_MD4 38 | 39 | #ifndef LWIP_INCLUDED_POLARSSL_MD4_H 40 | #define LWIP_INCLUDED_POLARSSL_MD4_H 41 | 42 | /** 43 | * \brief MD4 context structure 44 | */ 45 | typedef struct 46 | { 47 | unsigned long total[2]; /*!< number of bytes processed */ 48 | unsigned long state[4]; /*!< intermediate digest state */ 49 | unsigned char buffer[64]; /*!< data block being processed */ 50 | } 51 | md4_context; 52 | 53 | #ifdef __cplusplus 54 | extern "C" { 55 | #endif 56 | 57 | /** 58 | * \brief MD4 context setup 59 | * 60 | * \param ctx context to be initialized 61 | */ 62 | void md4_starts( md4_context *ctx ); 63 | 64 | /** 65 | * \brief MD4 process buffer 66 | * 67 | * \param ctx MD4 context 68 | * \param input buffer holding the data 69 | * \param ilen length of the input data 70 | */ 71 | void md4_update( md4_context *ctx, const unsigned char *input, int ilen ); 72 | 73 | /** 74 | * \brief MD4 final digest 75 | * 76 | * \param ctx MD4 context 77 | * \param output MD4 checksum result 78 | */ 79 | void md4_finish( md4_context *ctx, unsigned char output[16] ); 80 | 81 | /** 82 | * \brief Output = MD4( input buffer ) 83 | * 84 | * \param input buffer holding the data 85 | * \param ilen length of the input data 86 | * \param output MD4 checksum result 87 | */ 88 | void md4( unsigned char *input, int ilen, unsigned char output[16] ); 89 | 90 | 91 | #ifdef __cplusplus 92 | } 93 | #endif 94 | 95 | #endif /* LWIP_INCLUDED_POLARSSL_MD4_H */ 96 | 97 | #endif /* LWIP_INCLUDED_POLARSSL_MD4 */ 98 | -------------------------------------------------------------------------------- /lwip/src/include/netif/ppp/polarssl/md5.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file md5.h 3 | * 4 | * Based on XySSL: Copyright (C) 2006-2008 Christophe Devine 5 | * 6 | * Copyright (C) 2009 Paul Bakker 7 | * 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 14 | * * Redistributions of source code must retain the above copyright 15 | * notice, this list of conditions and the following disclaimer. 16 | * * Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in the 18 | * documentation and/or other materials provided with the distribution. 19 | * * Neither the names of PolarSSL or XySSL nor the names of its contributors 20 | * may be used to endorse or promote products derived from this software 21 | * without specific prior written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 29 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #include "netif/ppp/ppp_opts.h" 37 | #if LWIP_INCLUDED_POLARSSL_MD5 38 | 39 | #ifndef LWIP_INCLUDED_POLARSSL_MD5_H 40 | #define LWIP_INCLUDED_POLARSSL_MD5_H 41 | 42 | /** 43 | * \brief MD5 context structure 44 | */ 45 | typedef struct 46 | { 47 | unsigned long total[2]; /*!< number of bytes processed */ 48 | unsigned long state[4]; /*!< intermediate digest state */ 49 | unsigned char buffer[64]; /*!< data block being processed */ 50 | } 51 | md5_context; 52 | 53 | #ifdef __cplusplus 54 | extern "C" { 55 | #endif 56 | 57 | /** 58 | * \brief MD5 context setup 59 | * 60 | * \param ctx context to be initialized 61 | */ 62 | void md5_starts( md5_context *ctx ); 63 | 64 | /** 65 | * \brief MD5 process buffer 66 | * 67 | * \param ctx MD5 context 68 | * \param input buffer holding the data 69 | * \param ilen length of the input data 70 | */ 71 | void md5_update( md5_context *ctx, const unsigned char *input, int ilen ); 72 | 73 | /** 74 | * \brief MD5 final digest 75 | * 76 | * \param ctx MD5 context 77 | * \param output MD5 checksum result 78 | */ 79 | void md5_finish( md5_context *ctx, unsigned char output[16] ); 80 | 81 | /** 82 | * \brief Output = MD5( input buffer ) 83 | * 84 | * \param input buffer holding the data 85 | * \param ilen length of the input data 86 | * \param output MD5 checksum result 87 | */ 88 | void md5( unsigned char *input, int ilen, unsigned char output[16] ); 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | 94 | #endif /* LWIP_INCLUDED_POLARSSL_MD5_H */ 95 | 96 | #endif /* LWIP_INCLUDED_POLARSSL_MD5 */ 97 | -------------------------------------------------------------------------------- /lwip/src/include/netif/slipif.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * 4 | * SLIP netif API 5 | */ 6 | 7 | /* 8 | * Copyright (c) 2001, Swedish Institute of Computer Science. 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without 12 | * modification, are permitted provided that the following conditions 13 | * are met: 14 | * 1. Redistributions of source code must retain the above copyright 15 | * notice, this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in the 18 | * documentation and/or other materials provided with the distribution. 19 | * 3. Neither the name of the Institute nor the names of its contributors 20 | * may be used to endorse or promote products derived from this software 21 | * without specific prior written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 24 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 27 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 | * SUCH DAMAGE. 34 | * 35 | * This file is part of the lwIP TCP/IP stack. 36 | * 37 | * Author: Adam Dunkels 38 | * 39 | */ 40 | #ifndef LWIP_HDR_NETIF_SLIPIF_H 41 | #define LWIP_HDR_NETIF_SLIPIF_H 42 | 43 | #include "lwip/opt.h" 44 | #include "lwip/netif.h" 45 | 46 | /** Set this to 1 to start a thread that blocks reading on the serial line 47 | * (using sio_read()). 48 | */ 49 | #ifndef SLIP_USE_RX_THREAD 50 | #define SLIP_USE_RX_THREAD !NO_SYS 51 | #endif 52 | 53 | /** Set this to 1 to enable functions to pass in RX bytes from ISR context. 54 | * If enabled, slipif_received_byte[s]() process incoming bytes and put assembled 55 | * packets on a queue, which is fed into lwIP from slipif_poll(). 56 | * If disabled, slipif_poll() polls the serial line (using sio_tryread()). 57 | */ 58 | #ifndef SLIP_RX_FROM_ISR 59 | #define SLIP_RX_FROM_ISR 0 60 | #endif 61 | 62 | /** Set this to 1 (default for SLIP_RX_FROM_ISR) to queue incoming packets 63 | * received by slipif_received_byte[s]() as long as PBUF_POOL pbufs are available. 64 | * If disabled, packets will be dropped if more than one packet is received. 65 | */ 66 | #ifndef SLIP_RX_QUEUE 67 | #define SLIP_RX_QUEUE SLIP_RX_FROM_ISR 68 | #endif 69 | 70 | #ifdef __cplusplus 71 | extern "C" { 72 | #endif 73 | 74 | err_t slipif_init(struct netif * netif); 75 | void slipif_poll(struct netif *netif); 76 | #if SLIP_RX_FROM_ISR 77 | void slipif_process_rxqueue(struct netif *netif); 78 | void slipif_received_byte(struct netif *netif, u8_t data); 79 | void slipif_received_bytes(struct netif *netif, u8_t *data, u8_t len); 80 | #endif /* SLIP_RX_FROM_ISR */ 81 | 82 | #ifdef __cplusplus 83 | } 84 | #endif 85 | 86 | #endif /* LWIP_HDR_NETIF_SLIPIF_H */ 87 | -------------------------------------------------------------------------------- /lwip/src/include/netif/zepif.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * 4 | * A netif implementing the ZigBee Eencapsulation Protocol (ZEP). 5 | * This is used to tunnel 6LowPAN over UDP. 6 | */ 7 | 8 | /* 9 | * Copyright (c) 2018 Simon Goldschmidt 10 | * All rights reserved. 11 | * 12 | * Redistribution and use in source and binary forms, with or without modification, 13 | * are permitted provided that the following conditions are met: 14 | * 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. The name of the author may not be used to endorse or promote products 21 | * derived from this software without specific prior written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 24 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 25 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 26 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 28 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 31 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | * OF SUCH DAMAGE. 33 | * 34 | * This file is part of the lwIP TCP/IP stack. 35 | * 36 | * Author: Simon Goldschmidt 37 | * 38 | */ 39 | 40 | #ifndef LWIP_HDR_ZEPIF_H 41 | #define LWIP_HDR_ZEPIF_H 42 | 43 | #include "lwip/opt.h" 44 | #include "netif/lowpan6.h" 45 | 46 | #if LWIP_IPV6 && LWIP_UDP /* don't build if not configured for use in lwipopts.h */ 47 | 48 | #include "lwip/netif.h" 49 | 50 | #ifdef __cplusplus 51 | extern "C" { 52 | #endif 53 | 54 | #define ZEPIF_DEFAULT_UDP_PORT 17754 55 | 56 | /** Pass this struct as 'state' to netif_add to control the behaviour 57 | * of this netif. If NULL is passed, default behaviour is chosen */ 58 | struct zepif_init { 59 | /** The UDP port used to ZEP frames from (0 = default) */ 60 | u16_t zep_src_udp_port; 61 | /** The UDP port used to ZEP frames to (0 = default) */ 62 | u16_t zep_dst_udp_port; 63 | /** The IP address to sed ZEP frames from (NULL = ANY) */ 64 | const ip_addr_t *zep_src_ip_addr; 65 | /** The IP address to sed ZEP frames to (NULL = BROADCAST) */ 66 | const ip_addr_t *zep_dst_ip_addr; 67 | /** If != NULL, the udp pcb is bound to this netif */ 68 | const struct netif *zep_netif; 69 | /** MAC address of the 6LowPAN device */ 70 | u8_t addr[6]; 71 | }; 72 | 73 | err_t zepif_init(struct netif *netif); 74 | 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | 79 | #endif /* LWIP_IPV6 && LWIP_UDP */ 80 | 81 | #endif /* LWIP_HDR_ZEPIF_H */ 82 | -------------------------------------------------------------------------------- /lwip/src/netif/FILES: -------------------------------------------------------------------------------- 1 | This directory contains generic network interface device drivers that 2 | do not contain any hardware or architecture specific code. The files 3 | are: 4 | 5 | ethernet.c 6 | Shared code for Ethernet based interfaces. 7 | 8 | lowpan6.c 9 | A 6LoWPAN implementation as a netif. 10 | 11 | lowpan6_ble.c 12 | A 6LoWPAN over Bluetooth Low Energy (BLE) implementation as netif, 13 | according to RFC-7668. 14 | 15 | slipif.c 16 | A generic implementation of the SLIP (Serial Line IP) 17 | protocol. It requires a sio (serial I/O) module to work. 18 | 19 | ppp/ Point-to-Point Protocol stack 20 | The lwIP PPP support is based from pppd (http://ppp.samba.org) with 21 | huge changes to match code size and memory requirements for embedded 22 | devices. Please read /doc/ppp.txt and ppp/PPPD_FOLLOWUP for a detailed 23 | explanation. 24 | -------------------------------------------------------------------------------- /makecert.bat: -------------------------------------------------------------------------------- 1 | REM https://blog.jayway.com/2014/09/03/creating-self-signed-certificates-with-makecert-exe-for-development/ 2 | 3 | SET KEYSIZE=512 4 | SET SIGN=sha256 5 | 6 | REM to create root CA 7 | makecert.exe -n "CN=CARoot" -r -pe -a %SIGN% -len %KEYSIZE% -cy authority -sv CARoot.pvk CARoot.cer 8 | REM pack root CA as pfx 9 | pvk2pfx.exe -pvk CARoot.pvk -spc CARoot.cer -pfx CARoot.pfx -po straight 10 | 11 | REM to create server certificate 12 | makecert.exe -n "CN=server.straight" -iv CARoot.pvk -ic CARoot.cer -pe -a %SIGN% -len %KEYSIZE% -b 10/24/2020 -e 10/24/2030 -sky exchange -eku 1.3.6.1.5.5.7.3.1 -sv server.pvk server.cer 13 | REM pack server cert as pfx 14 | pvk2pfx.exe -pvk server.pvk -spc server.cer -pfx server.pfx -po straight 15 | 16 | REM to create client certificate 17 | makecert.exe -n "CN=client.straight" -iv CARoot.pvk -ic CARoot.cer -pe -a %SIGN% -len %KEYSIZE% -b 10/24/2020 -e 10/24/2030 -sky exchange -eku 1.3.6.1.5.5.7.3.2 -sv client.pvk client.cer 18 | REM pack client cert as pfx 19 | pvk2pfx.exe -pvk client.pvk -spc client.cer -pfx client.pfx -po straight 20 | 21 | REM openssl pkcs12 -in server.pfx -out server.pem 22 | openssl pkcs12 -in server.pfx -out server.pem 23 | 24 | pause 25 | -------------------------------------------------------------------------------- /makecert.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/straight-coding/straight-httpd-lwip-mbedtls-simulator/d74c483f00cf7f1a8db0cd4d16fd48be3c43bdfe/makecert.exe -------------------------------------------------------------------------------- /mbedtls/configs/README.txt: -------------------------------------------------------------------------------- 1 | This directory contains example configuration files. 2 | 3 | The examples are generally focused on a particular usage case (eg, support for 4 | a restricted number of ciphersuites) and aim at minimizing resource usage for 5 | this target. They can be used as a basis for custom configurations. 6 | 7 | These files are complete replacements for the default config.h. To use one of 8 | them, you can pick one of the following methods: 9 | 10 | 1. Replace the default file include/mbedtls/config.h with the chosen one. 11 | (Depending on your compiler, you may need to adjust the line with 12 | #include "mbedtls/check_config.h" then.) 13 | 14 | 2. Define MBEDTLS_CONFIG_FILE and adjust the include path accordingly. 15 | For example, using make: 16 | 17 | CFLAGS="-I$PWD/configs -DMBEDTLS_CONFIG_FILE=''" make 18 | 19 | Or, using cmake: 20 | 21 | find . -iname '*cmake*' -not -name CMakeLists.txt -exec rm -rf {} + 22 | CFLAGS="-I$PWD/configs -DMBEDTLS_CONFIG_FILE=''" cmake . 23 | make 24 | 25 | Note that the second method also works if you want to keep your custom 26 | configuration file outside the mbed TLS tree. 27 | -------------------------------------------------------------------------------- /mbedtls/configs/config-ccm-psk-tls1_2.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file config-ccm-psk-tls1_2.h 3 | * 4 | * \brief Minimal configuration for TLS 1.2 with PSK and AES-CCM ciphersuites 5 | */ 6 | /* 7 | * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved 8 | * SPDX-License-Identifier: Apache-2.0 9 | * 10 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 11 | * not use this file except in compliance with the License. 12 | * You may obtain a copy of the License at 13 | * 14 | * http://www.apache.org/licenses/LICENSE-2.0 15 | * 16 | * Unless required by applicable law or agreed to in writing, software 17 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 18 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | * See the License for the specific language governing permissions and 20 | * limitations under the License. 21 | * 22 | * This file is part of mbed TLS (https://tls.mbed.org) 23 | */ 24 | /* 25 | * Minimal configuration for TLS 1.2 with PSK and AES-CCM ciphersuites 26 | * Distinguishing features: 27 | * - no bignum, no PK, no X509 28 | * - fully modern and secure (provided the pre-shared keys have high entropy) 29 | * - very low record overhead with CCM-8 30 | * - optimized for low RAM usage 31 | * 32 | * See README.txt for usage instructions. 33 | */ 34 | #ifndef MBEDTLS_CONFIG_H 35 | #define MBEDTLS_CONFIG_H 36 | 37 | /* System support */ 38 | //#define MBEDTLS_HAVE_TIME /* Optionally used in Hello messages */ 39 | /* Other MBEDTLS_HAVE_XXX flags irrelevant for this configuration */ 40 | 41 | /* mbed TLS feature support */ 42 | #define MBEDTLS_KEY_EXCHANGE_PSK_ENABLED 43 | #define MBEDTLS_SSL_PROTO_TLS1_2 44 | 45 | /* mbed TLS modules */ 46 | #define MBEDTLS_AES_C 47 | #define MBEDTLS_CCM_C 48 | #define MBEDTLS_CIPHER_C 49 | #define MBEDTLS_CTR_DRBG_C 50 | #define MBEDTLS_ENTROPY_C 51 | #define MBEDTLS_MD_C 52 | #define MBEDTLS_NET_C 53 | #define MBEDTLS_SHA256_C 54 | #define MBEDTLS_SSL_CLI_C 55 | #define MBEDTLS_SSL_SRV_C 56 | #define MBEDTLS_SSL_TLS_C 57 | 58 | /* Save RAM at the expense of ROM */ 59 | #define MBEDTLS_AES_ROM_TABLES 60 | 61 | /* Save some RAM by adjusting to your exact needs */ 62 | #define MBEDTLS_PSK_MAX_LEN 16 /* 128-bits keys are generally enough */ 63 | 64 | /* 65 | * You should adjust this to the exact number of sources you're using: default 66 | * is the "platform_entropy_poll" source, but you may want to add other ones 67 | * Minimum is 2 for the entropy test suite. 68 | */ 69 | #define MBEDTLS_ENTROPY_MAX_SOURCES 2 70 | 71 | /* 72 | * Use only CCM_8 ciphersuites, and 73 | * save ROM and a few bytes of RAM by specifying our own ciphersuite list 74 | */ 75 | #define MBEDTLS_SSL_CIPHERSUITES \ 76 | MBEDTLS_TLS_PSK_WITH_AES_256_CCM_8, \ 77 | MBEDTLS_TLS_PSK_WITH_AES_128_CCM_8 78 | 79 | /* 80 | * Save RAM at the expense of interoperability: do this only if you control 81 | * both ends of the connection! (See comments in "mbedtls/ssl.h".) 82 | * The optimal size here depends on the typical size of records. 83 | */ 84 | #define MBEDTLS_SSL_MAX_CONTENT_LEN 1024 85 | 86 | #include "mbedtls/check_config.h" 87 | 88 | #endif /* MBEDTLS_CONFIG_H */ 89 | -------------------------------------------------------------------------------- /mbedtls/configs/config-mini-tls1_1.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file config-mini-tls1_1.h 3 | * 4 | * \brief Minimal configuration for TLS 1.1 (RFC 4346) 5 | */ 6 | /* 7 | * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved 8 | * SPDX-License-Identifier: Apache-2.0 9 | * 10 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 11 | * not use this file except in compliance with the License. 12 | * You may obtain a copy of the License at 13 | * 14 | * http://www.apache.org/licenses/LICENSE-2.0 15 | * 16 | * Unless required by applicable law or agreed to in writing, software 17 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 18 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | * See the License for the specific language governing permissions and 20 | * limitations under the License. 21 | * 22 | * This file is part of mbed TLS (https://tls.mbed.org) 23 | */ 24 | /* 25 | * Minimal configuration for TLS 1.1 (RFC 4346), implementing only the 26 | * required ciphersuite: MBEDTLS_TLS_RSA_WITH_3DES_EDE_CBC_SHA 27 | * 28 | * See README.txt for usage instructions. 29 | */ 30 | 31 | #ifndef MBEDTLS_CONFIG_H 32 | #define MBEDTLS_CONFIG_H 33 | 34 | /* System support */ 35 | #define MBEDTLS_HAVE_ASM 36 | #define MBEDTLS_HAVE_TIME 37 | 38 | /* mbed TLS feature support */ 39 | #define MBEDTLS_CIPHER_MODE_CBC 40 | #define MBEDTLS_PKCS1_V15 41 | #define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED 42 | #define MBEDTLS_SSL_PROTO_TLS1_1 43 | 44 | /* mbed TLS modules */ 45 | #define MBEDTLS_AES_C 46 | #define MBEDTLS_ASN1_PARSE_C 47 | #define MBEDTLS_ASN1_WRITE_C 48 | #define MBEDTLS_BIGNUM_C 49 | #define MBEDTLS_CIPHER_C 50 | #define MBEDTLS_CTR_DRBG_C 51 | #define MBEDTLS_DES_C 52 | #define MBEDTLS_ENTROPY_C 53 | #define MBEDTLS_MD_C 54 | #define MBEDTLS_MD5_C 55 | #define MBEDTLS_NET_C 56 | #define MBEDTLS_OID_C 57 | #define MBEDTLS_PK_C 58 | #define MBEDTLS_PK_PARSE_C 59 | #define MBEDTLS_RSA_C 60 | #define MBEDTLS_SHA1_C 61 | #define MBEDTLS_SHA256_C 62 | #define MBEDTLS_SSL_CLI_C 63 | #define MBEDTLS_SSL_SRV_C 64 | #define MBEDTLS_SSL_TLS_C 65 | #define MBEDTLS_X509_CRT_PARSE_C 66 | #define MBEDTLS_X509_USE_C 67 | 68 | /* For test certificates */ 69 | #define MBEDTLS_BASE64_C 70 | #define MBEDTLS_CERTS_C 71 | #define MBEDTLS_PEM_PARSE_C 72 | 73 | /* For testing with compat.sh */ 74 | #define MBEDTLS_FS_IO 75 | 76 | #include "mbedtls/check_config.h" 77 | 78 | #endif /* MBEDTLS_CONFIG_H */ 79 | -------------------------------------------------------------------------------- /mbedtls/configs/config-no-entropy.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file config-no-entropy.h 3 | * 4 | * \brief Minimal configuration of features that do not require an entropy source 5 | */ 6 | /* 7 | * Copyright (C) 2016, ARM Limited, All Rights Reserved 8 | * SPDX-License-Identifier: Apache-2.0 9 | * 10 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 11 | * not use this file except in compliance with the License. 12 | * You may obtain a copy of the License at 13 | * 14 | * http://www.apache.org/licenses/LICENSE-2.0 15 | * 16 | * Unless required by applicable law or agreed to in writing, software 17 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 18 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | * See the License for the specific language governing permissions and 20 | * limitations under the License. 21 | * 22 | * This file is part of mbed TLS (https://tls.mbed.org) 23 | */ 24 | /* 25 | * Minimal configuration of features that do not require an entropy source 26 | * Distinguishing reatures: 27 | * - no entropy module 28 | * - no TLS protocol implementation available due to absence of an entropy 29 | * source 30 | * 31 | * See README.txt for usage instructions. 32 | */ 33 | 34 | #ifndef MBEDTLS_CONFIG_H 35 | #define MBEDTLS_CONFIG_H 36 | 37 | /* System support */ 38 | #define MBEDTLS_HAVE_ASM 39 | #define MBEDTLS_HAVE_TIME 40 | 41 | /* mbed TLS feature support */ 42 | #define MBEDTLS_CIPHER_MODE_CBC 43 | #define MBEDTLS_CIPHER_PADDING_PKCS7 44 | #define MBEDTLS_REMOVE_ARC4_CIPHERSUITES 45 | #define MBEDTLS_ECP_DP_SECP256R1_ENABLED 46 | #define MBEDTLS_ECP_DP_SECP384R1_ENABLED 47 | #define MBEDTLS_ECP_DP_CURVE25519_ENABLED 48 | #define MBEDTLS_ECP_NIST_OPTIM 49 | #define MBEDTLS_ECDSA_DETERMINISTIC 50 | #define MBEDTLS_PK_RSA_ALT_SUPPORT 51 | #define MBEDTLS_PKCS1_V15 52 | #define MBEDTLS_PKCS1_V21 53 | #define MBEDTLS_SELF_TEST 54 | #define MBEDTLS_VERSION_FEATURES 55 | #define MBEDTLS_X509_CHECK_KEY_USAGE 56 | #define MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE 57 | 58 | /* mbed TLS modules */ 59 | #define MBEDTLS_AES_C 60 | #define MBEDTLS_ASN1_PARSE_C 61 | #define MBEDTLS_ASN1_WRITE_C 62 | #define MBEDTLS_BASE64_C 63 | #define MBEDTLS_BIGNUM_C 64 | #define MBEDTLS_CCM_C 65 | #define MBEDTLS_CIPHER_C 66 | #define MBEDTLS_ECDSA_C 67 | #define MBEDTLS_ECP_C 68 | #define MBEDTLS_ERROR_C 69 | #define MBEDTLS_GCM_C 70 | #define MBEDTLS_HMAC_DRBG_C 71 | #define MBEDTLS_MD_C 72 | #define MBEDTLS_OID_C 73 | #define MBEDTLS_PEM_PARSE_C 74 | #define MBEDTLS_PK_C 75 | #define MBEDTLS_PK_PARSE_C 76 | #define MBEDTLS_PK_WRITE_C 77 | #define MBEDTLS_PLATFORM_C 78 | #define MBEDTLS_RSA_C 79 | #define MBEDTLS_SHA256_C 80 | #define MBEDTLS_SHA512_C 81 | #define MBEDTLS_VERSION_C 82 | #define MBEDTLS_X509_USE_C 83 | #define MBEDTLS_X509_CRT_PARSE_C 84 | #define MBEDTLS_X509_CRL_PARSE_C 85 | //#define MBEDTLS_CMAC_C 86 | 87 | /* Miscellaneous options */ 88 | #define MBEDTLS_AES_ROM_TABLES 89 | 90 | #include "mbedtls/check_config.h" 91 | 92 | #endif /* MBEDTLS_CONFIG_H */ 93 | -------------------------------------------------------------------------------- /mbedtls/configs/config-symmetric-only.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file config-symmetric-only.h 3 | * 4 | * \brief Configuration without any asymmetric cryptography. 5 | */ 6 | /* 7 | * Copyright (C) 2019, ARM Limited, All Rights Reserved 8 | * SPDX-License-Identifier: Apache-2.0 9 | * 10 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 11 | * not use this file except in compliance with the License. 12 | * You may obtain a copy of the License at 13 | * 14 | * http://www.apache.org/licenses/LICENSE-2.0 15 | * 16 | * Unless required by applicable law or agreed to in writing, software 17 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 18 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | * See the License for the specific language governing permissions and 20 | * limitations under the License. 21 | * 22 | * This file is part of mbed TLS (https://tls.mbed.org) 23 | */ 24 | 25 | #ifndef MBEDTLS_CONFIG_H 26 | #define MBEDTLS_CONFIG_H 27 | 28 | /* System support */ 29 | //#define MBEDTLS_HAVE_ASM 30 | #define MBEDTLS_HAVE_TIME 31 | #define MBEDTLS_HAVE_TIME_DATE 32 | 33 | /* Mbed Crypto feature support */ 34 | #define MBEDTLS_CIPHER_MODE_CBC 35 | #define MBEDTLS_CIPHER_MODE_CFB 36 | #define MBEDTLS_CIPHER_MODE_CTR 37 | #define MBEDTLS_CIPHER_MODE_OFB 38 | #define MBEDTLS_CIPHER_MODE_XTS 39 | #define MBEDTLS_CIPHER_PADDING_PKCS7 40 | #define MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS 41 | #define MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN 42 | #define MBEDTLS_CIPHER_PADDING_ZEROS 43 | #define MBEDTLS_ERROR_STRERROR_DUMMY 44 | #define MBEDTLS_FS_IO 45 | #define MBEDTLS_ENTROPY_NV_SEED 46 | #define MBEDTLS_SELF_TEST 47 | #define MBEDTLS_USE_PSA_CRYPTO 48 | #define MBEDTLS_VERSION_FEATURES 49 | 50 | /* Mbed Crypto modules */ 51 | #define MBEDTLS_AES_C 52 | #define MBEDTLS_ARC4_C 53 | #define MBEDTLS_ASN1_PARSE_C 54 | #define MBEDTLS_ASN1_WRITE_C 55 | #define MBEDTLS_BASE64_C 56 | #define MBEDTLS_BLOWFISH_C 57 | #define MBEDTLS_CAMELLIA_C 58 | #define MBEDTLS_ARIA_C 59 | #define MBEDTLS_CCM_C 60 | #define MBEDTLS_CHACHA20_C 61 | #define MBEDTLS_CHACHAPOLY_C 62 | #define MBEDTLS_CIPHER_C 63 | #define MBEDTLS_CMAC_C 64 | #define MBEDTLS_CTR_DRBG_C 65 | #define MBEDTLS_DES_C 66 | #define MBEDTLS_ENTROPY_C 67 | #define MBEDTLS_ERROR_C 68 | #define MBEDTLS_GCM_C 69 | //#define MBEDTLS_HAVEGE_C 70 | #define MBEDTLS_HKDF_C 71 | #define MBEDTLS_HMAC_DRBG_C 72 | #define MBEDTLS_NIST_KW_C 73 | #define MBEDTLS_MD_C 74 | #define MBEDTLS_MD2_C 75 | #define MBEDTLS_MD4_C 76 | #define MBEDTLS_MD5_C 77 | #define MBEDTLS_OID_C 78 | #define MBEDTLS_PEM_PARSE_C 79 | #define MBEDTLS_PEM_WRITE_C 80 | #define MBEDTLS_PKCS5_C 81 | #define MBEDTLS_PKCS12_C 82 | #define MBEDTLS_PLATFORM_C 83 | #define MBEDTLS_POLY1305_C 84 | #define MBEDTLS_PSA_CRYPTO_C 85 | #define MBEDTLS_PSA_CRYPTO_SE_C 86 | #define MBEDTLS_PSA_CRYPTO_STORAGE_C 87 | #define MBEDTLS_PSA_ITS_FILE_C 88 | #define MBEDTLS_RIPEMD160_C 89 | #define MBEDTLS_SHA1_C 90 | #define MBEDTLS_SHA256_C 91 | #define MBEDTLS_SHA512_C 92 | //#define MBEDTLS_THREADING_C 93 | #define MBEDTLS_TIMING_C 94 | #define MBEDTLS_VERSION_C 95 | #define MBEDTLS_XTEA_C 96 | 97 | #include "check_config.h" 98 | 99 | #endif /* MBEDTLS_CONFIG_H */ 100 | -------------------------------------------------------------------------------- /mbedtls/configs/config-thread.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file config-thread.h 3 | * 4 | * \brief Minimal configuration for using TLS as part of Thread 5 | */ 6 | /* 7 | * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved 8 | * SPDX-License-Identifier: Apache-2.0 9 | * 10 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 11 | * not use this file except in compliance with the License. 12 | * You may obtain a copy of the License at 13 | * 14 | * http://www.apache.org/licenses/LICENSE-2.0 15 | * 16 | * Unless required by applicable law or agreed to in writing, software 17 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 18 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | * See the License for the specific language governing permissions and 20 | * limitations under the License. 21 | * 22 | * This file is part of mbed TLS (https://tls.mbed.org) 23 | */ 24 | 25 | /* 26 | * Minimal configuration for using TLS a part of Thread 27 | * http://threadgroup.org/ 28 | * 29 | * Distinguishing features: 30 | * - no RSA or classic DH, fully based on ECC 31 | * - no X.509 32 | * - support for experimental EC J-PAKE key exchange 33 | * 34 | * See README.txt for usage instructions. 35 | */ 36 | 37 | #ifndef MBEDTLS_CONFIG_H 38 | #define MBEDTLS_CONFIG_H 39 | 40 | /* System support */ 41 | #define MBEDTLS_HAVE_ASM 42 | 43 | /* mbed TLS feature support */ 44 | #define MBEDTLS_AES_ROM_TABLES 45 | #define MBEDTLS_ECP_DP_SECP256R1_ENABLED 46 | #define MBEDTLS_ECP_NIST_OPTIM 47 | #define MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED 48 | #define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH 49 | #define MBEDTLS_SSL_PROTO_TLS1_2 50 | #define MBEDTLS_SSL_PROTO_DTLS 51 | #define MBEDTLS_SSL_DTLS_ANTI_REPLAY 52 | #define MBEDTLS_SSL_DTLS_HELLO_VERIFY 53 | #define MBEDTLS_SSL_EXPORT_KEYS 54 | 55 | /* mbed TLS modules */ 56 | #define MBEDTLS_AES_C 57 | #define MBEDTLS_ASN1_PARSE_C 58 | #define MBEDTLS_ASN1_WRITE_C 59 | #define MBEDTLS_BIGNUM_C 60 | #define MBEDTLS_CCM_C 61 | #define MBEDTLS_CIPHER_C 62 | #define MBEDTLS_CTR_DRBG_C 63 | #define MBEDTLS_CMAC_C 64 | #define MBEDTLS_ECJPAKE_C 65 | #define MBEDTLS_ECP_C 66 | #define MBEDTLS_ENTROPY_C 67 | #define MBEDTLS_HMAC_DRBG_C 68 | #define MBEDTLS_MD_C 69 | #define MBEDTLS_OID_C 70 | #define MBEDTLS_PK_C 71 | #define MBEDTLS_PK_PARSE_C 72 | #define MBEDTLS_SHA256_C 73 | #define MBEDTLS_SSL_COOKIE_C 74 | #define MBEDTLS_SSL_CLI_C 75 | #define MBEDTLS_SSL_SRV_C 76 | #define MBEDTLS_SSL_TLS_C 77 | 78 | /* For tests using ssl-opt.sh */ 79 | #define MBEDTLS_NET_C 80 | #define MBEDTLS_TIMING_C 81 | 82 | /* Save RAM at the expense of ROM */ 83 | #define MBEDTLS_AES_ROM_TABLES 84 | 85 | /* Save RAM by adjusting to our exact needs */ 86 | #define MBEDTLS_ECP_MAX_BITS 256 87 | #define MBEDTLS_MPI_MAX_SIZE 32 // 256 bits is 32 bytes 88 | 89 | /* Save ROM and a few bytes of RAM by specifying our own ciphersuite list */ 90 | #define MBEDTLS_SSL_CIPHERSUITES MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8 91 | 92 | #include "mbedtls/check_config.h" 93 | 94 | #endif /* MBEDTLS_CONFIG_H */ 95 | -------------------------------------------------------------------------------- /mbedtls/include/mbedtls/config_user.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////// 2 | // in order to overwrite definitions, include this file at the end of config.h 3 | 4 | /////////////////////////////////////////////////////////////////////////////////////// 5 | // disable MICRO 6 | /////////////////////////////////////////////////////////////////////////////////////// 7 | 8 | #undef MBEDTLS_HAVE_TIME 9 | #undef MBEDTLS_HAVE_TIME_DATE 10 | 11 | #undef MBEDTLS_SSL_PROTO_DTLS 12 | #undef MBEDTLS_SSL_DTLS_ANTI_REPLAY 13 | #undef MBEDTLS_SSL_DTLS_HELLO_VERIFY 14 | #undef MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE 15 | #undef MBEDTLS_SSL_DTLS_BADMAC_LIMIT 16 | 17 | #undef MBEDTLS_MEMORY_BUFFER_ALLOC_C 18 | /////////////////////////////////////////////////////////////////////////////////////// 19 | // enable MICRO 20 | /////////////////////////////////////////////////////////////////////////////////////// 21 | 22 | #define MBEDTLS_SSL_PROTO_TLS1 23 | #define MBEDTLS_SSL_PROTO_TLS1_1 24 | #define MBEDTLS_SSL_PROTO_TLS1_2 25 | 26 | #define MBEDTLS_NO_PLATFORM_ENTROPY 27 | #define MBEDTLS_ENTROPY_NV_SEED 28 | #define MBEDTLS_ENTROPY_C 29 | #define ALTCP_MBEDTLS_RNG_FN mbedtls_entropy_func 30 | #define MBEDTLS_PLATFORM_NV_SEED_READ_MACRO mbedtls_platform_std_nv_seed_read 31 | #define MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO mbedtls_platform_std_nv_seed_write 32 | 33 | #define MBEDTLS_HAVE_ASM 34 | 35 | #define MBEDTLS_NO_64BIT_MULTIPLICATION 36 | 37 | #define MBEDTLS_PLATFORM_MEMORY 38 | #define MBEDTLS_PLATFORM_C 39 | 40 | #define MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH 41 | #define MBEDTLS_SSL_MAX_CONTENT_LEN 16384 42 | #define MBEDTLS_SSL_IN_CONTENT_LEN 16384 43 | 44 | #ifdef _WIN32 45 | #define MBEDTLS_SSL_OUT_CONTENT_LEN 16384 46 | #undef MBEDTLS_PLATFORM_NO_STD_FUNCTIONS 47 | #else 48 | #define MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH 49 | #define MBEDTLS_SSL_OUT_CONTENT_LEN 1024 //16384 50 | 51 | #define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS 52 | #define MBEDTLS_PLATFORM_SNPRINTF_MACRO sprintf_s 53 | #define MBEDTLS_PLATFORM_VSNPRINTF_MACRO vsnprintf 54 | #endif 55 | 56 | //0 No debug,1 Error,2 State change,3 Informational,4 Verbose 57 | #define MBEDTLS_DEBUG_LEVEL 1 58 | -------------------------------------------------------------------------------- /mbedtls/include/mbedtls/havege.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file havege.h 3 | * 4 | * \brief HAVEGE: HArdware Volatile Entropy Gathering and Expansion 5 | */ 6 | /* 7 | * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved 8 | * SPDX-License-Identifier: Apache-2.0 9 | * 10 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 11 | * not use this file except in compliance with the License. 12 | * You may obtain a copy of the License at 13 | * 14 | * http://www.apache.org/licenses/LICENSE-2.0 15 | * 16 | * Unless required by applicable law or agreed to in writing, software 17 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 18 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | * See the License for the specific language governing permissions and 20 | * limitations under the License. 21 | * 22 | * This file is part of mbed TLS (https://tls.mbed.org) 23 | */ 24 | #ifndef MBEDTLS_HAVEGE_H 25 | #define MBEDTLS_HAVEGE_H 26 | 27 | #if !defined(MBEDTLS_CONFIG_FILE) 28 | #include "mbedtls/config.h" 29 | #else 30 | #include MBEDTLS_CONFIG_FILE 31 | #endif 32 | 33 | #include 34 | #include 35 | 36 | #define MBEDTLS_HAVEGE_COLLECT_SIZE 1024 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /** 43 | * \brief HAVEGE state structure 44 | */ 45 | typedef struct mbedtls_havege_state 46 | { 47 | uint32_t PT1, PT2, offset[2]; 48 | uint32_t pool[MBEDTLS_HAVEGE_COLLECT_SIZE]; 49 | uint32_t WALK[8192]; 50 | } 51 | mbedtls_havege_state; 52 | 53 | /** 54 | * \brief HAVEGE initialization 55 | * 56 | * \param hs HAVEGE state to be initialized 57 | */ 58 | void mbedtls_havege_init( mbedtls_havege_state *hs ); 59 | 60 | /** 61 | * \brief Clear HAVEGE state 62 | * 63 | * \param hs HAVEGE state to be cleared 64 | */ 65 | void mbedtls_havege_free( mbedtls_havege_state *hs ); 66 | 67 | /** 68 | * \brief HAVEGE rand function 69 | * 70 | * \param p_rng A HAVEGE state 71 | * \param output Buffer to fill 72 | * \param len Length of buffer 73 | * 74 | * \return 0 75 | */ 76 | int mbedtls_havege_random( void *p_rng, unsigned char *output, size_t len ); 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | 82 | #endif /* havege.h */ 83 | -------------------------------------------------------------------------------- /mbedtls/include/mbedtls/md_internal.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file md_internal.h 3 | * 4 | * \brief Message digest wrappers. 5 | * 6 | * \warning This in an internal header. Do not include directly. 7 | * 8 | * \author Adriaan de Jong 9 | */ 10 | /* 11 | * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved 12 | * SPDX-License-Identifier: Apache-2.0 13 | * 14 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 15 | * not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at 17 | * 18 | * http://www.apache.org/licenses/LICENSE-2.0 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | * This file is part of mbed TLS (https://tls.mbed.org) 27 | */ 28 | #ifndef MBEDTLS_MD_WRAP_H 29 | #define MBEDTLS_MD_WRAP_H 30 | 31 | #if !defined(MBEDTLS_CONFIG_FILE) 32 | #include "mbedtls/config.h" 33 | #else 34 | #include MBEDTLS_CONFIG_FILE 35 | #endif 36 | 37 | #include "mbedtls/md.h" 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | /** 44 | * Message digest information. 45 | * Allows message digest functions to be called in a generic way. 46 | */ 47 | struct mbedtls_md_info_t 48 | { 49 | /** Name of the message digest */ 50 | const char * name; 51 | 52 | /** Digest identifier */ 53 | mbedtls_md_type_t type; 54 | 55 | /** Output length of the digest function in bytes */ 56 | unsigned char size; 57 | 58 | /** Block length of the digest function in bytes */ 59 | unsigned char block_size; 60 | }; 61 | 62 | #if defined(MBEDTLS_MD2_C) 63 | extern const mbedtls_md_info_t mbedtls_md2_info; 64 | #endif 65 | #if defined(MBEDTLS_MD4_C) 66 | extern const mbedtls_md_info_t mbedtls_md4_info; 67 | #endif 68 | #if defined(MBEDTLS_MD5_C) 69 | extern const mbedtls_md_info_t mbedtls_md5_info; 70 | #endif 71 | #if defined(MBEDTLS_RIPEMD160_C) 72 | extern const mbedtls_md_info_t mbedtls_ripemd160_info; 73 | #endif 74 | #if defined(MBEDTLS_SHA1_C) 75 | extern const mbedtls_md_info_t mbedtls_sha1_info; 76 | #endif 77 | #if defined(MBEDTLS_SHA256_C) 78 | extern const mbedtls_md_info_t mbedtls_sha224_info; 79 | extern const mbedtls_md_info_t mbedtls_sha256_info; 80 | #endif 81 | #if defined(MBEDTLS_SHA512_C) 82 | #if !defined(MBEDTLS_SHA512_NO_SHA384) 83 | extern const mbedtls_md_info_t mbedtls_sha384_info; 84 | #endif 85 | extern const mbedtls_md_info_t mbedtls_sha512_info; 86 | #endif 87 | 88 | #ifdef __cplusplus 89 | } 90 | #endif 91 | 92 | #endif /* MBEDTLS_MD_WRAP_H */ 93 | -------------------------------------------------------------------------------- /mbedtls/include/mbedtls/net.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file net.h 3 | * 4 | * \brief Deprecated header file that includes net_sockets.h 5 | * 6 | * \deprecated Superseded by mbedtls/net_sockets.h 7 | */ 8 | /* 9 | * Copyright (C) 2006-2016, ARM Limited, All Rights Reserved 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | * This file is part of mbed TLS (https://tls.mbed.org) 25 | */ 26 | #if !defined(MBEDTLS_CONFIG_FILE) 27 | #include "mbedtls/config.h" 28 | #else 29 | #include MBEDTLS_CONFIG_FILE 30 | #endif 31 | 32 | #if !defined(MBEDTLS_DEPRECATED_REMOVED) 33 | #include "mbedtls/net_sockets.h" 34 | #if defined(MBEDTLS_DEPRECATED_WARNING) 35 | #warning "Deprecated header file: Superseded by mbedtls/net_sockets.h" 36 | #endif /* MBEDTLS_DEPRECATED_WARNING */ 37 | #endif /* !MBEDTLS_DEPRECATED_REMOVED */ 38 | -------------------------------------------------------------------------------- /mbedtls/include/mbedtls/platform_time.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file platform_time.h 3 | * 4 | * \brief mbed TLS Platform time abstraction 5 | */ 6 | /* 7 | * Copyright (C) 2006-2016, ARM Limited, All Rights Reserved 8 | * SPDX-License-Identifier: Apache-2.0 9 | * 10 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 11 | * not use this file except in compliance with the License. 12 | * You may obtain a copy of the License at 13 | * 14 | * http://www.apache.org/licenses/LICENSE-2.0 15 | * 16 | * Unless required by applicable law or agreed to in writing, software 17 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 18 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | * See the License for the specific language governing permissions and 20 | * limitations under the License. 21 | * 22 | * This file is part of mbed TLS (https://tls.mbed.org) 23 | */ 24 | #ifndef MBEDTLS_PLATFORM_TIME_H 25 | #define MBEDTLS_PLATFORM_TIME_H 26 | 27 | #if !defined(MBEDTLS_CONFIG_FILE) 28 | #include "mbedtls/config.h" 29 | #else 30 | #include MBEDTLS_CONFIG_FILE 31 | #endif 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /** 38 | * \name SECTION: Module settings 39 | * 40 | * The configuration options you can set for this module are in this section. 41 | * Either change them in config.h or define them on the compiler command line. 42 | * \{ 43 | */ 44 | 45 | /* 46 | * The time_t datatype 47 | */ 48 | #if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) 49 | typedef MBEDTLS_PLATFORM_TIME_TYPE_MACRO mbedtls_time_t; 50 | #else 51 | /* For time_t */ 52 | #include 53 | typedef time_t mbedtls_time_t; 54 | #endif /* MBEDTLS_PLATFORM_TIME_TYPE_MACRO */ 55 | 56 | /* 57 | * The function pointers for time 58 | */ 59 | #if defined(MBEDTLS_PLATFORM_TIME_ALT) 60 | extern mbedtls_time_t (*mbedtls_time)( mbedtls_time_t* time ); 61 | 62 | /** 63 | * \brief Set your own time function pointer 64 | * 65 | * \param time_func the time function implementation 66 | * 67 | * \return 0 68 | */ 69 | int mbedtls_platform_set_time( mbedtls_time_t (*time_func)( mbedtls_time_t* time ) ); 70 | #else 71 | #if defined(MBEDTLS_PLATFORM_TIME_MACRO) 72 | #define mbedtls_time MBEDTLS_PLATFORM_TIME_MACRO 73 | #else 74 | #define mbedtls_time time 75 | #endif /* MBEDTLS_PLATFORM_TIME_MACRO */ 76 | #endif /* MBEDTLS_PLATFORM_TIME_ALT */ 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | 82 | #endif /* platform_time.h */ 83 | -------------------------------------------------------------------------------- /mbedtls/include/psa/crypto_driver_common.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file psa/crypto_driver_common.h 3 | * \brief Definitions for all PSA crypto drivers 4 | * 5 | * This file contains common definitions shared by all PSA crypto drivers. 6 | * Do not include it directly: instead, include the header file(s) for 7 | * the type(s) of driver that you are implementing. For example, if 8 | * you are writing a driver for a chip that provides both a hardware 9 | * random generator and an accelerator for some cryptographic algorithms, 10 | * include `psa/crypto_entropy_driver.h` and `psa/crypto_accel_driver.h`. 11 | * 12 | * This file is part of the PSA Crypto Driver Model, containing functions for 13 | * driver developers to implement to enable hardware to be called in a 14 | * standardized way by a PSA Cryptographic API implementation. The functions 15 | * comprising the driver model, which driver authors implement, are not 16 | * intended to be called by application developers. 17 | */ 18 | 19 | /* 20 | * Copyright (C) 2018, ARM Limited, All Rights Reserved 21 | * SPDX-License-Identifier: Apache-2.0 22 | * 23 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 24 | * not use this file except in compliance with the License. 25 | * You may obtain a copy of the License at 26 | * 27 | * http://www.apache.org/licenses/LICENSE-2.0 28 | * 29 | * Unless required by applicable law or agreed to in writing, software 30 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 31 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 32 | * See the License for the specific language governing permissions and 33 | * limitations under the License. 34 | */ 35 | #ifndef PSA_CRYPTO_DRIVER_COMMON_H 36 | #define PSA_CRYPTO_DRIVER_COMMON_H 37 | 38 | #include 39 | #include 40 | 41 | /* Include type definitions (psa_status_t, psa_algorithm_t, 42 | * psa_key_type_t, etc.) and macros to build and analyze values 43 | * of these types. */ 44 | #include "crypto_types.h" 45 | #include "crypto_values.h" 46 | 47 | /** For encrypt-decrypt functions, whether the operation is an encryption 48 | * or a decryption. */ 49 | typedef enum { 50 | PSA_CRYPTO_DRIVER_DECRYPT, 51 | PSA_CRYPTO_DRIVER_ENCRYPT 52 | } psa_encrypt_or_decrypt_t; 53 | 54 | #endif /* PSA_CRYPTO_DRIVER_COMMON_H */ 55 | -------------------------------------------------------------------------------- /mbedtls/library/common.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file common.h 3 | * 4 | * \brief Utility macros for internal use in the library 5 | */ 6 | /* 7 | * Copyright (C) 2019, ARM Limited, All Rights Reserved 8 | * SPDX-License-Identifier: Apache-2.0 9 | * 10 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 11 | * not use this file except in compliance with the License. 12 | * You may obtain a copy of the License at 13 | * 14 | * http://www.apache.org/licenses/LICENSE-2.0 15 | * 16 | * Unless required by applicable law or agreed to in writing, software 17 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 18 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | * See the License for the specific language governing permissions and 20 | * limitations under the License. 21 | * 22 | * This file is part of mbed TLS (https://tls.mbed.org) 23 | */ 24 | 25 | #ifndef MBEDTLS_LIBRARY_COMMON_H 26 | #define MBEDTLS_LIBRARY_COMMON_H 27 | 28 | #if defined(MBEDTLS_CONFIG_FILE) 29 | #include MBEDTLS_CONFIG_FILE 30 | #else 31 | #include "mbedtls/config.h" 32 | #endif 33 | 34 | /** Helper to define a function as static except when building invasive tests. 35 | * 36 | * If a function is only used inside its own source file and should be 37 | * declared `static` to allow the compiler to optimize for code size, 38 | * but that function has unit tests, define it with 39 | * ``` 40 | * MBEDTLS_STATIC_TESTABLE int mbedtls_foo(...) { ... } 41 | * ``` 42 | * and declare it in a header in the `library/` directory with 43 | * ``` 44 | * #if defined(MBEDTLS_TEST_HOOKS) 45 | * int mbedtls_foo(...); 46 | * #endif 47 | * ``` 48 | */ 49 | #if defined(MBEDTLS_TEST_HOOKS) 50 | #define MBEDTLS_STATIC_TESTABLE 51 | #else 52 | #define MBEDTLS_STATIC_TESTABLE static 53 | #endif 54 | 55 | #endif /* MBEDTLS_LIBRARY_COMMON_H */ 56 | -------------------------------------------------------------------------------- /mbedtls/library/psa_crypto_invasive.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file psa_crypto_invasive.h 3 | * 4 | * \brief PSA cryptography module: invasive interfaces for test only. 5 | * 6 | * The interfaces in this file are intended for testing purposes only. 7 | * They MUST NOT be made available to clients over IPC in integrations 8 | * with isolation, and they SHOULD NOT be made available in library 9 | * integrations except when building the library for testing. 10 | */ 11 | /* 12 | * Copyright (C) 2018, ARM Limited, All Rights Reserved 13 | * SPDX-License-Identifier: Apache-2.0 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 16 | * not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * http://www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 23 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | * 27 | * This file is part of mbed TLS (https://tls.mbed.org) 28 | */ 29 | 30 | #ifndef PSA_CRYPTO_INVASIVE_H 31 | #define PSA_CRYPTO_INVASIVE_H 32 | 33 | #if defined(MBEDTLS_CONFIG_FILE) 34 | #include MBEDTLS_CONFIG_FILE 35 | #else 36 | #include "mbedtls/config.h" 37 | #endif 38 | 39 | #include "psa/crypto.h" 40 | 41 | #include "mbedtls/entropy.h" 42 | 43 | /** \brief Configure entropy sources. 44 | * 45 | * This function may only be called before a call to psa_crypto_init(), 46 | * or after a call to mbedtls_psa_crypto_free() and before any 47 | * subsequent call to psa_crypto_init(). 48 | * 49 | * This function is only intended for test purposes. The functionality 50 | * it provides is also useful for system integrators, but 51 | * system integrators should configure entropy drivers instead of 52 | * breaking through to the Mbed TLS API. 53 | * 54 | * \param entropy_init Function to initialize the entropy context 55 | * and set up the desired entropy sources. 56 | * It is called by psa_crypto_init(). 57 | * By default this is mbedtls_entropy_init(). 58 | * This function cannot report failures directly. 59 | * To indicate a failure, set the entropy context 60 | * to a state where mbedtls_entropy_func() will 61 | * return an error. 62 | * \param entropy_free Function to free the entropy context 63 | * and associated resources. 64 | * It is called by mbedtls_psa_crypto_free(). 65 | * By default this is mbedtls_entropy_free(). 66 | * 67 | * \retval PSA_SUCCESS 68 | * Success. 69 | * \retval PSA_ERROR_NOT_PERMITTED 70 | * The caller does not have the permission to configure 71 | * entropy sources. 72 | * \retval PSA_ERROR_BAD_STATE 73 | * The library has already been initialized. 74 | */ 75 | psa_status_t mbedtls_psa_crypto_configure_entropy_sources( 76 | void (* entropy_init )( mbedtls_entropy_context *ctx ), 77 | void (* entropy_free )( mbedtls_entropy_context *ctx ) ); 78 | 79 | #endif /* PSA_CRYPTO_INVASIVE_H */ 80 | -------------------------------------------------------------------------------- /mbedtls/library/psa_crypto_service_integration.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019, ARM Limited, All Rights Reserved 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 6 | * not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * This file is part of mbed TLS (https://tls.mbed.org) 18 | */ 19 | 20 | #ifndef PSA_CRYPTO_SERVICE_INTEGRATION_H 21 | #define PSA_CRYPTO_SERVICE_INTEGRATION_H 22 | 23 | /* 24 | * When MBEDTLS_PSA_CRYPTO_SPM is defined, the code is being built for SPM 25 | * (Secure Partition Manager) integration which separates the code into two 26 | * parts: NSPE (Non-Secure Processing Environment) and SPE (Secure Processing 27 | * Environment). When building for the SPE, an additional header file should be 28 | * included. 29 | */ 30 | #if defined(MBEDTLS_PSA_CRYPTO_SPM) 31 | /* 32 | * PSA_CRYPTO_SECURE means that the file which included this file is being 33 | * compiled for SPE. The files crypto_structs.h and crypto_types.h have 34 | * different implementations for NSPE and SPE and are compiled according to this 35 | * flag. 36 | */ 37 | #define PSA_CRYPTO_SECURE 1 38 | #include "crypto_spe.h" 39 | #endif // MBEDTLS_PSA_CRYPTO_SPM 40 | 41 | #endif // PSA_CRYPTO_SERVICE_INTEGRATION_H 42 | -------------------------------------------------------------------------------- /mbedtls/library/version.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Version information 3 | * 4 | * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved 5 | * SPDX-License-Identifier: Apache-2.0 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 8 | * not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 15 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * This file is part of mbed TLS (https://tls.mbed.org) 20 | */ 21 | 22 | #if !defined(MBEDTLS_CONFIG_FILE) 23 | #include "mbedtls/config.h" 24 | #else 25 | #include MBEDTLS_CONFIG_FILE 26 | #endif 27 | 28 | #if defined(MBEDTLS_VERSION_C) 29 | 30 | #include "mbedtls/version.h" 31 | #include 32 | 33 | unsigned int mbedtls_version_get_number( void ) 34 | { 35 | return( MBEDTLS_VERSION_NUMBER ); 36 | } 37 | 38 | void mbedtls_version_get_string( char *string ) 39 | { 40 | memcpy( string, MBEDTLS_VERSION_STRING, 41 | sizeof( MBEDTLS_VERSION_STRING ) ); 42 | } 43 | 44 | void mbedtls_version_get_string_full( char *string ) 45 | { 46 | memcpy( string, MBEDTLS_VERSION_STRING_FULL, 47 | sizeof( MBEDTLS_VERSION_STRING_FULL ) ); 48 | } 49 | 50 | #endif /* MBEDTLS_VERSION_C */ 51 | -------------------------------------------------------------------------------- /pcap/Include/pcap-bpf.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * This code is derived from the Stanford/CMU enet packet filter, 6 | * (net/enet.c) distributed as part of 4.3BSD, and code contributed 7 | * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence 8 | * Berkeley Laboratory. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 3. All advertising materials mentioning features or use of this software 19 | * must display the following acknowledgement: 20 | * This product includes software developed by the University of 21 | * California, Berkeley and its contributors. 22 | * 4. Neither the name of the University nor the names of its contributors 23 | * may be used to endorse or promote products derived from this software 24 | * without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 | * SUCH DAMAGE. 37 | */ 38 | 39 | /* 40 | * For backwards compatibility. 41 | * 42 | * Note to OS vendors: do NOT get rid of this file! Some applications 43 | * might expect to be able to include . 44 | */ 45 | #include 46 | -------------------------------------------------------------------------------- /pcap/Include/pcap-namedb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1994, 1996 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. All advertising materials mentioning features or use of this software 14 | * must display the following acknowledgement: 15 | * This product includes software developed by the Computer Systems 16 | * Engineering Group at Lawrence Berkeley Laboratory. 17 | * 4. Neither the name of the University nor of the Laboratory may be used 18 | * to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* 35 | * For backwards compatibility. 36 | * 37 | * Note to OS vendors: do NOT get rid of this file! Some applications 38 | * might expect to be able to include . 39 | */ 40 | #include 41 | -------------------------------------------------------------------------------- /pcap/Include/pcap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1993, 1994, 1995, 1996, 1997 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. All advertising materials mentioning features or use of this software 14 | * must display the following acknowledgement: 15 | * This product includes software developed by the Computer Systems 16 | * Engineering Group at Lawrence Berkeley Laboratory. 17 | * 4. Neither the name of the University nor of the Laboratory may be used 18 | * to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* 35 | * For backwards compatibility. 36 | * 37 | * Note to OS vendors: do NOT get rid of this file! Many applications 38 | * expect to be able to include , and at least some of them 39 | * go through contortions in their configure scripts to try to detect 40 | * OSes that have "helpfully" moved pcap.h to without 41 | * leaving behind a file. 42 | */ 43 | #include 44 | -------------------------------------------------------------------------------- /pcap/Include/pcap/bluetooth.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 Paolo Abeni (Italy) 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote 15 | * products derived from this software without specific prior written 16 | * permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | * bluetooth data struct 31 | * By Paolo Abeni 32 | */ 33 | 34 | #ifndef lib_pcap_bluetooth_h 35 | #define lib_pcap_bluetooth_h 36 | 37 | #include 38 | 39 | /* 40 | * Header prepended libpcap to each bluetooth h4 frame, 41 | * fields are in network byte order 42 | */ 43 | typedef struct _pcap_bluetooth_h4_header { 44 | uint32_t direction; /* if first bit is set direction is incoming */ 45 | } pcap_bluetooth_h4_header; 46 | 47 | /* 48 | * Header prepended libpcap to each bluetooth linux monitor frame, 49 | * fields are in network byte order 50 | */ 51 | typedef struct _pcap_bluetooth_linux_monitor_header { 52 | uint16_t adapter_id; 53 | uint16_t opcode; 54 | } pcap_bluetooth_linux_monitor_header; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /pcap/Include/pcap/can_socketcan.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * This code is derived from the Stanford/CMU enet packet filter, 6 | * (net/enet.c) distributed as part of 4.3BSD, and code contributed 7 | * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence 8 | * Berkeley Laboratory. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 3. All advertising materials mentioning features or use of this software 19 | * must display the following acknowledgement: 20 | * This product includes software developed by the University of 21 | * California, Berkeley and its contributors. 22 | * 4. Neither the name of the University nor the names of its contributors 23 | * may be used to endorse or promote products derived from this software 24 | * without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 | * SUCH DAMAGE. 37 | */ 38 | 39 | #ifndef lib_pcap_can_socketcan_h 40 | #define lib_pcap_can_socketcan_h 41 | 42 | #include 43 | 44 | /* 45 | * SocketCAN header, as per Documentation/networking/can.txt in the 46 | * Linux source. 47 | */ 48 | typedef struct { 49 | uint32_t can_id; 50 | uint8_t payload_length; 51 | uint8_t pad; 52 | uint8_t reserved1; 53 | uint8_t reserved2; 54 | } pcap_can_socketcan_hdr; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /pcap/Include/pcap/ipnet.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * This code is derived from the Stanford/CMU enet packet filter, 6 | * (net/enet.c) distributed as part of 4.3BSD, and code contributed 7 | * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence 8 | * Berkeley Laboratory. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 3. All advertising materials mentioning features or use of this software 19 | * must display the following acknowledgement: 20 | * This product includes software developed by the University of 21 | * California, Berkeley and its contributors. 22 | * 4. Neither the name of the University nor the names of its contributors 23 | * may be used to endorse or promote products derived from this software 24 | * without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 | * SUCH DAMAGE. 37 | */ 38 | 39 | #define IPH_AF_INET 2 /* Matches Solaris's AF_INET */ 40 | #define IPH_AF_INET6 26 /* Matches Solaris's AF_INET6 */ 41 | 42 | #define IPNET_OUTBOUND 1 43 | #define IPNET_INBOUND 2 44 | -------------------------------------------------------------------------------- /pcap/Include/pcap/vlan.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. All advertising materials mentioning features or use of this software 14 | * must display the following acknowledgement: 15 | * This product includes software developed by the University of 16 | * California, Berkeley and its contributors. 17 | * 4. Neither the name of the University nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef lib_pcap_vlan_h 35 | #define lib_pcap_vlan_h 36 | 37 | #include 38 | 39 | struct vlan_tag { 40 | uint16_t vlan_tpid; /* ETH_P_8021Q */ 41 | uint16_t vlan_tci; /* VLAN TCI */ 42 | }; 43 | 44 | #define VLAN_TAG_LEN 4 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /pcap/lib/Packet.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/straight-coding/straight-httpd-lwip-mbedtls-simulator/d74c483f00cf7f1a8db0cd4d16fd48be3c43bdfe/pcap/lib/Packet.lib -------------------------------------------------------------------------------- /pcap/lib/wpcap.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/straight-coding/straight-httpd-lwip-mbedtls-simulator/d74c483f00cf7f1a8db0cd4d16fd48be3c43bdfe/pcap/lib/wpcap.lib -------------------------------------------------------------------------------- /pcap/lib/x64/Packet.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/straight-coding/straight-httpd-lwip-mbedtls-simulator/d74c483f00cf7f1a8db0cd4d16fd48be3c43bdfe/pcap/lib/x64/Packet.lib -------------------------------------------------------------------------------- /pcap/lib/x64/wpcap.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/straight-coding/straight-httpd-lwip-mbedtls-simulator/d74c483f00cf7f1a8db0cd4d16fd48be3c43bdfe/pcap/lib/x64/wpcap.lib -------------------------------------------------------------------------------- /pvk2pfx.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/straight-coding/straight-httpd-lwip-mbedtls-simulator/d74c483f00cf7f1a8db0cd4d16fd48be3c43bdfe/pvk2pfx.exe -------------------------------------------------------------------------------- /server.cer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/straight-coding/straight-httpd-lwip-mbedtls-simulator/d74c483f00cf7f1a8db0cd4d16fd48be3c43bdfe/server.cer -------------------------------------------------------------------------------- /server.pem: -------------------------------------------------------------------------------- 1 | Bag Attributes 2 | localKeyID: 01 00 00 00 3 | Microsoft CSP Name: Microsoft Strong Cryptographic Provider 4 | friendlyName: PvkTmp:395fcae3-a26d-4f0c-b880-b0ef1b142e6b 5 | Key Attributes 6 | X509v3 Key Usage: 10 7 | -----BEGIN ENCRYPTED PRIVATE KEY----- 8 | MIIBpjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIGPULjavQsEgCAggA 9 | MBQGCCqGSIb3DQMHBAhzhjxyhEJ7NgSCAWBihB0wi33LrSzyWYUjmBc2DmIo9FgB 10 | AK51vUyljP7XbSUE9lfSenRCf2bCtHlOe/x1crRmnI8Tr8F5iw6mOBEfJ6orROdy 11 | NAjNMNZXu76tIYjkblRuMSzXDNoQzH/dKxN1KMojtsKQbG2EcQVfG0GlQypXstgr 12 | ajJp57MZy0BKGXaWYUc+9Vgda8SLxWNLRy5wNwSBmN02ZxjT5t5zpYaUaUB1WFY4 13 | 6pIMgmynn636boOF2VHXQdRTJbcn76hsJYkVQhERB/z8yYKIhl0Y8Jag3Wm151wt 14 | gXwZivq7cVwgk7TWuE15NJQQKRNo1GMbkMLyaHLIQwvLeXYeul38ryxXm5CtvmG+ 15 | VmndzTSd6H1kJcgv2mTlH7deajEgNO2JMLSEYQRv0AJyVwdgJauWu3iz7+0W1iAD 16 | r2q+8CrzT1HhNdRoDLs28gwQ/f48XG8Erfg1ZZfUuQCNrYL1wATTs+wy 17 | -----END ENCRYPTED PRIVATE KEY----- 18 | Bag Attributes 19 | localKeyID: 01 00 00 00 20 | subject=/CN=server.straight 21 | issuer=/CN=CARoot 22 | -----BEGIN CERTIFICATE----- 23 | MIIBhjCCATCgAwIBAgIQuY9Og0ylhpRIUZV9sJFi5DANBgkqhkiG9w0BAQsFADAR 24 | MQ8wDQYDVQQDEwZDQVJvb3QwHhcNMjAxMDI0MDcwMDAwWhcNMzAxMDI0MDcwMDAw 25 | WjAaMRgwFgYDVQQDEw9zZXJ2ZXIuc3RyYWlnaHQwXDANBgkqhkiG9w0BAQEFAANL 26 | ADBIAkEA44T2OhYNX5CAVfP3aB7xC8XpIIRvST0JGeRptFWv7MiMsrI/Ewe/Lt+K 27 | ImUPDZwSzhJ4YEqMfOjclKPV06bf3QIDAQABo1swWTATBgNVHSUEDDAKBggrBgEF 28 | BQcDATBCBgNVHQEEOzA5gBB4pVILJFLqT8sdQXmk6FaWoRMwETEPMA0GA1UEAxMG 29 | Q0FSb290ghASHfUmS8dmi0SWS8hDV/pFMA0GCSqGSIb3DQEBCwUAA0EAQfkZZ2l1 30 | YCu7PHQBVwC6BFF8Pq5FfxpzFm2xFJ/hMI9U2xmSbLdWclCiy0fXNTW+yl4TKgbk 31 | EMYAWHOUwlBsTA== 32 | -----END CERTIFICATE----- 33 | -------------------------------------------------------------------------------- /server.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/straight-coding/straight-httpd-lwip-mbedtls-simulator/d74c483f00cf7f1a8db0cd4d16fd48be3c43bdfe/server.pfx -------------------------------------------------------------------------------- /server.pvk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/straight-coding/straight-httpd-lwip-mbedtls-simulator/d74c483f00cf7f1a8db0cd4d16fd48be3c43bdfe/server.pvk -------------------------------------------------------------------------------- /signin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/straight-coding/straight-httpd-lwip-mbedtls-simulator/d74c483f00cf7f1a8db0cd4d16fd48be3c43bdfe/signin.png -------------------------------------------------------------------------------- /stack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/straight-coding/straight-httpd-lwip-mbedtls-simulator/d74c483f00cf7f1a8db0cd4d16fd48be3c43bdfe/stack.png -------------------------------------------------------------------------------- /straight-buildfs.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/straight-coding/straight-httpd-lwip-mbedtls-simulator/d74c483f00cf7f1a8db0cd4d16fd48be3c43bdfe/straight-buildfs.exe -------------------------------------------------------------------------------- /straight-httpd/Debug/Packet.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/straight-coding/straight-httpd-lwip-mbedtls-simulator/d74c483f00cf7f1a8db0cd4d16fd48be3c43bdfe/straight-httpd/Debug/Packet.dll -------------------------------------------------------------------------------- /straight-httpd/Debug/wpcap.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/straight-coding/straight-httpd-lwip-mbedtls-simulator/d74c483f00cf7f1a8db0cd4d16fd48be3c43bdfe/straight-httpd/Debug/wpcap.dll -------------------------------------------------------------------------------- /straight-httpd/straight-buildfs/pch.cpp: -------------------------------------------------------------------------------- 1 | // pch.cpp: source file corresponding to pre-compiled header; necessary for compilation to succeed 2 | 3 | #include "pch.h" 4 | 5 | // In general, ignore this file, but keep it around if you are using pre-compiled headers. 6 | -------------------------------------------------------------------------------- /straight-httpd/straight-buildfs/pch.h: -------------------------------------------------------------------------------- 1 | // Tips for Getting Started: 2 | // 1. Use the Solution Explorer window to add/manage files 3 | // 2. Use the Team Explorer window to connect to source control 4 | // 3. Use the Output window to see build output and other messages 5 | // 4. Use the Error List window to view errors 6 | // 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project 7 | // 6. In the future, to open this project again, go to File > Open > Project and select the .sln file 8 | 9 | #ifndef PCH_H 10 | #define PCH_H 11 | 12 | // TODO: add headers that you want to pre-compile here 13 | #include 14 | #include 15 | 16 | #include 17 | #include 18 | 19 | #pragma warning(disable:4996) //_CRT_SECURE_NO_WARNINGS 20 | 21 | #endif //PCH_H 22 | -------------------------------------------------------------------------------- /straight-httpd/straight-httpd.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "straight-httpd", "straight-httpd\straight-httpd.vcxproj", "{0AC7D242-155F-457D-99F0-0DB7488C9344}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "straight-buildfs", "straight-buildfs\straight-buildfs.vcxproj", "{4EA8DD01-CD53-4892-93BB-593F3B085F86}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x86 = Debug|x86 11 | Release|x86 = Release|x86 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {0AC7D242-155F-457D-99F0-0DB7488C9344}.Debug|x86.ActiveCfg = Debug|Win32 15 | {0AC7D242-155F-457D-99F0-0DB7488C9344}.Debug|x86.Build.0 = Debug|Win32 16 | {0AC7D242-155F-457D-99F0-0DB7488C9344}.Release|x86.ActiveCfg = Release|Win32 17 | {0AC7D242-155F-457D-99F0-0DB7488C9344}.Release|x86.Build.0 = Release|Win32 18 | {4EA8DD01-CD53-4892-93BB-593F3B085F86}.Debug|x86.ActiveCfg = Debug|Win32 19 | {4EA8DD01-CD53-4892-93BB-593F3B085F86}.Debug|x86.Build.0 = Debug|Win32 20 | {4EA8DD01-CD53-4892-93BB-593F3B085F86}.Release|x86.ActiveCfg = Release|Win32 21 | {4EA8DD01-CD53-4892-93BB-593F3B085F86}.Release|x86.Build.0 = Release|Win32 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | GlobalSection(ExtensibilityGlobals) = postSolution 27 | SolutionGuid = {B9296463-078D-47F5-9863-339D996803F4} 28 | EndGlobalSection 29 | EndGlobal 30 | -------------------------------------------------------------------------------- /straight-httpd/straight-httpd/httpd/cgi/cgi_form.c: -------------------------------------------------------------------------------- 1 | /* 2 | cgi_form.c 3 | Author: Straight Coder 4 | Date: June 11, 2020 5 | */ 6 | 7 | #include "../http_cgi.h" 8 | 9 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 10 | 11 | extern void LogPrint(int level, char* format, ... ); 12 | extern void LoadConfig4Edit(void); 13 | extern void AppyConfig(void); 14 | 15 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 16 | 17 | static void Form_OnHeadersReceived(REQUEST_CONTEXT* context); 18 | static void Form_OnRequestReceived(REQUEST_CONTEXT* context); 19 | static void Form_SetResponseHeaders(REQUEST_CONTEXT* context, char* HttpCodeInfo); 20 | static void Form_AllSent(REQUEST_CONTEXT* context); 21 | 22 | struct CGI_Mapping g_cgiForm = { 23 | "/app/form.shtml", //char* path; 24 | CGI_OPT_AUTH_REQUIRED | CGI_OPT_GET_ENABLED | CGI_OPT_POST_ENABLED,// unsigned long options; 25 | 26 | NULL, //void (*OnCancel)(REQUEST_CONTEXT* context); 27 | 28 | NULL, //int (*OnHeaderReceived)(REQUEST_CONTEXT* context, char* header_line); 29 | Form_OnHeadersReceived, //void (*OnHeadersReceived)(REQUEST_CONTEXT* context); 30 | WEB_OnFormReceived, //int (*OnContentReceived)(REQUEST_CONTEXT* context, char* buffer, int size); 31 | Form_OnRequestReceived, //void (*OnRequestReceived)(REQUEST_CONTEXT* context); 32 | 33 | Form_SetResponseHeaders, //void (*SetResponseHeader)(REQUEST_CONTEXT* context, char* HttpCode); 34 | WEB_ReadContent, //int (*ReadContent)(REQUEST_CONTEXT* context, char* buffer, int maxSize); 35 | Form_AllSent, //int (*OnAllSent)(REQUEST_CONTEXT* context); 36 | NULL, //void (*OnFinished)(REQUEST_CONTEXT* context); 37 | 38 | NULL //struct CGI_Mapping* next; 39 | }; 40 | 41 | static void Form_OnHeadersReceived(REQUEST_CONTEXT* context) 42 | { 43 | if (context->_requestMethod == METHOD_GET) 44 | LoadConfig4Edit(); 45 | 46 | WEB_OnFormHeaders(context); //default for both GET and POST 47 | } 48 | 49 | static void Form_OnRequestReceived(REQUEST_CONTEXT* context) 50 | { 51 | WEB_RequestReceived(context); //default for both GET and POST 52 | 53 | if (context->_requestMethod == METHOD_POST) 54 | AppyConfig(); //apply the new values for the following function WEB_ReadContent 55 | 56 | memset(context->ctxResponse._sendBuffer, 0, sizeof(context->ctxResponse._sendBuffer)); 57 | context->ctxResponse._bytesLeft = 0; 58 | } 59 | 60 | static void Form_SetResponseHeaders(REQUEST_CONTEXT* context, char* HttpCodeInfo) 61 | { //clear send buffer for response use 62 | WEB_AppendHeaders(context, HttpCodeInfo); //default for both GET and POST 63 | } 64 | 65 | static void Form_AllSent(REQUEST_CONTEXT* context) 66 | { 67 | WEB_AllSent(context); //default for both GET and POST 68 | 69 | //form done 70 | } 71 | -------------------------------------------------------------------------------- /straight-httpd/straight-httpd/httpd/cgi/cgi_web.c: -------------------------------------------------------------------------------- 1 | /* 2 | cgi_web.c 3 | Author: Straight Coder 4 | Date: April 12, 2020 5 | */ 6 | 7 | #include "../http_cgi.h" 8 | 9 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 10 | 11 | struct CGI_Mapping g_cgiWebApp = { 12 | "/app/*", //char* path; 13 | CGI_OPT_AUTH_REQUIRED | CGI_OPT_GET_ENABLED,// unsigned long options; 14 | 15 | NULL, //void (*OnCancel)(REQUEST_CONTEXT* context); 16 | NULL, //int (*OnHeaderReceived)(REQUEST_CONTEXT* context, char* header_line); 17 | NULL, //void (*OnHeadersReceived)(REQUEST_CONTEXT* context); 18 | NULL, //int (*OnContentReceived)(REQUEST_CONTEXT* context, char* buffer, int size); 19 | WEB_RequestReceived, //void (*OnRequestReceived)(REQUEST_CONTEXT* context); 20 | 21 | WEB_AppendHeaders, //void (*SetResponseHeader)(REQUEST_CONTEXT* context, char* HttpCode); 22 | WEB_ReadContent, //int (*ReadContent)(REQUEST_CONTEXT* context, char* buffer, int maxSize); 23 | 24 | WEB_AllSent, //int (*OnAllSent)(REQUEST_CONTEXT* context); 25 | WEB_Finished, //void (*OnFinished)(REQUEST_CONTEXT* context); 26 | 27 | NULL //struct CGI_Mapping* next; 28 | }; 29 | -------------------------------------------------------------------------------- /straight-httpd/straight-httpd/httpd/cncweb/app/files.shtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Virtual Device 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 |
22 |
23 |
Virtual Device
24 |
Powered by 25 | 26 |
27 |
28 | 29 |
30 |
31 | 32 | 33 |
34 |
    35 |
36 |
37 | 38 |
39 | 40 | 41 | 42 | 43 | 44 |
45 |
46 | 47 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /straight-httpd/straight-httpd/httpd/cncweb/app/js/base64js.min.js: -------------------------------------------------------------------------------- 1 | (function(r){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=r()}else if(typeof define==="function"&&define.amd){define([],r)}else{var e;if(typeof window!=="undefined"){e=window}else if(typeof global!=="undefined"){e=global}else if(typeof self!=="undefined"){e=self}else{e=this}e.base64js=r()}})(function(){var r,e,n;return function(){function r(e,n,t){function o(f,i){if(!n[f]){if(!e[f]){var u="function"==typeof require&&require;if(!i&&u)return u(f,!0);if(a)return a(f,!0);var v=new Error("Cannot find module '"+f+"'");throw v.code="MODULE_NOT_FOUND",v}var d=n[f]={exports:{}};e[f][0].call(d.exports,function(r){var n=e[f][1][r];return o(n||r)},d,d.exports,r,e,n,t)}return n[f].exports}for(var a="function"==typeof require&&require,f=0;f0){throw new Error("Invalid string. Length must be a multiple of 4")}var n=r.indexOf("=");if(n===-1)n=e;var t=n===e?0:4-n%4;return[n,t]}function d(r){var e=v(r);var n=e[0];var t=e[1];return(n+t)*3/4-t}function c(r,e,n){return(e+n)*3/4-n}function h(r){var e;var n=v(r);var t=n[0];var f=n[1];var i=new a(c(r,t,f));var u=0;var d=f>0?t-4:t;for(var h=0;h>16&255;i[u++]=e>>8&255;i[u++]=e&255}if(f===2){e=o[r.charCodeAt(h)]<<2|o[r.charCodeAt(h+1)]>>4;i[u++]=e&255}if(f===1){e=o[r.charCodeAt(h)]<<10|o[r.charCodeAt(h+1)]<<4|o[r.charCodeAt(h+2)]>>2;i[u++]=e>>8&255;i[u++]=e&255}return i}function s(r){return t[r>>18&63]+t[r>>12&63]+t[r>>6&63]+t[r&63]}function l(r,e,n){var t;var o=[];for(var a=e;au?u:i+f))}if(o===1){e=r[n-1];a.push(t[e>>2]+t[e<<4&63]+"==")}else if(o===2){e=(r[n-2]<<8)+r[n-1];a.push(t[e>>10]+t[e>>4&63]+t[e<<2&63]+"=")}return a.join("")}},{}]},{},[])("/")}); -------------------------------------------------------------------------------- /straight-httpd/straight-httpd/httpd/cncweb/app/js/qrcodegen.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/straight-coding/straight-httpd-lwip-mbedtls-simulator/d74c483f00cf7f1a8db0cd4d16fd48be3c43bdfe/straight-httpd/straight-httpd/httpd/cncweb/app/js/qrcodegen.js -------------------------------------------------------------------------------- /straight-httpd/straight-httpd/httpd/cncweb/app/plugin/fileList/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/straight-coding/straight-httpd-lwip-mbedtls-simulator/d74c483f00cf7f1a8db0cd4d16fd48be3c43bdfe/straight-httpd/straight-httpd/httpd/cncweb/app/plugin/fileList/file.png -------------------------------------------------------------------------------- /straight-httpd/straight-httpd/httpd/cncweb/app/plugin/fileList/fileList.css: -------------------------------------------------------------------------------- 1 | /* 2 | fileList.css 3 | Author: Straight Coder 4 | Date: June 07, 2020 5 | */ 6 | 7 | .file-list li:first-child 8 | { 9 | border: 1px solid #8c8c8c; 10 | } 11 | 12 | .file-list li:not(:first-child) 13 | { 14 | border-top: 0px solid #8c8c8c; 15 | border-left: 1px solid #8c8c8c; 16 | border-right: 1px solid #8c8c8c; 17 | border-bottom: 1px solid #8c8c8c; 18 | } 19 | 20 | .file-item 21 | { 22 | padding: 10px; 23 | /* border: 1px solid #8c8c8c;*/ 24 | } 25 | .file-size 26 | { 27 | margin-top: 4px; 28 | font-size: 12px; 29 | } 30 | .file-op 31 | { 32 | width: 30px; 33 | color: red; 34 | font-size: 14px; 35 | } 36 | .file-op div 37 | { 38 | cursor: pointer; 39 | } 40 | .file-progress 41 | { 42 | height: 4px; 43 | margin-top: 8px; 44 | background-color: #ddd; 45 | } 46 | .file-progress > div 47 | { 48 | width: 0%; 49 | height: 100%; 50 | background-color: #17a2b8; 51 | } 52 | .file-name 53 | { 54 | max-width: 230px; 55 | } 56 | -------------------------------------------------------------------------------- /straight-httpd/straight-httpd/httpd/cncweb/app/plugin/fileList/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/straight-coding/straight-httpd-lwip-mbedtls-simulator/d74c483f00cf7f1a8db0cd4d16fd48be3c43bdfe/straight-httpd/straight-httpd/httpd/cncweb/app/plugin/fileList/folder.png -------------------------------------------------------------------------------- /straight-httpd/straight-httpd/httpd/cncweb/app/plugin/fileTransfer/fileTransfer.css: -------------------------------------------------------------------------------- 1 | /* 2 | fileTransfer.css 3 | Author: Straight Coder 4 | Date: June 04, 2020 5 | */ 6 | 7 | .file-item 8 | { 9 | padding: 10px; 10 | border: 1px solid #8c8c8c; 11 | } 12 | .file-size 13 | { 14 | margin-top: 4px; 15 | font-size: 12px; 16 | } 17 | .file-op 18 | { 19 | width: 30px; 20 | color: red; 21 | font-size: 14px; 22 | } 23 | .file-op div 24 | { 25 | cursor: pointer; 26 | } 27 | .file-progress 28 | { 29 | height: 4px; 30 | margin-top: 8px; 31 | background-color: #ddd; 32 | } 33 | .file-progress > div 34 | { 35 | width: 0%; 36 | height: 100%; 37 | background-color: #17a2b8; 38 | } 39 | .file-name 40 | { 41 | max-width: 230px; 42 | } 43 | -------------------------------------------------------------------------------- /straight-httpd/straight-httpd/httpd/http_fs.h: -------------------------------------------------------------------------------- 1 | /* 2 | http_fs.h 3 | Author: Straight Coder 4 | Date: June 28, 2020 5 | */ 6 | 7 | #ifndef _HTTP_FS_H_ 8 | #define _HTTP_FS_H_ 9 | 10 | #define MAX_FILES 32 11 | 12 | #define ATTRI_GZIP 0x00000001 13 | 14 | #ifdef WIN32 15 | #define __attribute__(x) 16 | #endif 17 | 18 | typedef struct _http_file_info 19 | { 20 | unsigned long nIndex; //index for read pointer 21 | unsigned long nSize; //file size 22 | unsigned long long tLastModified; //file date 23 | unsigned long nAttributes; //ATTRI_GZIP 24 | unsigned long nReserved; //padding for 4-byte alignment 25 | unsigned long nOffsetFileData; //file content offset 26 | unsigned long nOffsetNextFile; // ==> _http_file_info* 27 | }http_file_info __attribute__((aligned(4))); 28 | 29 | int WEB_fs_init(void); 30 | 31 | void* WEB_fopen(const char* szTemp, const char* mode); 32 | unsigned long WEB_ftime(char* fname, char* buf, int maxSize); 33 | int WEB_fseek(void* f, long offset); 34 | void WEB_fclose(void* f); 35 | long WEB_fsize(void* f); 36 | int WEB_fread(void* f, char* buf, int count, unsigned int* bytes); //0=success 37 | int WEB_fwrite(void* f, char* buf, int count); //>0:success 38 | 39 | void* WEB_firstdir(void* filter, int* isFolder, char* name, int maxLen, int* size, unsigned long long* date); /* date/time in unix secs past 1-Jan-70 */ 40 | int WEB_readdir(void* hFind, int* isFolder, char* name, int maxLen, int* size, unsigned long long* date); /* date/time in unix secs past 1-Jan-70 */ 41 | void WEB_closedir(void* hFind); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /straight-httpd/straight-httpd/httpd/http_session.h: -------------------------------------------------------------------------------- 1 | /* 2 | http_session.h 3 | Author: Straight Coder 4 | Date: June 13, 2020 5 | */ 6 | 7 | #ifndef _HTTP_SESSION_H_ 8 | #define _HTTP_SESSION_H_ 9 | 10 | #define MAX_SESSIONS 5 11 | #define MAX_COOKIE_SIZE 32 //max length of the cookie string 12 | //#define TO_SESSION 3*60*1000 13 | 14 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 15 | 16 | typedef struct _SESSION 17 | { 18 | char _token[MAX_COOKIE_SIZE]; //for http_core.c 19 | 20 | unsigned long _nLoginIP; 21 | unsigned long long _tLastReceived; //tick of the last received 22 | unsigned long long _tLastSent; //tick of the last sent 23 | }SESSION; //size of SESSION: 44 24 | 25 | void SetupSession(void); 26 | 27 | SESSION* SessionCreate(char* outCookie, unsigned long remoteIP); 28 | SESSION* GetSession(char* token); 29 | 30 | void SessionKill(SESSION* session); 31 | void SessionClearAll(void); //mutex used inside 32 | int SessionTypes(char* extension); 33 | 34 | void SessionCheck(long long tick); 35 | void SessionReceived(SESSION* session); 36 | void SessionSent(SESSION* session); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /straight-httpd/straight-httpd/httpd/http_web.h: -------------------------------------------------------------------------------- 1 | /* 2 | http_web.h 3 | Author: Straight Coder 4 | Date: June 10, 2020 5 | */ 6 | 7 | #ifndef _HTTP_WEB_H_ 8 | #define _HTTP_WEB_H_ 9 | 10 | #include "http_cgi.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 13 | 14 | extern void LogPrint(int level, char* format, ... ); 15 | extern int Strnicmp(char *str1, char *str2, int n); 16 | extern int ReplaceTag(REQUEST_CONTEXT* context, char* tagName, char* appendTo, int maxAllowed); 17 | 18 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 19 | void WEB_OnFormHeaders(REQUEST_CONTEXT* context); 20 | int WEB_OnFormReceived(REQUEST_CONTEXT* context, char* buffer, int size); 21 | 22 | void WEB_RequestReceived(REQUEST_CONTEXT* context); 23 | void WEB_AppendHeaders(REQUEST_CONTEXT* context, char* HttpCodeInfo); 24 | 25 | int WEB_ReadContent(REQUEST_CONTEXT* context, char* buffer, int maxSize); 26 | void WEB_AllSent(REQUEST_CONTEXT* context); 27 | void WEB_Finished(REQUEST_CONTEXT* context); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /straight-httpd/straight-httpd/ssdp/ssdp.h: -------------------------------------------------------------------------------- 1 | /* 2 | ssdp.h 3 | Author: Straight Coder 4 | Date: April 12, 2020 5 | */ 6 | 7 | #ifndef _SSDP_H 8 | #define _SSDP_H 9 | 10 | void ssdpInit(struct netif *net); 11 | void ssdpDown(void); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /straight-httpd/straight-httpd/utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | utils.h 3 | Author: Straight Coder 4 | Date: April 12, 2020 5 | */ 6 | 7 | #ifndef _UTILS_H_ 8 | #define _UTILS_H_ 9 | 10 | #pragma warning(disable:4996) //_CRT_SECURE_NO_WARNINGS 11 | 12 | typedef struct 13 | { 14 | char *extension; 15 | char *content_type; 16 | }TypeHeader; 17 | 18 | long ston(unsigned char* s); 19 | void ntos(long n, unsigned char* s); 20 | int ToLower(int nChar); 21 | int ToUpper(int nChar); 22 | int token_match(const char *s1, const char *s2); 23 | int Strnicmp(char *str1, char *str2, int n); 24 | void TrimFloat(char* floatString); 25 | int DecodeB64(unsigned char* data); 26 | int URLDecode(char* url); 27 | void MakeDeepPath(char* szPath); 28 | 29 | char* GetContentType(const char* extension); 30 | unsigned long GetIpAddress(char* addr); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /tasks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/straight-coding/straight-httpd-lwip-mbedtls-simulator/d74c483f00cf7f1a8db0cd4d16fd48be3c43bdfe/tasks.png -------------------------------------------------------------------------------- /upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/straight-coding/straight-httpd-lwip-mbedtls-simulator/d74c483f00cf7f1a8db0cd4d16fd48be3c43bdfe/upload.png -------------------------------------------------------------------------------- /work-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/straight-coding/straight-httpd-lwip-mbedtls-simulator/d74c483f00cf7f1a8db0cd4d16fd48be3c43bdfe/work-flow.png --------------------------------------------------------------------------------