📄 net_conn.h
字号:
/*
*********************************************************************************************************
* uC/TCP-IP
* The Embedded TCP/IP Suite
*
* (c) Copyright 2003-2006; Micrium, Inc.; Weston, FL
*
* All rights reserved. Protected by international copyright laws.
*
* uC/TCP-IP is provided in source form for FREE evaluation, for educational
* use or peaceful research. If you plan on using uC/TCP-IP in a commercial
* product you need to contact Micrium to properly license its use in your
* product. We provide ALL the source code for your convenience and to help
* you experience uC/TCP-IP. The fact that the source code is provided does
* NOT mean that you can use it without paying a licensing fee.
*
* Knowledge of the source code may NOT be used to develop a similar product.
*
* Please help us continue to provide the Embedded community with the finest
* software available. Your honesty is greatly appreciated.
*********************************************************************************************************
*/
/*
*********************************************************************************************************
*
* NETWORK CONNECTION MANAGEMENT
*
* Filename : net_conn.h
* Version : V1.87
* Programmer(s) : ITJ
*********************************************************************************************************
* Note(s) : (1) Supports network connections for local & remote addresses of the following :
*
* (a) Families :
* (1) IPv4 Connections
* (A) BSD 4.x Sockets
*
* (b) Connection types :
* (1) Datagram
* (2) Stream
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* MODULE
*
* Note(s) : (1) Connection module is required for :
*
* (a) IPv4 Connections
* (1) BSD 4.x Sockets
*
* See also 'net_conn.h Note #1'.
*
* (2) The following connection-module-present configuration value MUST be pre-#define'd in
* 'net_cfg_net.h' PRIOR to all other network modules that require Connection Management
* Module Configuration (see 'net_cfg_net.h NETWORK CONNECTION MANAGEMENT CONFIGURATION
* Note #2b') :
*
* NET_CONN_MODULE_PRESENT
*********************************************************************************************************
*/
#ifdef NET_CONN_MODULE_PRESENT /* See Note #2. */
/*
*********************************************************************************************************
* EXTERNS
*********************************************************************************************************
*/
#ifdef NET_CONN_MODULE
#define NET_CONN_EXT
#else
#define NET_CONN_EXT extern
#endif
/*$PAGE*/
/*
*********************************************************************************************************
* DEFINES
*********************************************************************************************************
*/
#define NET_CONN_ACCESSED_TH_MIN 10u
#define NET_CONN_ACCESSED_TH_MAX 65000u
#define NET_CONN_ACCESSED_TH_DFLT 100u
#define NET_CONN_ID_MIN 0
#define NET_CONN_ID_MAX (NET_CONN_CFG_NBR_CONN - 1)
#define NET_CONN_ID_NONE (NET_CONN_ID_MIN - 1)
#define NET_CONN_CLOSE_FULL 0
#define NET_CONN_CLOSE_HALF 1 /* Conn closed to tx's; open to rx's. */
/*
*********************************************************************************************************
* NETWORK CONNECTION LIST TYPES
*********************************************************************************************************
*/
#define NET_CONN_LIST_TYPE_NONE 0
#define NET_CONN_LIST_TYPE_ALL NET_CONN_LIST_TYPE_NONE
#define NET_CONN_LIST_TYPE_SERVER 1
#define NET_CONN_LIST_TYPE_CLIENT 2
#define NET_CONN_LIST_TYPE_MAX 3
/*
*********************************************************************************************************
* NETWORK CONNECTION LIST INDICES
*********************************************************************************************************
*/
#if (NET_CONN_CFG_FAMILY == NET_CONN_FAMILY_IP_V4_SOCK)
#define NET_CONN_LIST_IX_IP_V4_SOCK_UDP 0
#define NET_CONN_LIST_IX_IP_V4_SOCK_TCP 1
#endif
/*
*********************************************************************************************************
* NETWORK CONNECTION ADDRESS DEFINES
*********************************************************************************************************
*/
#if (NET_CONN_CFG_FAMILY == NET_CONN_FAMILY_IP_V4_SOCK)
#define NET_CONN_ADDR_IP_LEN_PORT NET_SOCK_ADDR_IP_LEN_PORT
#define NET_CONN_ADDR_IP_LEN_ADDR NET_SOCK_ADDR_IP_LEN_ADDR
#define NET_CONN_ADDR_IP_IX_BASE NET_SOCK_ADDR_IP_IX_BASE
#define NET_CONN_ADDR_IP_IX_PORT NET_SOCK_ADDR_IP_IX_PORT
#define NET_CONN_ADDR_IP_IX_ADDR NET_SOCK_ADDR_IP_IX_ADDR
#define NET_CONN_ADDR_IP_WILD_CARD NET_SOCK_ADDR_IP_WILD_CARD
#define NET_CONN_ADDR_IP_BROADCAST NET_SOCK_ADDR_IP_BROADCAST
#endif
/*$PAGE*/
/*
*********************************************************************************************************
* NETWORK CONNECTION FLAG DEFINES
*********************************************************************************************************
*/
/* ------------------ NET CONN FLAGS ------------------ */
#define NET_CONN_FLAG_NONE DEF_BIT_NONE
#define NET_CONN_FLAG_USED DEF_BIT_00 /* Conn cur used; i.e. NOT in free conn pool. */
/*
*********************************************************************************************************
* NETWORK CONNECTION TYPE DEFINES
*
* Note(s) : (1) NET_CONN_TYPE_??? #define values specifically chosen as ASCII representations of the
* connection types. Memory dumps of connection types will display the connection TYPE
* with the chosen ASCII name.
*********************************************************************************************************
*/
/* ------------------ NET CONN TYPES ------------------ */
#if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG)
#define NET_CONN_TYPE_NONE 0x4E4F4E45 /* "NONE" in ASCII. */
#define NET_CONN_TYPE_CONN 0x434F4E4E /* "CONN" in ASCII. */
#else
#if (CPU_CFG_DATA_SIZE == CPU_WORD_SIZE_32)
#define NET_CONN_TYPE_NONE 0x454E4F4E /* "NONE" in ASCII. */
#define NET_CONN_TYPE_CONN 0x4E4E4F43 /* "CONN" in ASCII. */
#elif (CPU_CFG_DATA_SIZE == CPU_WORD_SIZE_16)
#define NET_CONN_TYPE_NONE 0x4F4E454E /* "NONE" in ASCII. */
#define NET_CONN_TYPE_CONN 0x4F434E4E /* "CONN" in ASCII. */
#else /* Dflt CPU_WORD_SIZE_08. */
#define NET_CONN_TYPE_NONE 0x4E4F4E45 /* "NONE" in ASCII. */
#define NET_CONN_TYPE_CONN 0x434F4E4E /* "CONN" in ASCII. */
#endif
#endif
/*$PAGE*/
/*
*********************************************************************************************************
* DATA TYPES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* NETWORK CONNECTION QUANTITY DATA TYPE
*
* Note(s) : (1) See also 'NETWORK CONNECTION IDENTIFICATION DATA TYPE Note #2'.
*********************************************************************************************************
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -