📄 protocol.h
字号:
// protocol consts, see protocol.txt
#define TCPIP_MAX_RECEIVE 238 // Number of bytes allowed in a receive (max)
#define TCPIP_MAX_SEND 252 // Number of bytes allowed in a send (max)
#define TCP_WINDOW_SIZE 198 // Max tcp data
/* ARP packet type is 0x0806 */
#define EPT_ARP_HIGH 0x08
#define EPT_ARP_LOW 0x06
/* IP packet type is 0x0800 */
#define EPT_IP_HIGH 0x08
#define EPT_IP_LOW 0x00
/* Field offset in an IP packet */
#define EP_DST 0
#define EP_SRC HW_ALEN
#define EP_TYPE (HW_ALEN + HW_ALEN)
#define EP_DATA (EP_TYPE + 2)
/* APR packet length */
#define ARP_LENGTH (8 + HW_ALEN + IP_ALEN + HW_ALEN + IP_ALEN)
/* Internet Protocol (IP) constants */
/* Some assigned protocol numbers */
#define IPT_ICMP 1 /* protocol type for ICMP packets */
#define IPT_IGMP 2 /* protocol type for IGMP packets */
#define IPT_TCP 6 /* protocol type for TCP packets */
#define IPT_EGP 8 /* protocol type for EGP packets */
#define IPT_UDP 17 /* protocol type for UDP packets */
#define IPT_OSPF 89 /* protocol type for OSPF packets */
/* Field offeset in an IP packet */
#define IP_VERLEN 0 /* IP version & header length (in longs) */
#define IP_TOS 1 /* type of service */
#define IP_LEN 2 /* total packet length (in octets) */
#define IP_ID 4 /* datagram id */
#define IP_FRAGOFF 6 /* fragment offset (in 8-octet's) */
#define IP_TTL 8 /* time to live, in gateway hops */
#define IP_PROTO 9 /* IP protocol */
#define IP_CKSUM 10 /* header checksum */
#define IP_SRC 12 /* IP address of source */
#define IP_DST 16 /* IP address of destination */
#define IP_DATA 20 /* variable length data, minimum IP header length */
#define IP_FIRST_BYTE 0x45
#define IP_VERSION 4 /* current version value */
#define IP_MINHLEN 5 /* minimum header length (in longs) */
#define IP_INIT_TTL 128 /* initial time-to-live value */
/* UDP constants and formats */
/* Field offset of an UDP packet (following the IP header) */
#define UDP_SRC 0 /* source UDP port number */
#define UDP_DST 2 /* destination UDP port number */
#define UDP_LEN 4 /* length of UDP data */
#define UDP_CKSUM 6 /* UDP checksum (0 => none) */
#define UDP_DATA 8 /* data begin in UDP message, and the UDP header length */
#define UDB_LENGTH 4
/* TCP constants and formats */
#define TCP_DATA 20 /* data begin, minimum TCP header length */
#define TCB_LENGTH 28
#define UDP_LOCAL_PORT_HIGH 0x20
#define UDP_DEBUG_PORT_LOW 0x21
#define UDP_TEST_PORT_LOW 0x22
#define DNS_LOCAL_PORT_HIGH 0x24
#define DNS_LOCAL_PORT_LOW 0x23
#define TCP_LOCAL_PORT_HIGH 0x22
#define TCP_UPGRADE_PORT_LOW 0x23
// Wellknown DHCP server and client
#define DHCP_SERVER_PORT_HIGH 0
#define DHCP_SERVER_PORT_LOW 67
#define DHCP_LOCAL_PORT_HIGH 0
#define DHCP_LOCAL_PORT_LOW 68
#define DNS_SERVER_PORT_HIGH 0
#define DNS_SERVER_PORT_LOW 53
// TCP constant
// Self defined UDP port
// Self defined TCP port
//#define SERIAL_SERVER_PORT_HIGH 18
//#define SERIAL_SERVER_PORT_LOW 0x34
// Telnet Server port
#define TELNET_SERVER_PORT_HIGH 0x00
#define TELNET_SERVER_PORT_LOW 0x17
// email constants
#define DNS_DOMAIN_SIZE 80
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -