Changeset 331 for EcnlProtoTool/trunk/asp3_dcre/tinet/netinet6/in6_var.h
- Timestamp:
- Jan 21, 2018, 12:10:09 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
EcnlProtoTool/trunk/asp3_dcre/tinet/netinet6/in6_var.h
r321 r331 2 2 * TINET (TCP/IP Protocol Stack) 3 3 * 4 * Copyright (C) 2001-20 09by Dep. of Computer Science and Engineering4 * Copyright (C) 2001-2017 by Dep. of Computer Science and Engineering 5 5 * Tomakomai National College of Technology, JAPAN 6 6 * … … 102 102 #define _IN6_VAR_H_ 103 103 104 #ifdef SUPPORT_INET6 104 /* 105 * アドレスの定義 106 */ 107 108 #ifdef _NET_CFG_BYTE_ORDER 109 110 #if _NET_CFG_BYTE_ORDER == _NET_CFG_BIG_ENDIAN 111 112 #define IPV6_ADDR_INT32_ONE ULONG_C(0x00000001) 113 #define IPV6_ADDR_INT32_TWO ULONG_C(0x00000002) 114 #define IPV6_ADDR_INT32_0000FFFF ULONG_C(0x0000ffff) 115 #define IPV6_ADDR_INT32_MNL ULONG_C(0xff010000) 116 #define IPV6_ADDR_INT32_MLL ULONG_C(0xff020000) 117 #define IPV6_ADDR_INT32_ULL ULONG_C(0xfe800000) 118 #define IPV6_ADDR_INT16_ULL UINT_C(0xfe80) 119 #define IPV6_ADDR_INT16_USL UINT_C(0xfec0) 120 #define IPV6_ADDR_INT16_MLL UINT_C(0xff02) 121 122 #elif _NET_CFG_BYTE_ORDER == _NET_CFG_LITTLE_ENDIAN 123 124 #define IPV6_ADDR_INT32_ONE ULONG_C(0x01000000) 125 #define IPV6_ADDR_INT32_TWO ULONG_C(0x02000000) 126 #define IPV6_ADDR_INT32_0000FFFF ULONG_C(0xffff0000) 127 #define IPV6_ADDR_INT32_MNL ULONG_C(0x000001ff) 128 #define IPV6_ADDR_INT32_MLL ULONG_C(0x000002ff) 129 #define IPV6_ADDR_INT32_ULL ULONG_C(0x000080fe) 130 #define IPV6_ADDR_INT16_ULL UINT_C(0x80fe) 131 #define IPV6_ADDR_INT16_USL UINT_C(0xc0fe) 132 #define IPV6_ADDR_INT16_MLL UINT_C(0x02ff) 133 134 #endif /* #if _NET_CFG_BYTE_ORDER == _NET_CFG_BIG_ENDIAN */ 135 136 #endif /* of #ifdef _NET_CFG_BYTE_ORDER */ 137 138 /* 139 * 特別なアドレスのチェック 140 */ 141 142 /* IPv4 互換 */ 143 144 #ifdef _NET_CFG_BYTE_ORDER 145 #define IN6_IS_ADDR_V4COMPAT(a) \ 146 (memcmp((void *)(a), (void *)&in6_addr_unspecified, sizeof(T_IN6_ADDR) - 4) == 0 && \ 147 (a)->s6_addr32[3] > IPV6_ADDR_INT32_ONE) 148 #endif 149 150 /* IPv4 射影 */ 151 152 #ifdef _NET_CFG_BYTE_ORDER 153 #define IN6_IS_ADDR_V4MAPPED(a) \ 154 (((a)->s6_addr32[0] == ULONG_C(0x00000000)) && \ 155 ((a)->s6_addr32[1] == ULONG_C(0x00000000)) && \ 156 ((a)->s6_addr32[2] == IPV6_ADDR_INT32_0000FFFF)) 157 #endif 158 159 /* 要請マルチキャスト */ 160 161 #ifdef _NET_CFG_BYTE_ORDER 162 #define IN6_IS_ADDR_NS_MULTICAST(a) \ 163 (((a)->s6_addr32[0] == IPV6_ADDR_INT32_MLL) && \ 164 ((a)->s6_addr32[1] == ULONG_C(0x00000000)) && \ 165 ((a)->s6_addr32[2] == IPV6_ADDR_INT32_ONE) && \ 166 ((a)->s6_addr8[12] == UINT_C(0xff))) 167 #endif 168 169 #ifndef _MACRO_ONLY 105 170 106 171 /* … … 197 262 /* IPv6 マルチキャストアドレス配列の最大サイズ */ 198 263 199 /*200 * ルーティングの制御201 */202 203 264 /* ルーティング表エントリ構造体 */ 204 265 … … 231 292 232 293 /* 233 * IPv4 と IPv6 をコンパイル時に選択するためのマクロ 234 */ 235 236 #define IN_SET_HEADER(nbuf,len,dst,src,next,hlim) \ 237 in6_set_header(nbuf,len,dst,src,next,hlim) 238 #define IN_GET_DATAGRAM(nbuf,len,maxlen,dst,src,next,hlim,nbatr,tmout) \ 239 in6_get_datagram(nbuf,len,maxlen,dst,src,next,hlim,nbatr,tmout) 240 #define IN_CKSUM(nbuf,proto,off,len) in6_cksum(nbuf,proto,off,len) 241 #define IN_IS_DSTADDR_ACCEPT(myaddr,dstaddr) \ 242 in6_is_dstaddr_accept(myaddr,dstaddr) 243 #define IN_IFAWITHIFP(ifp,dst) in6_ifawithifp(ifp,dst) 244 #define T_IN_IFADDR T_IN6_IFADDR 245 #define T_IN_RTENTRY T_IN6_RTENTRY 294 * ルーティング表 295 */ 296 297 extern T_IN6_RTENTRY routing6_tbl[]; 246 298 247 299 /* … … 264 316 265 317 /* 318 * 関数シミュレーションマクロ 319 */ 320 321 #define IN6_COPY_TO_HOST(dst,nbuf) memcpy(dst,&GET_IP6_HDR(nbuf)->src,sizeof(T_IN6_ADDR)) 322 #define INN6_IS_DSTADDR_ACCEPT(addr,nbuf) \ 323 in6_is_dstaddr_accept(addr,&GET_IP6_HDR(nbuf)->dst) 324 325 /* 266 326 * 関数 267 327 */ 268 328 269 329 extern void in6_ifainit (void); 270 extern int_t in6_addr2maix ( T_IN6_ADDR *addr);271 extern ER in6_update_ifa (T_IFNET *ifp, T_IN6_IFADDR *ia, T_IN6_ADDR *addr,330 extern int_t in6_addr2maix (const T_IN6_ADDR *addr); 331 extern ER in6_update_ifa (T_IFNET *ifp, T_IN6_IFADDR *ia, const T_IN6_ADDR *addr, 272 332 uint_t prefix_len, uint32_t vltime, uint32_t pltime, 273 333 int_t router_index, int_t prefix_index, uint_t flags); 274 334 extern ER in6_set_header (T_NET_BUF *nbuf, uint_t len, 275 T_IN6_ADDR *dstaddr,T_IN6_ADDR *srcaddr,335 const T_IN6_ADDR *dstaddr, const T_IN6_ADDR *srcaddr, 276 336 uint8_t next, uint8_t hlim); 277 337 extern ER in6_get_datagram (T_NET_BUF **nbuf, uint_t len, uint_t maxlen, 278 T_IN6_ADDR *dstaddr,T_IN6_ADDR *srcaddr,338 const T_IN6_ADDR *dstaddr, const T_IN6_ADDR *srcaddr, 279 339 uint8_t next, uint8_t hlim, ATR nbatr, TMO tmout); 280 340 extern uint16_t in6_cksum (T_NET_BUF *nbuf, uint8_t proto, uint_t off, uint_t len); 281 341 extern T_IN6_IFADDR *in6ifa_ifpwithix (T_IFNET *ifp, int_t ix); 282 342 extern T_IN6_IFADDR *in6ifa_ifpwithrtrix (T_IFNET *ifp, int_t rtr_ix); 283 extern T_IN6_IFADDR *in6_ifawithifp (T_IFNET *ifp, T_IN6_ADDR *dst); 343 extern T_IN6_IFADDR *in6_ifawithifp (T_IFNET *ifp, const T_IN6_ADDR *dst); 344 extern const T_IN6_ADDR *in6_addrwithifp (T_IFNET *ifp, T_IN6_ADDR *src, const T_IN6_ADDR *dst); 284 345 extern void ip6_input (T_NET_BUF *input); 285 extern T_IN6_IFADDR *in6_lookup_ifaddr (T_IFNET *ifp, T_IN6_ADDR *addr); 286 extern bool_t in6_lookup_multi (T_IFNET *ifp, T_IN6_ADDR *maddr); 287 extern bool_t in6_is_dstaddr_accept (T_IN6_ADDR *myaddr, T_IN6_ADDR *dstaddr); 288 extern T_IN6_ADDR *in6_rtalloc (T_IFNET *ifp, T_IN6_ADDR *dst); 346 extern T_IN6_IFADDR *in6_lookup_ifaddr (T_IFNET *ifp, const T_IN6_ADDR *addr); 347 extern bool_t in6_lookup_multi (T_IFNET *ifp, const T_IN6_ADDR *maddr); 348 extern bool_t in6_is_dstaddr_accept (const T_IN6_ADDR *myaddr, const T_IN6_ADDR *dstaddr); 349 extern bool_t inn6_is_dstaddr_accept (const T_IN6_ADDR *myaddr, T_NET_BUF *input); 350 extern const T_IN6_ADDR *in6_rtalloc (T_IFNET *ifp, const T_IN6_ADDR *dst); 289 351 extern int_t in6_if2idlen (T_IFNET *ifp); 290 extern int_t in6_addr2ifaix ( T_IN6_ADDR *addr);352 extern int_t in6_addr2ifaix (const T_IN6_ADDR *addr); 291 353 extern void in6_plen2pmask (T_IN6_ADDR *mask, uint_t prefix_len); 292 extern bool_t in6_are_prefix_equal ( T_IN6_ADDR *addr,T_IN6_ADDR *prefix,354 extern bool_t in6_are_prefix_equal (const T_IN6_ADDR *addr, const T_IN6_ADDR *prefix, 293 355 uint_t prefix_len); 294 356 extern void in6_ifaddr_timer (T_IFNET *ifp); 295 extern T_IN6_RTENTRY *in6_gateway_lookup ( T_IN6_ADDR *src);296 extern void in6_rtredirect ( T_IN6_ADDR *gateway,T_IN6_ADDR *target,357 extern T_IN6_RTENTRY *in6_gateway_lookup (const T_IN6_ADDR *src); 358 extern void in6_rtredirect (const T_IN6_ADDR *gateway, const T_IN6_ADDR *target, 297 359 uint_t prefix_len, uint8_t flags, uint32_t tmo); 298 360 extern void in6_init (void); 299 361 extern void in6_if_up (T_IFNET *ifp); 300 362 extern void in6_hostcache_update (T_IN6_ADDR *dst, uint32_t mtu); 301 extern uint32_t in6_hostcache_getmtu ( T_IN6_ADDR *dst);302 extern uint_t in6_addrscope ( T_IN6_ADDR *addr);363 extern uint32_t in6_hostcache_getmtu (const T_IN6_ADDR *dst); 364 extern uint_t in6_addrscope (const T_IN6_ADDR *addr); 303 365 extern const T_NET_BUF**ip6_get_frag_queue (void); 304 366 305 #endif /* of #if def SUPPORT_INET6*/367 #endif /* of #ifndef _MACRO_ONLY */ 306 368 307 369 #endif /* of #ifndef _IN6_VAR_H_ */
Note:
See TracChangeset
for help on using the changeset viewer.