📄 net_config.h
字号:
OS_FRAME *ReTransFrm; /* Retransmission frame */
/* Application Event-CallBack function */
U16 (*cb_func)(U8 socket, U8 event, U8 *p1, U16 p2);
} TCP_INFO;
typedef struct http_info { /* << HTTP Session info >> */
U8 State; /* HTTP Session current state */
U8 Socket; /* binded TCP Socket */
U16 Flags; /* State machine Flags */
U8 FType; /* File Type: html, jpeg, gif,... */
U8 PostSt; /* POST method Processing Status */
U8 DelimSz; /* Boundary delimiter size */
U32 CGIvar; /* CGI session private variable (cgi_func) */
U32 DLen; /* Data length (number of bytes to send) */
U32 Count; /* Total number of bytes sent */
U16 BCnt; /* Number of bytes sent in last packet */
U8 Lang[6]; /* Selected Web Language: en-us, de, fr .. */
U8 *Script; /* Script Buffer pointer */
U8 *pDelim; /* Multipart Boundary delimiter value */
void *sFile; /* Script Interpreter File pointer */
void *dFile; /* Data File pointer */
} HTTP_INFO;
typedef struct http_file { /* << HTTP File info >> */
U8 Name[30]; /* File Name */
U8 *Start; /* File Start Address in ROM */
U32 Size; /* File Size in bytes */
} HTTP_FILE;
typedef struct tnet_info { /* << Telnet Session info >> */
U8 State; /* Telnet Session current state */
U8 Socket; /* binded TCP Socket */
U8 Flags; /* State machine Flags */
U8 BCnt; /* Received Data byte count */
U16 Tout; /* Timeout delay counter */
U16 XCnt; /* Repeat index and Timeout counter */
U8 Widx; /* Fifo buffer Write index */
U8 Ridx; /* Fifo buffer Read index */
U8 Fifo[16]; /* Fifo buffer for pressed key codes */
U8 LBuf[80]; /* Data Line Buffer */
} TNET_INFO;
typedef struct tftp_info { /* << TFTP Session info >> */
U8 State; /* TFTP Session current state */
U8 Retries; /* Number of retries */
U8 Flags; /* State machine Flags */
U16 Timer; /* Timeout Timer value */
U8 RemIpAdr[IP_ADRLEN]; /* Remote IP address */
U16 RemPort; /* Remote TCP port */
U16 BlockNr; /* Block Number */
void *File; /* File Handle pointer */
U32 FPos; /* File Position indicator */
} TFTP_INFO;
typedef struct dns_info { /* << DNS Cache Entry info >> */
U32 HostId; /* Host Id (CRC32 value of host name) */
U32 Ttl; /* Cache Entry Time To Live */
U8 IpAdr[IP_ADRLEN]; /* Ethernet IP Address */
} DNS_INFO;
typedef struct localm { /* << Local Machine info >> */
U8 IpAdr[IP_ADRLEN]; /* Local IP Address */
U8 DefGW[IP_ADRLEN]; /* Default GateWay */
U8 NetMask[IP_ADRLEN]; /* Net Mask */
U8 PriDNS[IP_ADRLEN]; /* Primary DNS Server */
U8 SecDNS[IP_ADRLEN]; /* Secondary DNS Server */
} LOCALM;
typedef struct remotem { /* << Remote Machine Info >> */
U8 IpAdr[IP_ADRLEN]; /* Remote IP address */
U8 HwAdr[ETH_ADRLEN]; /* Remote Hardware Address */
} REMOTEM;
typedef enum { /* << Fatal System Error Codes >> */
ERR_MEM_ALLOC,
ERR_MEM_FREE,
ERR_MEM_CORRUPT,
ERR_UDP_ALLOC,
ERR_TCP_ALLOC,
ERR_TCP_STATE
} ERROR_CODE;
/*----------------------------------------------------------------------------
* Functions
*---------------------------------------------------------------------------*/
/* Net_Config.c */
extern void init_system (void);
extern void run_system (void);
extern void process_hl_igmp (OS_FRAME *frame);
extern void process_hl_udp (OS_FRAME *frame);
extern void process_hl_tcp (OS_FRAME *frame);
extern BOOL dispatch_frame (OS_FRAME *frame, U8 netif);
extern BOOL eth_chk_adr (OS_FRAME *frame);
extern U8 *eth_get_adr (U8 *ipadr);
extern void sys_error (ERROR_CODE code);
/* at_Mem.c */
extern OS_FRAME *alloc_mem (U32 byte_size);
extern void free_mem (OS_FRAME *mem_ptr);
/* at_Ethernet.c */
extern void init_eth_link (void);
extern void run_eth_link (void);
extern void put_in_queue (OS_FRAME *frame);
extern BOOL eth_send_frame (OS_FRAME *frame);
/* at_Ppp.c */
extern void init_ppp_link (void);
extern void run_ppp_link (void);
extern BOOL ppp_send_frame (OS_FRAME *frame, U16 prot);
/* at_Slip.c */
extern void init_slip_link (void);
extern void run_slip_link (void);
extern BOOL slip_send_frame (OS_FRAME *frame);
/* at_Lib.c */
extern int mem_copy (void *dp, void *sp, int len);
extern void mem_rcopy (void *dp, void *sp, int len);
extern BOOL mem_comp (void *sp1, void *sp2, int len);
extern void mem_set (void *dp, U8 val, int len);
extern BOOL mem_test (void *sp, U8 val, int len);
extern BOOL str_scomp (U8 *sp, U8 const *cp);
extern int str_copy (U8 *dp, U8 *sp);
extern void str_up_case (U8 *dp, U8 *sp);
extern U16 SwapB (U16 w16);
extern U16 get_u16 (U8 *p16);
extern U32 get_u32 (U8 *p32);
extern void set_u32 (U8 *p32, U32 val);
/* at_Igmp.c */
extern void init_igmp (void);
extern void run_igmp_host (void);
extern void process_igmp (OS_FRAME *frame);
extern BOOL igmp_is_member (U8 *ipadr);
/* at_Udp.c */
extern void init_udp (void);
extern void process_udp (OS_FRAME *frame);
/* at_Tcp.c */
extern void init_tcp (void);
extern void tcp_poll_sockets (void);
extern void process_tcp (OS_FRAME *frame_r);
/* at_Http.c */
extern void init_http (void);
extern void run_http_server (void);
extern void *http_fopen (U8 *name);
extern void http_fclose (void *file);
extern U16 http_fread (void *file, U8 *buf, U16 len);
extern BOOL http_fgets (void *file, U8 *buf, U16 size);
extern void cgi_process_var (U8 *qstr);
extern void cgi_process_data (U8 code, U8 *dat, U16 len);
extern U16 cgi_func (U8 *env, U8 *buf, U16 buflen, U32 *pcgi);
extern U8 *http_get_var (U8 *env, void *ansi, U16 maxlen);
extern U8 *http_get_lang (void);
extern void http_get_info (REMOTEM *info);
extern U8 http_get_session (void);
/* at_Telnet.c */
extern void init_tnet (void);
extern void run_tnet_server (void);
extern U16 tnet_cbfunc (U8 code, U8 *buf, U16 buflen);
extern U16 tnet_process_cmd (U8 *cmd, U8 *buf, U16 buflen, U16 xcnt);
extern BOOL tnet_ccmp (U8 *buf, U8 *cmd);
extern void tnet_set_delay (U16 cnt);
extern void tnet_get_info (REMOTEM *info);
extern U8 tnet_get_session (void);
extern BOOL tnet_msg_poll (U8 session);
/* at_Tftp.c */
extern void init_tftp (void);
extern void run_tftp_server (void);
extern void *tftp_fopen (U8 *fname, U8 *mode);
extern void tftp_fclose (void *file);
extern U16 tftp_fread (void *file, U32 fpos, U8 *buf);
extern U16 tftp_fwrite (void *file, U8 *buf, U16 len);
/* at_Bootp.c */
extern void init_bootp (void);
extern void bootp_client (void);
/* at_Dhcp.c */
extern void init_dhcp (void);
extern void run_dhcp_client (void);
/* at_Nbns.c */
extern void init_nbns (void);
/* at_Dns.c */
extern void init_dns (void);
extern void run_dns_client (void);
extern U8 get_host_by_name (U8 *hostn, void (*cbfunc)(U8, U8 *));
/* at_Smtp.c */
extern void init_smtp (void);
extern void run_smtp_client (void);
extern U16 smtp_cbfunc (U8 code, U8 *buf, U16 buflen, U16 xcnt);
/* Ethernet Device Driver */
extern void init_ethernet (void);
extern void send_frame (OS_FRAME *frame);
extern void poll_ethernet (void);
extern void int_enable_eth (void);
extern void int_disable_eth (void);
/* Serial Device Driver */
extern void init_serial (void);
extern int com_getchar (void);
extern BOOL com_putchar (U8 c);
extern BOOL com_tx_active (void);
/* Modem Device Driver */
extern void init_modem (void);
extern void modem_dial (U8 *dialnum);
extern void modem_hangup (void);
extern void modem_listen (void);
extern BOOL modem_online (void);
extern BOOL modem_process (U8 ch);
extern void modem_run (void);
#ifdef __cplusplus // EC++
}
#endif
/*----------------------------------------------------------------------------
* end of file
*---------------------------------------------------------------------------*/
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -