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

📄 uip.h

📁 移植到440 下的uip
💻 H
📖 第 1 页 / 共 3 页
字号:
/** * Convert 16-bit quantity from host byte order to network byte order. * * This function is primarily used for converting variables from host * byte order to network byte order. For converting constants to * network byte order, use the HTONS() macro instead. */#ifndef htonsu16_t htons(u16_t val);#endif /* htons *//** @} *//** * Pointer to the application data in the packet buffer. * * This pointer points to the application data when the application is * called. If the application wishes to send data, the application may * use this space to write the data into before calling uip_send(). */extern volatile u8_t *uip_appdata;extern volatile u8_t *uip_sappdata; #if UIP_URGDATA > 0 /* u8_t *uip_urgdata: * * This pointer points to any urgent data that has been received. Only * present if compiled with support for urgent data (UIP_URGDATA). */extern volatile u8_t *uip_urgdata; #endif /* UIP_URGDATA > 0 *//* u[8|16]_t uip_len: * * When the application is called, uip_len contains the length of any * new data that has been received from the remote host. The * application should set this variable to the size of any data that * the application wishes to send. When the network device driver * output function is called, uip_len should contain the length of the * outgoing packet. */extern volatile u16_t uip_len, uip_slen;#if UIP_URGDATA > 0 extern volatile u8_t uip_urglen, uip_surglen;#endif /* UIP_URGDATA > 0 *//** * Representation of a uIP TCP connection. * * The uip_conn structure is used for identifying a connection. All * but one field in the structure are to be considered read-only by an * application. The only exception is the appstate field whos purpose * is to let the application store application-specific state (e.g., * file pointers) for the connection. The size of this field is * configured in the "uipopt.h" header file. */struct uip_conn {  u16_t ripaddr[2];   /**< The IP address of the remote host. */    u16_t lport;        /**< The local TCP port, in network byte order. */  u16_t rport;        /**< The local remote TCP port, in network byte			 order. */      u8_t rcv_nxt[4];    /**< The sequence number that we expect to			 receive next. */  u8_t snd_nxt[4];    /**< The sequence number that was last sent by                         us. */  u16_t len;          /**< Length of the data that was previously sent. */  u16_t mss;          /**< Current maximum segment size for the			 connection. */  u16_t initialmss;   /**< Initial maximum segment size for the			 connection. */    u8_t sa;            /**< Retransmission time-out calculation state			 variable. */  u8_t sv;            /**< Retransmission time-out calculation state			 variable. */  u8_t rto;           /**< Retransmission time-out. */  u8_t tcpstateflags; /**< TCP state and flags. */  u8_t timer;         /**< The retransmission timer. */  u8_t nrtx;          /**< The number of retransmissions for the last			 segment sent. */  /** The application state. */  u8_t appstate[UIP_APPSTATE_SIZE];  };/* Pointer to the current connection. */extern struct uip_conn *uip_conn;/* The array containing all uIP connections. */extern struct uip_conn uip_conns[UIP_CONNS];/** * \addtogroup uiparch * @{ *//** * 4-byte array used for the 32-bit sequence number calculations. */extern volatile u8_t uip_acc32[4];/** @} */#if UIP_UDP/** * Representation of a uIP UDP connection. */struct uip_udp_conn {  u16_t ripaddr[2];   /**< The IP address of the remote peer. */  u16_t lport;        /**< The local port number in network byte order. */  u16_t rport;        /**< The remote port number in network byte order. */};extern struct uip_udp_conn *uip_udp_conn;extern struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS];#endif /* UIP_UDP *//** * The structure holding the TCP/IP statistics that are gathered if * UIP_STATISTICS is set to 1. * */struct uip_stats {  struct {    uip_stats_t drop;     /**< Number of dropped packets at the IP			     layer. */    uip_stats_t recv;     /**< Number of received packets at the IP			     layer. */    uip_stats_t sent;     /**< Number of sent packets at the IP			     layer. */    uip_stats_t vhlerr;   /**< Number of packets dropped due to wrong			     IP version or header length. */    uip_stats_t hblenerr; /**< Number of packets dropped due to wrong			     IP length, high byte. */    uip_stats_t lblenerr; /**< Number of packets dropped due to wrong			     IP length, low byte. */    uip_stats_t fragerr;  /**< Number of packets dropped since they			     were IP fragments. */    uip_stats_t chkerr;   /**< Number of packets dropped due to IP			     checksum errors. */    uip_stats_t protoerr; /**< Number of packets dropped since they			     were neither ICMP, UDP nor TCP. */  } ip;                   /**< IP statistics. */  struct {    uip_stats_t drop;     /**< Number of dropped ICMP packets. */    uip_stats_t recv;     /**< Number of received ICMP packets. */    uip_stats_t sent;     /**< Number of sent ICMP packets. */    uip_stats_t typeerr;  /**< Number of ICMP packets with a wrong			     type. */  } icmp;                 /**< ICMP statistics. */  struct {//add    uip_stats_t drop;    uip_stats_t chkerr;	  } udp;//add  struct {    uip_stats_t drop;     /**< Number of dropped TCP segments. */    uip_stats_t recv;     /**< Number of recived TCP segments. */    uip_stats_t sent;     /**< Number of sent TCP segments. */    uip_stats_t chkerr;   /**< Number of TCP segments with a bad			     checksum. */    uip_stats_t ackerr;   /**< Number of TCP segments with a bad ACK			     number. */    uip_stats_t rst;      /**< Number of recevied TCP RST (reset) segments. */    uip_stats_t rexmit;   /**< Number of retransmitted TCP segments. */    uip_stats_t syndrop;  /**< Number of dropped SYNs due to too few			     connections was avaliable. */    uip_stats_t synrst;   /**< Number of SYNs for closed ports,			     triggering a RST. */  } tcp;                  /**< TCP statistics. */};/** * The uIP TCP/IP statistics. * * This is the variable in which the uIP TCP/IP statistics are gathered. */extern struct uip_stats uip_stat;/*-----------------------------------------------------------------------------------*//* All the stuff below this point is internal to uIP and should not be * used directly by an application or by a device driver. *//*-----------------------------------------------------------------------------------*//* u8_t uip_flags: * * When the application is called, uip_flags will contain the flags * that are defined in this file. Please read below for more * infomation. */extern volatile u8_t uip_flags;/* The following flags may be set in the global variable uip_flags   before calling the application callback. The UIP_ACKDATA and   UIP_NEWDATA flags may both be set at the same time, whereas the   others are mutualy exclusive. Note that these flags should *NOT* be   accessed directly, but through the uIP functions/macros. */#define UIP_ACKDATA   1     /* Signifies that the outstanding data was			       acked and the application should send			       out new data instead of retransmitting			       the last data. */#define UIP_NEWDATA   2     /* Flags the fact that the peer has sent			       us new data. */#define UIP_REXMIT    4     /* Tells the application to retransmit the			       data that was last sent. */#define UIP_POLL      8     /* Used for polling the application, to			       check if the application has data that			       it wants to send. */#define UIP_CLOSE     16    /* The remote host has closed the			       connection, thus the connection has			       gone away. Or the application signals			       that it wants to close the			       connection. */#define UIP_ABORT     32    /* The remote host has aborted the			       connection, thus the connection has			       gone away. Or the application signals			       that it wants to abort the			       connection. */#define UIP_CONNECTED 64    /* We have got a connection from a remote                               host and have set up a new connection                               for it, or an active connection has                               been successfully established. */#define UIP_TIMEDOUT  128   /* The connection has been aborted due to			       too many retransmissions. *//* uip_process(flag): * * The actual uIP function which does all the work. */void uip_process(u8_t flag);/* The following flags are passed as an argument to the uip_process()   function. They are used to distinguish between the two cases where   uip_process() is called. It can be called either because we have   incoming data that should be processed, or because the periodic   timer has fired. */#define UIP_DATA    1     /* Tells uIP that there is incoming data in                             the uip_buf buffer. The length of the                             data is stored in the global variable                             uip_len. */#define UIP_TIMER   2     /* Tells uIP that the periodic timer has                             fired. */#if UIP_UDP#define UIP_UDP_TIMER 3#endif /* UIP_UDP *//* The TCP states used in the uip_conn->tcpstateflags. */#define CLOSED      0#define SYN_RCVD    1#define SYN_SENT    2#define ESTABLISHED 3#define FIN_WAIT_1  4#define FIN_WAIT_2  5#define CLOSING     6#define TIME_WAIT   7#define LAST_ACK    8#define TS_MASK     15  #define UIP_STOPPED      16#define UIP_TCPIP_HLEN 40/* The TCP and IP headers. */typedef __packed struct {  /* IP header. */  u8_t vhl,    tos,              len[2],           ipid[2],            ipoffset[2],      ttl,              proto;       u16_t ipchksum;  u16_t srcipaddr[2],     destipaddr[2];    /* TCP header. */  u16_t srcport,    destport;  u8_t seqno[4],      ackno[4],    tcpoffset,    flags,    wnd[2];       u16_t tcpchksum;  u8_t urgp[2];  u8_t optdata[4];} uip_tcpip_hdr;/* The ICMP and IP headers. */typedef __packed struct {  /* IP header. */  u8_t vhl,    tos,              len[2],           ipid[2],            ipoffset[2],      ttl,              proto;       u16_t ipchksum;  u16_t srcipaddr[2],     destipaddr[2];  /* ICMP (echo) header. */  u8_t type, icode;  u16_t icmpchksum;  u16_t id, seqno;  } uip_icmpip_hdr;/* The UDP and IP headers. */typedef __packed struct {  /* IP header. */  u8_t vhl,    tos,              len[2],           ipid[2],            ipoffset[2],      ttl,              proto;       u16_t ipchksum;  u16_t srcipaddr[2],     destipaddr[2];    /* UDP header. */  u16_t srcport,    destport;  u16_t udplen;  u16_t udpchksum;} uip_udpip_hdr;#define UIP_PROTO_ICMP  1#define UIP_PROTO_TCP   6#define UIP_PROTO_UDP   17#if UIP_FIXEDADDRextern const u16_t uip_hostaddr[2];#else /* UIP_FIXEDADDR */extern u16_t uip_hostaddr[2];#endif /* UIP_FIXEDADDR */#endif /* __UIP_H__ *//** @} */

⌨️ 快捷键说明

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