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

📄 in.h

📁 用于嵌入式系统的TCP/IP协议栈及若干服务
💻 H
📖 第 1 页 / 共 2 页
字号:
/**            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/12/11 09:28:14 $*  $Source: M:/psisrc/stack/incl/rcs/in.h $*  $Revision: 1.23 $***************************************************************************                         - Revision Log -                               ** Who   When        Why** FND   12/05/01    Added constructs for C++ compatability** FND   10/02/02    Removed little endian macros for htonl, htons, ntohl*                   and ntohs because they need to be functions. They*                   won't always work in little endian.****************************************************************************  File Description:  Constants and structures defined by the internet*                     system, Per RFC 790, September 1981.**************************************************************************/#ifndef _IN_#define _IN_#include "config.h"#include "ccdep.h"#define IPPR_   IPPROTO_#define IPO_    IPPORT_ #define IMPLNK_ IMPLINK_#define INCLS   IN_CLASS#define sockaddr_in in_sockaddr /* for certain implementations *//* IP protocol codes */#define IP_IP           0       /* Internet Protocol (for use with get/setsopt only) */#define IP_ICMP         1       /* Internet Control Message Protocol */#define IP_IGMP         2       /* Internet Group Management Protocol */#define IP_GGP          3       /* Gateway-to-Gateway Protocol */#define IP_TCP          6       /* Transaction Control Protocol */#define IP_UDP          17      /* User Datagram Protocol */#define IP_SNMP         57      /* Simple Network Management Protocol */#define IP_OSPF         89      /* OSPF Protocol *//* Port/socket numbers: network standard functions */#define IPO_ECHO                7#define IPO_DISCARD             9#define IPO_SYSTAT              11#define IPO_DAYTIME             13#define IPO_NETSTAT             15#define IPO_FTP                 21#define IPO_TELNET              23#define IPO_SMTP                25#define IPO_TIMESERVER          37#define IPO_NAMESERVER          42#define IPO_WHOIS               43#define IPO_MTP                 57#define IPO_HTTP                80/* Port/socket numbers: host specific functions */#define IPO_TFTP                69#define IPO_RJE                 77#define IPO_FINGER              79#define IPO_TTYLINK             87#define IPO_SUPDUP              95/* UNIX TCP sockets */#define IPO_EXECSERVER          512#define IPO_LOGINSERVER         513#define IPO_CMDSERVER           514/* UNIX UDP sockets */#define IPO_BIFFUDP             512#define IPO_WHOSERVER           513/* Ports < IPO_RESERVED are reserved for   privileged processes (e.g. root). */#define IPO_RESERVED            1024/* Link numbers */#define IMPLNK_IP               155#define IMPLNK_LOWEXPER         156#define IMPLNK_HIGHEXPER        158/* Internet address */struct in_addr {		u32 s_addr;};/* Macros for dealing with Class A/B/C network   numbers.  High 3 bits of uppermost byte indicates   how to interpret the remainder of the 32-bit   Internet address.  The macros may be used in time   time critical sections of code, while subroutine   versions also exist use in other places. */#define INCLSA       0x80000000L#define INCLSA_NET   0xff000000L     /* 8 bits of net # */#define INCLSA_LNA   0x00ffffffL#define INCLSB       0x40000000L#define INCLSB_NET   0xffff0000L     /* 16 bits of net # */#define INCLSB_LNA   0x0000ffffL#define INCLSC_NET   0xffffff00L     /* 24 bits of net # */#define INCLSC_LNA   0x000000ffL#define IN_NETOF(in) \	(((in).s_addr&INCLSA) == 0 ? (in).s_addr&INCLSA_NET : \		((in).s_addr&INCLSB) == 0 ? (in).s_addr&INCLSB_NET : \			(in).s_addr&INCLSC_NET)#define IN_LNAOF(in) \	(((in).s_addr&INCLSA) == 0 ? (in).s_addr&INCLSA_LNA : \		((in).s_addr&INCLSB) == 0 ? (in).s_addr&INCLSB_LNA : \			(in).s_addr&INCLSC_LNA)#ifndef INADDR_ANY#define INADDR_ANY      0x00000000L#endif/* Socket address, internet style. */struct in_sockaddr {	i16     sin_family;	u16     sin_port;	struct  in_addr sin_addr;	char    sin_zero[8];};/************************************************************************//* Function prototypes                                                  *//************************************************************************/#if defined(__cplusplus)extern "C"{#endifextern u32   fns_inet_addr(const char * cp);extern char *fns_inet_ntoa(struct in_addr in);extern int  fns_inet_aton(register const char *name, struct in_addr *adrp );#ifdef CPU_IS_LITTLE_ENDIANextern u16 htons(u16 val);extern u16 ntohs(u16 val);extern u32 htonl(u32 val);extern u32 ntohl(u32 val);#endif /* CPU_IS_LITTLE_ENDIAN */#if defined(__cplusplus)}#endif/*************************************************************************                                                                       **     Aligned 16 Bit Host Byte Order to Network Byte Order Conversion   **                                                                       *************************************************************************/#ifndef htons#ifdef CPU_IS_BIG_ENDIAN   /* big endian processor definition */#define htons(val) (u16)(val)#endif      /* CPU_IS_BIG_ENDIAN */#endif      /* htons *//*************************************************************************                                                                       **   Aligned 16 Bit Network Byte Order To Host Byte Order Conversion     **                                                                       *************************************************************************/#ifndef ntohs#ifdef CPU_IS_BIG_ENDIAN   /* big endian processor definition */#define ntohs(val) (u16)(val)#endif      /* CPU_IS_BIG_ENDIAN */#endif      /* ntohs *//*************************************************************************                                                                       **     Aligned 32 Bit Host Byte Order to Network Byte Order Conversion   **                                                                       *************************************************************************//*#ifndef htonl*/#ifdef CPU_IS_BIG_ENDIAN   /* big endian processor definition */

⌨️ 快捷键说明

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