source: EcnlProtoTool/trunk/asp3_dcre/tinet/netinet/ip_var.h@ 331

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

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 7.5 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) 1982, 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 * @(#)ip_var.h 8.2 (Berkeley) 1/9/95
67 * $FreeBSD: src/sys/netinet/ip_var.h,v 1.45.2.1 1999/08/29 16:29:51 peter Exp $
68 */
69
70#ifndef _IP_VAR_H_
71#define _IP_VAR_H_
72
73#include <netinet/ip4_var.h>
74#include <netinet6/ip6_var.h>
75
76/*
77 * IPv4 と IPv6 をコンパイル時に選択するためのマクロ
78 */
79
80#define GET_IP_VER(nbuf) (*(uint8_t*)((nbuf)->buf+IF_HDR_SIZE)>>4)
81
82#if defined(_IP6_CFG)
83
84#if defined(_IP4_CFG)
85
86#define IF_IP_HDR_SIZE(nbuf) (GET_IP_VER(nbuf)==IPV6_VERSION?IF_IP6_HDR_SIZE:IF_IP4_HDR_SIZE)
87#define IF_IP_NET_HDR_SIZE(addr) (IN6_IS_ADDR_V4MAPPED(addr)?IF_IP4_HDR_SIZE:IF_IP6_HDR_SIZE)
88
89#define IP_OUTPUT(nbuf,tmout) (GET_IP_VER(nbuf)==IPV6_VERSION?ip6_output(nbuf,0,tmout):ip_output(nbuf,tmout))
90#define IP_REMOVE_OPTIONS(nbuf) (GET_IP_VER(nbuf)==IPV6_VERSION?ip6_remove_exthdrs(nbuf):ip_remove_options(nbuf))
91
92#define GET_IP_HDR(nbuf) (GET_IP_VER(nbuf)==IPV6_VERSION?GET_IP6_HDR(nbuf):GET_IP4_HDR(nbuf))
93#define GET_IP_HDR_SIZE(nbuf) (GET_IP_VER(nbuf)==IPV6_VERSION?GET_IP6_HDR_SIZE(nbuf):GET_IP4_HDR_SIZE(nbuf))
94#define GET_IP_SDU_SIZE(nbuf) (GET_IP_VER(nbuf)==IPV6_VERSION?GET_IP6_SDU_SIZE(nbuf):GET_IP4_SDU_SIZE(nbuf))
95#define GET_IF_IP_HDR_SIZE(nbuf) (GET_IP_VER(nbuf)==IPV6_VERSION?GET_IF_IP6_HDR_SIZE(nbuf):GET_IF_IP4_HDR_SIZE(nbuf))
96#define GET_IP_TCP_Q_HDR_OFFSET(nbuf) (GET_IP_VER(nbuf)==IPV6_VERSION?\
97 ((T_IP6_TCP_Q_HDR*)GET_IP6_HDR(nbuf))->thoff:((T_IP4_TCP_Q_HDR*)GET_IP4_HDR(nbuf))->thoff)
98
99#define SET_IP_CF(nbuf,cf) (GET_IP_VER(nbuf)==IPV6_VERSION?SET_IP6_CF(nbuf,cf):(0))
100#define SET_IP_SDU_SIZE(nbuf,len) (GET_IP_VER(nbuf)==IPV6_VERSION?SET_IP6_SDU_SIZE(nbuf,len):SET_IP4_SDU_SIZE(nbuf,len))
101#define SET_IP_TCP_Q_HDR_OFFSET(nbuf,thoff) \
102 (GET_IP_VER(nbuf)==IPV6_VERSION\
103 ?(((T_IP6_TCP_Q_HDR*)GET_IP6_HDR(nbuf))->thoff=thoff)\
104 :(((T_IP4_TCP_Q_HDR*)GET_IP4_HDR(nbuf))->thoff=thoff))
105
106#else /* of #if defined(_IP4_CFG) */
107
108#define IF_IP_HDR_SIZE(nbuf) IF_IP6_HDR_SIZE
109#define IF_IP_NET_HDR_SIZE(addr) IF_IP6_HDR_SIZE
110
111#define IP_OUTPUT(nbuf,tmout) ip6_output(nbuf,0,tmout)
112#define IP_REMOVE_OPTIONS(nbuf) ip6_remove_exthdrs(nbuf)
113
114#define GET_IP_HDR(nbuf) GET_IP6_HDR(nbuf)
115#define GET_IP_HDR_SIZE(nbuf) GET_IP6_HDR_SIZE(nbuf)
116#define GET_IP_SDU_SIZE(nbuf) GET_IP6_SDU_SIZE(nbuf)
117#define GET_IF_IP_HDR_SIZE(nbuf) GET_IF_IP6_HDR_SIZE(nbuf)
118#define GET_IP_TCP_Q_HDR_OFFSET(nbuf) (((T_IP6_TCP_Q_HDR*)GET_IP6_HDR(nbuf))->thoff)
119
120#define SET_IP_CF(nbuf,cf) SET_IP6_CF(nbuf,cf)
121#define SET_IP_SDU_SIZE(nbuf,len) SET_IP6_SDU_SIZE(nbuf,len)
122#define SET_IP_TCP_Q_HDR_OFFSET(nbuf,thoff) \
123 (((T_IP6_TCP_Q_HDR*)GET_IP6_HDR(nbuf))->thoff=thoff)
124
125#endif /* of #if defined(_IP4_CFG) */
126
127#else /* of #if defined(_IP6_CFG) */
128
129#if defined(_IP4_CFG)
130
131#define IF_IP_HDR_SIZE(nbuf) IF_IP4_HDR_SIZE
132#define IF_IP_NET_HDR_SIZE(addr) IF_IP4_HDR_SIZE
133
134#define IP_OUTPUT(nbuf,tmout) ip_output(nbuf,tmout)
135#define IP_REMOVE_OPTIONS(nbuf) ip_remove_options(nbuf)
136
137#define GET_IP_HDR(nbuf) GET_IP4_HDR(nbuf)
138#define GET_IP_HDR_SIZE(nbuf) GET_IP4_HDR_SIZE(nbuf)
139#define GET_IP_SDU_SIZE(nbuf) GET_IP4_SDU_SIZE(nbuf)
140#define GET_IF_IP_HDR_SIZE(nbuf) GET_IF_IP4_HDR_SIZE(nbuf)
141#define GET_IP_TCP_Q_HDR_OFFSET(nbuf) (((T_IP4_TCP_Q_HDR*)GET_IP4_HDR(nbuf))->thoff)
142
143#define SET_IP_SDU_SIZE(nbuf,len) SET_IP4_SDU_SIZE(nbuf,len)
144#define SET_IP_TCP_Q_HDR_OFFSET(nbuf,thoff) \
145 (((T_IP4_TCP_Q_HDR*)GET_IP4_HDR(nbuf))->thoff=thoff)
146
147#else /* of #if defined(_IP4_CFG) */
148
149#error "not implemented."
150
151#endif /* of #if defined(_IP4_CFG) */
152
153#endif /* of #if defined(_IP6_CFG) */
154
155#endif /* of #ifndef _IP_VAR_H_ */
Note: See TracBrowser for help on using the repository browser.