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

📄 net_bsd.h

📁 uCOS-II 2.8和uC-TCP/IP在ATMEL AT91SAM9261上移植
💻 H
📖 第 1 页 / 共 2 页
字号:
/*
*********************************************************************************************************
*                                              uC/TCP-IP
*                                      The Embedded TCP/IP Suite
*
*                          (c) Copyright 2003-2007; 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.
*********************************************************************************************************
*/

/*
*********************************************************************************************************
*
*                                            BSD 4.x LAYER
*
* Filename      : net_bsd.h
* Version       : V1.89
* Programmer(s) : ITJ
*********************************************************************************************************
* Notice(s)     : (1) The Institute of Electrical and Electronics Engineers and The Open Group, have given 
*                     us permission to reprint portions of their documentation.  Portions of this text are 
*                     reprinted and reproduced in electronic form from the IEEE Std 1003.1, 2004 Edition, 
*                     Standard for Information Technology -- Portable Operating System Interface (POSIX), 
*                     The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute 
*                     of Electrical and Electronics Engineers, Inc and The Open Group.  In the event of any 
*                     discrepancy between these versions and the original IEEE and The Open Group Standard, 
*                     the original IEEE and The Open Group Standard is the referee document.  The original 
*                     Standard can be obtained online at http://www.opengroup.org/unix/online.html.
*********************************************************************************************************
*/

/*
*********************************************************************************************************
*                                               MODULE
*
* Note(s) : (1) BSD 4.x module is required for :
*
*               (a) Network sockets
*               (b) Applications that require BSD 4.x application interface (API) :
*                   (1) Macro's
*                   (2) Data Types
*                   (3) Functions
*
*               See also 'net_sock.h  Note #1'
*                      & 'net_cfg.h   BSD 4.x LAYER CONFIGURATION'.
*
*           (2) The following BSD-module-present configuration value MUST be pre-#define'd in 'net_cfg_net.h'
*               PRIOR to all other network modules that require BSD 4.x Layer Configuration (see 'net_cfg_net.h
*               BSD 4.x LAYER CONFIGURATION  Note #2b') :
*
*                   NET_BSD_MODULE_PRESENT
*********************************************************************************************************
*/

#ifdef   NET_BSD_MODULE_PRESENT                                 /* See Note #2.                                         */


/*
*********************************************************************************************************
*                                               EXTERNS
*********************************************************************************************************
*/

#ifdef   NET_BSD_MODULE
#define  NET_BSD_EXT
#else
#define  NET_BSD_EXT  extern
#endif


/*$PAGE*/
/*
*********************************************************************************************************
*                                               DEFINES
*********************************************************************************************************
*/

#define  NET_BSD_ADDR_LEN_MAX                             14    /* Sizeof(sockaddr.addr).                               */
#define  NET_BSD_ADDR_IP_NBR_OCTETS_UNUSED                 8


#define  NET_BSD_ASCII_LEN_MAX_ADDR_IP                   NET_ASCII_LEN_MAX_ADDR_IP


/*
*********************************************************************************************************
*                              BSD 4.x SOCKET FAMILY & PROTOCOL DEFINES
*
* Note(s) : (1) The following socket values MUST be pre-#define'd in 'net_def.h' PRIOR to 'net_cfg.h'
*               so that the developer can configure sockets for the correct socket family values (see
*               'net_def.h  BSD 4.x & NETWORK SOCKET LAYER DEFINES  Note #1' & 'net_cfg_net.h  NETWORK 
*               SOCKET LAYER CONFIGURATION') :
*
*                   AF_INET                                        2
*                   PF_INET                                  AF_INET
*********************************************************************************************************
*/

                                                                /* -------------------- SOCK TYPES -------------------- */
#ifdef   SOCK_STREAM
#undef   SOCK_STREAM
#endif
#define  SOCK_STREAM                                       1

#ifdef   SOCK_DGRAM
#undef   SOCK_DGRAM
#endif
#define  SOCK_DGRAM                                        2


                                                                /* -------------- TCP/IP SOCK PROTOCOLS --------------- */
