Welcome to mirror list, hosted at ThFree Co, Russian Federation.

in6.h « cygwin « include « cygwin « winsup - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5f3d5818a908225dd24cb559fa59db0ebe43ef37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/* cygwin/in6.h

   Copyright 2006 Red Hat, Inc.

This file is part of Cygwin.

This software is a copyrighted work licensed under the terms of the
Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
details. */

/* NOTE:  This file is NOT for direct inclusion.  Use netinet/in.h. */

#ifndef _CYGWIN_IN6_H
#define _CYGWIN_IN6_H

#define INET6_ADDRSTRLEN 46

#define IN6_ARE_ADDR_EQUAL(a, b) \
	(((const uint32_t *)(a))[0] == ((const uint32_t *)(b))[0] \
	 && ((const uint32_t *)(a))[1] == ((const uint32_t *)(b))[1] \
	 && ((const uint32_t *)(a))[2] == ((const uint32_t *)(b))[2] \
	 && ((const uint32_t *)(a))[3] == ((const uint32_t *)(b))[3])

#define IN6_IS_ADDR_UNSPECIFIED(addr) \
	(((const uint32_t *)(addr))[0] == 0 \
	 && ((const uint32_t *)(addr))[1] == 0 \
	 && ((const uint32_t *)(addr))[2] == 0 \
	 && ((const uint32_t *)(addr))[3] == 0)

#define IN6_IS_ADDR_LOOPBACK(addr) \
	(((const uint32_t *)(addr))[0] == 0 \
	 && ((const uint32_t *)(addr))[1] == 0 \
	 && ((const uint32_t *)(addr))[2] == 0 \
	 && ((const uint32_t *)(addr))[3] == htonl (1))

#define IN6_IS_ADDR_MULTICAST(addr) (((const uint8_t *) (addr))[0] == 0xff)

#define IN6_IS_ADDR_LINKLOCAL(addr) \
	((((const uint16_t *)(addr))[0] & htons (0xffc0)) == htons (0xfe80))

#define IN6_IS_ADDR_SITELOCAL(addr) \
	((((const uint16_t *)(addr))[0] & htons (0xffc0)) == htons (0xfec0))

#define IN6_IS_ADDR_V4MAPPED(addr) \
	(((const uint32_t *)(addr))[0] == 0 \
	 && ((const uint32_t *)(addr))[1] == 0 \
	 && ((const uint32_t *)(addr))[2] == htonl (0xffff))

#define IN6_IS_ADDR_V4COMPAT(addr) \
	(((const uint32_t *)(addr))[0] == 0 \
	 && ((const uint32_t *)(addr))[1] == 0 \
	 && ((const uint32_t *)(addr))[2] == 0 \
	 && ntohl (((const uint32_t *)(addr))[3]) > 1)

#define IN6_IS_ADDR_MC_NODELOCAL(addr) \
	(IN6_IS_ADDR_MULTICAST(addr) \
	 && (((const uint8_t *)(addr))[1] & 0xf) == 0x1)

#define IN6_IS_ADDR_MC_LINKLOCAL(addr) \
	(IN6_IS_ADDR_MULTICAST (addr) \
	 && (((const uint8_t *)(addr))[1] & 0xf) == 0x2)

#define IN6_IS_ADDR_MC_SITELOCAL(addr) \
	(IN6_IS_ADDR_MULTICAST(addr) \
	 && (((const uint8_t *)(addr))[1] & 0xf) == 0x5)

#define IN6_IS_ADDR_MC_ORGLOCAL(addr) \
	(IN6_IS_ADDR_MULTICAST(addr) \
	 && (((const uint8_t *)(addr))[1] & 0xf) == 0x8)

#define IN6_IS_ADDR_MC_GLOBAL(addr) \
	(IN6_IS_ADDR_MULTICAST(addr) \
	 && (((const uint8_t *)(addr))[1] & 0xf) == 0xe)

struct in6_addr
{
  union
    {
      uint8_t 	  __s6_addr[16];
      uint16_t 	  __s6_addr16[8];
      uint32_t 	  __s6_addr32[4];
    } __u6;
#define s6_addr		__u6.__s6_addr
#define s6_addr16	__u6.__s6_addr16
#define s6_addr32	__u6.__s6_addr32
};

struct ipv6_mreq
{
  struct in6_addr ipv6mr_multiaddr;
  unsigned int    ipv6mr_interface;
};

struct in6_pktinfo
{
  struct in6_addr ipi6_addr;
  unsigned int    ipi6_ifindex;
};

#if defined (__INSIDE_CYGWIN__) && !defined (_CYGWIN_IN_H)
typedef uint16_t in_port_t;
#endif

struct sockaddr_in6
{
  sa_family_t	  sin6_family;		/* AF_INET6 */
  in_port_t	  sin6_port;		/* Port number. */
  uint32_t	  sin6_flowinfo;	/* Traffic class and flow inf. */
  struct in6_addr sin6_addr;		/* IPv6 address. */
  uint32_t	  sin6_scope_id;	/* Set of interfaces for a scope. */
};

#define IN6ADDR_ANY_INIT	{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
#define IN6ADDR_LOOPBACK_INIT	{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }

extern const struct in6_addr in6addr_any;
extern const struct in6_addr in6addr_loopback;

#endif	/* _CYGWIN_IN6_H */