Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/windows/native/java/net/icmp.h
32287 views
1
/*
2
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
#ifndef ICMP_H
27
#define ICMP_H
28
29
/*
30
* Structure of an internet header, naked of options.
31
*
32
* We declare ip_len and ip_off to be short, rather than ushort_t
33
* pragmatically since otherwise unsigned comparisons can result
34
* against negative integers quite easily, and fail in subtle ways.
35
*/
36
struct ip {
37
unsigned char ip_hl:4, /* header length */
38
ip_v:4; /* version */
39
unsigned char ip_tos; /* type of service */
40
short ip_len; /* total length */
41
unsigned short ip_id; /* identification */
42
short ip_off; /* fragment offset field */
43
#define IP_DF 0x4000 /* don't fragment flag */
44
#define IP_MF 0x2000 /* more fragments flag */
45
unsigned char ip_ttl; /* time to live */
46
unsigned char ip_p; /* protocol */
47
unsigned short ip_sum; /* checksum */
48
struct in_addr ip_src, ip_dst; /* source and dest address */
49
};
50
51
/*
52
* Structure of an icmp header.
53
*/
54
struct icmp {
55
unsigned char icmp_type; /* type of message, see below */
56
unsigned char icmp_code; /* type sub code */
57
unsigned short icmp_cksum; /* ones complement cksum of struct */
58
union {
59
unsigned char ih_pptr; /* ICMP_PARAMPROB */
60
struct in_addr ih_gwaddr; /* ICMP_REDIRECT */
61
struct ih_idseq {
62
unsigned short icd_id;
63
unsigned short icd_seq;
64
} ih_idseq;
65
int ih_void;
66
67
/* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
68
struct ih_pmtu {
69
unsigned short ipm_void;
70
unsigned short ipm_nextmtu;
71
} ih_pmtu;
72
73
struct ih_rtradv {
74
unsigned char irt_num_addrs;
75
unsigned char irt_wpa;
76
unsigned short irt_lifetime;
77
} ih_rtradv;
78
} icmp_hun;
79
#define icmp_pptr icmp_hun.ih_pptr
80
#define icmp_gwaddr icmp_hun.ih_gwaddr
81
#define icmp_id icmp_hun.ih_idseq.icd_id
82
#define icmp_seq icmp_hun.ih_idseq.icd_seq
83
#define icmp_void icmp_hun.ih_void
84
#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void
85
#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu
86
union {
87
struct id_ts {
88
unsigned int its_otime;
89
unsigned int its_rtime;
90
unsigned int its_ttime;
91
} id_ts;
92
struct id_ip {
93
struct ip idi_ip;
94
/* options and then 64 bits of data */
95
} id_ip;
96
unsigned int id_mask;
97
char id_data[1];
98
} icmp_dun;
99
#define icmp_otime icmp_dun.id_ts.its_otime
100
#define icmp_rtime icmp_dun.id_ts.its_rtime
101
#define icmp_ttime icmp_dun.id_ts.its_ttime
102
#define icmp_ip icmp_dun.id_ip.idi_ip
103
#define icmp_mask icmp_dun.id_mask
104
#define icmp_data icmp_dun.id_data
105
};
106
107
#define ICMP_ECHOREPLY 0 /* echo reply */
108
#define ICMP_ECHO 8 /* echo service */
109
110
/*
111
* ICMPv6 structures & constants
112
*/
113
114
typedef struct icmp6_hdr {
115
u_char icmp6_type; /* type field */
116
u_char icmp6_code; /* code field */
117
u_short icmp6_cksum; /* checksum field */
118
union {
119
u_int icmp6_un_data32[1]; /* type-specific field */
120
u_short icmp6_un_data16[2]; /* type-specific field */
121
u_char icmp6_un_data8[4]; /* type-specific field */
122
} icmp6_dataun;
123
} icmp6_t;
124
125
#define icmp6_data32 icmp6_dataun.icmp6_un_data32
126
#define icmp6_data16 icmp6_dataun.icmp6_un_data16
127
#define icmp6_data8 icmp6_dataun.icmp6_un_data8
128
#define icmp6_pptr icmp6_data32[0] /* parameter prob */
129
#define icmp6_mtu icmp6_data32[0] /* packet too big */
130
#define icmp6_id icmp6_data16[0] /* echo request/reply */
131
#define icmp6_seq icmp6_data16[1] /* echo request/reply */
132
#define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */
133
134
struct ip6_pseudo_hdr /* for calculate the ICMPv6 checksum */
135
{
136
struct in6_addr ip6_src;
137
struct in6_addr ip6_dst;
138
u_int ip6_plen;
139
u_int ip6_nxt;
140
};
141
142
#define ICMP6_ECHO_REQUEST 128
143
#define ICMP6_ECHO_REPLY 129
144
#define IPPROTO_ICMPV6 58
145
#define IPV6_UNICAST_HOPS 4 /* Set/get IP unicast hop limit */
146
147
148
#endif
149
150