├── Document └── NL6621 SDK用户手册.pdf ├── Project ├── PrjSdkOsIpRom │ ├── PrjSdkOsIpRom.uvopt │ ├── PrjSdkOsIpRom.uvproj │ ├── bin.bat │ └── scatter.scat └── PrjSdkRam │ ├── PrjSdkRam.uvopt │ ├── PrjSdkRam.uvproj │ ├── bin.bat │ ├── scatter_jtag.scat │ └── scatter_loader.scat ├── README.md ├── Source ├── App │ ├── DhcpServer │ │ ├── dhcp_server.c │ │ └── dhcp_server.h │ └── DnsServer │ │ ├── dns_server.c │ │ └── dns_server.h ├── BOOT │ └── CortexM3_startup.s ├── BSP │ ├── I2C.c │ ├── I2C.h │ ├── I2S.c │ ├── I2S.h │ ├── board.h │ ├── bsp.c │ ├── bsp.h │ ├── cortexM3_it.c │ ├── cortexm3_macro.s │ ├── dma.c │ ├── dma.h │ ├── flash.c │ ├── flash.h │ ├── gpio.c │ ├── gpio.h │ ├── mpu.c │ ├── mpu.h │ ├── nvic.c │ ├── nvic.h │ ├── printf.c │ ├── qspi.c │ ├── qspi.h │ ├── reg.h │ ├── sdio.c │ ├── sdio.h │ ├── spi.c │ ├── spi.h │ ├── timer.c │ ├── timer.h │ ├── uart.c │ ├── uart.h │ ├── wdg.c │ └── wdg.h ├── Include │ ├── airkiss.h │ ├── app_cfg.h │ ├── global.h │ ├── includes.h │ ├── param.h │ ├── rom_hook_tbl.h │ ├── task_util.h │ ├── types_def.h │ └── util.h ├── Lib │ ├── libairkiss.lib │ ├── libairkiss_aes.lib │ ├── libairkiss_aes_log.lib │ ├── libairkiss_log.lib │ ├── wcore.lib │ ├── wcore_11n.lib │ ├── wcore_11n_ap.lib │ ├── wcore_11n_sta.lib │ ├── wcore_ap.lib │ └── wcore_sta.lib ├── LwIP │ ├── doc │ │ ├── FILES │ │ ├── contrib.txt │ │ ├── rawapi.txt │ │ ├── savannah.txt │ │ ├── snmp_agent.txt │ │ └── sys_arch.txt │ ├── port │ │ ├── include │ │ │ ├── arch │ │ │ │ ├── bpstruct.h │ │ │ │ ├── cc.h │ │ │ │ ├── cpu.h │ │ │ │ ├── epstruct.h │ │ │ │ ├── perf.h │ │ │ │ └── sys_arch.h │ │ │ ├── lwIP.h │ │ │ ├── lwipopts.h │ │ │ └── netif │ │ │ │ └── ethernetif.h │ │ ├── lwIP.c │ │ └── sys_arch.c │ └── src │ │ ├── .hgignore │ │ ├── FILES │ │ ├── api │ │ ├── api_lib.c │ │ ├── api_msg.c │ │ ├── err.c │ │ ├── netbuf.c │ │ ├── netdb.c │ │ ├── netifapi.c │ │ ├── sockets.c │ │ └── tcpip.c │ │ ├── core │ │ ├── def.c │ │ ├── dhcp.c │ │ ├── dns.c │ │ ├── ipv4 │ │ │ ├── autoip.c │ │ │ ├── icmp.c │ │ │ ├── igmp.c │ │ │ ├── inet.c │ │ │ ├── inet_chksum.c │ │ │ ├── ip.c │ │ │ ├── ip_addr.c │ │ │ └── ip_frag.c │ │ ├── ipv6 │ │ │ ├── README │ │ │ ├── icmp6.c │ │ │ ├── inet6.c │ │ │ ├── ip6.c │ │ │ └── ip6_addr.c │ │ ├── lwip_init.c │ │ ├── mem.c │ │ ├── memp.c │ │ ├── netif.c │ │ ├── pbuf.c │ │ ├── raw.c │ │ ├── snmp │ │ │ ├── asn1_dec.c │ │ │ ├── asn1_enc.c │ │ │ ├── mib2.c │ │ │ ├── mib_structs.c │ │ │ ├── msg_in.c │ │ │ └── msg_out.c │ │ ├── stats.c │ │ ├── sys.c │ │ ├── tcp.c │ │ ├── tcp_in.c │ │ ├── tcp_out.c │ │ ├── timers.c │ │ └── udp.c │ │ ├── include │ │ ├── ipv4 │ │ │ └── lwip │ │ │ │ ├── autoip.h │ │ │ │ ├── icmp.h │ │ │ │ ├── igmp.h │ │ │ │ ├── inet.h │ │ │ │ ├── inet_chksum.h │ │ │ │ ├── ip.h │ │ │ │ ├── ip_addr.h │ │ │ │ └── ip_frag.h │ │ ├── ipv6 │ │ │ └── lwip │ │ │ │ ├── icmp.h │ │ │ │ ├── inet.h │ │ │ │ ├── ip.h │ │ │ │ └── ip_addr.h │ │ ├── lwip │ │ │ ├── api.h │ │ │ ├── api_msg.h │ │ │ ├── arch.h │ │ │ ├── debug.h │ │ │ ├── def.h │ │ │ ├── dhcp.h │ │ │ ├── dns.h │ │ │ ├── err.h │ │ │ ├── init.h │ │ │ ├── mem.h │ │ │ ├── memp.h │ │ │ ├── memp_std.h │ │ │ ├── netbuf.h │ │ │ ├── netdb.h │ │ │ ├── netif.h │ │ │ ├── netifapi.h │ │ │ ├── opt.h │ │ │ ├── pbuf.h │ │ │ ├── raw.h │ │ │ ├── sio.h │ │ │ ├── snmp.h │ │ │ ├── snmp_asn1.h │ │ │ ├── snmp_msg.h │ │ │ ├── snmp_structs.h │ │ │ ├── sockets.h │ │ │ ├── stats.h │ │ │ ├── sys.h │ │ │ ├── tcp.h │ │ │ ├── tcp_impl.h │ │ │ ├── tcpip.h │ │ │ ├── timers.h │ │ │ └── udp.h │ │ └── netif │ │ │ ├── etharp.h │ │ │ ├── ppp_oe.h │ │ │ └── slipif.h │ │ └── netif │ │ ├── FILES │ │ ├── etharp.c │ │ ├── ethernetif.c │ │ ├── ppp │ │ ├── auth.h │ │ ├── chap.c │ │ ├── chap.h │ │ ├── chpms.c │ │ ├── chpms.h │ │ ├── fsm.c │ │ ├── fsm.h │ │ ├── ipcp.c │ │ ├── ipcp.h │ │ ├── lcp.c │ │ ├── lcp.h │ │ ├── lwip_auth.c │ │ ├── magic.c │ │ ├── magic.h │ │ ├── md5.c │ │ ├── md5.h │ │ ├── pap.c │ │ ├── pap.h │ │ ├── ppp.c │ │ ├── ppp.h │ │ ├── ppp_impl.h │ │ ├── ppp_oe.c │ │ ├── pppdebug.h │ │ ├── randm.c │ │ ├── randm.h │ │ ├── vj.c │ │ └── vj.h │ │ └── slipif.c ├── Ports │ └── Cortex-M3 │ │ ├── cpu_a.asm │ │ ├── os_cpu.h │ │ ├── os_cpu_a.asm │ │ ├── os_cpu_c.c │ │ ├── os_dmem.c │ │ └── os_dmem.h ├── Sys │ ├── app_main.c │ ├── main.c │ ├── param.c │ ├── rom_hook_tbl.c │ ├── sys_mgmt.c │ └── util.c └── uCOS-II │ ├── os_app_cfg.h │ ├── os_cfg.h │ ├── os_core.c │ ├── os_dbg.c │ ├── os_flag.c │ ├── os_mbox.c │ ├── os_mem.c │ ├── os_mutex.c │ ├── os_q.c │ ├── os_sem.c │ ├── os_task.c │ ├── os_time.c │ ├── os_tmr.c │ └── ucos_ii.h └── Tool ├── AirKissDebugger.apk ├── DirectConfigDemo.rar ├── GenBootBins.exe ├── NLConfigTool.apk ├── NLConfigTool.rar ├── NLDirectConfig.apk ├── NLDirectConfig_src.rar ├── OTAUpdateFw.apk ├── OTAUpdateFw_src.rar ├── bootTool.exe ├── burnFlash.bin └── fblink.exe /Document/NL6621 SDK用户手册.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Document/NL6621 SDK用户手册.pdf -------------------------------------------------------------------------------- /Project/PrjSdkOsIpRom/bin.bat: -------------------------------------------------------------------------------- 1 | C:\Keil\ARM\BIN40\fromelf.exe --bin -o OUTPUT OUTPUT\OBJ\SdkFw.axf 2 | C:\Keil\ARM\BIN40\fromelf.exe -c -s -o OUTPUT\SdkFw.lst OUTPUT\OBJ\SdkFw.axf 3 | copy OUTPUT\LIST\SdkFw.map OUTPUT\SdkFw.map /B/Y 4 | del cmpl.fed 5 | copy ..\..\Tool\fblink.exe .\fblink.exe 6 | fblink.exe 7 | del fblink.exe 8 | del link.fed 9 | copy ..\..\Tool\GenBootBins.exe OUTPUT\GenBootBins.exe 10 | cd OUTPUT 11 | GenBootBins.exe fwCodeSRAM 12 | del GenBootBins.exe 13 | -------------------------------------------------------------------------------- /Project/PrjSdkRam/bin.bat: -------------------------------------------------------------------------------- 1 | C:\Keil\ARM\BIN40\fromelf.exe --bin -o OUTPUT\SdkFw.bin OUTPUT\OBJ\SdkFw.axf 2 | C:\Keil\ARM\BIN40\fromelf.exe -c -s -o OUTPUT\SdkFw.lst OUTPUT\OBJ\SdkFw.axf 3 | copy OUTPUT\LIST\SdkFw.map OUTPUT\SdkFw.map /B/Y 4 | 5 | copy ..\..\Tool\GenBootBins.exe OUTPUT\GenBootBins.exe 6 | cd OUTPUT 7 | GenBootBins.exe SdkFw.bin 8 | del GenBootBins.exe 9 | 10 | 11 | -------------------------------------------------------------------------------- /Project/PrjSdkRam/scatter_jtag.scat: -------------------------------------------------------------------------------- 1 | ;; Copyright ARM Ltd 2005-2008. All rights reserved. 2 | ;; Scatter file for Cortex-M3 3 | 4 | LOAD_REGION 0x00000000 0x00030000 { ; load region size_region 5 | ;; ROM-64K-10000, CODE-192K-30000 6 | ROM 0x00000000 0x00030000 { ; load address = execution address 7 | *.o (RESET, +First) 8 | *(InRoot$$Sections) 9 | .ANY (+RO) 10 | } 11 | 12 | ;; DATA-96K-18000 13 | ;; 0x00080000-0x000807FF FW ROM hook function table 14 | DATA_SRAM 0x00080800 0x00017800 { 15 | cortexm3_startup.o(STACK) 16 | main.o(main_only_cpu_access_mem) 17 | mac_mng_main.o(mac_only_cpu_access_mem) 18 | mac_mng_main.o(cell_mem_pool) 19 | .ANY (+RW +ZI) 20 | } 21 | 22 | ;; BUF-160K-28000 23 | PING_BUF_SRAM0 0x20000000 0x18000 ; BUF_SRAM0 24 | { 25 | mac_mng_main.o(ping_mem_pool) 26 | .ANY (+RW +ZI) 27 | } 28 | 29 | PONG_BUF_SRAM1 0x20040000 0x10000 ; BUF_SRAM1 30 | { 31 | mac_mng_main.o(pong_mem_pool) 32 | .ANY (+RW +ZI) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Project/PrjSdkRam/scatter_loader.scat: -------------------------------------------------------------------------------- 1 | ;; Copyright ARM Ltd 2005-2008. All rights reserved. 2 | ;; Scatter file for Cortex-M3 3 | 4 | 5 | ; 0x10100-0x40000 for download SRAM FW(including 32KB for customer), interrupt vector locate in 0x10100 6 | LOAD_REGION 0x00010100 0x0002FF00 { ; load region size_region 7 | 8 | ROM 0x00010100 0x0002FF00 { ; load address = execution address 9 | *.o (RESET, +First) ; interrupt vector table, do not change it 10 | *(InRoot$$Sections) 11 | .ANY (+RO) 12 | } 13 | 14 | ;; DATA-96K-18000 15 | ;; 0x00080000-0x000807FF FW ROM hook function table 16 | DATA_SRAM 0x00080800 0x00017800 { 17 | cortexm3_startup.o(STACK) 18 | main.o(main_only_cpu_access_mem) 19 | mac_mng_main.o(mac_only_cpu_access_mem) 20 | mac_mng_main.o(cell_mem_pool) 21 | .ANY (+RW +ZI) 22 | } 23 | 24 | ;; BUF-160K-28000 25 | PING_BUF_SRAM0 0x20000000 0x18000 ; BUF_SRAM0 26 | { 27 | mac_mng_main.o(ping_mem_pool) 28 | .ANY (+RW +ZI) 29 | } 30 | 31 | PONG_BUF_SRAM1 0x20040000 0x10000 ; BUF_SRAM1 32 | { 33 | mac_mng_main.o(pong_mem_pool) 34 | .ANY (+RW +ZI) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NL6621_StandardSDK 2 | NL6621标准SDK代码 3 | -------------------------------------------------------------------------------- /Source/App/DhcpServer/dhcp_server.h: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | Copyright (C), 2013, BEIJING NUFRONT CO., LTD 3 | File name: dhcp_server.h 4 | Author: jun.chen@nufront.com 5 | Version: V1.0.0 6 | Date: 2013-7-12 7 | Description: This file contains DHCP server structures and APIs. 8 | Others: ... 9 | Function List: 10 | 1. ... 11 | History: 12 | 1. Date: ... 13 | Author: ... 14 | Modification: ... 15 | 2. ... 16 | *************************************************/ 17 | #ifndef __DHCP_SERVER_H__ 18 | #define __DHCP_SERVER_H__ 19 | 20 | #define DHCPS_ERR_SUCCESS 0 21 | #define DHCPS_ERR_LINKDOWN -1 22 | #define DHCPS_ERR_PARAM -2 23 | #define DHCPS_ERR_MEM -3 24 | #define DHCPS_ERR_NOT_BIND -4 25 | #define DHCPS_ERR_NOT_FOUND -5 26 | #define DHCPS_ERR_INACTIVE -6 27 | 28 | #define DHCPS_HISTORY_CLIENT_NUM 8 29 | 30 | #define DHCP_DEFAULT_LEASE_TIME 3600*24*365*10 /* almost infinite */ 31 | //#define DHCP_DEFAULT_LEASE_TIME 7200 /* 2 Hours. */ 32 | //#define DHCP_DEFAULT_LEASE_TIME_MS 7200000 /* 7200000ms */ 33 | #define DHCP_TICK_TIME 1000 /* 1s. */ 34 | #define DHCP_DEFFAULT_TIMEOUT 10 /* 10s */ 35 | 36 | #define DHCP_HWTYPE_ETHERNET 1 37 | 38 | /* udp port number of dhcp. */ 39 | #define DHCP_CLIENT_UDP_PORT 68 40 | #define DHCP_SERVER_UDP_PORT 67 41 | 42 | /* Magic number in DHCP packet. */ 43 | #define DHCP_MAGIC 0x63825363 44 | 45 | #define DHCP_OP_REQUEST 1 46 | #define DHCP_OP_REPLY 2 47 | 48 | #define DHCP_OPTION_ID_PAD 0 49 | #define DHCP_OPTION_ID_SUBNET_MASK 1 50 | #define DHCP_OPTION_ID_DEF_GW 3 51 | #define DHCP_OPTION_ID_DNS_SERVER 6 52 | #define DHCP_OPTION_ID_LEASE_TIME 51 53 | #define DHCP_OPTION_ID_MSG_TYPE 53 54 | #define DHCP_OPTION_ID_SERVER_ID 54 55 | #define DHCP_OPTION_ID_REQ_IP_ADDR 50 56 | #define DHCP_OPTION_ID_END 255 57 | 58 | #define DHCP_MSG_DISCOVER 1 59 | #define DHCP_MSG_OFFER 2 60 | #define DHCP_MSG_REQUEST 3 61 | #define DHCP_MSG_DECLINE 4 62 | #define DHCP_MSG_ACK 5 63 | #define DHCP_MSG_NAK 6 64 | #define DHCP_MSG_RELEASE 7 65 | #define DHCP_MSG_INFORM 8 66 | 67 | typedef enum __DHCP_CLIENT_STATE 68 | { 69 | DHCP_CLIENT_STATE_IDLE=0, 70 | DHCP_CLIENT_STATE_SELECT, 71 | DHCP_CLIENT_STATE_REQUEST, 72 | DHCP_CLIENT_STATE_BIND 73 | }DHCP_CLIENT_STATE; 74 | 75 | typedef struct __DHCP_CLIENT 76 | { 77 | DHCP_CLIENT_STATE State; 78 | INT32U Timeout; 79 | /* Attention!!! MUST BE __align(4) */ 80 | struct ip_addr IpAddr; 81 | INT8U MacAddr[6]; 82 | INT32U Lease; 83 | }DHCP_CLIENT, *PDHCP_CLIENT; 84 | 85 | typedef struct __DHCP_SERVER 86 | { 87 | INT8U Enable; 88 | struct udp_pcb * Socket; 89 | /* Attention!!! MUST BE __align(4) */ 90 | struct ip_addr ServerIpAddr; 91 | struct ip_addr StartIpAddr; 92 | struct ip_addr SubnetMask; 93 | struct ip_addr GateWay; 94 | struct ip_addr Dns1; 95 | struct ip_addr Dns2; 96 | INT32U LeaseTime; 97 | DHCP_CLIENT Clients[DHCPS_HISTORY_CLIENT_NUM]; 98 | }DHCP_SERVER, *PDHCP_SERVER; 99 | 100 | #define DHCPS_HADDR_SIZE 16 101 | #define DHCPS_SNAME_SIZE 64 102 | #define DHCPS_FILENAME_SIZE 128 103 | #define DHCPS_OPTIONS_LEN 312 104 | typedef struct __DHCP_MSG 105 | { 106 | INT8U Op; 107 | INT8U HType; 108 | INT8U HLen; 109 | INT8U HOps; 110 | 111 | INT32U Xid; 112 | 113 | INT16U Secs; 114 | INT16U Flags; 115 | 116 | INT32U Ciaddr; 117 | 118 | INT32U Yiaddr; 119 | 120 | INT32U Siaddr; 121 | 122 | INT32U Giaddr; 123 | 124 | INT8U Chaddr[DHCPS_HADDR_SIZE]; 125 | 126 | INT8U Sname[DHCPS_SNAME_SIZE]; 127 | 128 | INT8U File[DHCPS_FILENAME_SIZE]; 129 | 130 | INT32U Magic; 131 | 132 | INT8U Options[DHCPS_OPTIONS_LEN - 4]; 133 | }DHCP_MSG, *PDHCP_MSG; 134 | 135 | INT32 DHCPS_Start(struct netif *Netif); 136 | void DHCPS_Stop(void); 137 | INT8S DHCPS_ClientDelete(INT8U * MacAddr); 138 | VOID DHCPS_RecvCb(VOID *Arg, struct udp_pcb *Pcb, struct pbuf *P, struct ip_addr *Addr, INT16U Port); 139 | #endif /* __DHCP_SERVER_H__ */ 140 | 141 | -------------------------------------------------------------------------------- /Source/App/DnsServer/dns_server.h: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | Copyright (C), 2013, BEIJING NUFRONT CO., LTD 3 | File name: dns_server.h 4 | Author: jun.chen@nufront.com 5 | Version: V1.0.0 6 | Date: 2013-7-12 7 | Description: This file contains DNS server structures and APIs. 8 | Others: ... 9 | Function List: 10 | 1. ... 11 | History: 12 | 1. Date: ... 13 | Author: ... 14 | Modification: ... 15 | 2. ... 16 | *************************************************/ 17 | #ifndef __DNS_SERVER_H__ 18 | #define __DNS_SERVER_H__ 19 | 20 | #define DNSS_ERR_SUCCESS 0 21 | #define DNSS_ERR_LINKDOWN -1 22 | #define DNSS_ERR_PARAM -2 23 | #define DNSS_ERR_MEM -3 24 | 25 | #define DNS_DEFAULT_TTL 3600 /* a day. */ 26 | 27 | #define DNS_SERVER_PORT 53 28 | 29 | /* DNS field TYPE used for "Resource Records". */ 30 | #define DNS_RRTYPE_A 1 /* a host address. */ 31 | #define DNS_RRTYPE_NS 2 /* an authoritative name server. */ 32 | #define DNS_RRTYPE_MD 3 /* a mail destination (Obsolete - use MX). */ 33 | #define DNS_RRTYPE_MF 4 /* a mail forwarder (Obsolete - use MX) */ 34 | #define DNS_RRTYPE_CNAME 5 /* the canonical name for an alias. */ 35 | #define DNS_RRTYPE_SOA 6 /* marks the start of a zone of authority. */ 36 | #define DNS_RRTYPE_MB 7 /* a mailbox domain name (EXPERIMENTAL). */ 37 | #define DNS_RRTYPE_MG 8 /* a mail group member (EXPERIMENTAL). */ 38 | #define DNS_RRTYPE_MR 9 /* a mail rename domain name (EXPERIMENTAL). */ 39 | #define DNS_RRTYPE_NULL 10 /* a null RR (EXPERIMENTAL). */ 40 | #define DNS_RRTYPE_WKS 11 /* a well known service description. */ 41 | #define DNS_RRTYPE_PTR 12 /* a domain name pointer. */ 42 | #define DNS_RRTYPE_HINFO 13 /* host information. */ 43 | #define DNS_RRTYPE_MINFO 14 /* mailbox or mail list information. */ 44 | #define DNS_RRTYPE_MX 15 /* mail exchange. */ 45 | #define DNS_RRTYPE_TXT 16 /* text strings. */ 46 | 47 | /* DNS field CLASS used for "Resource Records". */ 48 | #define DNS_RRCLASS_IN 1 /* the Internet */ 49 | #define DNS_RRCLASS_CS 2 /* the CSNET class (Obsolete - used only for examples in some obsolete RFCs).*/ 50 | #define DNS_RRCLASS_CH 3 /* the CHAOS class. */ 51 | #define DNS_RRCLASS_HS 4 /* Hesiod [Dyer 87].*/ 52 | #define DNS_RRCLASS_FLUSH 0x800 /* Flush bit. */ 53 | 54 | /* DNS protocol flags */ 55 | #define DNS_FLAG1_RESPONSE 0x80 56 | #define DNS_FLAG1_OPCODE_STATUS 0x10 57 | #define DNS_FLAG1_OPCODE_INVERSE 0x08 58 | #define DNS_FLAG1_OPCODE_STANDARD 0x00 59 | #define DNS_FLAG1_AUTHORATIVE 0x04 60 | #define DNS_FLAG1_TRUNC 0x02 61 | #define DNS_FLAG1_RD 0x01 62 | #define DNS_FLAG2_RA 0x80 63 | #define DNS_FLAG2_ERR_MASK 0x0f 64 | #define DNS_FLAG2_ERR_NONE 0x00 65 | #define DNS_FLAG2_ERR_NAME 0x03 66 | 67 | #define DNS_NAME_OFFSET 0xC000 68 | 69 | typedef struct __DNS_SERVER 70 | { 71 | struct udp_pcb * Socket; 72 | INT8U DnsName[32]; 73 | /* Attention!!! MUST BE __align(4) */ 74 | struct ip_addr HostIp; 75 | }DNS_SERVER; 76 | 77 | typedef struct __DNS_HEADER 78 | { 79 | INT16U TansactionId; 80 | INT8U DnsFlag1; 81 | INT8U DnsFlag2; 82 | INT16U Quentions; 83 | INT16U AnswerRR; 84 | INT16U AuthorityRR; 85 | INT16U AdditionalRR; 86 | }DNS_HEADER, *PDNS_HEADER; 87 | 88 | typedef struct _DNS_QUERY 89 | { 90 | INT16U Type; 91 | INT16U Class; 92 | }DNS_QUERY, *PDNS_QUERY; 93 | 94 | typedef struct __DNS_ANSWER 95 | { 96 | INT16U Type; 97 | INT16U Class; 98 | INT32U Ttl; 99 | }DNS_ANSWER, *PDNS_ANSWER; 100 | 101 | VOID DNSS_RecvCb(VOID *Arg, struct udp_pcb *Pcb, struct pbuf *P, struct ip_addr *Addr, INT16U Port); 102 | INT32 DNSS_Config(INT8U * DnsName); 103 | INT32 DNSS_Start(struct netif *Netif, INT8U * DnsName); 104 | void DNSS_Stop(void); 105 | 106 | #endif /* __DNS_SERVER_H__ */ 107 | 108 | -------------------------------------------------------------------------------- /Source/BSP/I2C.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/BSP/I2C.c -------------------------------------------------------------------------------- /Source/BSP/I2S.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/BSP/I2S.c -------------------------------------------------------------------------------- /Source/BSP/I2S.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/BSP/I2S.h -------------------------------------------------------------------------------- /Source/BSP/board.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/BSP/board.h -------------------------------------------------------------------------------- /Source/BSP/bsp.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/BSP/bsp.c -------------------------------------------------------------------------------- /Source/BSP/bsp.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/BSP/bsp.h -------------------------------------------------------------------------------- /Source/BSP/cortexM3_it.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/BSP/cortexM3_it.c -------------------------------------------------------------------------------- /Source/BSP/dma.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/BSP/dma.c -------------------------------------------------------------------------------- /Source/BSP/dma.h: -------------------------------------------------------------------------------- 1 | /* 2 | ****************************************************************************** 3 | ** 4 | ** Project : 5 | ** Description : dma.h 6 | ** Author : pchn 7 | ** Date : 8 | ** 9 | ** UpdatedBy : 10 | ** UpdatedDate : 11 | ** 12 | ****************************************************************************** 13 | */ 14 | 15 | #ifndef _DMA_H 16 | #define _DMA_H 17 | 18 | typedef OS_EVENT NST_LOCK; 19 | 20 | #ifdef DMA_MOVE_MEM 21 | extern OS_EVENT *pDmaSem; 22 | extern PUINT8 pDmaSrc; 23 | extern PUINT8 pDmaDst; 24 | extern UINT16 DmaSize; 25 | #endif // DMA_MOVE_MEM // 26 | 27 | /* 28 | ********************************************************************************************************* 29 | * FUNCTION PROTOTYPES 30 | ********************************************************************************************************* 31 | */ 32 | 33 | //******************************************************************************************************* 34 | VOID BSP_DmaInit (UINT8 channel_num); 35 | #ifdef DMA_MOVE_MEM 36 | VOID BSP_DmaMoveMemInit (UINT8 channel_num); 37 | #endif // DMA_MOVE_MEM // 38 | VOID BSP_DmaStart(UINT32* pSrc, UINT32* pDest, UINT8 channel_num); 39 | VOID BSP_DmaHalt(UINT8 channel_num); 40 | VOID BSP_DmaDeinit(VOID); 41 | VOID BSP_DmaIntISR(VOID); 42 | 43 | #endif //_DMA_H 44 | -------------------------------------------------------------------------------- /Source/BSP/flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/BSP/flash.c -------------------------------------------------------------------------------- /Source/BSP/flash.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/BSP/flash.h -------------------------------------------------------------------------------- /Source/BSP/gpio.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/BSP/gpio.c -------------------------------------------------------------------------------- /Source/BSP/gpio.h: -------------------------------------------------------------------------------- 1 | #ifndef _GPIO_H 2 | #define _GPIO_H 3 | #include "includes.h" 4 | 5 | 6 | #define NST_WR_GPIO_REG(Offset, Value) /*0x40040000*/\ 7 | {\ 8 | (*(volatile UINT32 *)(_GPIO_BASE_ADR + Offset)) = (UINT32)Value;\ 9 | } 10 | 11 | #define NST_RD_GPIO_REG(Offset) (*(volatile UINT32 *)(_GPIO_BASE_ADR + Offset)) 12 | 13 | //GPIO level 14 | #define GPIO_LOW_LEVEL 0 15 | #define GPIO_HIGH_LEVEL 1 16 | 17 | //GPIO direction 18 | #define GPIO_DIRECTION_INPUT 0 19 | #define GPIO_DIRECTION_OUTPUT 1 20 | 21 | //GPIO interrupt type level 22 | #define GPIO_INT_LEVEL_SENSITIVE 0 23 | #define GPIO_INT_EDGE_SENSITIVE 1 24 | 25 | //GPIO interrupt polarity 26 | //level sensitve: active-low active-high 27 | //dege sensitive: falling-edge raiseing-edge 28 | #define GPIO_INT_ACTIVE_LOW 0 29 | #define GPIO_INT_ACTIVE_HIGH 1 30 | 31 | //GPIO interrupt mask 32 | #define GPIO_INT_UNMASK 0 33 | #define GPIO_INT_ENMASK 1 34 | 35 | 36 | VOID BSP_GPIOInit (VOID); 37 | VOID BSP_GPIOPinMux (int portNum); 38 | VOID BSP_GPIOSetDir ( int portNum, BOOLEAN dir); 39 | VOID BSP_GPIOSetValue (int portNum, BOOLEAN bitValue); 40 | int BSP_GPIOGetValue (int portNum); 41 | VOID BSP_GPIOIntEn (int portNum, BOOLEAN typeLev, BOOLEAN polarity); 42 | VOID BSP_GPIOIntDisable (int portNum); 43 | VOID BSP_GPIOIntMask (int portNum, BOOLEAN mask); 44 | VOID BSP_GPIOIntISR (int portNum); 45 | 46 | #endif // _GPIO_H 47 | 48 | -------------------------------------------------------------------------------- /Source/BSP/mpu.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/BSP/mpu.c -------------------------------------------------------------------------------- /Source/BSP/mpu.h: -------------------------------------------------------------------------------- 1 | #ifndef MPU_H_ 2 | #define MPU_H_ 3 | 4 | #include "types_def.h" 5 | 6 | extern VOID MPU_init(VOID); 7 | 8 | /* Masks for MPU Memory Region Sizes */ 9 | #define REGION_32B 0x08 10 | #define REGION_64B 0x0A 11 | #define REGION_128B 0x0C 12 | #define REGION_256B 0x0E 13 | #define REGION_512B 0x10 14 | #define REGION_1K 0x12 15 | #define REGION_2K 0x14 16 | #define REGION_4K 0x16 17 | #define REGION_8K 0x18 18 | #define REGION_16K 0x1A 19 | #define REGION_32K 0x1C 20 | #define REGION_64K 0x1E 21 | #define REGION_128K 0x20 22 | #define REGION_256K 0x22 23 | #define REGION_512K 0x24 24 | #define REGION_1M 0x26 25 | #define REGION_2M 0x28 26 | #define REGION_4M 0x2A 27 | #define REGION_8M 0x2C 28 | #define REGION_16M 0x2E 29 | #define REGION_32M 0x30 30 | #define REGION_64M 0x32 31 | #define REGION_128M 0x34 32 | #define REGION_256M 0x36 33 | #define REGION_512M 0x38 34 | #define REGION_1G 0x3A 35 | #define REGION_2G 0x3C 36 | #define REGION_4G 0x3E 37 | 38 | /* General MPU Masks */ 39 | #define REGION_Enabled 0x1 40 | #define REGION_Valid 0x10 41 | 42 | #define SHAREABLE 0x40000 43 | #define CACHEABLE 0x20000 44 | #define BUFFERABLE 0x10000 45 | 46 | /* Region Permissions */ 47 | 48 | #define NOT_EXEC 0x10000000 /* All Instruction fetches abort */ 49 | 50 | #define NO_ACCESS 0x00000000 /* Privileged No Access, Unprivileged No Access */ 51 | #define P_NA_U_NA 0x00000000 /* Privileged No Access, Unprivileged No Access */ 52 | #define P_RW_U_NA 0x01000000 /* Privileged Read Write, Unprivileged No Access */ 53 | #define P_RW_U_RO 0x02000000 /* Privileged Read Write, Unprivileged Read Only */ 54 | #define P_RW_U_RW 0x03000000 /* Privileged Read Write, Unprivileged Read Write */ 55 | #define FULL_ACCESS 0x03000000 /* Privileged Read Write, Unprivileged Read Write */ 56 | #define P_RO_U_NA 0x05000000 /* Privileged Read Only, Unprivileged No Access */ 57 | #define P_RO_U_RO 0x06000000 /* Privileged Read Only, Unprivileged Read Only */ 58 | #define RO 0x07000000 /* Privileged Read Only, Unprivileged Read Only */ 59 | 60 | 61 | typedef struct 62 | { 63 | VUINT32 Type; 64 | VUINT32 Ctrl; 65 | VUINT32 RegionNumber; 66 | VUINT32 RegionBaseAddr; 67 | VUINT32 RegionAttrSize; 68 | } MPU_TypeDef; 69 | 70 | 71 | 72 | #define MPU_BASE ((UINT32)0xE000ED90) 73 | 74 | #ifndef DEBUG 75 | #define NST_MPU ((MPU_TypeDef *) MPU_BASE) 76 | #else 77 | /*------------------------ Debug Mode ----------------------------------------*/ 78 | extern MPU_TypeDef *NST_MPU; 79 | #endif 80 | 81 | VOID MPU_Init(void); 82 | 83 | #endif /* MPU_H_*/ 84 | -------------------------------------------------------------------------------- /Source/BSP/nvic.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/BSP/nvic.c -------------------------------------------------------------------------------- /Source/BSP/printf.c: -------------------------------------------------------------------------------- 1 | /* 2 | ****************************************************************************** 3 | ** 4 | ** Project : 5 | ** Description : Driver for Printing debug info 6 | ** Author : pchn 7 | ** Date : 8 | ** 9 | ** UpdatedBy : 10 | ** UpdatedDate : 11 | ** 12 | ****************************************************************************** 13 | */ 14 | 15 | /* Includes ------------------------------------------------------------------*/ 16 | 17 | #include "includes.h" 18 | 19 | #include "uart.h" 20 | 21 | #pragma import(__use_no_semihosting) 22 | struct __FILE { int handle; /* Add whatever you need here */}; 23 | FILE __stdout; 24 | FILE __stdin; 25 | 26 | 27 | /* 28 | ** Retargeted I/O 29 | ** ============== 30 | ** The following C library functions make use of semihosting 31 | ** to read or write characters to the debugger console: fputc(), 32 | ** fgetc(), and _ttywrch(). They must be retargeted to write to 33 | ** the model's UART. __backspace() must also be retargeted 34 | ** with this layer to enable scanf(). See the Compiler and 35 | ** Libraries Guide. 36 | */ 37 | 38 | /* 39 | ** These must be defined to avoid linking in stdio.o from the 40 | ** C Library 41 | */ 42 | int fputc(int ch, FILE *f) 43 | { 44 | 45 | if(ch == '\n') 46 | { 47 | BSP_UartPutcPolled('\r'); 48 | } 49 | BSP_UartPutcPolled(ch); 50 | 51 | return ch; 52 | } 53 | 54 | void _ttywrch(int ch) 55 | { 56 | unsigned char tempch = ch; 57 | BSP_UartPutcPolled(tempch); 58 | } 59 | 60 | 61 | /* END of Retargeted I/O */ 62 | 63 | /* 64 | ** Exception Signaling and Handling 65 | ** ================================ 66 | ** The C library implementations of ferror() uses semihosting directly 67 | ** and must therefore be retargeted. This is a minimal reimplementation. 68 | ** _sys_exit() is called after the user's main() function has exited. The C library 69 | ** implementation uses semihosting to report to the debugger that the application has 70 | ** finished executing. 71 | */ 72 | 73 | int ferror(FILE *f) 74 | { 75 | return EOF; 76 | } 77 | 78 | void _sys_exit(int return_code) 79 | { 80 | while(1); 81 | } 82 | 83 | 84 | /* 85 | ****************************************************************************** 86 | ** End Of File ** 87 | ****************************************************************************** 88 | */ 89 | -------------------------------------------------------------------------------- /Source/BSP/qspi.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/BSP/qspi.c -------------------------------------------------------------------------------- /Source/BSP/qspi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/BSP/qspi.h -------------------------------------------------------------------------------- /Source/BSP/reg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/BSP/reg.h -------------------------------------------------------------------------------- /Source/BSP/sdio.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/BSP/sdio.c -------------------------------------------------------------------------------- /Source/BSP/sdio.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/BSP/sdio.h -------------------------------------------------------------------------------- /Source/BSP/spi.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/BSP/spi.c -------------------------------------------------------------------------------- /Source/BSP/spi.h: -------------------------------------------------------------------------------- 1 | #ifndef _SPI_H 2 | #define _SPI_H 3 | 4 | 5 | #define MRST_SPI_TIMEOUT 0x200000 6 | #define MRST_REGBASE_SPI0 0xff128000 7 | #define MRST_REGBASE_SPI1 0xff128400 8 | #define MRST_CLK_SPI0_REG 0xff11d86c 9 | 10 | /* Bit fields in CTRLR0 */ 11 | #define SPI_DFS_OFFSET 0 12 | 13 | #define SPI_FRF_OFFSET 4 14 | #define SPI_FRF_SPI 0x0 15 | #define SPI_FRF_SSP 0x1 16 | #define SPI_FRF_MICROWIRE 0x2 17 | #define SPI_FRF_RESV 0x3 18 | 19 | #define SPI_MODE_OFFSET 6 20 | #define SPI_SCPH_OFFSET 6 21 | #define SPI_SCOL_OFFSET 7 22 | #define SPI_TMOD_OFFSET 8 23 | #define SPI_TMOD_TR 0x0 /* xmit & recv */ 24 | #define SPI_TMOD_TO 0x1 /* xmit only */ 25 | #define SPI_TMOD_RO 0x2 /* recv only */ 26 | #define SPI_TMOD_EPROMREAD 0x3 /* eeprom read mode */ 27 | 28 | #define SPI_SLVOE_OFFSET 10 29 | #define SPI_SRL_OFFSET 11 30 | #define SPI_CFS_OFFSET 12 31 | #define SPI_SLV_OE 0x1 32 | /* Bit fields in SR, 7 bits */ 33 | #define SR_MASK 0x7f /* cover 7 bits */ 34 | #define SR_BUSY (1 << 0) 35 | #define SR_TF_NOT_FULL (1 << 1) 36 | #define SR_TF_EMPT (1 << 2) 37 | #define SR_RF_NOT_EMPT (1 << 3) 38 | #define SR_RF_FULL (1 << 4) 39 | #define SR_TX_ERR (1 << 5) 40 | #define SR_DCOL (1 << 6) 41 | 42 | 43 | #define SPI_CLK_DIV 2 // Fsclk_out = Fssi_clk/SCKD, Fssi_clk (APB CLK 40Mhz) 44 | #define SPI_MODE_0 0 45 | #define SPI_MODE_3 3 46 | 47 | #define SPI_FRM_SIZE 8 48 | 49 | 50 | typedef PACKED struct _SPI_REGS { 51 | VUINT32 CTRLR0; // 0x00 52 | VUINT32 CTRLR1; // 0x04 53 | VUINT32 SSIENR; // 0x08 54 | VUINT32 MWCR; // 0x0C 55 | VUINT32 SER; // 0x10 56 | VUINT32 BAUDR; // 0x14 57 | VUINT32 TXFTLR; // 0x18 TX FIFO threshold level 58 | VUINT32 RXFTLR; // 0x1C RX FIFO threshold level 59 | VUINT32 SPI_TXFLR; //0X20 60 | VUINT32 SPI_RXFLR; // 0X24 61 | VUINT32 SR; // 0X28 status reg 62 | VUINT32 IMR; // 0x2C 63 | VUINT32 ISR; // 0x30 64 | VUINT32 RISR; // 0x34 65 | VUINT32 TXOICR; // 0x38 66 | VUINT32 RXOICR; // 0x3C 67 | VUINT32 RXUICR; // 0x40 68 | VUINT32 MSTICR; // 0x44 69 | VUINT32 ICR; // 0x48 70 | VUINT32 DMACR; // 0x4C 71 | VUINT32 DMATDLR; // 0x50 72 | VUINT32 DMARDLR; // 0x54 73 | VUINT32 IDR; // 0x58 74 | VUINT32 VERSION; // 0x5C 75 | 76 | /* Currently operates as 32 bits, though only the low 16 bits matter */ 77 | VUINT32 DR; // 0x60 78 | } SPI_REGS; 79 | 80 | #ifndef EXT 81 | #define EXT extern 82 | #endif /* EXT */ 83 | 84 | /*------------------------ Non Debug Mode ------------------------------------*/ 85 | #ifndef DEBUG 86 | #define NST_SPI ((SPI_REGS *) _SPI_BASE_ADR) 87 | #else 88 | /*------------------------ Debug Mode ----------------------------------------*/ 89 | EXT SPI_REGS *NST_SPI; 90 | #endif 91 | 92 | 93 | #define NST_WR_SPI_REG(Value, Adr) \ 94 | {\ 95 | (*(volatile UINT32 *)(_SPI_BASE_ADR + Adr)) = (UINT32)(Value);\ 96 | } 97 | 98 | #define NST_RD_SPI_REG(Adr) (*(volatile UINT32 *)(_SPI_BASE_ADR + Adr)) 99 | 100 | VOID BSP_SpiWait(VOID); 101 | VOID BSP_SpiInit(VOID); 102 | VOID BSP_SpiWriteByte(UINT8 Byte); 103 | VOID BSP_SpiRead(UINT32 RdCnt, UINT8* pBuf); 104 | 105 | #ifdef SPI_SDIO_CMD_TEST 106 | VOID BSP_SpiEum(VOID); 107 | VOID BSP_SpiCmd53Read(UINT16 bytecnt,UINT8* pBuf); 108 | VOID BSP_SpiCmd53Write(UINT16 bytecnt,UINT8* pBuf); 109 | VOID BSP_SpiSdioCmdTest(VOID); 110 | #endif 111 | 112 | #endif 113 | 114 | -------------------------------------------------------------------------------- /Source/BSP/timer.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/BSP/timer.c -------------------------------------------------------------------------------- /Source/BSP/timer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/BSP/timer.h -------------------------------------------------------------------------------- /Source/BSP/uart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/BSP/uart.c -------------------------------------------------------------------------------- /Source/BSP/wdg.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/BSP/wdg.c -------------------------------------------------------------------------------- /Source/BSP/wdg.h: -------------------------------------------------------------------------------- 1 | #ifndef _WDG_H 2 | #define _WDG_H 3 | 4 | #include "includes.h" 5 | 6 | 7 | VOID WDG_Init(VOID); 8 | VOID WDResetSWWatchdog( VOID ); 9 | VOID WDResetWDTimer( VOID ); 10 | 11 | #endif // _WDG_H 12 | 13 | -------------------------------------------------------------------------------- /Source/Include/app_cfg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/Include/app_cfg.h -------------------------------------------------------------------------------- /Source/Include/global.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/Include/global.h -------------------------------------------------------------------------------- /Source/Include/includes.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDES_H_ 2 | #define INCLUDES_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include "os_cpu.h" 8 | #include "os_cfg.h" 9 | #include "os_dmem.h" 10 | #include "arch/sys_arch.h" 11 | #include "app_cfg.h" 12 | #include "types_def.h" 13 | #include "bsp.h" 14 | #include "board.h" 15 | #include "util.h" 16 | #include "global.h" 17 | #include "task_util.h" 18 | #include "wdg.h" 19 | #include "param.h" 20 | #include "lwip.h" 21 | #endif /*INCLUDES_H_*/ 22 | -------------------------------------------------------------------------------- /Source/Include/rom_hook_tbl.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/Include/rom_hook_tbl.h -------------------------------------------------------------------------------- /Source/Include/task_util.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/Include/task_util.h -------------------------------------------------------------------------------- /Source/Include/types_def.h: -------------------------------------------------------------------------------- 1 | #ifndef TYPES_DEF_H_ 2 | #define TYPES_DEF_H_ 3 | 4 | 5 | #define IN 6 | #define OUT 7 | #define INOUT 8 | 9 | #ifndef PACKED 10 | #define PACKED __packed//__attribute__ ((packed)) 11 | #endif //PACKED 12 | 13 | #ifndef NULL 14 | #define NULL 0 15 | #endif 16 | 17 | #ifndef INLINE 18 | #ifdef __GNUC__ 19 | /** inline directive */ 20 | #define INLINE inline 21 | #else 22 | /** inline directive */ 23 | #define INLINE __inline 24 | #endif 25 | #endif 26 | 27 | typedef signed char INT8; 28 | typedef unsigned char UINT8; 29 | typedef signed short int INT16; 30 | typedef unsigned short int UINT16; 31 | typedef signed int INT32; 32 | typedef unsigned int UINT32; 33 | typedef volatile unsigned long VUINT32; 34 | typedef volatile unsigned long const VUC32; /* Read Only */ 35 | typedef volatile UINT16 VUINT16; 36 | typedef volatile UINT16 const VUC16; /* Read Only */ 37 | 38 | typedef unsigned char * PUINT8; 39 | typedef unsigned short int * PUINT16; 40 | typedef unsigned int * PUINT32; 41 | 42 | #ifndef BOOL_T 43 | typedef unsigned char BOOL_T; 44 | #endif 45 | 46 | #ifndef VOID 47 | #define VOID void 48 | //typedef void VOID; 49 | typedef void * PVOID; 50 | #endif 51 | 52 | typedef char * PSTRING; 53 | typedef char STRING; 54 | 55 | #define NST_FALSE 0 56 | #define NST_TRUE 1 57 | 58 | typedef __int64 UINT64; 59 | 60 | typedef union _LARGE_INTEGER 61 | { 62 | struct 63 | { 64 | UINT32 LowPart; 65 | UINT32 HighPart; 66 | } u; 67 | __int64 QuadPart; 68 | } LARGE_INTEGER; 69 | 70 | 71 | #endif /*TYPES_DEF_H_*/ 72 | -------------------------------------------------------------------------------- /Source/Include/util.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/Include/util.h -------------------------------------------------------------------------------- /Source/Lib/libairkiss.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/Lib/libairkiss.lib -------------------------------------------------------------------------------- /Source/Lib/libairkiss_aes.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/Lib/libairkiss_aes.lib -------------------------------------------------------------------------------- /Source/Lib/libairkiss_aes_log.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/Lib/libairkiss_aes_log.lib -------------------------------------------------------------------------------- /Source/Lib/libairkiss_log.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/Lib/libairkiss_log.lib -------------------------------------------------------------------------------- /Source/Lib/wcore.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/Lib/wcore.lib -------------------------------------------------------------------------------- /Source/Lib/wcore_11n.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/Lib/wcore_11n.lib -------------------------------------------------------------------------------- /Source/Lib/wcore_11n_ap.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/Lib/wcore_11n_ap.lib -------------------------------------------------------------------------------- /Source/Lib/wcore_11n_sta.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/Lib/wcore_11n_sta.lib -------------------------------------------------------------------------------- /Source/Lib/wcore_ap.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/Lib/wcore_ap.lib -------------------------------------------------------------------------------- /Source/Lib/wcore_sta.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/Lib/wcore_sta.lib -------------------------------------------------------------------------------- /Source/LwIP/doc/FILES: -------------------------------------------------------------------------------- 1 | savannah.txt - How to obtain the current development source code. 2 | contrib.txt - How to contribute to lwIP as a developer. 3 | rawapi.txt - The documentation for the core API of lwIP. 4 | Also provides an overview about the other APIs and multithreading. 5 | snmp_agent.txt - The documentation for the lwIP SNMP agent. 6 | sys_arch.txt - The documentation for a system abstraction layer of lwIP. 7 | -------------------------------------------------------------------------------- /Source/LwIP/doc/contrib.txt: -------------------------------------------------------------------------------- 1 | 1 Introduction 2 | 3 | This document describes some guidelines for people participating 4 | in lwIP development. 5 | 6 | 2 How to contribute to lwIP 7 | 8 | Here is a short list of suggestions to anybody working with lwIP and 9 | trying to contribute bug reports, fixes, enhancements, platform ports etc. 10 | First of all as you may already know lwIP is a volunteer project so feedback 11 | to fixes or questions might often come late. Hopefully the bug and patch tracking 12 | features of Savannah help us not lose users' input. 13 | 14 | 2.1 Source code style: 15 | 16 | 1. do not use tabs. 17 | 2. indentation is two spaces per level (i.e. per tab). 18 | 3. end debug messages with a trailing newline (\n). 19 | 4. one space between keyword and opening bracket. 20 | 5. no space between function and opening bracket. 21 | 6. one space and no newline before opening curly braces of a block. 22 | 7. closing curly brace on a single line. 23 | 8. spaces surrounding assignment and comparisons. 24 | 9. don't initialize static and/or global variables to zero, the compiler takes care of that. 25 | 10. use current source code style as further reference. 26 | 27 | 2.2 Source code documentation style: 28 | 29 | 1. JavaDoc compliant and Doxygen compatible. 30 | 2. Function documentation above functions in .c files, not .h files. 31 | (This forces you to synchronize documentation and implementation.) 32 | 3. Use current documentation style as further reference. 33 | 34 | 2.3 Bug reports and patches: 35 | 36 | 1. Make sure you are reporting bugs or send patches against the latest 37 | sources. (From the latest release and/or the current CVS sources.) 38 | 2. If you think you found a bug make sure it's not already filed in the 39 | bugtracker at Savannah. 40 | 3. If you have a fix put the patch on Savannah. If it is a patch that affects 41 | both core and arch specific stuff please separate them so that the core can 42 | be applied separately while leaving the other patch 'open'. The prefered way 43 | is to NOT touch archs you can't test and let maintainers take care of them. 44 | This is a good way to see if they are used at all - the same goes for unix 45 | netifs except tapif. 46 | 4. Do not file a bug and post a fix to it to the patch area. Either a bug report 47 | or a patch will be enough. 48 | If you correct an existing bug then attach the patch to the bug rather than creating a new entry in the patch area. 49 | 5. Trivial patches (compiler warning, indentation and spelling fixes or anything obvious which takes a line or two) 50 | can go to the lwip-users list. This is still the fastest way of interaction and the list is not so crowded 51 | as to allow for loss of fixes. Putting bugs on Savannah and subsequently closing them is too much an overhead 52 | for reporting a compiler warning fix. 53 | 6. Patches should be specific to a single change or to related changes.Do not mix bugfixes with spelling and other 54 | trivial fixes unless the bugfix is trivial too.Do not reorganize code and rename identifiers in the same patch you 55 | change behaviour if not necessary.A patch is easier to read and understand if it's to the point and short than 56 | if it's not to the point and long :) so the chances for it to be applied are greater. 57 | 58 | 2.4 Platform porters: 59 | 60 | 1. If you have ported lwIP to a platform (an OS, a uC/processor or a combination of these) and 61 | you think it could benefit others[1] you might want discuss this on the mailing list. You 62 | can also ask for CVS access to submit and maintain your port in the contrib CVS module. 63 | -------------------------------------------------------------------------------- /Source/LwIP/port/include/arch/bpstruct.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2003 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | 33 | #if defined(__IAR_SYSTEMS_ICC__) 34 | #pragma pack(1) 35 | #endif 36 | 37 | -------------------------------------------------------------------------------- /Source/LwIP/port/include/arch/cpu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2003 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __CPU_H__ 33 | #define __CPU_H__ 34 | 35 | #define BYTE_ORDER LITTLE_ENDIAN 36 | 37 | #endif /* __CPU_H__ */ 38 | -------------------------------------------------------------------------------- /Source/LwIP/port/include/arch/epstruct.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2003 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | 33 | #if defined(__IAR_SYSTEMS_ICC__) 34 | #pragma pack() 35 | #endif 36 | 37 | -------------------------------------------------------------------------------- /Source/LwIP/port/include/arch/perf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2003 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __PERF_H__ 33 | #define __PERF_H__ 34 | 35 | #define PERF_START /* null definition */ 36 | #define PERF_STOP(x) /* null definition */ 37 | 38 | #endif /* __PERF_H__ */ 39 | -------------------------------------------------------------------------------- /Source/LwIP/port/include/arch/sys_arch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2003 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __ARCH_SYS_ARCH_H__ 33 | #define __ARCH_SYS_ARCH_H__ 34 | 35 | #include "arch/cc.h" 36 | #include "app_cfg.h" // define LWIP TASK Prio 37 | 38 | #ifdef SYS_ARCH_GLOBALS 39 | #define SYS_ARCH_EXT 40 | #else 41 | #define SYS_ARCH_EXT extern 42 | #endif 43 | 44 | /*-----------------macros-----------------------------------------------------*/ 45 | #define LWIP_STK_SIZE 300 46 | 47 | //#define LWIP_TASK_MAX 3 //max number of lwip tasks (TCPIP) 48 | //#define LWIP_START_PRIO 10 //first prio of lwip tasks in uC/OS-II 49 | 50 | #define LWIP_TASK_MAX (LWIP_TASK_END_PRIO - LWIP_TASK_START_PRIO + 1) 51 | //max number of lwip tasks (TCPIP) note LWIP TASK start with 1 52 | 53 | #define LWIP_START_PRIO LWIP_TASK_START_PRIO //first prio of lwip tasks in uC/OS-II 54 | 55 | #define MAX_QUEUES 10 // the number of mailboxes 56 | #define MAX_QUEUE_ENTRIES 20 // the max size of each mailbox 57 | 58 | #define SYS_MBOX_NULL (void *)0 59 | #define SYS_SEM_NULL (void *)0 60 | 61 | #define sys_arch_mbox_tryfetch(mbox,msg) \ 62 | sys_arch_mbox_fetch(mbox,msg,1) 63 | 64 | #include "ucos_ii.h" 65 | /*-----------------type define------------------------------------------------*/ 66 | 67 | /** Function prototype for thread functions */ 68 | typedef void (*lwip_thread_fn)(void *arg); 69 | 70 | /** struct of LwIP mailbox */ 71 | typedef struct { 72 | OS_EVENT* pQ; 73 | void* pvQEntries[MAX_QUEUE_ENTRIES]; 74 | } TQ_DESCR, *PQ_DESCR; 75 | 76 | typedef OS_EVENT *sys_sem_t; // type of semiphores 77 | typedef PQ_DESCR sys_mbox_t; // type of mailboxes 78 | typedef INT8U sys_thread_t; // type of id of the new thread 79 | 80 | typedef INT8U sys_prot_t; 81 | 82 | /*-----------------global variables-------------------------------------------*/ 83 | 84 | SYS_ARCH_EXT OS_STK LWIP_TASK_STK[LWIP_TASK_MAX][LWIP_STK_SIZE]; 85 | 86 | #include "rom_hook_tbl.h" 87 | 88 | #endif /* __SYS_RTXC_H__ */ 89 | 90 | -------------------------------------------------------------------------------- /Source/LwIP/port/include/lwIP.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lwIP.h 3 | * @brief A brief file description. 4 | * @details 5 | * A more elaborated file description. 6 | * @author Wang Mengyin 7 | * @date 2010Jul19 15:54:55 8 | * @note 9 | * Copyright 2010 Wang Mengyin.ALL RIGHTS RESERVED. 10 | * http://tigerwang202.blogbus.com 11 | * This software is provided under license and contains proprietary and 12 | * confidential material which is the property of Company Name tech. 13 | */ 14 | 15 | 16 | #ifndef __LW_IP_H 17 | #define __LW_IP_H 18 | 19 | #include "includes.h" 20 | 21 | typedef struct netif NET_IF; 22 | 23 | #define MAX_DHCP_TRIES 4 24 | 25 | #define DHCP_STATE_IDLE 0 26 | #define DHCP_STATE_RUN 1 27 | #define DHCP_STATE_STOP 2 28 | 29 | #define SUBNET_MASK_ADR 0xFFFFFF00 30 | 31 | 32 | VOID LwIPInit(VOID); 33 | INT32 L2LinkUp(VOID); 34 | VOID L2LinkDown(VOID); 35 | extern NET_IF netif; 36 | 37 | #endif /* #ifndef __LW_IP_H */ 38 | /*-- File end --*/ 39 | 40 | -------------------------------------------------------------------------------- /Source/LwIP/port/include/netif/ethernetif.h: -------------------------------------------------------------------------------- 1 | #ifndef __ETHERNETIF_H__ 2 | #define __ETHERNETIF_H__ 3 | 4 | 5 | #include "lwip/err.h" 6 | #include "lwip/netif.h" 7 | 8 | err_t ethernetif_init(struct netif *netif); 9 | err_t ethernetif_input(struct netif *netif); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /Source/LwIP/port/lwIP.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/LwIP/port/lwIP.c -------------------------------------------------------------------------------- /Source/LwIP/port/sys_arch.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/LwIP/port/sys_arch.c -------------------------------------------------------------------------------- /Source/LwIP/src/.hgignore: -------------------------------------------------------------------------------- 1 | syntax: glob 2 | 3 | *.pyc 4 | *.orig 5 | *.rej 6 | *~ 7 | TAGS 8 | Module.symvers 9 | *.ncb 10 | *.suo 11 | *.bak 12 | *.orig 13 | *.rej 14 | 15 | syntax: regexp 16 | \.\#.+ 17 | [\\/]CVS$ 18 | ^CVS$ 19 | ^build$ 20 | ^install$ 21 | ^logs.build_tree$ 22 | [\\/]bin$ 23 | ^bin$ 24 | [\\/]obj$ 25 | ^obj$ 26 | \.cvsignore 27 | -------------------------------------------------------------------------------- /Source/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 | core/ - The core of the TPC/IP stack; protocol implementations, 5 | memory and buffer management, and the low-level raw API. 6 | 7 | include/ - lwIP include files. 8 | 9 | netif/ - Generic network interface device drivers are kept here, 10 | as well as the ARP module. 11 | 12 | For more information on the various subdirectories, check the FILES 13 | file in each directory. 14 | -------------------------------------------------------------------------------- /Source/LwIP/src/api/err.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Error Management module 4 | * 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 | 39 | #include "lwip/err.h" 40 | 41 | #ifdef LWIP_DEBUG 42 | 43 | static const char *err_strerr[] = { 44 | "Ok.", /* ERR_OK 0 */ 45 | "Out of memory error.", /* ERR_MEM -1 */ 46 | "Buffer error.", /* ERR_BUF -2 */ 47 | "Timeout.", /* ERR_TIMEOUT -3 */ 48 | "Routing problem.", /* ERR_RTE -4 */ 49 | "Operation in progress.", /* ERR_INPROGRESS -5 */ 50 | "Illegal value.", /* ERR_VAL -6 */ 51 | "Operation would block.", /* ERR_WOULDBLOCK -7 */ 52 | "Address in use.", /* ERR_USE -8 */ 53 | "Already connected.", /* ERR_ISCONN -9 */ 54 | "Connection aborted.", /* ERR_ABRT -10 */ 55 | "Connection reset.", /* ERR_RST -11 */ 56 | "Connection closed.", /* ERR_CLSD -12 */ 57 | "Not connected.", /* ERR_CONN -13 */ 58 | "Illegal argument.", /* ERR_ARG -14 */ 59 | "Low-level netif error.", /* ERR_IF -15 */ 60 | }; 61 | 62 | /** 63 | * Convert an lwip internal error to a string representation. 64 | * 65 | * @param err an lwip internal err_t 66 | * @return a string representation for err 67 | */ 68 | const char * 69 | lwip_strerr(err_t err) 70 | { 71 | return err_strerr[-err]; 72 | 73 | } 74 | 75 | #endif /* LWIP_DEBUG */ 76 | -------------------------------------------------------------------------------- /Source/LwIP/src/core/def.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Common functions used throughout the stack. 4 | * 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: Simon Goldschmidt 36 | * 37 | */ 38 | 39 | #include "lwip/opt.h" 40 | #include "lwip/def.h" 41 | 42 | /** 43 | * These are reference implementations of the byte swapping functions. 44 | * Again with the aim of being simple, correct and fully portable. 45 | * Byte swapping is the second thing you would want to optimize. You will 46 | * need to port it to your architecture and in your cc.h: 47 | * 48 | * #define LWIP_PLATFORM_BYTESWAP 1 49 | * #define LWIP_PLATFORM_HTONS(x) 50 | * #define LWIP_PLATFORM_HTONL(x) 51 | * 52 | * Note ntohs() and ntohl() are merely references to the htonx counterparts. 53 | */ 54 | 55 | #if (LWIP_PLATFORM_BYTESWAP == 0) && (BYTE_ORDER == LITTLE_ENDIAN) 56 | 57 | /** 58 | * Convert an u16_t from host- to network byte order. 59 | * 60 | * @param n u16_t in host byte order 61 | * @return n in network byte order 62 | */ 63 | u16_t 64 | lwip_htons(u16_t n) 65 | { 66 | return ((n & 0xff) << 8) | ((n & 0xff00) >> 8); 67 | } 68 | 69 | /** 70 | * Convert an u16_t from network- to host byte order. 71 | * 72 | * @param n u16_t in network byte order 73 | * @return n in host byte order 74 | */ 75 | u16_t 76 | lwip_ntohs(u16_t n) 77 | { 78 | return lwip_htons(n); 79 | } 80 | 81 | /** 82 | * Convert an u32_t from host- to network byte order. 83 | * 84 | * @param n u32_t in host byte order 85 | * @return n in network byte order 86 | */ 87 | u32_t 88 | lwip_htonl(u32_t n) 89 | { 90 | return ((n & 0xff) << 24) | 91 | ((n & 0xff00) << 8) | 92 | ((n & 0xff0000UL) >> 8) | 93 | ((n & 0xff000000UL) >> 24); 94 | } 95 | 96 | /** 97 | * Convert an u32_t from network- to host byte order. 98 | * 99 | * @param n u32_t in network byte order 100 | * @return n in host byte order 101 | */ 102 | u32_t 103 | lwip_ntohl(u32_t n) 104 | { 105 | return lwip_htonl(n); 106 | } 107 | 108 | #endif /* (LWIP_PLATFORM_BYTESWAP == 0) && (BYTE_ORDER == LITTLE_ENDIAN) */ 109 | -------------------------------------------------------------------------------- /Source/LwIP/src/core/ipv4/inet.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Functions common to all TCP/IPv4 modules, such as the byte order functions. 4 | * 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 | 39 | #include "lwip/opt.h" 40 | 41 | #include "lwip/inet.h" 42 | 43 | -------------------------------------------------------------------------------- /Source/LwIP/src/core/ipv6/README: -------------------------------------------------------------------------------- 1 | IPv6 support in lwIP is very experimental. 2 | -------------------------------------------------------------------------------- /Source/LwIP/src/core/ipv6/inet6.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Functions common to all TCP/IPv6 modules, such as the Internet checksum and the 4 | * byte order functions. 5 | * 6 | */ 7 | 8 | /* 9 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 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: Adam Dunkels 37 | * 38 | */ 39 | 40 | #include "lwip/opt.h" 41 | 42 | #include "lwip/def.h" 43 | #include "lwip/inet.h" 44 | 45 | /* chksum: 46 | * 47 | * Sums up all 16 bit words in a memory portion. Also includes any odd byte. 48 | * This function is used by the other checksum functions. 49 | * 50 | * For now, this is not optimized. Must be optimized for the particular processor 51 | * arcitecture on which it is to run. Preferebly coded in assembler. 52 | */ 53 | 54 | static u32_t 55 | chksum(void *dataptr, u16_t len) 56 | { 57 | u16_t *sdataptr = dataptr; 58 | u32_t acc; 59 | 60 | 61 | for(acc = 0; len > 1; len -= 2) { 62 | acc += *sdataptr++; 63 | } 64 | 65 | /* add up any odd byte */ 66 | if (len == 1) { 67 | acc += htons((u16_t)(*(u8_t *)dataptr) << 8); 68 | } 69 | 70 | return acc; 71 | 72 | } 73 | 74 | /* inet_chksum_pseudo: 75 | * 76 | * Calculates the pseudo Internet checksum used by TCP and UDP for a pbuf chain. 77 | */ 78 | 79 | u16_t 80 | inet_chksum_pseudo(struct pbuf *p, 81 | struct ip_addr *src, struct ip_addr *dest, 82 | u8_t proto, u32_t proto_len) 83 | { 84 | u32_t acc; 85 | struct pbuf *q; 86 | u8_t swapped, i; 87 | 88 | acc = 0; 89 | swapped = 0; 90 | for(q = p; q != NULL; q = q->next) { 91 | acc += chksum(q->payload, q->len); 92 | while (acc >> 16) { 93 | acc = (acc & 0xffff) + (acc >> 16); 94 | } 95 | if (q->len % 2 != 0) { 96 | swapped = 1 - swapped; 97 | acc = ((acc & 0xff) << 8) | ((acc & 0xff00) >> 8); 98 | } 99 | } 100 | 101 | if (swapped) { 102 | acc = ((acc & 0xff) << 8) | ((acc & 0xff00) >> 8); 103 | } 104 | 105 | for(i = 0; i < 8; i++) { 106 | acc += ((u16_t *)src->addr)[i] & 0xffff; 107 | acc += ((u16_t *)dest->addr)[i] & 0xffff; 108 | while (acc >> 16) { 109 | acc = (acc & 0xffff) + (acc >> 16); 110 | } 111 | } 112 | acc += (u16_t)htons((u16_t)proto); 113 | acc += ((u16_t *)&proto_len)[0] & 0xffff; 114 | acc += ((u16_t *)&proto_len)[1] & 0xffff; 115 | 116 | while (acc >> 16) { 117 | acc = (acc & 0xffff) + (acc >> 16); 118 | } 119 | return ~(acc & 0xffff); 120 | } 121 | 122 | /* inet_chksum: 123 | * 124 | * Calculates the Internet checksum over a portion of memory. Used primarely for IP 125 | * and ICMP. 126 | */ 127 | 128 | u16_t 129 | inet_chksum(void *dataptr, u16_t len) 130 | { 131 | u32_t acc, sum; 132 | 133 | acc = chksum(dataptr, len); 134 | sum = (acc & 0xffff) + (acc >> 16); 135 | sum += (sum >> 16); 136 | return ~(sum & 0xffff); 137 | } 138 | 139 | u16_t 140 | inet_chksum_pbuf(struct pbuf *p) 141 | { 142 | u32_t acc; 143 | struct pbuf *q; 144 | u8_t swapped; 145 | 146 | acc = 0; 147 | swapped = 0; 148 | for(q = p; q != NULL; q = q->next) { 149 | acc += chksum(q->payload, q->len); 150 | while (acc >> 16) { 151 | acc = (acc & 0xffff) + (acc >> 16); 152 | } 153 | if (q->len % 2 != 0) { 154 | swapped = 1 - swapped; 155 | acc = (acc & 0xff << 8) | (acc & 0xff00 >> 8); 156 | } 157 | } 158 | 159 | if (swapped) { 160 | acc = ((acc & 0xff) << 8) | ((acc & 0xff00) >> 8); 161 | } 162 | return ~(acc & 0xffff); 163 | } 164 | -------------------------------------------------------------------------------- /Source/LwIP/src/core/ipv6/ip6_addr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | 33 | #include "lwip/opt.h" 34 | #include "lwip/ip_addr.h" 35 | #include "lwip/inet.h" 36 | 37 | u8_t 38 | ip_addr_netcmp(struct ip_addr *addr1, struct ip_addr *addr2, 39 | struct ip_addr *mask) 40 | { 41 | return((addr1->addr[0] & mask->addr[0]) == (addr2->addr[0] & mask->addr[0]) && 42 | (addr1->addr[1] & mask->addr[1]) == (addr2->addr[1] & mask->addr[1]) && 43 | (addr1->addr[2] & mask->addr[2]) == (addr2->addr[2] & mask->addr[2]) && 44 | (addr1->addr[3] & mask->addr[3]) == (addr2->addr[3] & mask->addr[3])); 45 | 46 | } 47 | 48 | u8_t 49 | ip_addr_cmp(struct ip_addr *addr1, struct ip_addr *addr2) 50 | { 51 | return(addr1->addr[0] == addr2->addr[0] && 52 | addr1->addr[1] == addr2->addr[1] && 53 | addr1->addr[2] == addr2->addr[2] && 54 | addr1->addr[3] == addr2->addr[3]); 55 | } 56 | 57 | void 58 | ip_addr_set(struct ip_addr *dest, struct ip_addr *src) 59 | { 60 | SMEMCPY(dest, src, sizeof(struct ip_addr)); 61 | /* dest->addr[0] = src->addr[0]; 62 | dest->addr[1] = src->addr[1]; 63 | dest->addr[2] = src->addr[2]; 64 | dest->addr[3] = src->addr[3];*/ 65 | } 66 | 67 | u8_t 68 | ip_addr_isany(struct ip_addr *addr) 69 | { 70 | if (addr == NULL) return 1; 71 | return((addr->addr[0] | addr->addr[1] | addr->addr[2] | addr->addr[3]) == 0); 72 | } 73 | -------------------------------------------------------------------------------- /Source/LwIP/src/core/sys.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * lwIP Operating System abstraction 4 | * 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 | 39 | #include "lwip/opt.h" 40 | 41 | #include "lwip/sys.h" 42 | 43 | /* Most of the functions defined in sys.h must be implemented in the 44 | * architecture-dependent file sys_arch.c */ 45 | 46 | #if !NO_SYS 47 | 48 | #ifndef sys_msleep 49 | /** 50 | * Sleep for some ms. Timeouts are NOT processed while sleeping. 51 | * 52 | * @param ms number of milliseconds to sleep 53 | */ 54 | void 55 | sys_msleep(u32_t ms) 56 | { 57 | if (ms > 0) { 58 | sys_sem_t delaysem; 59 | err_t err = sys_sem_new(&delaysem, 0); 60 | if (err == ERR_OK) { 61 | sys_arch_sem_wait(&delaysem, ms); 62 | sys_sem_free(&delaysem); 63 | } 64 | } 65 | } 66 | #endif /* sys_msleep */ 67 | 68 | #endif /* !NO_SYS */ 69 | -------------------------------------------------------------------------------- /Source/LwIP/src/include/ipv4/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 | * Please coordinate changes and requests with Dominik Spies 41 | * 42 | */ 43 | 44 | #ifndef __LWIP_AUTOIP_H__ 45 | #define __LWIP_AUTOIP_H__ 46 | 47 | #include "lwip/opt.h" 48 | 49 | #if LWIP_AUTOIP /* don't build if not configured for use in lwipopts.h */ 50 | 51 | #include "lwip/netif.h" 52 | #include "lwip/udp.h" 53 | #include "netif/etharp.h" 54 | 55 | #ifdef __cplusplus 56 | extern "C" { 57 | #endif 58 | 59 | /* AutoIP Timing */ 60 | #define AUTOIP_TMR_INTERVAL 100 61 | #define AUTOIP_TICKS_PER_SECOND (1000 / AUTOIP_TMR_INTERVAL) 62 | 63 | /* RFC 3927 Constants */ 64 | #define PROBE_WAIT 1 /* second (initial random delay) */ 65 | #define PROBE_MIN 1 /* second (minimum delay till repeated probe) */ 66 | #define PROBE_MAX 2 /* seconds (maximum delay till repeated probe) */ 67 | #define PROBE_NUM 3 /* (number of probe packets) */ 68 | #define ANNOUNCE_NUM 2 /* (number of announcement packets) */ 69 | #define ANNOUNCE_INTERVAL 2 /* seconds (time between announcement packets) */ 70 | #define ANNOUNCE_WAIT 2 /* seconds (delay before announcing) */ 71 | #define MAX_CONFLICTS 10 /* (max conflicts before rate limiting) */ 72 | #define RATE_LIMIT_INTERVAL 60 /* seconds (delay between successive attempts) */ 73 | #define DEFEND_INTERVAL 10 /* seconds (min. wait between defensive ARPs) */ 74 | 75 | /* AutoIP client states */ 76 | #define AUTOIP_STATE_OFF 0 77 | #define AUTOIP_STATE_PROBING 1 78 | #define AUTOIP_STATE_ANNOUNCING 2 79 | #define AUTOIP_STATE_BOUND 3 80 | 81 | struct autoip 82 | { 83 | ip_addr_t llipaddr; /* the currently selected, probed, announced or used LL IP-Address */ 84 | u8_t state; /* current AutoIP state machine state */ 85 | u8_t sent_num; /* sent number of probes or announces, dependent on state */ 86 | u16_t ttw; /* ticks to wait, tick is AUTOIP_TMR_INTERVAL long */ 87 | u8_t lastconflict; /* ticks until a conflict can be solved by defending */ 88 | u8_t tried_llipaddr; /* total number of probed/used Link Local IP-Addresses */ 89 | }; 90 | 91 | 92 | #define autoip_init() /* Compatibility define, no init needed. */ 93 | 94 | /** Set a struct autoip allocated by the application to work with */ 95 | void autoip_set_struct(struct netif *netif, struct autoip *autoip); 96 | 97 | /** Start AutoIP client */ 98 | err_t autoip_start(struct netif *netif); 99 | 100 | /** Stop AutoIP client */ 101 | err_t autoip_stop(struct netif *netif); 102 | 103 | /** Handles every incoming ARP Packet, called by etharp_arp_input */ 104 | void autoip_arp_reply(struct netif *netif, struct etharp_hdr *hdr); 105 | 106 | /** Has to be called in loop every AUTOIP_TMR_INTERVAL milliseconds */ 107 | void autoip_tmr(void); 108 | 109 | /** Handle a possible change in the network configuration */ 110 | void autoip_network_changed(struct netif *netif); 111 | 112 | #ifdef __cplusplus 113 | } 114 | #endif 115 | 116 | #endif /* LWIP_AUTOIP */ 117 | 118 | #endif /* __LWIP_AUTOIP_H__ */ 119 | -------------------------------------------------------------------------------- /Source/LwIP/src/include/ipv4/lwip/icmp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __LWIP_ICMP_H__ 33 | #define __LWIP_ICMP_H__ 34 | 35 | #include "lwip/opt.h" 36 | #include "lwip/pbuf.h" 37 | #include "lwip/ip_addr.h" 38 | #include "lwip/netif.h" 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | #define ICMP_ER 0 /* echo reply */ 45 | #define ICMP_DUR 3 /* destination unreachable */ 46 | #define ICMP_SQ 4 /* source quench */ 47 | #define ICMP_RD 5 /* redirect */ 48 | #define ICMP_ECHO 8 /* echo */ 49 | #define ICMP_TE 11 /* time exceeded */ 50 | #define ICMP_PP 12 /* parameter problem */ 51 | #define ICMP_TS 13 /* timestamp */ 52 | #define ICMP_TSR 14 /* timestamp reply */ 53 | #define ICMP_IRQ 15 /* information request */ 54 | #define ICMP_IR 16 /* information reply */ 55 | 56 | enum icmp_dur_type { 57 | ICMP_DUR_NET = 0, /* net unreachable */ 58 | ICMP_DUR_HOST = 1, /* host unreachable */ 59 | ICMP_DUR_PROTO = 2, /* protocol unreachable */ 60 | ICMP_DUR_PORT = 3, /* port unreachable */ 61 | ICMP_DUR_FRAG = 4, /* fragmentation needed and DF set */ 62 | ICMP_DUR_SR = 5 /* source route failed */ 63 | }; 64 | 65 | enum icmp_te_type { 66 | ICMP_TE_TTL = 0, /* time to live exceeded in transit */ 67 | ICMP_TE_FRAG = 1 /* fragment reassembly time exceeded */ 68 | }; 69 | 70 | #ifdef PACK_STRUCT_USE_INCLUDES 71 | # include "arch/bpstruct.h" 72 | #endif 73 | /** This is the standard ICMP header only that the u32_t data 74 | * is splitted to two u16_t like ICMP echo needs it. 75 | * This header is also used for other ICMP types that do not 76 | * use the data part. 77 | */ 78 | PACK_STRUCT_BEGIN 79 | struct icmp_echo_hdr { 80 | PACK_STRUCT_FIELD(u8_t type); 81 | PACK_STRUCT_FIELD(u8_t code); 82 | PACK_STRUCT_FIELD(u16_t chksum); 83 | PACK_STRUCT_FIELD(u16_t id); 84 | PACK_STRUCT_FIELD(u16_t seqno); 85 | } PACK_STRUCT_STRUCT; 86 | PACK_STRUCT_END 87 | #ifdef PACK_STRUCT_USE_INCLUDES 88 | # include "arch/epstruct.h" 89 | #endif 90 | 91 | #define ICMPH_TYPE(hdr) ((hdr)->type) 92 | #define ICMPH_CODE(hdr) ((hdr)->code) 93 | 94 | /** Combines type and code to an u16_t */ 95 | #define ICMPH_TYPE_SET(hdr, t) ((hdr)->type = (t)) 96 | #define ICMPH_CODE_SET(hdr, c) ((hdr)->code = (c)) 97 | 98 | 99 | #if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */ 100 | 101 | void icmp_input(struct pbuf *p, struct netif *inp); 102 | void icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t); 103 | void icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t); 104 | 105 | #endif /* LWIP_ICMP */ 106 | 107 | #ifdef __cplusplus 108 | } 109 | #endif 110 | 111 | #endif /* __LWIP_ICMP_H__ */ 112 | -------------------------------------------------------------------------------- /Source/LwIP/src/include/ipv4/lwip/igmp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002 CITEL Technologies Ltd. 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 | * 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. Neither the name of CITEL Technologies Ltd nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY CITEL TECHNOLOGIES AND CONTRIBUTORS ``AS IS'' 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL CITEL TECHNOLOGIES OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * This file is a contribution to the lwIP TCP/IP stack. 30 | * The Swedish Institute of Computer Science and Adam Dunkels 31 | * are specifically granted permission to redistribute this 32 | * source code. 33 | */ 34 | 35 | #ifndef __LWIP_IGMP_H__ 36 | #define __LWIP_IGMP_H__ 37 | 38 | #include "lwip/opt.h" 39 | #include "lwip/ip_addr.h" 40 | #include "lwip/netif.h" 41 | #include "lwip/pbuf.h" 42 | 43 | #if LWIP_IGMP /* don't build if not configured for use in lwipopts.h */ 44 | 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | 50 | /* IGMP timer */ 51 | #define IGMP_TMR_INTERVAL 100 /* Milliseconds */ 52 | #define IGMP_V1_DELAYING_MEMBER_TMR (1000/IGMP_TMR_INTERVAL) 53 | #define IGMP_JOIN_DELAYING_MEMBER_TMR (500 /IGMP_TMR_INTERVAL) 54 | 55 | /* MAC Filter Actions, these are passed to a netif's 56 | * igmp_mac_filter callback function. */ 57 | #define IGMP_DEL_MAC_FILTER 0 58 | #define IGMP_ADD_MAC_FILTER 1 59 | 60 | 61 | /** 62 | * igmp group structure - there is 63 | * a list of groups for each interface 64 | * these should really be linked from the interface, but 65 | * if we keep them separate we will not affect the lwip original code 66 | * too much 67 | * 68 | * There will be a group for the all systems group address but this 69 | * will not run the state machine as it is used to kick off reports 70 | * from all the other groups 71 | */ 72 | struct igmp_group { 73 | /** next link */ 74 | struct igmp_group *next; 75 | /** interface on which the group is active */ 76 | struct netif *netif; 77 | /** multicast address */ 78 | ip_addr_t group_address; 79 | /** signifies we were the last person to report */ 80 | u8_t last_reporter_flag; 81 | /** current state of the group */ 82 | u8_t group_state; 83 | /** timer for reporting, negative is OFF */ 84 | u16_t timer; 85 | /** counter of simultaneous uses */ 86 | u8_t use; 87 | }; 88 | 89 | /* Prototypes */ 90 | void igmp_init(void); 91 | err_t igmp_start(struct netif *netif); 92 | err_t igmp_stop(struct netif *netif); 93 | void igmp_report_groups(struct netif *netif); 94 | struct igmp_group *igmp_lookfor_group(struct netif *ifp, ip_addr_t *addr); 95 | void igmp_input(struct pbuf *p, struct netif *inp, ip_addr_t *dest); 96 | err_t igmp_joingroup(ip_addr_t *ifaddr, ip_addr_t *groupaddr); 97 | err_t igmp_leavegroup(ip_addr_t *ifaddr, ip_addr_t *groupaddr); 98 | void igmp_tmr(void); 99 | 100 | #ifdef __cplusplus 101 | } 102 | #endif 103 | 104 | #endif /* LWIP_IGMP */ 105 | 106 | #endif /* __LWIP_IGMP_H__ */ 107 | -------------------------------------------------------------------------------- /Source/LwIP/src/include/ipv4/lwip/inet.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __LWIP_INET_H__ 33 | #define __LWIP_INET_H__ 34 | 35 | #include "lwip/opt.h" 36 | #include "lwip/def.h" 37 | #include "lwip/ip_addr.h" 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | /** For compatibility with BSD code */ 44 | struct in_addr { 45 | u32_t s_addr; 46 | }; 47 | 48 | /** 255.255.255.255 */ 49 | #define INADDR_NONE IPADDR_NONE 50 | /** 127.0.0.1 */ 51 | #define INADDR_LOOPBACK IPADDR_LOOPBACK 52 | /** 0.0.0.0 */ 53 | #define INADDR_ANY IPADDR_ANY 54 | /** 255.255.255.255 */ 55 | #define INADDR_BROADCAST IPADDR_BROADCAST 56 | 57 | /* Definitions of the bits in an Internet address integer. 58 | 59 | On subnets, host and network parts are found according to 60 | the subnet mask, not these masks. */ 61 | #define IN_CLASSA(a) IP_CLASSA(a) 62 | #define IN_CLASSA_NET IP_CLASSA_NET 63 | #define IN_CLASSA_NSHIFT IP_CLASSA_NSHIFT 64 | #define IN_CLASSA_HOST IP_CLASSA_HOST 65 | #define IN_CLASSA_MAX IP_CLASSA_MAX 66 | 67 | #define IN_CLASSB(b) IP_CLASSB(b) 68 | #define IN_CLASSB_NET IP_CLASSB_NET 69 | #define IN_CLASSB_NSHIFT IP_CLASSB_NSHIFT 70 | #define IN_CLASSB_HOST IP_CLASSB_HOST 71 | #define IN_CLASSB_MAX IP_CLASSB_MAX 72 | 73 | #define IN_CLASSC(c) IP_CLASSC(c) 74 | #define IN_CLASSC_NET IP_CLASSC_NET 75 | #define IN_CLASSC_NSHIFT IP_CLASSC_NSHIFT 76 | #define IN_CLASSC_HOST IP_CLASSC_HOST 77 | #define IN_CLASSC_MAX IP_CLASSC_MAX 78 | 79 | #define IN_CLASSD(d) IP_CLASSD(d) 80 | #define IN_CLASSD_NET IP_CLASSD_NET /* These ones aren't really */ 81 | #define IN_CLASSD_NSHIFT IP_CLASSD_NSHIFT /* net and host fields, but */ 82 | #define IN_CLASSD_HOST IP_CLASSD_HOST /* routing needn't know. */ 83 | #define IN_CLASSD_MAX IP_CLASSD_MAX 84 | 85 | #define IN_MULTICAST(a) IP_MULTICAST(a) 86 | 87 | #define IN_EXPERIMENTAL(a) IP_EXPERIMENTAL(a) 88 | #define IN_BADCLASS(a) IP_BADCLASS(a) 89 | 90 | #define IN_LOOPBACKNET IP_LOOPBACKNET 91 | 92 | #define inet_addr_from_ipaddr(target_inaddr, source_ipaddr) ((target_inaddr)->s_addr = ip4_addr_get_u32(source_ipaddr)) 93 | #define inet_addr_to_ipaddr(target_ipaddr, source_inaddr) (ip4_addr_set_u32(target_ipaddr, (source_inaddr)->s_addr)) 94 | /* ATTENTION: the next define only works because both s_addr and ip_addr_t are an u32_t effectively! */ 95 | #define inet_addr_to_ipaddr_p(target_ipaddr_p, source_inaddr) ((target_ipaddr_p) = (ip_addr_t*)&((source_inaddr)->s_addr)) 96 | 97 | /* directly map this to the lwip internal functions */ 98 | #define inet_addr(cp) ipaddr_addr(cp) 99 | #define inet_aton(cp, addr) ipaddr_aton(cp, (ip_addr_t*)addr) 100 | #define inet_ntoa(addr) ipaddr_ntoa((ip_addr_t*)&(addr)) 101 | #define inet_ntoa_r(addr, buf, buflen) ipaddr_ntoa_r((ip_addr_t*)&(addr), buf, buflen) 102 | 103 | #ifdef __cplusplus 104 | } 105 | #endif 106 | 107 | #endif /* __LWIP_INET_H__ */ 108 | -------------------------------------------------------------------------------- /Source/LwIP/src/include/ipv4/lwip/inet_chksum.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __LWIP_INET_CHKSUM_H__ 33 | #define __LWIP_INET_CHKSUM_H__ 34 | 35 | #include "lwip/opt.h" 36 | 37 | #include "lwip/pbuf.h" 38 | #include "lwip/ip_addr.h" 39 | 40 | /** Swap the bytes in an u16_t: much like htons() for little-endian */ 41 | #ifndef SWAP_BYTES_IN_WORD 42 | #if LWIP_PLATFORM_BYTESWAP && (BYTE_ORDER == LITTLE_ENDIAN) 43 | /* little endian and PLATFORM_BYTESWAP defined */ 44 | #define SWAP_BYTES_IN_WORD(w) LWIP_PLATFORM_HTONS(w) 45 | #else /* LWIP_PLATFORM_BYTESWAP && (BYTE_ORDER == LITTLE_ENDIAN) */ 46 | /* can't use htons on big endian (or PLATFORM_BYTESWAP not defined)... */ 47 | #define SWAP_BYTES_IN_WORD(w) (((w) & 0xff) << 8) | (((w) & 0xff00) >> 8) 48 | #endif /* LWIP_PLATFORM_BYTESWAP && (BYTE_ORDER == LITTLE_ENDIAN)*/ 49 | #endif /* SWAP_BYTES_IN_WORD */ 50 | 51 | /** Split an u32_t in two u16_ts and add them up */ 52 | #ifndef FOLD_U32T 53 | #define FOLD_U32T(u) (((u) >> 16) + ((u) & 0x0000ffffUL)) 54 | #endif 55 | 56 | #if LWIP_CHECKSUM_ON_COPY 57 | /** Function-like macro: same as MEMCPY but returns the checksum of copied data 58 | as u16_t */ 59 | #ifndef LWIP_CHKSUM_COPY 60 | #define LWIP_CHKSUM_COPY(dst, src, len) lwip_chksum_copy(dst, src, len) 61 | #ifndef LWIP_CHKSUM_COPY_ALGORITHM 62 | #define LWIP_CHKSUM_COPY_ALGORITHM 1 63 | #endif /* LWIP_CHKSUM_COPY_ALGORITHM */ 64 | #endif /* LWIP_CHKSUM_COPY */ 65 | #else /* LWIP_CHECKSUM_ON_COPY */ 66 | #define LWIP_CHKSUM_COPY_ALGORITHM 0 67 | #endif /* LWIP_CHECKSUM_ON_COPY */ 68 | 69 | #ifdef __cplusplus 70 | extern "C" { 71 | #endif 72 | 73 | u16_t inet_chksum(void *dataptr, u16_t len); 74 | u16_t inet_chksum_pbuf(struct pbuf *p); 75 | u16_t inet_chksum_pseudo(struct pbuf *p, 76 | ip_addr_t *src, ip_addr_t *dest, 77 | u8_t proto, u16_t proto_len); 78 | u16_t inet_chksum_pseudo_partial(struct pbuf *p, 79 | ip_addr_t *src, ip_addr_t *dest, 80 | u8_t proto, u16_t proto_len, u16_t chksum_len); 81 | #if LWIP_CHKSUM_COPY_ALGORITHM 82 | u16_t lwip_chksum_copy(void *dst, const void *src, u16_t len); 83 | #endif /* LWIP_CHKSUM_COPY_ALGORITHM */ 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif /* __LWIP_INET_H__ */ 90 | 91 | -------------------------------------------------------------------------------- /Source/LwIP/src/include/ipv4/lwip/ip_frag.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Jani Monoses 30 | * 31 | */ 32 | 33 | #ifndef __LWIP_IP_FRAG_H__ 34 | #define __LWIP_IP_FRAG_H__ 35 | 36 | #include "lwip/opt.h" 37 | #include "lwip/err.h" 38 | #include "lwip/pbuf.h" 39 | #include "lwip/netif.h" 40 | #include "lwip/ip_addr.h" 41 | #include "lwip/ip.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | #if IP_REASSEMBLY 48 | /* The IP reassembly timer interval in milliseconds. */ 49 | #define IP_TMR_INTERVAL 1000 50 | 51 | /* IP reassembly helper struct. 52 | * This is exported because memp needs to know the size. 53 | */ 54 | struct ip_reassdata { 55 | struct ip_reassdata *next; 56 | struct pbuf *p; 57 | struct ip_hdr iphdr; 58 | u16_t datagram_len; 59 | u8_t flags; 60 | u8_t timer; 61 | }; 62 | 63 | void ip_reass_init(void); 64 | void ip_reass_tmr(void); 65 | struct pbuf * ip_reass(struct pbuf *p); 66 | #endif /* IP_REASSEMBLY */ 67 | 68 | #if IP_FRAG 69 | #if !IP_FRAG_USES_STATIC_BUF && !LWIP_NETIF_TX_SINGLE_PBUF 70 | /** A custom pbuf that holds a reference to another pbuf, which is freed 71 | * when this custom pbuf is freed. This is used to create a custom PBUF_REF 72 | * that points into the original pbuf. */ 73 | struct pbuf_custom_ref { 74 | /** 'base class' */ 75 | struct pbuf_custom pc; 76 | /** pointer to the original pbuf that is referenced */ 77 | struct pbuf *original; 78 | }; 79 | #endif /* !IP_FRAG_USES_STATIC_BUF && !LWIP_NETIF_TX_SINGLE_PBUF */ 80 | 81 | err_t ip_frag(struct pbuf *p, struct netif *netif, ip_addr_t *dest); 82 | #endif /* IP_FRAG */ 83 | 84 | #ifdef __cplusplus 85 | } 86 | #endif 87 | 88 | #endif /* __LWIP_IP_FRAG_H__ */ 89 | -------------------------------------------------------------------------------- /Source/LwIP/src/include/ipv6/lwip/icmp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __LWIP_ICMP_H__ 33 | #define __LWIP_ICMP_H__ 34 | 35 | #include "lwip/opt.h" 36 | 37 | #if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */ 38 | 39 | #include "lwip/pbuf.h" 40 | #include "lwip/netif.h" 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #define ICMP6_DUR 1 47 | #define ICMP6_TE 3 48 | #define ICMP6_ECHO 128 /* echo */ 49 | #define ICMP6_ER 129 /* echo reply */ 50 | 51 | 52 | enum icmp_dur_type { 53 | ICMP_DUR_NET = 0, /* net unreachable */ 54 | ICMP_DUR_HOST = 1, /* host unreachable */ 55 | ICMP_DUR_PROTO = 2, /* protocol unreachable */ 56 | ICMP_DUR_PORT = 3, /* port unreachable */ 57 | ICMP_DUR_FRAG = 4, /* fragmentation needed and DF set */ 58 | ICMP_DUR_SR = 5 /* source route failed */ 59 | }; 60 | 61 | enum icmp_te_type { 62 | ICMP_TE_TTL = 0, /* time to live exceeded in transit */ 63 | ICMP_TE_FRAG = 1 /* fragment reassembly time exceeded */ 64 | }; 65 | 66 | void icmp_input(struct pbuf *p, struct netif *inp); 67 | 68 | void icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t); 69 | void icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t); 70 | 71 | struct icmp_echo_hdr { 72 | u8_t type; 73 | u8_t icode; 74 | u16_t chksum; 75 | u16_t id; 76 | u16_t seqno; 77 | }; 78 | 79 | struct icmp_dur_hdr { 80 | u8_t type; 81 | u8_t icode; 82 | u16_t chksum; 83 | u32_t unused; 84 | }; 85 | 86 | struct icmp_te_hdr { 87 | u8_t type; 88 | u8_t icode; 89 | u16_t chksum; 90 | u32_t unused; 91 | }; 92 | 93 | #ifdef __cplusplus 94 | } 95 | #endif 96 | 97 | #endif /* LWIP_ICMP */ 98 | 99 | #endif /* __LWIP_ICMP_H__ */ 100 | 101 | -------------------------------------------------------------------------------- /Source/LwIP/src/include/ipv6/lwip/inet.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __LWIP_INET_H__ 33 | #define __LWIP_INET_H__ 34 | 35 | #include "lwip/opt.h" 36 | #include "lwip/pbuf.h" 37 | #include "lwip/ip_addr.h" 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | u16_t inet_chksum(void *data, u16_t len); 44 | u16_t inet_chksum_pbuf(struct pbuf *p); 45 | u16_t inet_chksum_pseudo(struct pbuf *p, 46 | struct ip_addr *src, struct ip_addr *dest, 47 | u8_t proto, u32_t proto_len); 48 | 49 | u32_t inet_addr(const char *cp); 50 | s8_t inet_aton(const char *cp, struct in_addr *addr); 51 | 52 | #ifndef _MACHINE_ENDIAN_H_ 53 | #ifndef _NETINET_IN_H 54 | #ifndef _LINUX_BYTEORDER_GENERIC_H 55 | u16_t htons(u16_t n); 56 | u16_t ntohs(u16_t n); 57 | u32_t htonl(u32_t n); 58 | u32_t ntohl(u32_t n); 59 | #endif /* _LINUX_BYTEORDER_GENERIC_H */ 60 | #endif /* _NETINET_IN_H */ 61 | #endif /* _MACHINE_ENDIAN_H_ */ 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #endif /* __LWIP_INET_H__ */ 68 | 69 | -------------------------------------------------------------------------------- /Source/LwIP/src/include/ipv6/lwip/ip.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __LWIP_IP_H__ 33 | #define __LWIP_IP_H__ 34 | 35 | #include "lwip/opt.h" 36 | #include "lwip/def.h" 37 | #include "lwip/pbuf.h" 38 | #include "lwip/ip_addr.h" 39 | 40 | #include "lwip/err.h" 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #define IP_HLEN 40 47 | 48 | #define IP_PROTO_ICMP 58 49 | #define IP_PROTO_UDP 17 50 | #define IP_PROTO_UDPLITE 136 51 | #define IP_PROTO_TCP 6 52 | 53 | /* This is passed as the destination address to ip_output_if (not 54 | to ip_output), meaning that an IP header already is constructed 55 | in the pbuf. This is used when TCP retransmits. */ 56 | #ifdef IP_HDRINCL 57 | #undef IP_HDRINCL 58 | #endif /* IP_HDRINCL */ 59 | #define IP_HDRINCL NULL 60 | 61 | #if LWIP_NETIF_HWADDRHINT 62 | #define IP_PCB_ADDRHINT ;u8_t addr_hint 63 | #else 64 | #define IP_PCB_ADDRHINT 65 | #endif /* LWIP_NETIF_HWADDRHINT */ 66 | 67 | /* This is the common part of all PCB types. It needs to be at the 68 | beginning of a PCB type definition. It is located here so that 69 | changes to this common part are made in one location instead of 70 | having to change all PCB structs. */ 71 | #define IP_PCB struct ip_addr local_ip; \ 72 | struct ip_addr remote_ip; \ 73 | /* Socket options */ \ 74 | u16_t so_options; \ 75 | /* Type Of Service */ \ 76 | u8_t tos; \ 77 | /* Time To Live */ \ 78 | u8_t ttl; \ 79 | /* link layer address resolution hint */ \ 80 | IP_PCB_ADDRHINT 81 | 82 | 83 | /* The IPv6 header. */ 84 | struct ip_hdr { 85 | #if BYTE_ORDER == LITTLE_ENDIAN 86 | u8_t tclass1:4, v:4; 87 | u8_t flow1:4, tclass2:4; 88 | #else 89 | u8_t v:4, tclass1:4; 90 | u8_t tclass2:8, flow1:4; 91 | #endif 92 | u16_t flow2; 93 | u16_t len; /* payload length */ 94 | u8_t nexthdr; /* next header */ 95 | u8_t hoplim; /* hop limit (TTL) */ 96 | struct ip_addr src, dest; /* source and destination IP addresses */ 97 | }; 98 | 99 | #define IPH_PROTO(hdr) (iphdr->nexthdr) 100 | 101 | void ip_init(void); 102 | 103 | #include "lwip/netif.h" 104 | 105 | struct netif *ip_route(struct ip_addr *dest); 106 | 107 | void ip_input(struct pbuf *p, struct netif *inp); 108 | 109 | /* source and destination addresses in network byte order, please */ 110 | err_t ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, 111 | u8_t ttl, u8_t proto); 112 | 113 | err_t ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, 114 | u8_t ttl, u8_t proto, 115 | struct netif *netif); 116 | 117 | #define ip_current_netif() NULL 118 | #define ip_current_header() NULL 119 | 120 | #if IP_DEBUG 121 | void ip_debug_print(struct pbuf *p); 122 | #endif /* IP_DEBUG */ 123 | 124 | #ifdef __cplusplus 125 | } 126 | #endif 127 | 128 | #endif /* __LWIP_IP_H__ */ 129 | 130 | 131 | -------------------------------------------------------------------------------- /Source/LwIP/src/include/ipv6/lwip/ip_addr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __LWIP_IP_ADDR_H__ 33 | #define __LWIP_IP_ADDR_H__ 34 | 35 | #include "lwip/opt.h" 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | #define IP_ADDR_ANY 0 42 | 43 | #ifdef PACK_STRUCT_USE_INCLUDES 44 | # include "arch/bpstruct.h" 45 | #endif 46 | PACK_STRUCT_BEGIN 47 | struct ip_addr { 48 | PACK_STRUCT_FIELD(u32_t addr[4]); 49 | } PACK_STRUCT_STRUCT; 50 | PACK_STRUCT_END 51 | #ifdef PACK_STRUCT_USE_INCLUDES 52 | # include "arch/epstruct.h" 53 | #endif 54 | 55 | /* 56 | * struct ipaddr2 is used in the definition of the ARP packet format in 57 | * order to support compilers that don't have structure packing. 58 | */ 59 | #ifdef PACK_STRUCT_USE_INCLUDES 60 | # include "arch/bpstruct.h" 61 | #endif 62 | PACK_STRUCT_BEGIN 63 | struct ip_addr2 { 64 | PACK_STRUCT_FIELD(u16_t addrw[2]); 65 | } PACK_STRUCT_STRUCT; 66 | PACK_STRUCT_END 67 | #ifdef PACK_STRUCT_USE_INCLUDES 68 | # include "arch/epstruct.h" 69 | #endif 70 | 71 | #define IP6_ADDR(ipaddr, a,b,c,d,e,f,g,h) do { (ipaddr)->addr[0] = htonl((u32_t)((a & 0xffff) << 16) | (b & 0xffff)); \ 72 | (ipaddr)->addr[1] = htonl(((c & 0xffff) << 16) | (d & 0xffff)); \ 73 | (ipaddr)->addr[2] = htonl(((e & 0xffff) << 16) | (f & 0xffff)); \ 74 | (ipaddr)->addr[3] = htonl(((g & 0xffff) << 16) | (h & 0xffff)); } while(0) 75 | 76 | u8_t ip_addr_netcmp(struct ip_addr *addr1, struct ip_addr *addr2, 77 | struct ip_addr *mask); 78 | u8_t ip_addr_cmp(struct ip_addr *addr1, struct ip_addr *addr2); 79 | void ip_addr_set(struct ip_addr *dest, struct ip_addr *src); 80 | u8_t ip_addr_isany(struct ip_addr *addr); 81 | 82 | #define ip_addr_debug_print(debug, ipaddr) \ 83 | LWIP_DEBUGF(debug, ("%"X32_F":%"X32_F":%"X32_F":%"X32_F":%"X32_F":%"X32_F":%"X32_F":%"X32_F"\n", \ 84 | (ntohl(ipaddr->addr[0]) >> 16) & 0xffff, \ 85 | ntohl(ipaddr->addr[0]) & 0xffff, \ 86 | (ntohl(ipaddr->addr[1]) >> 16) & 0xffff, \ 87 | ntohl(ipaddr->addr[1]) & 0xffff, \ 88 | (ntohl(ipaddr->addr[2]) >> 16) & 0xffff, \ 89 | ntohl(ipaddr->addr[2]) & 0xffff, \ 90 | (ntohl(ipaddr->addr[3]) >> 16) & 0xffff, \ 91 | ntohl(ipaddr->addr[3]) & 0xffff)); 92 | 93 | #ifdef __cplusplus 94 | } 95 | #endif 96 | 97 | #endif /* __LWIP_IP_ADDR_H__ */ 98 | -------------------------------------------------------------------------------- /Source/LwIP/src/include/lwip/debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __LWIP_DEBUG_H__ 33 | #define __LWIP_DEBUG_H__ 34 | 35 | #include "lwip/arch.h" 36 | #include "lwip/opt.h" 37 | 38 | /** lower two bits indicate debug level 39 | * - 0 all 40 | * - 1 warning 41 | * - 2 serious 42 | * - 3 severe 43 | */ 44 | #define LWIP_DBG_LEVEL_ALL 0x00 45 | #define LWIP_DBG_LEVEL_OFF LWIP_DBG_LEVEL_ALL /* compatibility define only */ 46 | #define LWIP_DBG_LEVEL_WARNING 0x01 /* bad checksums, dropped packets, ... */ 47 | #define LWIP_DBG_LEVEL_SERIOUS 0x02 /* memory allocation failures, ... */ 48 | #define LWIP_DBG_LEVEL_SEVERE 0x03 49 | #define LWIP_DBG_MASK_LEVEL 0x03 50 | 51 | /** flag for LWIP_DEBUGF to enable that debug message */ 52 | #define LWIP_DBG_ON 0x80U 53 | /** flag for LWIP_DEBUGF to disable that debug message */ 54 | #define LWIP_DBG_OFF 0x00U 55 | 56 | /** flag for LWIP_DEBUGF indicating a tracing message (to follow program flow) */ 57 | #define LWIP_DBG_TRACE 0x40U 58 | /** flag for LWIP_DEBUGF indicating a state debug message (to follow module states) */ 59 | #define LWIP_DBG_STATE 0x20U 60 | /** flag for LWIP_DEBUGF indicating newly added code, not thoroughly tested yet */ 61 | #define LWIP_DBG_FRESH 0x10U 62 | /** flag for LWIP_DEBUGF to halt after printing this debug message */ 63 | #define LWIP_DBG_HALT 0x08U 64 | 65 | #ifndef LWIP_NOASSERT 66 | #define LWIP_ASSERT(message, assertion) do { if(!(assertion)) \ 67 | LWIP_PLATFORM_ASSERT(message); } while(0) 68 | #else /* LWIP_NOASSERT */ 69 | #define LWIP_ASSERT(message, assertion) 70 | #endif /* LWIP_NOASSERT */ 71 | 72 | /** if "expression" isn't true, then print "message" and execute "handler" expression */ 73 | #ifndef LWIP_ERROR 74 | #define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \ 75 | handler;}} while(0) 76 | #endif /* LWIP_ERROR */ 77 | 78 | #ifdef LWIP_DEBUG 79 | /** print debug message only if debug message type is enabled... 80 | * AND is of correct type AND is at least LWIP_DBG_LEVEL 81 | */ 82 | #define LWIP_DEBUGF(debug, message) do { \ 83 | if ( \ 84 | ((debug) & LWIP_DBG_ON) && \ 85 | ((debug) & LWIP_DBG_TYPES_ON) && \ 86 | ((s16_t)((debug) & LWIP_DBG_MASK_LEVEL) >= LWIP_DBG_MIN_LEVEL)) { \ 87 | LWIP_PLATFORM_DIAG(message); \ 88 | if ((debug) & LWIP_DBG_HALT) { \ 89 | while(1); \ 90 | } \ 91 | } \ 92 | } while(0) 93 | 94 | #else /* LWIP_DEBUG */ 95 | #define LWIP_DEBUGF(debug, message) 96 | #endif /* LWIP_DEBUG */ 97 | 98 | #endif /* __LWIP_DEBUG_H__ */ 99 | 100 | -------------------------------------------------------------------------------- /Source/LwIP/src/include/lwip/def.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __LWIP_DEF_H__ 33 | #define __LWIP_DEF_H__ 34 | 35 | /* arch.h might define NULL already */ 36 | #include "lwip/arch.h" 37 | #include "lwip/opt.h" 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | #define LWIP_MAX(x , y) (((x) > (y)) ? (x) : (y)) 44 | #define LWIP_MIN(x , y) (((x) < (y)) ? (x) : (y)) 45 | 46 | #ifndef NULL 47 | #define NULL ((void *)0) 48 | #endif 49 | 50 | /* Endianess-optimized shifting of two u8_t to create one u16_t */ 51 | #if BYTE_ORDER == LITTLE_ENDIAN 52 | #define LWIP_MAKE_U16(a, b) ((a << 8) | b) 53 | #else 54 | #define LWIP_MAKE_U16(a, b) ((b << 8) | a) 55 | #endif 56 | 57 | #ifndef LWIP_PLATFORM_BYTESWAP 58 | #define LWIP_PLATFORM_BYTESWAP 0 59 | #endif 60 | 61 | #ifndef LWIP_PREFIX_BYTEORDER_FUNCS 62 | /* workaround for naming collisions on some platforms */ 63 | 64 | #ifdef htons 65 | #undef htons 66 | #endif /* htons */ 67 | #ifdef htonl 68 | #undef htonl 69 | #endif /* htonl */ 70 | #ifdef ntohs 71 | #undef ntohs 72 | #endif /* ntohs */ 73 | #ifdef ntohl 74 | #undef ntohl 75 | #endif /* ntohl */ 76 | 77 | #define htons(x) lwip_htons(x) 78 | #define ntohs(x) lwip_ntohs(x) 79 | #define htonl(x) lwip_htonl(x) 80 | #define ntohl(x) lwip_ntohl(x) 81 | #endif /* LWIP_PREFIX_BYTEORDER_FUNCS */ 82 | 83 | #if BYTE_ORDER == BIG_ENDIAN 84 | #define lwip_htons(x) (x) 85 | #define lwip_ntohs(x) (x) 86 | #define lwip_htonl(x) (x) 87 | #define lwip_ntohl(x) (x) 88 | #define PP_HTONS(x) (x) 89 | #define PP_NTOHS(x) (x) 90 | #define PP_HTONL(x) (x) 91 | #define PP_NTOHL(x) (x) 92 | #else /* BYTE_ORDER != BIG_ENDIAN */ 93 | #if LWIP_PLATFORM_BYTESWAP 94 | #define lwip_htons(x) LWIP_PLATFORM_HTONS(x) 95 | #define lwip_ntohs(x) LWIP_PLATFORM_HTONS(x) 96 | #define lwip_htonl(x) LWIP_PLATFORM_HTONL(x) 97 | #define lwip_ntohl(x) LWIP_PLATFORM_HTONL(x) 98 | #else /* LWIP_PLATFORM_BYTESWAP */ 99 | u16_t lwip_htons(u16_t x); 100 | u16_t lwip_ntohs(u16_t x); 101 | u32_t lwip_htonl(u32_t x); 102 | u32_t lwip_ntohl(u32_t x); 103 | #endif /* LWIP_PLATFORM_BYTESWAP */ 104 | 105 | /* These macros should be calculated by the preprocessor and are used 106 | with compile-time constants only (so that there is no little-endian 107 | overhead at runtime). */ 108 | #define PP_HTONS(x) ((((x) & 0xff) << 8) | (((x) & 0xff00) >> 8)) 109 | #define PP_NTOHS(x) PP_HTONS(x) 110 | #define PP_HTONL(x) ((((x) & 0xff) << 24) | \ 111 | (((x) & 0xff00) << 8) | \ 112 | (((x) & 0xff0000UL) >> 8) | \ 113 | (((x) & 0xff000000UL) >> 24)) 114 | #define PP_NTOHL(x) PP_HTONL(x) 115 | 116 | #endif /* BYTE_ORDER == BIG_ENDIAN */ 117 | 118 | #ifdef __cplusplus 119 | } 120 | #endif 121 | 122 | #endif /* __LWIP_DEF_H__ */ 123 | 124 | -------------------------------------------------------------------------------- /Source/LwIP/src/include/lwip/err.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __LWIP_ERR_H__ 33 | #define __LWIP_ERR_H__ 34 | 35 | #include "lwip/opt.h" 36 | #include "lwip/arch.h" 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /** Define LWIP_ERR_T in cc.h if you want to use 43 | * a different type for your platform (must be signed). */ 44 | #ifdef LWIP_ERR_T 45 | typedef LWIP_ERR_T err_t; 46 | #else /* LWIP_ERR_T */ 47 | typedef s8_t err_t; 48 | #endif /* LWIP_ERR_T*/ 49 | 50 | /* Definitions for error constants. */ 51 | 52 | #define ERR_OK 0 /* No error, everything OK. */ 53 | #define ERR_MEM -1 /* Out of memory error. */ 54 | #define ERR_BUF -2 /* Buffer error. */ 55 | #define ERR_TIMEOUT -3 /* Timeout. */ 56 | #define ERR_RTE -4 /* Routing problem. */ 57 | #define ERR_INPROGRESS -5 /* Operation in progress */ 58 | #define ERR_VAL -6 /* Illegal value. */ 59 | #define ERR_WOULDBLOCK -7 /* Operation would block. */ 60 | #define ERR_USE -8 /* Address in use. */ 61 | #define ERR_ISCONN -9 /* Already connected. */ 62 | 63 | #define ERR_IS_FATAL(e) ((e) < ERR_ISCONN) 64 | 65 | #define ERR_ABRT -10 /* Connection aborted. */ 66 | #define ERR_RST -11 /* Connection reset. */ 67 | #define ERR_CLSD -12 /* Connection closed. */ 68 | #define ERR_CONN -13 /* Not connected. */ 69 | 70 | #define ERR_ARG -14 /* Illegal argument. */ 71 | 72 | #define ERR_IF -15 /* Low-level netif error */ 73 | 74 | 75 | #ifdef LWIP_DEBUG 76 | extern const char *lwip_strerr(err_t err); 77 | #else 78 | #define lwip_strerr(x) "" 79 | #endif /* LWIP_DEBUG */ 80 | 81 | #ifdef __cplusplus 82 | } 83 | #endif 84 | 85 | #endif /* __LWIP_ERR_H__ */ 86 | -------------------------------------------------------------------------------- /Source/LwIP/src/include/lwip/init.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __LWIP_INIT_H__ 33 | #define __LWIP_INIT_H__ 34 | 35 | #include "lwip/opt.h" 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | /** X.x.x: Major version of the stack */ 42 | #define LWIP_VERSION_MAJOR 1U 43 | /** x.X.x: Minor version of the stack */ 44 | #define LWIP_VERSION_MINOR 4U 45 | /** x.x.X: Revision of the stack */ 46 | #define LWIP_VERSION_REVISION 1U 47 | /** For release candidates, this is set to 1..254 48 | * For official releases, this is set to 255 (LWIP_RC_RELEASE) 49 | * For development versions (CVS), this is set to 0 (LWIP_RC_DEVELOPMENT) */ 50 | #define LWIP_VERSION_RC 255U 51 | 52 | /** LWIP_VERSION_RC is set to LWIP_RC_RELEASE for official releases */ 53 | #define LWIP_RC_RELEASE 255U 54 | /** LWIP_VERSION_RC is set to LWIP_RC_DEVELOPMENT for CVS versions */ 55 | #define LWIP_RC_DEVELOPMENT 0U 56 | 57 | #define LWIP_VERSION_IS_RELEASE (LWIP_VERSION_RC == LWIP_RC_RELEASE) 58 | #define LWIP_VERSION_IS_DEVELOPMENT (LWIP_VERSION_RC == LWIP_RC_DEVELOPMENT) 59 | #define LWIP_VERSION_IS_RC ((LWIP_VERSION_RC != LWIP_RC_RELEASE) && (LWIP_VERSION_RC != LWIP_RC_DEVELOPMENT)) 60 | 61 | /** Provides the version of the stack */ 62 | #define LWIP_VERSION (LWIP_VERSION_MAJOR << 24 | LWIP_VERSION_MINOR << 16 | \ 63 | LWIP_VERSION_REVISION << 8 | LWIP_VERSION_RC) 64 | 65 | /* Modules initialization */ 66 | void lwip_init(void); 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | 72 | #endif /* __LWIP_INIT_H__ */ 73 | -------------------------------------------------------------------------------- /Source/LwIP/src/include/lwip/mem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __LWIP_MEM_H__ 33 | #define __LWIP_MEM_H__ 34 | 35 | #include "lwip/opt.h" 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | #if MEM_LIBC_MALLOC 42 | 43 | 44 | typedef size_t mem_size_t; 45 | #define MEM_SIZE_F SZT_F 46 | 47 | /* aliases for C library malloc() */ 48 | #define mem_init() 49 | /* in case C library malloc() needs extra protection, 50 | * allow these defines to be overridden. 51 | */ 52 | #ifndef mem_free 53 | #define mem_free free 54 | #endif 55 | #ifndef mem_malloc 56 | #define mem_malloc malloc 57 | #endif 58 | #ifndef mem_calloc 59 | #define mem_calloc calloc 60 | #endif 61 | /* Since there is no C library allocation function to shrink memory without 62 | moving it, define this to nothing. */ 63 | #ifndef mem_trim 64 | #define mem_trim(mem, size) (mem) 65 | #endif 66 | #else /* MEM_LIBC_MALLOC */ 67 | 68 | /* MEM_SIZE would have to be aligned, but using 64000 here instead of 69 | * 65535 leaves some room for alignment... 70 | */ 71 | #if MEM_SIZE > 64000L 72 | typedef u32_t mem_size_t; 73 | #define MEM_SIZE_F U32_F 74 | #else 75 | typedef u16_t mem_size_t; 76 | #define MEM_SIZE_F U16_F 77 | #endif /* MEM_SIZE > 64000 */ 78 | 79 | #if MEM_USE_POOLS 80 | /** mem_init is not used when using pools instead of a heap */ 81 | #define mem_init() 82 | /** mem_trim is not used when using pools instead of a heap: 83 | we can't free part of a pool element and don't want to copy the rest */ 84 | #define mem_trim(mem, size) (mem) 85 | #else /* MEM_USE_POOLS */ 86 | /* lwIP alternative malloc */ 87 | void mem_init(void); 88 | void *mem_trim(void *mem, mem_size_t size); 89 | #endif /* MEM_USE_POOLS */ 90 | void *mem_malloc(mem_size_t size); 91 | void *mem_calloc(mem_size_t count, mem_size_t size); 92 | void mem_free(void *mem); 93 | #endif /* MEM_LIBC_MALLOC */ 94 | 95 | /** Calculate memory size for an aligned buffer - returns the next highest 96 | * multiple of MEM_ALIGNMENT (e.g. LWIP_MEM_ALIGN_SIZE(3) and 97 | * LWIP_MEM_ALIGN_SIZE(4) will both yield 4 for MEM_ALIGNMENT == 4). 98 | */ 99 | #ifndef LWIP_MEM_ALIGN_SIZE 100 | #define LWIP_MEM_ALIGN_SIZE(size) (((size) + MEM_ALIGNMENT - 1) & ~(MEM_ALIGNMENT-1)) 101 | #endif 102 | 103 | /** Calculate safe memory size for an aligned buffer when using an unaligned 104 | * type as storage. This includes a safety-margin on (MEM_ALIGNMENT - 1) at the 105 | * start (e.g. if buffer is u8_t[] and actual data will be u32_t*) 106 | */ 107 | #ifndef LWIP_MEM_ALIGN_BUFFER 108 | #define LWIP_MEM_ALIGN_BUFFER(size) (((size) + MEM_ALIGNMENT - 1)) 109 | #endif 110 | 111 | /** Align a memory pointer to the alignment defined by MEM_ALIGNMENT 112 | * so that ADDR % MEM_ALIGNMENT == 0 113 | */ 114 | #ifndef LWIP_MEM_ALIGN 115 | #define LWIP_MEM_ALIGN(addr) ((void *)(((mem_ptr_t)(addr) + MEM_ALIGNMENT - 1) & ~(mem_ptr_t)(MEM_ALIGNMENT-1))) 116 | #endif 117 | 118 | #ifdef __cplusplus 119 | } 120 | #endif 121 | 122 | #endif /* __LWIP_MEM_H__ */ 123 | -------------------------------------------------------------------------------- /Source/LwIP/src/include/lwip/memp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | 33 | #ifndef __LWIP_MEMP_H__ 34 | #define __LWIP_MEMP_H__ 35 | 36 | #include "lwip/opt.h" 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /* Create the list of all memory pools managed by memp. MEMP_MAX represents a NULL pool at the end */ 43 | typedef enum { 44 | #define LWIP_MEMPOOL(name,num,size,desc) MEMP_##name, 45 | #include "lwip/memp_std.h" 46 | MEMP_MAX 47 | } memp_t; 48 | 49 | #if MEM_USE_POOLS 50 | /* Use a helper type to get the start and end of the user "memory pools" for mem_malloc */ 51 | typedef enum { 52 | /* Get the first (via: 53 | MEMP_POOL_HELPER_START = ((u8_t) 1*MEMP_POOL_A + 0*MEMP_POOL_B + 0*MEMP_POOL_C + 0)*/ 54 | MEMP_POOL_HELPER_FIRST = ((u8_t) 55 | #define LWIP_MEMPOOL(name,num,size,desc) 56 | #define LWIP_MALLOC_MEMPOOL_START 1 57 | #define LWIP_MALLOC_MEMPOOL(num, size) * MEMP_POOL_##size + 0 58 | #define LWIP_MALLOC_MEMPOOL_END 59 | #include "lwip/memp_std.h" 60 | ) , 61 | /* Get the last (via: 62 | MEMP_POOL_HELPER_END = ((u8_t) 0 + MEMP_POOL_A*0 + MEMP_POOL_B*0 + MEMP_POOL_C*1) */ 63 | MEMP_POOL_HELPER_LAST = ((u8_t) 64 | #define LWIP_MEMPOOL(name,num,size,desc) 65 | #define LWIP_MALLOC_MEMPOOL_START 66 | #define LWIP_MALLOC_MEMPOOL(num, size) 0 + MEMP_POOL_##size * 67 | #define LWIP_MALLOC_MEMPOOL_END 1 68 | #include "lwip/memp_std.h" 69 | ) 70 | } memp_pool_helper_t; 71 | 72 | /* The actual start and stop values are here (cast them over) 73 | We use this helper type and these defines so we can avoid using const memp_t values */ 74 | #define MEMP_POOL_FIRST ((memp_t) MEMP_POOL_HELPER_FIRST) 75 | #define MEMP_POOL_LAST ((memp_t) MEMP_POOL_HELPER_LAST) 76 | #endif /* MEM_USE_POOLS */ 77 | 78 | #if MEMP_MEM_MALLOC || MEM_USE_POOLS 79 | extern const u16_t memp_sizes[MEMP_MAX]; 80 | #endif /* MEMP_MEM_MALLOC || MEM_USE_POOLS */ 81 | 82 | #if MEMP_MEM_MALLOC 83 | 84 | #include "mem.h" 85 | 86 | #define memp_init() 87 | #define memp_malloc(type) mem_malloc(memp_sizes[type]) 88 | #define memp_free(type, mem) mem_free(mem) 89 | 90 | #else /* MEMP_MEM_MALLOC */ 91 | 92 | #if MEM_USE_POOLS 93 | /** This structure is used to save the pool one element came from. */ 94 | struct memp_malloc_helper 95 | { 96 | memp_t poolnr; 97 | }; 98 | #endif /* MEM_USE_POOLS */ 99 | 100 | void memp_init(void); 101 | 102 | #if MEMP_OVERFLOW_CHECK 103 | void *memp_malloc_fn(memp_t type, const char* file, const int line); 104 | #define memp_malloc(t) memp_malloc_fn((t), __FILE__, __LINE__) 105 | #else 106 | void *memp_malloc(memp_t type); 107 | #endif 108 | void memp_free(memp_t type, void *mem); 109 | 110 | #endif /* MEMP_MEM_MALLOC */ 111 | 112 | #ifdef __cplusplus 113 | } 114 | #endif 115 | 116 | #endif /* __LWIP_MEMP_H__ */ 117 | -------------------------------------------------------------------------------- /Source/LwIP/src/include/lwip/netbuf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __LWIP_NETBUF_H__ 33 | #define __LWIP_NETBUF_H__ 34 | 35 | #include "lwip/opt.h" 36 | #include "lwip/pbuf.h" 37 | #include "lwip/ip_addr.h" 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | /** This netbuf has dest-addr/port set */ 44 | #define NETBUF_FLAG_DESTADDR 0x01 45 | /** This netbuf includes a checksum */ 46 | #define NETBUF_FLAG_CHKSUM 0x02 47 | 48 | struct netbuf { 49 | struct pbuf *p, *ptr; 50 | ip_addr_t addr; 51 | u16_t port; 52 | #if LWIP_NETBUF_RECVINFO || LWIP_CHECKSUM_ON_COPY 53 | #if LWIP_CHECKSUM_ON_COPY 54 | u8_t flags; 55 | #endif /* LWIP_CHECKSUM_ON_COPY */ 56 | u16_t toport_chksum; 57 | #if LWIP_NETBUF_RECVINFO 58 | ip_addr_t toaddr; 59 | #endif /* LWIP_NETBUF_RECVINFO */ 60 | #endif /* LWIP_NETBUF_RECVINFO || LWIP_CHECKSUM_ON_COPY */ 61 | }; 62 | 63 | /* Network buffer functions: */ 64 | struct netbuf * netbuf_new (void); 65 | void netbuf_delete (struct netbuf *buf); 66 | void * netbuf_alloc (struct netbuf *buf, u16_t size); 67 | void netbuf_free (struct netbuf *buf); 68 | err_t netbuf_ref (struct netbuf *buf, 69 | const void *dataptr, u16_t size); 70 | void netbuf_chain (struct netbuf *head, 71 | struct netbuf *tail); 72 | 73 | err_t netbuf_data (struct netbuf *buf, 74 | void **dataptr, u16_t *len); 75 | s8_t netbuf_next (struct netbuf *buf); 76 | void netbuf_first (struct netbuf *buf); 77 | 78 | 79 | #define netbuf_copy_partial(buf, dataptr, len, offset) \ 80 | pbuf_copy_partial((buf)->p, (dataptr), (len), (offset)) 81 | #define netbuf_copy(buf,dataptr,len) netbuf_copy_partial(buf, dataptr, len, 0) 82 | #define netbuf_take(buf, dataptr, len) pbuf_take((buf)->p, dataptr, len) 83 | #define netbuf_len(buf) ((buf)->p->tot_len) 84 | #define netbuf_fromaddr(buf) (&((buf)->addr)) 85 | #define netbuf_set_fromaddr(buf, fromaddr) ip_addr_set((&(buf)->addr), fromaddr) 86 | #define netbuf_fromport(buf) ((buf)->port) 87 | #if LWIP_NETBUF_RECVINFO 88 | #define netbuf_destaddr(buf) (&((buf)->toaddr)) 89 | #define netbuf_set_destaddr(buf, destaddr) ip_addr_set((&(buf)->addr), destaddr) 90 | #define netbuf_destport(buf) (((buf)->flags & NETBUF_FLAG_DESTADDR) ? (buf)->toport_chksum : 0) 91 | #endif /* LWIP_NETBUF_RECVINFO */ 92 | #if LWIP_CHECKSUM_ON_COPY 93 | #define netbuf_set_chksum(buf, chksum) do { (buf)->flags = NETBUF_FLAG_CHKSUM; \ 94 | (buf)->toport_chksum = chksum; } while(0) 95 | #endif /* LWIP_CHECKSUM_ON_COPY */ 96 | 97 | #ifdef __cplusplus 98 | } 99 | #endif 100 | 101 | #endif /* __LWIP_NETBUF_H__ */ 102 | -------------------------------------------------------------------------------- /Source/LwIP/src/include/lwip/netdb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Redistribution and use in source and binary forms, with or without modification, 3 | * are permitted provided that the following conditions are met: 4 | * 5 | * 1. Redistributions of source code must retain the above copyright notice, 6 | * this list of conditions and the following disclaimer. 7 | * 2. Redistributions in binary form must reproduce the above copyright notice, 8 | * this list of conditions and the following disclaimer in the documentation 9 | * and/or other materials provided with the distribution. 10 | * 3. The name of the author may not be used to endorse or promote products 11 | * derived from this software without specific prior written permission. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 14 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 16 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 18 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 19 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 20 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 21 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 22 | * OF SUCH DAMAGE. 23 | * 24 | * This file is part of the lwIP TCP/IP stack. 25 | * 26 | * Author: Simon Goldschmidt 27 | * 28 | */ 29 | #ifndef __LWIP_NETDB_H__ 30 | #define __LWIP_NETDB_H__ 31 | 32 | #include "lwip/opt.h" 33 | 34 | #if LWIP_DNS && LWIP_SOCKET 35 | 36 | 37 | #include "lwip/inet.h" 38 | #include "lwip/sockets.h" 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | /* some rarely used options */ 45 | #ifndef LWIP_DNS_API_DECLARE_H_ERRNO 46 | #define LWIP_DNS_API_DECLARE_H_ERRNO 1 47 | #endif 48 | 49 | #ifndef LWIP_DNS_API_DEFINE_ERRORS 50 | #define LWIP_DNS_API_DEFINE_ERRORS 1 51 | #endif 52 | 53 | #ifndef LWIP_DNS_API_DECLARE_STRUCTS 54 | #define LWIP_DNS_API_DECLARE_STRUCTS 1 55 | #endif 56 | 57 | #if LWIP_DNS_API_DEFINE_ERRORS 58 | /** Errors used by the DNS API functions, h_errno can be one of them */ 59 | #define EAI_NONAME 200 60 | #define EAI_SERVICE 201 61 | #define EAI_FAIL 202 62 | #define EAI_MEMORY 203 63 | 64 | #define HOST_NOT_FOUND 210 65 | #define NO_DATA 211 66 | #define NO_RECOVERY 212 67 | #define TRY_AGAIN 213 68 | #endif /* LWIP_DNS_API_DEFINE_ERRORS */ 69 | 70 | #if LWIP_DNS_API_DECLARE_STRUCTS 71 | struct hostent { 72 | char *h_name; /* Official name of the host. */ 73 | char **h_aliases; /* A pointer to an array of pointers to alternative host names, 74 | terminated by a null pointer. */ 75 | int h_addrtype; /* Address type. */ 76 | int h_length; /* The length, in bytes, of the address. */ 77 | char **h_addr_list; /* A pointer to an array of pointers to network addresses (in 78 | network byte order) for the host, terminated by a null pointer. */ 79 | #define h_addr h_addr_list[0] /* for backward compatibility */ 80 | }; 81 | 82 | struct addrinfo { 83 | int ai_flags; /* Input flags. */ 84 | int ai_family; /* Address family of socket. */ 85 | int ai_socktype; /* Socket type. */ 86 | int ai_protocol; /* Protocol of socket. */ 87 | socklen_t ai_addrlen; /* Length of socket address. */ 88 | struct sockaddr *ai_addr; /* Socket address of socket. */ 89 | char *ai_canonname; /* Canonical name of service location. */ 90 | struct addrinfo *ai_next; /* Pointer to next in list. */ 91 | }; 92 | #endif /* LWIP_DNS_API_DECLARE_STRUCTS */ 93 | 94 | #if LWIP_DNS_API_DECLARE_H_ERRNO 95 | /* application accessable error code set by the DNS API functions */ 96 | extern int h_errno; 97 | #endif /* LWIP_DNS_API_DECLARE_H_ERRNO*/ 98 | 99 | struct hostent *lwip_gethostbyname(const char *name); 100 | int lwip_gethostbyname_r(const char *name, struct hostent *ret, char *buf, 101 | size_t buflen, struct hostent **result, int *h_errnop); 102 | void lwip_freeaddrinfo(struct addrinfo *ai); 103 | int lwip_getaddrinfo(const char *nodename, 104 | const char *servname, 105 | const struct addrinfo *hints, 106 | struct addrinfo **res); 107 | 108 | #if LWIP_COMPAT_SOCKETS 109 | #define gethostbyname(name) lwip_gethostbyname(name) 110 | #define gethostbyname_r(name, ret, buf, buflen, result, h_errnop) \ 111 | lwip_gethostbyname_r(name, ret, buf, buflen, result, h_errnop) 112 | #define freeaddrinfo(addrinfo) lwip_freeaddrinfo(addrinfo) 113 | #define getaddrinfo(nodname, servname, hints, res) \ 114 | lwip_getaddrinfo(nodname, servname, hints, res) 115 | #endif /* LWIP_COMPAT_SOCKETS */ 116 | 117 | #ifdef __cplusplus 118 | } 119 | #endif 120 | 121 | #endif /* LWIP_DNS && LWIP_SOCKET */ 122 | 123 | #endif /* __LWIP_NETDB_H__ */ 124 | -------------------------------------------------------------------------------- /Source/LwIP/src/include/lwip/netifapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Redistribution and use in source and binary forms, with or without modification, 3 | * are permitted provided that the following conditions are met: 4 | * 5 | * 1. Redistributions of source code must retain the above copyright notice, 6 | * this list of conditions and the following disclaimer. 7 | * 2. Redistributions in binary form must reproduce the above copyright notice, 8 | * this list of conditions and the following disclaimer in the documentation 9 | * and/or other materials provided with the distribution. 10 | * 3. The name of the author may not be used to endorse or promote products 11 | * derived from this software without specific prior written permission. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 14 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 16 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 18 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 19 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 20 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 21 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 22 | * OF SUCH DAMAGE. 23 | * 24 | * This file is part of the lwIP TCP/IP stack. 25 | * 26 | */ 27 | 28 | #ifndef __LWIP_NETIFAPI_H__ 29 | #define __LWIP_NETIFAPI_H__ 30 | 31 | #include "lwip/opt.h" 32 | 33 | #if LWIP_NETIF_API /* don't build if not configured for use in lwipopts.h */ 34 | 35 | #include "lwip/sys.h" 36 | #include "lwip/netif.h" 37 | #include "lwip/dhcp.h" 38 | #include "lwip/autoip.h" 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | typedef void (*netifapi_void_fn)(struct netif *netif); 45 | typedef err_t (*netifapi_errt_fn)(struct netif *netif); 46 | 47 | struct netifapi_msg_msg { 48 | #if !LWIP_TCPIP_CORE_LOCKING 49 | sys_sem_t sem; 50 | #endif /* !LWIP_TCPIP_CORE_LOCKING */ 51 | err_t err; 52 | struct netif *netif; 53 | union { 54 | struct { 55 | ip_addr_t *ipaddr; 56 | ip_addr_t *netmask; 57 | ip_addr_t *gw; 58 | void *state; 59 | netif_init_fn init; 60 | netif_input_fn input; 61 | } add; 62 | struct { 63 | netifapi_void_fn voidfunc; 64 | netifapi_errt_fn errtfunc; 65 | } common; 66 | } msg; 67 | }; 68 | 69 | struct netifapi_msg { 70 | void (* function)(struct netifapi_msg_msg *msg); 71 | struct netifapi_msg_msg msg; 72 | }; 73 | 74 | 75 | /* API for application */ 76 | err_t netifapi_netif_add ( struct netif *netif, 77 | ip_addr_t *ipaddr, 78 | ip_addr_t *netmask, 79 | ip_addr_t *gw, 80 | void *state, 81 | netif_init_fn init, 82 | netif_input_fn input); 83 | 84 | err_t netifapi_netif_set_addr ( struct netif *netif, 85 | ip_addr_t *ipaddr, 86 | ip_addr_t *netmask, 87 | ip_addr_t *gw ); 88 | 89 | err_t netifapi_netif_common ( struct netif *netif, 90 | netifapi_void_fn voidfunc, 91 | netifapi_errt_fn errtfunc); 92 | 93 | #define netifapi_netif_remove(n) netifapi_netif_common(n, netif_remove, NULL) 94 | #define netifapi_netif_set_up(n) netifapi_netif_common(n, netif_set_up, NULL) 95 | #define netifapi_netif_set_down(n) netifapi_netif_common(n, netif_set_down, NULL) 96 | #define netifapi_netif_set_default(n) netifapi_netif_common(n, netif_set_default, NULL) 97 | #define netifapi_dhcp_start(n) netifapi_netif_common(n, NULL, dhcp_start) 98 | #define netifapi_dhcp_stop(n) netifapi_netif_common(n, dhcp_stop, NULL) 99 | #define netifapi_autoip_start(n) netifapi_netif_common(n, NULL, autoip_start) 100 | #define netifapi_autoip_stop(n) netifapi_netif_common(n, NULL, autoip_stop) 101 | 102 | #ifdef __cplusplus 103 | } 104 | #endif 105 | 106 | #endif /* LWIP_NETIF_API */ 107 | 108 | #endif /* __LWIP_NETIFAPI_H__ */ 109 | -------------------------------------------------------------------------------- /Source/LwIP/src/include/lwip/raw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __LWIP_RAW_H__ 33 | #define __LWIP_RAW_H__ 34 | 35 | #include "lwip/opt.h" 36 | 37 | #if LWIP_RAW /* don't build if not configured for use in lwipopts.h */ 38 | 39 | #include "lwip/pbuf.h" 40 | #include "lwip/def.h" 41 | #include "lwip/ip.h" 42 | #include "lwip/ip_addr.h" 43 | 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif 47 | 48 | struct raw_pcb; 49 | 50 | /** Function prototype for raw pcb receive callback functions. 51 | * @param arg user supplied argument (raw_pcb.recv_arg) 52 | * @param pcb the raw_pcb which received data 53 | * @param p the packet buffer that was received 54 | * @param addr the remote IP address from which the packet was received 55 | * @return 1 if the packet was 'eaten' (aka. deleted), 56 | * 0 if the packet lives on 57 | * If returning 1, the callback is responsible for freeing the pbuf 58 | * if it's not used any more. 59 | */ 60 | typedef u8_t (*raw_recv_fn)(void *arg, struct raw_pcb *pcb, struct pbuf *p, 61 | ip_addr_t *addr); 62 | 63 | struct raw_pcb { 64 | /* Common members of all PCB types */ 65 | IP_PCB; 66 | 67 | struct raw_pcb *next; 68 | 69 | u8_t protocol; 70 | 71 | /** receive callback function */ 72 | raw_recv_fn recv; 73 | /* user-supplied argument for the recv callback */ 74 | void *recv_arg; 75 | }; 76 | 77 | /* The following functions is the application layer interface to the 78 | RAW code. */ 79 | struct raw_pcb * raw_new (u8_t proto); 80 | void raw_remove (struct raw_pcb *pcb); 81 | err_t raw_bind (struct raw_pcb *pcb, ip_addr_t *ipaddr); 82 | err_t raw_connect (struct raw_pcb *pcb, ip_addr_t *ipaddr); 83 | 84 | void raw_recv (struct raw_pcb *pcb, raw_recv_fn recv, void *recv_arg); 85 | err_t raw_sendto (struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *ipaddr); 86 | err_t raw_send (struct raw_pcb *pcb, struct pbuf *p); 87 | 88 | /* The following functions are the lower layer interface to RAW. */ 89 | u8_t raw_input (struct pbuf *p, struct netif *inp); 90 | #define raw_init() /* Compatibility define, not init needed. */ 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | #endif /* LWIP_RAW */ 97 | 98 | #endif /* __LWIP_RAW_H__ */ 99 | -------------------------------------------------------------------------------- /Source/LwIP/src/include/lwip/sio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | */ 29 | 30 | /* 31 | * This is the interface to the platform specific serial IO module 32 | * It needs to be implemented by those platforms which need SLIP or PPP 33 | */ 34 | 35 | #ifndef __SIO_H__ 36 | #define __SIO_H__ 37 | 38 | #include "lwip/arch.h" 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | /* If you want to define sio_fd_t elsewhere or differently, 45 | define this in your cc.h file. */ 46 | #ifndef __sio_fd_t_defined 47 | typedef void * sio_fd_t; 48 | #endif 49 | 50 | /* The following functions can be defined to something else in your cc.h file 51 | or be implemented in your custom sio.c file. */ 52 | 53 | #ifndef sio_open 54 | /** 55 | * Opens a serial device for communication. 56 | * 57 | * @param devnum device number 58 | * @return handle to serial device if successful, NULL otherwise 59 | */ 60 | sio_fd_t sio_open(u8_t devnum); 61 | #endif 62 | 63 | #ifndef sio_send 64 | /** 65 | * Sends a single character to the serial device. 66 | * 67 | * @param c character to send 68 | * @param fd serial device handle 69 | * 70 | * @note This function will block until the character can be sent. 71 | */ 72 | void sio_send(u8_t c, sio_fd_t fd); 73 | #endif 74 | 75 | #ifndef sio_recv 76 | /** 77 | * Receives a single character from the serial device. 78 | * 79 | * @param fd serial device handle 80 | * 81 | * @note This function will block until a character is received. 82 | */ 83 | u8_t sio_recv(sio_fd_t fd); 84 | #endif 85 | 86 | #ifndef sio_read 87 | /** 88 | * Reads from the serial device. 89 | * 90 | * @param fd serial device handle 91 | * @param data pointer to data buffer for receiving 92 | * @param len maximum length (in bytes) of data to receive 93 | * @return number of bytes actually received - may be 0 if aborted by sio_read_abort 94 | * 95 | * @note This function will block until data can be received. The blocking 96 | * can be cancelled by calling sio_read_abort(). 97 | */ 98 | u32_t sio_read(sio_fd_t fd, u8_t *data, u32_t len); 99 | #endif 100 | 101 | #ifndef sio_tryread 102 | /** 103 | * Tries to read from the serial device. Same as sio_read but returns 104 | * immediately if no data is available and never blocks. 105 | * 106 | * @param fd serial device handle 107 | * @param data pointer to data buffer for receiving 108 | * @param len maximum length (in bytes) of data to receive 109 | * @return number of bytes actually received 110 | */ 111 | u32_t sio_tryread(sio_fd_t fd, u8_t *data, u32_t len); 112 | #endif 113 | 114 | #ifndef sio_write 115 | /** 116 | * Writes to the serial device. 117 | * 118 | * @param fd serial device handle 119 | * @param data pointer to data to send 120 | * @param len length (in bytes) of data to send 121 | * @return number of bytes actually sent 122 | * 123 | * @note This function will block until all data can be sent. 124 | */ 125 | u32_t sio_write(sio_fd_t fd, u8_t *data, u32_t len); 126 | #endif 127 | 128 | #ifndef sio_read_abort 129 | /** 130 | * Aborts a blocking sio_read() call. 131 | * 132 | * @param fd serial device handle 133 | */ 134 | void sio_read_abort(sio_fd_t fd); 135 | #endif 136 | 137 | #ifdef __cplusplus 138 | } 139 | #endif 140 | 141 | #endif /* __SIO_H__ */ 142 | -------------------------------------------------------------------------------- /Source/LwIP/src/include/lwip/snmp_asn1.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Abstract Syntax Notation One (ISO 8824, 8825) codec. 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands. 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 | * Author: Christiaan Simons 33 | */ 34 | 35 | #ifndef __LWIP_SNMP_ASN1_H__ 36 | #define __LWIP_SNMP_ASN1_H__ 37 | 38 | #include "lwip/opt.h" 39 | #include "lwip/err.h" 40 | #include "lwip/pbuf.h" 41 | #include "lwip/snmp.h" 42 | 43 | #if LWIP_SNMP 44 | 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | #define SNMP_ASN1_UNIV (0) /* (!0x80 | !0x40) */ 50 | #define SNMP_ASN1_APPLIC (0x40) /* (!0x80 | 0x40) */ 51 | #define SNMP_ASN1_CONTXT (0x80) /* ( 0x80 | !0x40) */ 52 | 53 | #define SNMP_ASN1_CONSTR (0x20) /* ( 0x20) */ 54 | #define SNMP_ASN1_PRIMIT (0) /* (!0x20) */ 55 | 56 | /* universal tags */ 57 | #define SNMP_ASN1_INTEG 2 58 | #define SNMP_ASN1_OC_STR 4 59 | #define SNMP_ASN1_NUL 5 60 | #define SNMP_ASN1_OBJ_ID 6 61 | #define SNMP_ASN1_SEQ 16 62 | 63 | /* application specific (SNMP) tags */ 64 | #define SNMP_ASN1_IPADDR 0 /* octet string size(4) */ 65 | #define SNMP_ASN1_COUNTER 1 /* u32_t */ 66 | #define SNMP_ASN1_GAUGE 2 /* u32_t */ 67 | #define SNMP_ASN1_TIMETICKS 3 /* u32_t */ 68 | #define SNMP_ASN1_OPAQUE 4 /* octet string */ 69 | 70 | /* context specific (SNMP) tags */ 71 | #define SNMP_ASN1_PDU_GET_REQ 0 72 | #define SNMP_ASN1_PDU_GET_NEXT_REQ 1 73 | #define SNMP_ASN1_PDU_GET_RESP 2 74 | #define SNMP_ASN1_PDU_SET_REQ 3 75 | #define SNMP_ASN1_PDU_TRAP 4 76 | 77 | err_t snmp_asn1_dec_type(struct pbuf *p, u16_t ofs, u8_t *type); 78 | err_t snmp_asn1_dec_length(struct pbuf *p, u16_t ofs, u8_t *octets_used, u16_t *length); 79 | err_t snmp_asn1_dec_u32t(struct pbuf *p, u16_t ofs, u16_t len, u32_t *value); 80 | err_t snmp_asn1_dec_s32t(struct pbuf *p, u16_t ofs, u16_t len, s32_t *value); 81 | err_t snmp_asn1_dec_oid(struct pbuf *p, u16_t ofs, u16_t len, struct snmp_obj_id *oid); 82 | err_t snmp_asn1_dec_raw(struct pbuf *p, u16_t ofs, u16_t len, u16_t raw_len, u8_t *raw); 83 | 84 | void snmp_asn1_enc_length_cnt(u16_t length, u8_t *octets_needed); 85 | void snmp_asn1_enc_u32t_cnt(u32_t value, u16_t *octets_needed); 86 | void snmp_asn1_enc_s32t_cnt(s32_t value, u16_t *octets_needed); 87 | void snmp_asn1_enc_oid_cnt(u8_t ident_len, s32_t *ident, u16_t *octets_needed); 88 | err_t snmp_asn1_enc_type(struct pbuf *p, u16_t ofs, u8_t type); 89 | err_t snmp_asn1_enc_length(struct pbuf *p, u16_t ofs, u16_t length); 90 | err_t snmp_asn1_enc_u32t(struct pbuf *p, u16_t ofs, u16_t octets_needed, u32_t value); 91 | err_t snmp_asn1_enc_s32t(struct pbuf *p, u16_t ofs, u16_t octets_needed, s32_t value); 92 | err_t snmp_asn1_enc_oid(struct pbuf *p, u16_t ofs, u8_t ident_len, s32_t *ident); 93 | err_t snmp_asn1_enc_raw(struct pbuf *p, u16_t ofs, u16_t raw_len, u8_t *raw); 94 | 95 | #ifdef __cplusplus 96 | } 97 | #endif 98 | 99 | #endif /* LWIP_SNMP */ 100 | 101 | #endif /* __LWIP_SNMP_ASN1_H__ */ 102 | -------------------------------------------------------------------------------- /Source/LwIP/src/include/lwip/timers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * Simon Goldschmidt 31 | * 32 | */ 33 | #ifndef __LWIP_TIMERS_H__ 34 | #define __LWIP_TIMERS_H__ 35 | 36 | #include "lwip/opt.h" 37 | 38 | /* Timers are not supported when NO_SYS==1 and NO_SYS_NO_TIMERS==1 */ 39 | #define LWIP_TIMERS (!NO_SYS || (NO_SYS && !NO_SYS_NO_TIMERS)) 40 | 41 | #if LWIP_TIMERS 42 | 43 | #include "lwip/err.h" 44 | #if !NO_SYS 45 | #include "lwip/sys.h" 46 | #endif 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | #ifndef LWIP_DEBUG_TIMERNAMES 53 | #ifdef LWIP_DEBUG 54 | #define LWIP_DEBUG_TIMERNAMES SYS_DEBUG 55 | #else /* LWIP_DEBUG */ 56 | #define LWIP_DEBUG_TIMERNAMES 0 57 | #endif /* LWIP_DEBUG*/ 58 | #endif 59 | 60 | /** Function prototype for a timeout callback function. Register such a function 61 | * using sys_timeout(). 62 | * 63 | * @param arg Additional argument to pass to the function - set up by sys_timeout() 64 | */ 65 | typedef void (* sys_timeout_handler)(void *arg); 66 | 67 | struct sys_timeo { 68 | struct sys_timeo *next; 69 | u32_t time; 70 | sys_timeout_handler h; 71 | void *arg; 72 | #if LWIP_DEBUG_TIMERNAMES 73 | const char* handler_name; 74 | #endif /* LWIP_DEBUG_TIMERNAMES */ 75 | }; 76 | 77 | void sys_timeouts_init(void); 78 | 79 | #if LWIP_DEBUG_TIMERNAMES 80 | void sys_timeout_debug(u32_t msecs, sys_timeout_handler handler, void *arg, const char* handler_name); 81 | #define sys_timeout(msecs, handler, arg) sys_timeout_debug(msecs, handler, arg, #handler) 82 | #else /* LWIP_DEBUG_TIMERNAMES */ 83 | void sys_timeout(u32_t msecs, sys_timeout_handler handler, void *arg); 84 | #endif /* LWIP_DEBUG_TIMERNAMES */ 85 | 86 | void sys_untimeout(sys_timeout_handler handler, void *arg); 87 | #if NO_SYS 88 | void sys_check_timeouts(void); 89 | void sys_restart_timeouts(void); 90 | #else /* NO_SYS */ 91 | void sys_timeouts_mbox_fetch(sys_mbox_t *mbox, void **msg); 92 | #endif /* NO_SYS */ 93 | 94 | 95 | #ifdef __cplusplus 96 | } 97 | #endif 98 | 99 | #endif /* LWIP_TIMERS */ 100 | #endif /* __LWIP_TIMERS_H__ */ 101 | -------------------------------------------------------------------------------- /Source/LwIP/src/include/netif/slipif.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001, Swedish Institute of Computer Science. 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 | * 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. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | * Author: Adam Dunkels 32 | * 33 | */ 34 | #ifndef __NETIF_SLIPIF_H__ 35 | #define __NETIF_SLIPIF_H__ 36 | 37 | #include "lwip/opt.h" 38 | #include "lwip/netif.h" 39 | 40 | /** Set this to 1 to start a thread that blocks reading on the serial line 41 | * (using sio_read()). 42 | */ 43 | #ifndef SLIP_USE_RX_THREAD 44 | #define SLIP_USE_RX_THREAD !NO_SYS 45 | #endif 46 | 47 | /** Set this to 1 to enable functions to pass in RX bytes from ISR context. 48 | * If enabled, slipif_received_byte[s]() process incoming bytes and put assembled 49 | * packets on a queue, which is fed into lwIP from slipif_poll(). 50 | * If disabled, slipif_poll() polls the serila line (using sio_tryread()). 51 | */ 52 | #ifndef SLIP_RX_FROM_ISR 53 | #define SLIP_RX_FROM_ISR 0 54 | #endif 55 | 56 | /** Set this to 1 (default for SLIP_RX_FROM_ISR) to queue incoming packets 57 | * received by slipif_received_byte[s]() as long as PBUF_POOL pbufs are available. 58 | * If disabled, packets will be dropped if more than one packet is received. 59 | */ 60 | #ifndef SLIP_RX_QUEUE 61 | #define SLIP_RX_QUEUE SLIP_RX_FROM_ISR 62 | #endif 63 | 64 | #ifdef __cplusplus 65 | extern "C" { 66 | #endif 67 | 68 | err_t slipif_init(struct netif * netif); 69 | void slipif_poll(struct netif *netif); 70 | #if SLIP_RX_FROM_ISR 71 | void slipif_process_rxqueue(struct netif *netif); 72 | void slipif_received_byte(struct netif *netif, u8_t data); 73 | void slipif_received_bytes(struct netif *netif, u8_t *data, u8_t len); 74 | #endif /* SLIP_RX_FROM_ISR */ 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | 80 | #endif 81 | 82 | -------------------------------------------------------------------------------- /Source/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 | etharp.c 6 | Implements the ARP (Address Resolution Protocol) over 7 | Ethernet. The code in this file should be used together with 8 | Ethernet device drivers. Note that this module has been 9 | largely made Ethernet independent so you should be able to 10 | adapt this for other link layers (such as Firewire). 11 | 12 | ethernetif.c 13 | An example of how an Ethernet device driver could look. This 14 | file can be used as a "skeleton" for developing new Ethernet 15 | network device drivers. It uses the etharp.c ARP code. 16 | 17 | loopif.c 18 | A "loopback" network interface driver. It requires configuration 19 | through the define LWIP_LOOPIF_MULTITHREADING (see opt.h). 20 | 21 | slipif.c 22 | A generic implementation of the SLIP (Serial Line IP) 23 | protocol. It requires a sio (serial I/O) module to work. 24 | 25 | ppp/ Point-to-Point Protocol stack 26 | The PPP stack has been ported from ucip (http://ucip.sourceforge.net). 27 | It matches quite well to pppd 2.3.1 (http://ppp.samba.org), although 28 | compared to that, it has some modifications for embedded systems and 29 | the source code has been reordered a bit. -------------------------------------------------------------------------------- /Source/LwIP/src/netif/ppp/auth.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * auth.h - PPP Authentication and phase control header file. 3 | * 4 | * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. 5 | * portions Copyright (c) 1998 Global Election Systems Inc. 6 | * 7 | * The authors hereby grant permission to use, copy, modify, distribute, 8 | * and license this software and its documentation for any purpose, provided 9 | * that existing copyright notices are retained in all copies and that this 10 | * notice and the following disclaimer are included verbatim in any 11 | * distributions. No written agreement, license, or royalty fee is required 12 | * for any of the authorized uses. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | * 25 | ****************************************************************************** 26 | * REVISION HISTORY 27 | * 28 | * 03-01-01 Marc Boucher 29 | * Ported to lwIP. 30 | * 97-12-04 Guy Lancaster , Global Election Systems Inc. 31 | * Original derived from BSD pppd.h. 32 | *****************************************************************************/ 33 | /* 34 | * pppd.h - PPP daemon global declarations. 35 | * 36 | * Copyright (c) 1989 Carnegie Mellon University. 37 | * All rights reserved. 38 | * 39 | * Redistribution and use in source and binary forms are permitted 40 | * provided that the above copyright notice and this paragraph are 41 | * duplicated in all such forms and that any documentation, 42 | * advertising materials, and other materials related to such 43 | * distribution and use acknowledge that the software was developed 44 | * by Carnegie Mellon University. The name of the 45 | * University may not be used to endorse or promote products derived 46 | * from this software without specific prior written permission. 47 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 48 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 49 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 50 | * 51 | */ 52 | 53 | #ifndef AUTH_H 54 | #define AUTH_H 55 | 56 | /*********************** 57 | *** PUBLIC FUNCTIONS *** 58 | ***********************/ 59 | 60 | /* we are starting to use the link */ 61 | void link_required (int); 62 | 63 | /* we are finished with the link */ 64 | void link_terminated (int); 65 | 66 | /* the LCP layer has left the Opened state */ 67 | void link_down (int); 68 | 69 | /* the link is up; authenticate now */ 70 | void link_established (int); 71 | 72 | /* a network protocol has come up */ 73 | void np_up (int, u16_t); 74 | 75 | /* a network protocol has gone down */ 76 | void np_down (int, u16_t); 77 | 78 | /* a network protocol no longer needs link */ 79 | void np_finished (int, u16_t); 80 | 81 | /* peer failed to authenticate itself */ 82 | void auth_peer_fail (int, u16_t); 83 | 84 | /* peer successfully authenticated itself */ 85 | void auth_peer_success (int, u16_t, char *, int); 86 | 87 | /* we failed to authenticate ourselves */ 88 | void auth_withpeer_fail (int, u16_t); 89 | 90 | /* we successfully authenticated ourselves */ 91 | void auth_withpeer_success (int, u16_t); 92 | 93 | /* check authentication options supplied */ 94 | void auth_check_options (void); 95 | 96 | /* check what secrets we have */ 97 | void auth_reset (int); 98 | 99 | /* Check peer-supplied username/password */ 100 | u_char check_passwd (int, char *, int, char *, int, char **, int *); 101 | 102 | /* get "secret" for chap */ 103 | int get_secret (int, char *, char *, char *, int *, int); 104 | 105 | /* check if IP address is authorized */ 106 | int auth_ip_addr (int, u32_t); 107 | 108 | /* check if IP address is unreasonable */ 109 | int bad_ip_adrs (u32_t); 110 | 111 | #endif /* AUTH_H */ 112 | -------------------------------------------------------------------------------- /Source/LwIP/src/netif/ppp/chpms.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * chpms.h - Network Microsoft Challenge Handshake Protocol header file. 3 | * 4 | * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. 5 | * portions Copyright (c) 1998 Global Election Systems Inc. 6 | * 7 | * The authors hereby grant permission to use, copy, modify, distribute, 8 | * and license this software and its documentation for any purpose, provided 9 | * that existing copyright notices are retained in all copies and that this 10 | * notice and the following disclaimer are included verbatim in any 11 | * distributions. No written agreement, license, or royalty fee is required 12 | * for any of the authorized uses. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | * 25 | ****************************************************************************** 26 | * REVISION HISTORY 27 | * 28 | * 03-01-01 Marc Boucher 29 | * Ported to lwIP. 30 | * 98-01-30 Guy Lancaster , Global Election Systems Inc. 31 | * Original built from BSD network code. 32 | ******************************************************************************/ 33 | /* 34 | * chap.h - Challenge Handshake Authentication Protocol definitions. 35 | * 36 | * Copyright (c) 1995 Eric Rosenquist, Strata Software Limited. 37 | * http://www.strataware.com/ 38 | * 39 | * All rights reserved. 40 | * 41 | * Redistribution and use in source and binary forms are permitted 42 | * provided that the above copyright notice and this paragraph are 43 | * duplicated in all such forms and that any documentation, 44 | * advertising materials, and other materials related to such 45 | * distribution and use acknowledge that the software was developed 46 | * by Eric Rosenquist. The name of the author may not be used to 47 | * endorse or promote products derived from this software without 48 | * specific prior written permission. 49 | * 50 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 51 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 52 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 53 | * 54 | * $Id: chpms.h,v 1.5 2007/12/19 20:47:23 fbernon Exp $ 55 | */ 56 | 57 | #ifndef CHPMS_H 58 | #define CHPMS_H 59 | 60 | #define MAX_NT_PASSWORD 256 /* Maximum number of (Unicode) chars in an NT password */ 61 | 62 | void ChapMS (chap_state *, char *, int, char *, int); 63 | 64 | #endif /* CHPMS_H */ 65 | -------------------------------------------------------------------------------- /Source/LwIP/src/netif/ppp/magic.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * magic.c - Network Random Number Generator program file. 3 | * 4 | * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. 5 | * portions Copyright (c) 1997 by Global Election Systems Inc. 6 | * 7 | * The authors hereby grant permission to use, copy, modify, distribute, 8 | * and license this software and its documentation for any purpose, provided 9 | * that existing copyright notices are retained in all copies and that this 10 | * notice and the following disclaimer are included verbatim in any 11 | * distributions. No written agreement, license, or royalty fee is required 12 | * for any of the authorized uses. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | * 25 | ****************************************************************************** 26 | * REVISION HISTORY 27 | * 28 | * 03-01-01 Marc Boucher 29 | * Ported to lwIP. 30 | * 97-12-04 Guy Lancaster , Global Election Systems Inc. 31 | * Original based on BSD magic.c. 32 | *****************************************************************************/ 33 | /* 34 | * magic.c - PPP Magic Number routines. 35 | * 36 | * Copyright (c) 1989 Carnegie Mellon University. 37 | * All rights reserved. 38 | * 39 | * Redistribution and use in source and binary forms are permitted 40 | * provided that the above copyright notice and this paragraph are 41 | * duplicated in all such forms and that any documentation, 42 | * advertising materials, and other materials related to such 43 | * distribution and use acknowledge that the software was developed 44 | * by Carnegie Mellon University. The name of the 45 | * University may not be used to endorse or promote products derived 46 | * from this software without specific prior written permission. 47 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 48 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 49 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 50 | */ 51 | 52 | #include "lwip/opt.h" 53 | 54 | #if PPP_SUPPORT 55 | 56 | #include "ppp_impl.h" 57 | #include "randm.h" 58 | #include "magic.h" 59 | 60 | 61 | /* 62 | * magicInit - Initialize the magic number generator. 63 | * 64 | * Since we use another random number generator that has its own 65 | * initialization, we do nothing here. 66 | */ 67 | void magicInit() 68 | { 69 | return; 70 | } 71 | 72 | /* 73 | * magic - Returns the next magic number. 74 | */ 75 | u32_t magic() 76 | { 77 | return avRandom(); 78 | } 79 | 80 | #endif /* PPP_SUPPORT */ 81 | -------------------------------------------------------------------------------- /Source/LwIP/src/netif/ppp/magic.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * magic.h - Network Random Number Generator header file. 3 | * 4 | * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. 5 | * portions Copyright (c) 1997 Global Election Systems Inc. 6 | * 7 | * The authors hereby grant permission to use, copy, modify, distribute, 8 | * and license this software and its documentation for any purpose, provided 9 | * that existing copyright notices are retained in all copies and that this 10 | * notice and the following disclaimer are included verbatim in any 11 | * distributions. No written agreement, license, or royalty fee is required 12 | * for any of the authorized uses. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | * 25 | ****************************************************************************** 26 | * REVISION HISTORY 27 | * 28 | * 03-01-01 Marc Boucher 29 | * Ported to lwIP. 30 | * 97-12-04 Guy Lancaster , Global Election Systems Inc. 31 | * Original derived from BSD codes. 32 | *****************************************************************************/ 33 | /* 34 | * magic.h - PPP Magic Number definitions. 35 | * 36 | * Copyright (c) 1989 Carnegie Mellon University. 37 | * All rights reserved. 38 | * 39 | * Redistribution and use in source and binary forms are permitted 40 | * provided that the above copyright notice and this paragraph are 41 | * duplicated in all such forms and that any documentation, 42 | * advertising materials, and other materials related to such 43 | * distribution and use acknowledge that the software was developed 44 | * by Carnegie Mellon University. The name of the 45 | * University may not be used to endorse or promote products derived 46 | * from this software without specific prior written permission. 47 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 48 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 49 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 50 | * 51 | * $Id: magic.h,v 1.3 2010/01/18 20:49:43 goldsimon Exp $ 52 | */ 53 | 54 | #ifndef MAGIC_H 55 | #define MAGIC_H 56 | 57 | /* Initialize the magic number generator */ 58 | void magicInit(void); 59 | 60 | /* Returns the next magic number */ 61 | u32_t magic(void); 62 | 63 | #endif /* MAGIC_H */ 64 | -------------------------------------------------------------------------------- /Source/LwIP/src/netif/ppp/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | *********************************************************************** 3 | ** md5.h -- header file for implementation of MD5 ** 4 | ** RSA Data Security, Inc. MD5 Message-Digest Algorithm ** 5 | ** Created: 2/17/90 RLR ** 6 | ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version ** 7 | ** Revised (for MD5): RLR 4/27/91 ** 8 | ** -- G modified to have y&~z instead of y&z ** 9 | ** -- FF, GG, HH modified to add in last register done ** 10 | ** -- Access pattern: round 2 works mod 5, round 3 works mod 3 ** 11 | ** -- distinct additive constant for each step ** 12 | ** -- round 4 added, working mod 7 ** 13 | *********************************************************************** 14 | */ 15 | 16 | /* 17 | *********************************************************************** 18 | ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. ** 19 | ** ** 20 | ** License to copy and use this software is granted provided that ** 21 | ** it is identified as the "RSA Data Security, Inc. MD5 Message- ** 22 | ** Digest Algorithm" in all material mentioning or referencing this ** 23 | ** software or this function. ** 24 | ** ** 25 | ** License is also granted to make and use derivative works ** 26 | ** provided that such works are identified as "derived from the RSA ** 27 | ** Data Security, Inc. MD5 Message-Digest Algorithm" in all ** 28 | ** material mentioning or referencing the derived work. ** 29 | ** ** 30 | ** RSA Data Security, Inc. makes no representations concerning ** 31 | ** either the merchantability of this software or the suitability ** 32 | ** of this software for any particular purpose. It is provided "as ** 33 | ** is" without express or implied warranty of any kind. ** 34 | ** ** 35 | ** These notices must be retained in any copies of any part of this ** 36 | ** documentation and/or software. ** 37 | *********************************************************************** 38 | */ 39 | 40 | #ifndef MD5_H 41 | #define MD5_H 42 | 43 | /* Data structure for MD5 (Message-Digest) computation */ 44 | typedef struct { 45 | u32_t i[2]; /* number of _bits_ handled mod 2^64 */ 46 | u32_t buf[4]; /* scratch buffer */ 47 | unsigned char in[64]; /* input buffer */ 48 | unsigned char digest[16]; /* actual digest after MD5Final call */ 49 | } MD5_CTX; 50 | 51 | void MD5Init ( MD5_CTX *mdContext); 52 | void MD5Update( MD5_CTX *mdContext, unsigned char *inBuf, unsigned int inLen); 53 | void MD5Final ( unsigned char hash[], MD5_CTX *mdContext); 54 | 55 | #endif /* MD5_H */ 56 | -------------------------------------------------------------------------------- /Source/LwIP/src/netif/ppp/pap.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * pap.h - PPP Password Authentication Protocol header file. 3 | * 4 | * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. 5 | * portions Copyright (c) 1997 Global Election Systems Inc. 6 | * 7 | * The authors hereby grant permission to use, copy, modify, distribute, 8 | * and license this software and its documentation for any purpose, provided 9 | * that existing copyright notices are retained in all copies and that this 10 | * notice and the following disclaimer are included verbatim in any 11 | * distributions. No written agreement, license, or royalty fee is required 12 | * for any of the authorized uses. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | * 25 | ****************************************************************************** 26 | * REVISION HISTORY 27 | * 28 | * 03-01-01 Marc Boucher 29 | * Ported to lwIP. 30 | * 97-12-04 Guy Lancaster , Global Election Systems Inc. 31 | * Original derived from BSD codes. 32 | *****************************************************************************/ 33 | /* 34 | * upap.h - User/Password Authentication Protocol definitions. 35 | * 36 | * Copyright (c) 1989 Carnegie Mellon University. 37 | * All rights reserved. 38 | * 39 | * Redistribution and use in source and binary forms are permitted 40 | * provided that the above copyright notice and this paragraph are 41 | * duplicated in all such forms and that any documentation, 42 | * advertising materials, and other materials related to such 43 | * distribution and use acknowledge that the software was developed 44 | * by Carnegie Mellon University. The name of the 45 | * University may not be used to endorse or promote products derived 46 | * from this software without specific prior written permission. 47 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 48 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 49 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 50 | */ 51 | 52 | #ifndef PAP_H 53 | #define PAP_H 54 | 55 | #if PAP_SUPPORT /* don't build if not configured for use in lwipopts.h */ 56 | 57 | /* 58 | * Packet header = Code, id, length. 59 | */ 60 | #define UPAP_HEADERLEN (sizeof (u_char) + sizeof (u_char) + sizeof (u_short)) 61 | 62 | 63 | /* 64 | * UPAP codes. 65 | */ 66 | #define UPAP_AUTHREQ 1 /* Authenticate-Request */ 67 | #define UPAP_AUTHACK 2 /* Authenticate-Ack */ 68 | #define UPAP_AUTHNAK 3 /* Authenticate-Nak */ 69 | 70 | /* 71 | * Each interface is described by upap structure. 72 | */ 73 | typedef struct upap_state { 74 | int us_unit; /* Interface unit number */ 75 | const char *us_user; /* User */ 76 | int us_userlen; /* User length */ 77 | const char *us_passwd; /* Password */ 78 | int us_passwdlen; /* Password length */ 79 | int us_clientstate; /* Client state */ 80 | int us_serverstate; /* Server state */ 81 | u_char us_id; /* Current id */ 82 | int us_timeouttime; /* Timeout (seconds) for auth-req retrans. */ 83 | int us_transmits; /* Number of auth-reqs sent */ 84 | int us_maxtransmits; /* Maximum number of auth-reqs to send */ 85 | int us_reqtimeout; /* Time to wait for auth-req from peer */ 86 | } upap_state; 87 | 88 | /* 89 | * Client states. 90 | */ 91 | #define UPAPCS_INITIAL 0 /* Connection down */ 92 | #define UPAPCS_CLOSED 1 /* Connection up, haven't requested auth */ 93 | #define UPAPCS_PENDING 2 /* Connection down, have requested auth */ 94 | #define UPAPCS_AUTHREQ 3 /* We've sent an Authenticate-Request */ 95 | #define UPAPCS_OPEN 4 /* We've received an Ack */ 96 | #define UPAPCS_BADAUTH 5 /* We've received a Nak */ 97 | 98 | /* 99 | * Server states. 100 | */ 101 | #define UPAPSS_INITIAL 0 /* Connection down */ 102 | #define UPAPSS_CLOSED 1 /* Connection up, haven't requested auth */ 103 | #define UPAPSS_PENDING 2 /* Connection down, have requested auth */ 104 | #define UPAPSS_LISTEN 3 /* Listening for an Authenticate */ 105 | #define UPAPSS_OPEN 4 /* We've sent an Ack */ 106 | #define UPAPSS_BADAUTH 5 /* We've sent a Nak */ 107 | 108 | 109 | extern upap_state upap[]; 110 | 111 | void upap_authwithpeer (int, char *, char *); 112 | void upap_authpeer (int); 113 | 114 | extern struct protent pap_protent; 115 | 116 | #endif /* PAP_SUPPORT */ 117 | 118 | #endif /* PAP_H */ 119 | -------------------------------------------------------------------------------- /Source/LwIP/src/netif/ppp/pppdebug.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * pppdebug.h - System debugging utilities. 3 | * 4 | * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. 5 | * portions Copyright (c) 1998 Global Election Systems Inc. 6 | * portions Copyright (c) 2001 by Cognizant Pty Ltd. 7 | * 8 | * The authors hereby grant permission to use, copy, modify, distribute, 9 | * and license this software and its documentation for any purpose, provided 10 | * that existing copyright notices are retained in all copies and that this 11 | * notice and the following disclaimer are included verbatim in any 12 | * distributions. No written agreement, license, or royalty fee is required 13 | * for any of the authorized uses. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | * 26 | ****************************************************************************** 27 | * REVISION HISTORY (please don't use tabs!) 28 | * 29 | * 03-01-01 Marc Boucher 30 | * Ported to lwIP. 31 | * 98-07-29 Guy Lancaster , Global Election Systems Inc. 32 | * Original. 33 | * 34 | ***************************************************************************** 35 | */ 36 | #ifndef PPPDEBUG_H 37 | #define PPPDEBUG_H 38 | 39 | /* Trace levels. */ 40 | #define LOG_CRITICAL (PPP_DEBUG | LWIP_DBG_LEVEL_SEVERE) 41 | #define LOG_ERR (PPP_DEBUG | LWIP_DBG_LEVEL_SEVERE) 42 | #define LOG_NOTICE (PPP_DEBUG | LWIP_DBG_LEVEL_WARNING) 43 | #define LOG_WARNING (PPP_DEBUG | LWIP_DBG_LEVEL_WARNING) 44 | #define LOG_INFO (PPP_DEBUG) 45 | #define LOG_DETAIL (PPP_DEBUG) 46 | #define LOG_DEBUG (PPP_DEBUG) 47 | 48 | 49 | #define TRACELCP PPP_DEBUG 50 | 51 | #if PPP_DEBUG 52 | 53 | #define AUTHDEBUG(a, b) LWIP_DEBUGF(a, b) 54 | #define IPCPDEBUG(a, b) LWIP_DEBUGF(a, b) 55 | #define UPAPDEBUG(a, b) LWIP_DEBUGF(a, b) 56 | #define LCPDEBUG(a, b) LWIP_DEBUGF(a, b) 57 | #define FSMDEBUG(a, b) LWIP_DEBUGF(a, b) 58 | #define CHAPDEBUG(a, b) LWIP_DEBUGF(a, b) 59 | #define PPPDEBUG(a, b) LWIP_DEBUGF(a, b) 60 | 61 | #else /* PPP_DEBUG */ 62 | 63 | #define AUTHDEBUG(a, b) 64 | #define IPCPDEBUG(a, b) 65 | #define UPAPDEBUG(a, b) 66 | #define LCPDEBUG(a, b) 67 | #define FSMDEBUG(a, b) 68 | #define CHAPDEBUG(a, b) 69 | #define PPPDEBUG(a, b) 70 | 71 | #endif /* PPP_DEBUG */ 72 | 73 | #endif /* PPPDEBUG_H */ 74 | -------------------------------------------------------------------------------- /Source/LwIP/src/netif/ppp/randm.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * randm.h - Random number generator header file. 3 | * 4 | * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. 5 | * Copyright (c) 1998 Global Election Systems Inc. 6 | * 7 | * The authors hereby grant permission to use, copy, modify, distribute, 8 | * and license this software and its documentation for any purpose, provided 9 | * that existing copyright notices are retained in all copies and that this 10 | * notice and the following disclaimer are included verbatim in any 11 | * distributions. No written agreement, license, or royalty fee is required 12 | * for any of the authorized uses. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | * 25 | ****************************************************************************** 26 | * REVISION HISTORY 27 | * 28 | * 03-01-01 Marc Boucher 29 | * Ported to lwIP. 30 | * 98-05-29 Guy Lancaster , Global Election Systems Inc. 31 | * Extracted from avos. 32 | *****************************************************************************/ 33 | 34 | #ifndef RANDM_H 35 | #define RANDM_H 36 | 37 | /*********************** 38 | *** PUBLIC FUNCTIONS *** 39 | ***********************/ 40 | /* 41 | * Initialize the random number generator. 42 | */ 43 | void avRandomInit(void); 44 | 45 | /* 46 | * Churn the randomness pool on a random event. Call this early and often 47 | * on random and semi-random system events to build randomness in time for 48 | * usage. For randomly timed events, pass a null pointer and a zero length 49 | * and this will use the system timer and other sources to add randomness. 50 | * If new random data is available, pass a pointer to that and it will be 51 | * included. 52 | */ 53 | void avChurnRand(char *randData, u32_t randLen); 54 | 55 | /* 56 | * Randomize our random seed value. To be called for truely random events 57 | * such as user operations and network traffic. 58 | */ 59 | #if MD5_SUPPORT 60 | #define avRandomize() avChurnRand(NULL, 0) 61 | #else /* MD5_SUPPORT */ 62 | void avRandomize(void); 63 | #endif /* MD5_SUPPORT */ 64 | 65 | /* 66 | * Use the random pool to generate random data. This degrades to pseudo 67 | * random when used faster than randomness is supplied using churnRand(). 68 | * Thus it's important to make sure that the results of this are not 69 | * published directly because one could predict the next result to at 70 | * least some degree. Also, it's important to get a good seed before 71 | * the first use. 72 | */ 73 | void avGenRand(char *buf, u32_t bufLen); 74 | 75 | /* 76 | * Return a new random number. 77 | */ 78 | u32_t avRandom(void); 79 | 80 | 81 | #endif /* RANDM_H */ 82 | -------------------------------------------------------------------------------- /Source/Ports/Cortex-M3/os_cpu_a.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/Ports/Cortex-M3/os_cpu_a.asm -------------------------------------------------------------------------------- /Source/Ports/Cortex-M3/os_dmem.h: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | Copyright (C), 2013, BEIJING NUFRONT CO., LTD 3 | File name: os_dmem.h 4 | Author: jun.chen@nufront.com 5 | Version: V1.0.0 6 | Date: 2013-7-12 7 | Description: This file contains dynamic memory manegement structures and APIs. 8 | Others: ... 9 | Function List: 10 | 1. ... 11 | History: 12 | 1. Date: ... 13 | Author: ... 14 | Modification: ... 15 | 2. ... 16 | *************************************************/ 17 | #ifndef __OS_DMEM_H__ 18 | #define __OS_DMEM_H__ 19 | 20 | #define OS_DMEM_NAME_SIZE 4 /* Determine the size of a memory partition name */ 21 | 22 | #define OS_DMEM_INVALID_MEMPOOL 150u 23 | #define OS_DMEM_INVALID_MEMPOOL_SIZE 151u 24 | 25 | typedef struct CS_NODE_STRUCT 26 | { 27 | struct CS_NODE_STRUCT *cs_previous; 28 | struct CS_NODE_STRUCT *cs_next; 29 | }CS_NODE; 30 | 31 | typedef unsigned int UNSIGNED; 32 | typedef unsigned char CHAR; 33 | typedef unsigned char DATA_ELEMENT; 34 | #ifndef VOID 35 | typedef void VOID; 36 | #endif 37 | 38 | #ifndef TRUE 39 | #define TRUE 1 40 | #endif 41 | 42 | #ifndef FALSE 43 | #define FALSE 0 44 | #endif 45 | 46 | #ifndef NULL 47 | #define NULL 0 48 | #endif 49 | 50 | /* Define constants local to this component. */ 51 | #define DM_DYNAMIC_ID 0x44594e41UL 52 | #define DM_OVERHEAD ((sizeof(DM_HEADER) + sizeof(UNSIGNED) \ 53 | - 1)/sizeof(UNSIGNED)) * \ 54 | sizeof(UNSIGNED) 55 | 56 | #define KL_MAX_NAME 8 57 | #define PAD_1 3 58 | #define R1 register 59 | 60 | /* Define the Dynamic Pool Control Block data type. */ 61 | typedef struct DM_PCB_STRUCT 62 | { 63 | CS_NODE dm_created; /* Node for linking to */ 64 | /* created dynamic pools */ 65 | UNSIGNED dm_id; /* Internal PCB ID */ 66 | CHAR dm_name[OS_DMEM_NAME_SIZE]; /* Dynamic Pool name */ 67 | VOID *dm_start_address; /* Starting pool address */ 68 | UNSIGNED dm_pool_size; /* Size of pool */ 69 | UNSIGNED dm_min_allocation; /* Minimum allocate size */ 70 | UNSIGNED dm_available; /* Total available bytes */ 71 | struct DM_HEADER_STRUCT 72 | *dm_memory_list; /* Memory list */ 73 | struct DM_HEADER_STRUCT 74 | *dm_search_ptr; /* Search pointer */ 75 | } DM_PCB; 76 | 77 | 78 | /* Define the header structure that is in front of each memory block. */ 79 | typedef struct DM_HEADER_STRUCT 80 | { 81 | struct DM_HEADER_STRUCT 82 | *dm_next_memory, /* Next memory block */ 83 | *dm_previous_memory; /* Previous memory block */ 84 | DATA_ELEMENT dm_memory_free; /* Memory block free flag */ 85 | #if PAD_1 86 | DATA_ELEMENT dm_padding[PAD_1]; 87 | #endif 88 | DM_PCB *dm_memory_pool; /* Dynamic pool pointer */ 89 | } DM_HEADER; 90 | 91 | void OS_DMemInit(void); 92 | void *OSMMalloc(INT32U size); 93 | void OSMFree(void *ptr); 94 | INT8U OS_GetMem(DM_PCB *pool_ptr, void **return_pointer, UNSIGNED size); 95 | INT8U OS_FreeMem(VOID *memory); 96 | INT8U OS_Create_Memory_Pool(DM_PCB *pool_ptr, CHAR *name, 97 | void *start_address, UNSIGNED pool_size, 98 | UNSIGNED min_allocation); 99 | INT8U OS_DelMemPool(DM_PCB *pool_ptr); 100 | 101 | #endif//__OS_DMEM_H__ 102 | -------------------------------------------------------------------------------- /Source/Sys/app_main.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/Sys/app_main.c -------------------------------------------------------------------------------- /Source/Sys/main.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/Sys/main.c -------------------------------------------------------------------------------- /Source/Sys/rom_hook_tbl.c: -------------------------------------------------------------------------------- 1 | /* 2 | ****************************************************************************** 3 | ** 4 | ** Project : 5 | ** Description : ROM functions table 6 | ** Author : pchn 7 | ** Date : 8 | ** 9 | ** UpdatedBy : 10 | ** UpdatedDate : 11 | ** 12 | ****************************************************************************** 13 | */ 14 | //------------------------------------------------------------------------------------------------------ 15 | #include "lwip/sys.h" 16 | 17 | //------------------------------------------------------------------------------------------------------ 18 | 19 | void InitRomHookFuncTbl(void) 20 | { 21 | OS_MemClr((unsigned char*)gpRomHookFuncTbl, ROM_HOOK_FUNC_TABLE_SIZE); 22 | 23 | gpRomHookFuncTbl->OSDebugInit = OSDebugInit; 24 | gpRomHookFuncTbl->OSInitHookBegin = OSInitHookBegin; 25 | gpRomHookFuncTbl->OSInitHookEnd = OSInitHookEnd; 26 | gpRomHookFuncTbl->OSTaskCreateHook = OSTaskCreateHook; 27 | gpRomHookFuncTbl->OSTaskDelHook = OSTaskDelHook; 28 | gpRomHookFuncTbl->OSTaskIdleHook = OSTaskIdleHook; 29 | gpRomHookFuncTbl->OSTaskReturnHook = OSTaskReturnHook; 30 | gpRomHookFuncTbl->OSTaskStatHook = OSTaskStatHook; 31 | gpRomHookFuncTbl->OSTaskStkInit = OSTaskStkInit; 32 | gpRomHookFuncTbl->OSTaskSwHook = OSTaskSwHook; 33 | gpRomHookFuncTbl->OSTCBInitHook = OSTCBInitHook; 34 | gpRomHookFuncTbl->OSTimeTickHook = OSTimeTickHook; 35 | gpRomHookFuncTbl->OS_CPU_SR_Save = OS_CPU_SR_Save; 36 | gpRomHookFuncTbl->OS_CPU_SR_Restore = OS_CPU_SR_Restore; 37 | gpRomHookFuncTbl->OSCtxSw = OSCtxSw; 38 | gpRomHookFuncTbl->OSIntCtxSw = OSIntCtxSw; 39 | gpRomHookFuncTbl->OSStartHighRdy = OSStartHighRdy; 40 | 41 | gpRomHookFuncTbl->_sys_mbox_new = _sys_mbox_new; 42 | gpRomHookFuncTbl->_sys_mbox_free = _sys_mbox_free; 43 | gpRomHookFuncTbl->_sys_mbox_post = _sys_mbox_post; 44 | gpRomHookFuncTbl->_sys_mbox_trypost = _sys_mbox_trypost; 45 | gpRomHookFuncTbl->_sys_arch_mbox_fetch = _sys_arch_mbox_fetch; 46 | gpRomHookFuncTbl->_sys_mbox_valid = _sys_mbox_valid; 47 | gpRomHookFuncTbl->_sys_mbox_set_invalid = _sys_mbox_set_invalid; 48 | gpRomHookFuncTbl->_sys_sem_new = _sys_sem_new; 49 | gpRomHookFuncTbl->_sys_sem_free = _sys_sem_free; 50 | gpRomHookFuncTbl->_sys_arch_sem_wait = _sys_arch_sem_wait; 51 | gpRomHookFuncTbl->_sys_sem_signal = _sys_sem_signal; 52 | gpRomHookFuncTbl->_sys_sem_valid = _sys_sem_valid; 53 | gpRomHookFuncTbl->_sys_sem_set_invalid = _sys_sem_set_invalid; 54 | gpRomHookFuncTbl->_sys_init = _sys_init; 55 | gpRomHookFuncTbl->_sys_thread_new = _sys_thread_new; 56 | 57 | } 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /Source/Sys/sys_mgmt.c: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | Copyright (C), 2013, BEIJING NUFRONT CO., LTD 3 | File name: dhcp_server.c 4 | Author: jun.chen@nufront.com 5 | Version: V1.0.0 6 | Date: 2013-7-22 7 | Description: This file contains system management implementation. 8 | Others: ... 9 | Function List: 10 | 1. ... 11 | History: 12 | 1. Date: ... 13 | Author: ... 14 | Modification: ... 15 | 2. ... 16 | *************************************************/ 17 | /* 18 | ****************************************************************************** 19 | ** Include Files 20 | ****************************************************************************** 21 | */ 22 | #include "includes.h" 23 | #include "lwIP.h" 24 | #include "uart.h" 25 | 26 | /* 27 | ****************************************************************************** 28 | ** MACROS and VARIABLES 29 | ****************************************************************************** 30 | */ 31 | const INT8U FwCreatedDate[] = __DATE__; 32 | const INT8U FwCreatedTime[] = __TIME__; 33 | const INT8U FwType[] = "SDK"; 34 | const INT8U FwVerNum[3] = { 35 | 0x01, /* Main version */ 36 | 0x13, /* Sub version */ 37 | 0x00 /* Internal version */ 38 | }; 39 | 40 | SysEvtCallBack SysEvtCB = NULL; 41 | 42 | extern VOID NST_CoreTasksInit(VOID); 43 | 44 | VOID DisplayVersion(VOID) 45 | { 46 | DBGPRINT(DEBUG_TRACE, "\n\r"); 47 | DBGPRINT(DEBUG_TRACE, "=========================================================\n\r"); 48 | DBGPRINT(DEBUG_TRACE, " ********************** NL6621 SDK ********************* \n\r"); 49 | DBGPRINT(DEBUG_TRACE, " * * \n\r"); 50 | DBGPRINT(DEBUG_TRACE, " * Version: %s%x.%02x.%02x(%s %s) %s *\n\r", \ 51 | FwType, FwVerNum[0], FwVerNum[1], FwVerNum[2], 52 | FwCreatedTime, FwCreatedDate, 53 | #if DEBUG_ON 54 | "dbg" 55 | #else 56 | "rel" 57 | #endif 58 | ); 59 | DBGPRINT(DEBUG_TRACE, " * * \n\r"); 60 | DBGPRINT(DEBUG_TRACE, " ******************************************************* \n\r"); 61 | DBGPRINT(DEBUG_TRACE, "=========================================================\n\r\n\r"); 62 | } 63 | 64 | VOID SystemInit(VOID) 65 | { 66 | BSP_ClkInit(); 67 | 68 | InitRomHookFuncTbl(); 69 | 70 | OSInit(); 71 | 72 | NST_CoreTasksInit(); 73 | 74 | BSP_Init(); 75 | } 76 | 77 | void DefaultProc(NST_TskMsg *msg) 78 | { 79 | if (msg == NULL) 80 | return; 81 | 82 | switch (msg->msgId) 83 | { 84 | case SYS_LINK_UP_ID: /*WiFi Connected*/ 85 | { 86 | #ifdef LWIP_SUPPORT 87 | if (L2LinkUp() != 0) 88 | break; 89 | #endif 90 | 91 | if (SysEvtCB) 92 | (*SysEvtCB)(SYS_EVT_LINK_UP); 93 | break; 94 | } 95 | 96 | case SYS_LINK_DOWN_ID: /*WiFi Disconnected*/ 97 | { 98 | #ifdef LWIP_SUPPORT 99 | L2LinkDown(); 100 | #endif 101 | 102 | if (SysEvtCB) 103 | (*SysEvtCB)(SYS_EVT_LINK_DOWN); 104 | break; 105 | } 106 | 107 | case SYS_STA_JOIN_FAIL_ID: /* sta failed to join */ 108 | { 109 | if (SysEvtCB) 110 | (*SysEvtCB)(SYS_EVT_JOIN_FAIL); 111 | break; 112 | } 113 | 114 | case SYS_DHCP_TIMEOUT_ID: /*dhcp client timeout */ 115 | { 116 | if (SysEvtCB) 117 | (*SysEvtCB)(SYS_EVT_DHCP_FAIL); 118 | break; 119 | } 120 | 121 | case SYS_SCAN_DONE_ID: 122 | if (SysEvtCB) 123 | (*SysEvtCB)(SYS_EVT_SCAN_DONE); 124 | break; 125 | 126 | case SYS_DIRECT_CFG_DONE_ID: 127 | if (SysEvtCB) 128 | (*SysEvtCB)(SYS_EVT_DIRECT_CFG_DONE); 129 | break; 130 | 131 | default: 132 | break; 133 | } 134 | } 135 | 136 | VOID SysMgmtMain(VOID * pParam) 137 | { 138 | NST_TskMsg* pTaskMsg; 139 | 140 | #ifdef CPU_USAGE_STAT 141 | OSTimeDly(100); 142 | #endif // CPU_USAGE_STAT // 143 | 144 | DisplayVersion(); 145 | 146 | while (1) 147 | { 148 | if (NST_GetMsg(gpSysMngTskMsgQ, &pTaskMsg ) != OS_ERR_NONE) 149 | continue; 150 | 151 | if (pTaskMsg != NULL) 152 | { 153 | DefaultProc(pTaskMsg); 154 | 155 | NST_FreeTskMsg(pTaskMsg); 156 | } 157 | } 158 | } 159 | 160 | -------------------------------------------------------------------------------- /Source/Sys/util.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/Sys/util.c -------------------------------------------------------------------------------- /Source/uCOS-II/os_app_cfg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/uCOS-II/os_app_cfg.h -------------------------------------------------------------------------------- /Source/uCOS-II/os_cfg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/uCOS-II/os_cfg.h -------------------------------------------------------------------------------- /Source/uCOS-II/os_core.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/uCOS-II/os_core.c -------------------------------------------------------------------------------- /Source/uCOS-II/os_dbg.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/uCOS-II/os_dbg.c -------------------------------------------------------------------------------- /Source/uCOS-II/os_flag.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/uCOS-II/os_flag.c -------------------------------------------------------------------------------- /Source/uCOS-II/os_mbox.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/uCOS-II/os_mbox.c -------------------------------------------------------------------------------- /Source/uCOS-II/os_mem.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/uCOS-II/os_mem.c -------------------------------------------------------------------------------- /Source/uCOS-II/os_mutex.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/uCOS-II/os_mutex.c -------------------------------------------------------------------------------- /Source/uCOS-II/os_q.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/uCOS-II/os_q.c -------------------------------------------------------------------------------- /Source/uCOS-II/os_sem.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/uCOS-II/os_sem.c -------------------------------------------------------------------------------- /Source/uCOS-II/os_task.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/uCOS-II/os_task.c -------------------------------------------------------------------------------- /Source/uCOS-II/os_time.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/uCOS-II/os_time.c -------------------------------------------------------------------------------- /Source/uCOS-II/os_tmr.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/uCOS-II/os_tmr.c -------------------------------------------------------------------------------- /Source/uCOS-II/ucos_ii.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Source/uCOS-II/ucos_ii.h -------------------------------------------------------------------------------- /Tool/AirKissDebugger.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Tool/AirKissDebugger.apk -------------------------------------------------------------------------------- /Tool/DirectConfigDemo.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Tool/DirectConfigDemo.rar -------------------------------------------------------------------------------- /Tool/GenBootBins.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Tool/GenBootBins.exe -------------------------------------------------------------------------------- /Tool/NLConfigTool.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Tool/NLConfigTool.apk -------------------------------------------------------------------------------- /Tool/NLConfigTool.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Tool/NLConfigTool.rar -------------------------------------------------------------------------------- /Tool/NLDirectConfig.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Tool/NLDirectConfig.apk -------------------------------------------------------------------------------- /Tool/NLDirectConfig_src.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Tool/NLDirectConfig_src.rar -------------------------------------------------------------------------------- /Tool/OTAUpdateFw.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Tool/OTAUpdateFw.apk -------------------------------------------------------------------------------- /Tool/OTAUpdateFw_src.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Tool/OTAUpdateFw_src.rar -------------------------------------------------------------------------------- /Tool/bootTool.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Tool/bootTool.exe -------------------------------------------------------------------------------- /Tool/burnFlash.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Tool/burnFlash.bin -------------------------------------------------------------------------------- /Tool/fblink.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NufrontIOT/NL6621_StandardSDK/f81d4a9879e338a2167ecc9542b72500bc0f5e0d/Tool/fblink.exe --------------------------------------------------------------------------------