#ifdef   IPPROTO_TCP
#undef   IPPROTO_TCP
#endif
#define  IPPROTO_TCP                                       6    /*  = NET_IP_HDR_PROTOCOL_TCP                           */

#ifdef   IPPROTO_UDP
#undef   IPPROTO_UDP
#endif
#define  IPPROTO_UDP                                      17    /*  = NET_IP_HDR_PROTOCOL_UDP                           */


/*
*********************************************************************************************************
*                                   BSD 4.x SOCKET ADDRESS DEFINES
*********************************************************************************************************
*/

#ifdef   INADDR_ANY
#undef   INADDR_ANY
#endif
#define  INADDR_ANY                                      NET_IP_ADDR_NONE

#ifdef   INADDR_BROADCAST
#undef   INADDR_BROADCAST
#endif
#define  INADDR_BROADCAST                                NET_IP_ADDR_BROADCAST


/*$PAGE*/
/*
*********************************************************************************************************
*                                     BSD 4.x SOCKET FLAG DEFINES
*
* Note(s) : (1) #### Some socket flags NOT currently supported.
*********************************************************************************************************
*/

#ifdef   MSG_OOB
#undef   MSG_OOB
#endif
#define  MSG_OOB                                  DEF_BIT_00    /* See Note #1.                                         */

#ifdef   MSG_PEEK
#undef   MSG_PEEK
#endif
#define  MSG_PEEK                                 DEF_BIT_01

#ifdef   MSG_DONTROUTE
#undef   MSG_DONTROUTE
#endif
#define  MSG_DONTROUTE                            DEF_BIT_02    /* See Note #1.                                         */

#ifdef   MSG_EOR
#undef   MSG_EOR
#endif
#define  MSG_EOR                                  DEF_BIT_03    /* See Note #1.                                         */

#ifdef   MSG_TRUNC
#undef   MSG_TRUNC
#endif
#define  MSG_TRUNC                                DEF_BIT_04    /* See Note #1.                                         */

#ifdef   MSG_CTRUNC
#undef   MSG_CTRUNC
#endif
#define  MSG_CTRUNC                               DEF_BIT_05    /* See Note #1.                                         */

#ifdef   MSG_WAITALL
#undef   MSG_WAITALL
#endif
#define  MSG_WAITALL                              DEF_BIT_06    /* See Note #1.                                         */

#ifdef   MSG_DONTWAIT
#undef   MSG_DONTWAIT
#endif
#define  MSG_DONTWAIT                             DEF_BIT_07


/*$PAGE*/
/*
*********************************************************************************************************
*                                 BSD 4.x RETURN CODE / ERROR DEFINES
*
* Note(s) : (1) (a) (1) (A) IEEE Std 1003.1, 2004 Edition states to "return 0 ... upon successful
*                           completion" ...
*
*                       (B) ... of the following BSD socket functions :
*
*                           (1) close()
*                           (2) shutdown()
*                           (3) bind()
*                           (4) connect()
*                           (5) listen()
*
*                   (2) (A) (1) "Otherwise, -1 shall be returned"       ...
*                           (2) "and 'errno' set to indicate the error" ...
*
*                       (B) ... for the following BSD socket functions :
*
*                           (1) socket()
*                           (2) close()
*                           (3) shutdown()
*                           (4) bind()
*                           (5) listen()
*                           (6) accept()
*                           (7) connect()
*                           (8) recvfrom()
*                           (9) recv()
*                          (10) sendto()
*                          (11) send()
*                          (12) inet_addr()
*                          (13) inet_ntoa()
*
*               (b) (1) IEEE Std 1003.1, 2004 Edition states to "return 0 ... if no messages are 
*                       available ... and the peer has performed an orderly shutdown" ...
*
*                   (2) ... for the following BSD socket functions :
*
*                       (A) recvfrom()
*                       (B) recv()
*********************************************************************************************************
*/

⌨️ 快捷键说明

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