source: azure_iot_hub/trunk/asp3_dcre/tinet/netinet/in_var.h@ 389

Last change on this file since 389 was 389, checked in by coas-nagasima, 5 years ago

ビルドが通るよう更新

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 9.1 KB
Line 
1/*
2 * TINET (TCP/IP Protocol Stack)
3 *
4 * Copyright (C) 2001-2017 by Dep. of Computer Science and Engineering
5 * Tomakomai National College of Technology, JAPAN
6 *
7 * 上記著作権者は,以下の (1)~(4) の条件か,Free Software Foundation
8 * によって公表されている GNU General Public License の Version 2 に記
9 * 述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
10 * を改変したものを含む.以下同じ)を使用・複製・改変・再配布(以下,
11 * 利用と呼ぶ)することを無償で許諾する.
12 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
13 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
14 * スコード中に含まれていること.
15 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
16 * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
17 * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
18 * の無保証規定を掲載すること.
19 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
20 * 用できない形で再配布する場合には,次の条件を満たすこと.
21 * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
22 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
23 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
24 * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
25 *
26 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
27 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
28 * 含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
29 * 接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
30 *
31 * @(#) $Id$
32 */
33
34/*
35 * Copyright (c) 1985, 1986, 1993
36 * The Regents of the University of California. All rights reserved.
37 *
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions
40 * are met:
41 * 1. Redistributions of source code must retain the above copyright
42 * notice, this list of conditions and the following disclaimer.
43 * 2. Redistributions in binary form must reproduce the above copyright
44 * notice, this list of conditions and the following disclaimer in the
45 * documentation and/or other materials provided with the distribution.
46 * 3. All advertising materials mentioning features or use of this software
47 * must display the following acknowledgement:
48 * This product includes software developed by the University of
49 * California, Berkeley and its contributors.
50 * 4. Neither the name of the University nor the names of its contributors
51 * may be used to endorse or promote products derived from this software
52 * without specific prior written permission.
53 *
54 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
56 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
57 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
58 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
59 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
60 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
61 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
62 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
63 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64 * SUCH DAMAGE.
65 *
66 * @(#)in_var.h 8.2 (Berkeley) 1/9/95
67 * $FreeBSD: src/sys/netinet/in_var.h,v 1.29.2.1 1999/08/29 16:29:38 peter Exp $
68 */
69
70#ifndef _IN_VAR_H_
71#define _IN_VAR_H_
72
73#include <netinet/in4_var.h>
74#include <netinet6/in6_var.h>
75
76/*
77 * 独自のエラーコード
78 */
79
80#define EV_NOPND (-97) /* ペンディングしていない */
81
82/*
83 * ネットワークエラーコード
84 */
85
86#define EV_MSIZE (-98) /* データグラム長超過 */
87#define EV_NURCH (-99) /* ネットワーク到達不能 */
88#define EV_HDOWN (-100) /* ホストダウン */
89#define EV_HURCH (-101) /* ホスト到達不能 */
90#define EV_CNNRF (-102) /* 接続不能 */
91#define EV_CNRST (-103) /* 接続リセット */
92#define EV_REXMTMO (-104) /* 再送タイムアウト */
93
94/*
95 * 共通タイマの起動周期の定義
96 */
97
98#define IN_TIMER_TMO (SYSTIM_HZ/NET_TIMER_CYCLE)
99
100/*
101 * ルーティングエントリ状態フラグ
102 */
103
104#define IN_RTF_DEFINED UINT_C(0x01) /* 定義済み */
105#define IN_RTF_REDIRECT UINT_C(0x10) /* 向け直しにより自動設定された */
106
107/*
108 * IPv4 と IPv6 をコンパイル時に選択するためのマクロ
109 */
110
111#if defined(_IP6_CFG)
112
113#define T_IN_ADDR T_IN6_ADDR
114#define T_IPEP T_IPV6EP
115#define IP_ADDRANY IPV6_ADDRANY
116
117#elif defined(_IP4_CFG) /* of #if defined(_IP6_CFG) */
118
119#define T_IN_ADDR T_IN4_ADDR
120#define T_IPEP T_IPV4EP
121#define IP_ADDRANY IPV4_ADDRANY
122
123#endif /* of #if defined(_IP6_CFG) */
124
125#if defined(_IP6_CFG)
126
127#if defined(_IP4_CFG)
128
129#define IN_CKSUM(nbuf,proto,off,len) (GET_IP_VER(nbuf)==IPV6_VERSION \
130 ?in6_cksum(nbuf,proto,off,len) \
131 :in4_cksum(nbuf,proto,off,len))
132#define IN_IS_DSTADDR_ACCEPT(myaddr,nbuf) \
133 inn_is_dstaddr_accept(myaddr,nbuf)
134#define IN_ARE_HDR_ADDR_EQUAL(nbuf) (GET_IP_VER(nbuf)==IPV6_VERSION \
135 ?IN6_ARE_ADDR_EQUAL(&GET_IP6_HDR(nbuf)->dst,&GET_IP6_HDR(nbuf)->src) \
136 :IN4_ARE_ADDR_EQUAL(&GET_IP4_HDR(nbuf)->dst,&GET_IP4_HDR(nbuf)->src))
137#define IN_ARE_NET_SRCADDR_EQUAL(ipaddr,nbuf) \
138 inn_are_net_srcaddr_equal(ipaddr,nbuf)
139#define IN_COPY_TO_HOST(dst,nbuf) inn_copy_to_host(dst,nbuf)
140#define IN_GET_DATAGRAM(nbuf,len,maxlen,dst,src,next,hlim,nbatr,tmout) \
141 inn_get_datagram(nbuf,len,maxlen,dst,src,next,hlim,nbatr,tmout)
142#define IN_IS_ADDR_MULTICAST(addr) inn_is_addr_multicast(addr)
143#define IN_IS_NET_ADDR_MULTICAST(nbuf) IN_IS_ADDR_MULTICAST(&GET_IP6_HDR(nbuf)->dst)
144#define IN_ADDRWITHIFP(ifp,src,dst) inn_addrwithifp(ifp,src,dst)
145#define IN_IS_ADDR_ANY(addr) IN6_IS_ADDR_UNSPECIFIED(addr)
146
147#else /* of #if defined(_IP4_CFG) */
148
149#define IN_CKSUM(nbuf,proto,off,len) in6_cksum(nbuf,proto,off,len)
150#define IN_IS_DSTADDR_ACCEPT(myaddr,nbuf) \
151 INN6_IS_DSTADDR_ACCEPT(myaddr,nbuf)
152#define IN_ARE_HDR_ADDR_EQUAL(nbuf) IN6_ARE_ADDR_EQUAL(&GET_IP6_HDR(nbuf)->dst,&GET_IP6_HDR(nbuf)->src)
153#define IN_ARE_NET_SRCADDR_EQUAL(ipaddr,nbuf) \
154 IN6_ARE_ADDR_EQUAL(ipaddr,&GET_IP6_HDR(nbuf)->src)
155#define IN_COPY_TO_HOST(dst,nbuf) IN6_COPY_TO_HOST(dst, nbuf)
156#define IN_GET_DATAGRAM(nbuf,len,maxlen,dst,src,next,hlim,nbatr,tmout) \
157 in6_get_datagram(nbuf,len,maxlen,dst,src,next,hlim,nbatr,tmout)
158#define IN_IS_ADDR_MULTICAST(addr) IN6_IS_ADDR_MULTICAST(addr)
159#define IN_IS_NET_ADDR_MULTICAST(nbuf) IN6_IS_ADDR_MULTICAST(&GET_IP6_HDR(nbuf)->dst)
160#define IN_ADDRWITHIFP(ifp,src,dst) in6_addrwithifp(ifp,src,dst)
161#define IN_IS_ADDR_ANY(addr) IN6_IS_ADDR_UNSPECIFIED(addr)
162
163#endif /* of #if defined(_IP4_CFG) */
164
165#else /* of #if defined(_IP6_CFG) */
166
167#if defined(_IP4_CFG)
168
169#define IN_CKSUM(nbuf,proto,off,len) in4_cksum(nbuf,proto,off,len)
170#define IN_IS_DSTADDR_ACCEPT(myaddr,nbuf) \
171 inn4_is_dstaddr_accept(myaddr,nbuf)
172#define IN_ARE_HDR_ADDR_EQUAL(nbuf) IN4_ARE_ADDR_EQUAL(&GET_IP4_HDR(nbuf)->dst,&GET_IP4_HDR(nbuf)->src)
173#define IN_ARE_NET_SRCADDR_EQUAL(ipaddr,nbuf) \
174 (*(ipaddr)==ntohl(GET_IP4_HDR(nbuf)->src))
175#define IN_COPY_TO_HOST(dst,nbuf) IN4_COPY_TO_HOST(dst, nbuf)
176#define IN_GET_DATAGRAM(nbuf,len,maxlen, dst,src,proto,ttl,nbatr,tmout) \
177 in4_get_datagram(nbuf,len,maxlen, dst,src,proto,ttl,nbatr,tmout)
178#define IN_IS_ADDR_MULTICAST(addr) IN4_IS_ADDR_MULTICAST(*(addr))
179#define IN_IS_NET_ADDR_MULTICAST(nbuf) IN4_IS_ADDR_MULTICAST(ntohl(GET_IP4_HDR(nbuf)->dst))
180#define IN_ADDRWITHIFP(ifp,src,dst) in4_addrwithifp(ifp,src,dst)
181#define IN_IS_ADDR_ANY(addr) IN4_IS_ADDR_ANY(addr)
182
183#else /* of #if defined(_IP4_CFG) */
184
185#error "not implemented."
186
187#endif /* of #if defined(_IP4_CFG) */
188
189#endif /* of #if defined(_IP6_CFG) */
190
191#ifndef _MACRO_ONLY
192
193/*
194 * 関数
195 */
196extern bool_t inn_is_dstaddr_accept (T_IN6_ADDR *myaddr, T_NET_BUF *nbuf);
197extern bool_t inn_is_addr_multicast (T_IN6_ADDR *addr);
198extern bool_t inn_are_net_srcaddr_equal (T_IN6_ADDR *ipaddr, T_NET_BUF *nbuf);
199extern void inn_copy_to_host (T_IN6_ADDR *dst, T_NET_BUF *nbuf);
200extern ER inn_get_datagram (T_NET_BUF **nbuf, uint_t len, uint_t maxlen,
201 T_IN6_ADDR *dstaddr, T_IN6_ADDR *srcaddr,
202 uint8_t next, uint8_t hlim, ATR nbatr, TMO tmout);
203extern T_IN6_ADDR *inn_addrwithifp (T_IFNET *ifp, T_IN6_ADDR *src, T_IN6_ADDR *dst);
204
205#endif /* of #ifndef _MACRO_ONLY */
206
207#endif /* of #ifndef _IN_VAR_H_ */
Note: See TracBrowser for help on using the repository browser.