⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tftp.h

📁 用于嵌入式系统的TCP/IP协议栈及若干服务
💻 H
字号:
/**            Copyright (c) 1998-2001 by NETsilicon Inc.**  This software is copyrighted by and is the sole property of*  NETsilicon.  All rights, title, ownership, or other interests*  in the software remain the property of NETsilicon.  This*  software may only be used in accordance with the corresponding*  license agreement.  Any unauthorized use, duplication, transmission,*  distribution, or disclosure of this software is expressly forbidden.**  This Copyright notice may not be removed or modified without prior*  written consent of NETsilicon.**  NETsilicon, reserves the right to modify this software*  without notice.**  NETsilicon*  411 Waverley Oaks Road                  USA 781.647.1234*  Suite 227                               http://www.netsilicon.com*  Waltham, MA 02452                       AmericaSales@netsilicon.com***************************************************************************  $Name: Fusion 6.52 Fusion 6.51 $*  $Date: 2001/09/20 11:03:05 $*  $Source: M:/psisrc/tftp_cli/incl/rcs/tftp.h $*  $Revision: 1.10 $****************************************************************************  File Description:  Definitions and data structures for TFTP ***************************************************************************/#ifndef _TFTP_#define _TFTP_/* Allowed file modes */#define OCTET           1#define NETASCII        2/* Tftp specfied packet types */#define RRQ     1#define WRQ     2#define DATA    3#define TFTPACK 4#define ERROR   5/* Tftp specified error values */#define TE_UNDEFINED            0#define TE_FLE_NOT_FOUND        1#define TE_ACCESS_VIOLATION     2#define TE_DISK_FULL            3#define TE_ILL_TFTP_OP          4#define TE_UNKNOWN_TID          5#define TE_FLE_EXISTS           6#define TE_NO_SUCH_USER         7/* Misc. decor */#define DEF_PKT_INTERVAL        5000    /* in milliseconds */#define DEF_INTERVAL            (30 * DEF_PKT_INTERVAL)#define DEF_VERBOSE             false#define DEF_TRACING             false#define DEF_MVALUE              OCTET#define MIN_PKT_SIZE            (sizeof (a16) + sizeof (a16))#define MAX_DLEN                512#define MAX_RBUF_LEN            512/* TFTP Header Structure  */typedef u8  TF_PKT;#define  TF_P_OP     0                      /* offset 0, 2 bytes long */#define  TF_TFW_FNAME   (TF_P_OP+2)         /* 2 bytes offset */#define  TF_TFD_BNUM    (TF_TFW_FNAME)      /* 2 bytes offset */#define  TF_TFD_DATA    (TF_TFD_BNUM+2)     /* MAX_DLEN bytes*/#define  TF_ACK_BNUM    TF_TFW_FNAME        /* 2 bytes offset */#define  TF_TFE_ERRCODE TF_TFW_FNAME        /* 2 bytes offset */#define	 TF_TFE_ERRMSG  (TF_TFE_ERRCODE+2)  /* MAX_DLEN bytes */#define SIZEOF_TF_PKT   (TF_TFE_ERRCODE+MAX_DLEN + 2)  /* TFTP Header Shortcuts */#define P_FNAME         TF_TFW_FNAME#define P_DATA          TF_TFD_DATA#define P_BNUM          TF_TFD_BNUM#define P_ERR           TF_TFE_ERRCODE#define P_ERRMSG        TF_TFE_ERRMSG/* The following structure allows us to eliminate global variables.** This is important for a psuedo multi thread process (e.g. MS/DOS daemons)*/typedef struct tfs {	struct tfs      * tf_next;	struct tfs      * tf_prev;	u16             tf_flags;	int             tf_netfd;	char            * tf_dname;	char            * tf_headp; /* points to head of netascii buffer */	char            * tf_bufp; /* points to next character in buffer */	char            * tf_endp; /* points to end of data in buffer*/	struct in_sockaddr     tf_daddr;	u16             tf_dlen;	u16             tf_mode;	int             tf_infd;	int             tf_outfd;	char            * tf_ramptr;	char            * tf_ramend;	u16             tf_slen;	u16             tf_rlen;	u16             tf_bnum;	boolean         tf_tracing;	boolean         tf_verbose;	u32             tf_interval;	u32             tf_pkt_interval;	TF_PKT          tf_spkt[SIZEOF_TF_PKT];	TF_PKT          tf_rpkt[SIZEOF_TF_PKT];} tfs;/* Values of tf_flags */#define TF_NEED_NL      1#define TF_NEED_NULL    2#define TF_DITCH_NULL   4#define TF_ZOMBIE       8#ifdef TFTP_DEBUG#define tftp_debug0(s)       os_printf(s)#define tftp_debug1(s,x)     os_printf(s,x)#define tftp_debug2(s,x,y)   os_printf(s,x,y)#define tftp_debug3(s,x,y,z) os_printf(s,x,y,z)#else#define tftp_debug0(s)#define tftp_debug1(s,x)#define tftp_debug2(s,x,y)#define tftp_debug3(s,x,y,z)#endif#ifdef TFTP_TRACE#define tftp_trace0(s)       os_printf(s)#define tftp_trace1(s,x)     os_printf(s,x)#define tftp_trace2(s,x,y)   os_printf(s,x,y)#define tftp_trace3(s,x,y,z) os_printf(s,x,y,z)#else#define tftp_trace0(s)#define tftp_trace1(s,x)#define tftp_trace2(s,x,y)#define tftp_trace3(s,x,y,z)#endifimport  boolean default_user(void);import  const   char * err_send(tfs * tfsp, saddr * addr, int err, const char * msg);import  u16     get_mode(char * s);import  char    * mode_str(u16 mode);import  void    pr_pkt(TF_PKT * packet);import  int     tf_conn_chk(tfs * tfsp);import  void    tf_fclose(tfs * tfsp);import  int     tf_fsm(tfs * tfsp);import  u16     tf_get_port(struct in_sockaddr * isp);import  void    tf_ireset(tfs * tfsp);import  tfs     * tf_new(void);import  void    tf_free(tfs * p_tfs);import  int     tf_op(tfs * tfsp, u16 op, char * remote_file);import  void    tf_reset(tfs * tfsp);import  int     tf_rfopen(tfs * tfsp);import  int     tf_wfopen(tfs * tfsp);import  int     tftp_get(char * filename, u32 remote_ip_addr, char * tftpbuf,                         int   bufsize, u16 mode);import  int     tftp_put(char * filename, u32 remote_ip_addr, char * tftpbuf,                         int   bufsize, u16 mode);#endif /* _TFTP_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -