xref: /titanic_51/usr/src/uts/common/inet/arp.h (revision 7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fe)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 1992,1997-2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 /* Copyright (c) 1990 Mentat Inc. */
27 
28 #ifndef	_INET_ARP_H
29 #define	_INET_ARP_H
30 
31 #pragma ident	"%Z%%M%	%I%	%E% SMI"
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 #define	ARP_REQUEST	1
38 #define	ARP_RESPONSE	2
39 #define	RARP_REQUEST	3
40 #define	RARP_RESPONSE	4
41 
42 #define	AR_IOCTL		(((unsigned)'A' & 0xFF)<<8)
43 #define	CMD_IN_PROGRESS		0x10000
44 /*
45  * The following ARP commands are private, and not part of a supported
46  * interface. They are subject to change without notice in any release.
47  */
48 #define	AR_ENTRY_ADD		(AR_IOCTL + 1)
49 #define	AR_ENTRY_DELETE		(AR_IOCTL + 2)
50 #define	AR_ENTRY_QUERY		(AR_IOCTL + 3)
51 #define	AR_XMIT_REQUEST		(AR_IOCTL + 4)
52 #define	AR_XMIT_TEMPLATE	(AR_IOCTL + 5)
53 #define	AR_ENTRY_SQUERY		(AR_IOCTL + 6)
54 #define	AR_MAPPING_ADD		(AR_IOCTL + 7)
55 #define	AR_CLIENT_NOTIFY	(AR_IOCTL + 8)
56 #define	AR_INTERFACE_UP		(AR_IOCTL + 9)
57 #define	AR_INTERFACE_DOWN	(AR_IOCTL + 10)
58 #define	AR_XMIT_RESPONSE	(AR_IOCTL + 11)
59 #define	AR_INTERFACE_ON		(AR_IOCTL + 12)
60 #define	AR_INTERFACE_OFF	(AR_IOCTL + 13)
61 #define	AR_DLPIOP_DONE		(AR_IOCTL + 14)
62 #define	AR_ENTRY_LLAQUERY	(AR_IOCTL + 15)
63 /*
64  * This is not an ARP command per se, it is used to interface between
65  * ARP and IP during close.
66  */
67 #define	AR_ARP_CLOSING		(AR_IOCTL + 16)
68 
69 /*
70  * The following ACE flags are private, and not part of a supported
71  * interface. They are subject to change without notice in any release.
72  */
73 #define	ACE_F_PERMANENT		0x1
74 #define	ACE_F_PUBLISH		0x2
75 #define	ACE_F_DYING		0x4
76 #define	ACE_F_RESOLVED		0x8
77 /* Using bit mask extraction from target address */
78 #define	ACE_F_MAPPING		0x10
79 #define	ACE_F_MYADDR		0x20	/* Strong check for duplicate MACs */
80 
81 /* ARP Cmd Table entry */
82 typedef struct arct_s {
83 	pfi_t	arct_pfi;
84 	uint32_t	arct_cmd;
85 	int	arct_min_len;
86 	uint32_t	arct_flags;
87 	int		arct_priv_req;	/* Privilege required for this cmd */
88 	const char	*arct_txt;
89 } arct_t;
90 
91 /* ARP Command Structures */
92 
93 /* arc_t - Common command overlay */
94 typedef struct ar_cmd_s {
95 	uint32_t	arc_cmd;
96 	uint32_t	arc_name_offset;
97 	uint32_t	arc_name_length;
98 } arc_t;
99 
100 /*
101  * The following ARP command structures are private, and not
102  * part of a supported interface. They are subject to change
103  * without notice in any release.
104  */
105 
106 /*
107  * NOTE: when using area_t for an AR_ENTRY_SQUERY, the area_hw_addr_offset
108  * field isn't what you might think. See comments in ip_multi.c where
109  * the routine ill_create_squery() is called, and also in the routine
110  * itself, to see how this field is used *only* when the area_t holds
111  * an AR_ENTRY_SQUERY.
112  */
113 typedef	struct ar_entry_add_s {
114 	uint32_t	area_cmd;
115 	uint32_t	area_name_offset;
116 	uint32_t	area_name_length;
117 	uint32_t	area_proto;
118 	uint32_t	area_proto_addr_offset;
119 	uint32_t	area_proto_addr_length;
120 	uint32_t	area_proto_mask_offset;
121 	uint32_t	area_flags;		/* Same values as ace_flags */
122 	uint32_t	area_hw_addr_offset;
123 	uint32_t	area_hw_addr_length;
124 } area_t;
125 
126 typedef	struct ar_entry_delete_s {
127 	uint32_t	ared_cmd;
128 	uint32_t	ared_name_offset;
129 	uint32_t	ared_name_length;
130 	uint32_t	ared_proto;
131 	uint32_t	ared_proto_addr_offset;
132 	uint32_t	ared_proto_addr_length;
133 } ared_t;
134 
135 typedef	struct ar_entry_query_s {
136 	uint32_t	areq_cmd;
137 	uint32_t	areq_name_offset;
138 	uint32_t	areq_name_length;
139 	uint32_t	areq_proto;
140 	uint32_t	areq_target_addr_offset;
141 	uint32_t	areq_target_addr_length;
142 	uint32_t	areq_flags;
143 	uint32_t	areq_sender_addr_offset;
144 	uint32_t	areq_sender_addr_length;
145 	uint32_t	areq_xmit_count;	/* 0 ==> cache lookup only */
146 	uint32_t	areq_xmit_interval; /* # of milliseconds; 0: default */
147 		/* # ofquests to buffer; 0: default */
148 	uint32_t	areq_max_buffered;
149 	uchar_t	areq_sap[8];		/* to insert in returned template */
150 } areq_t;
151 
152 /*
153  * Structure used with AR_ENTRY_LLAQUERY to map from the link_addr
154  * (in Neighbor Discovery option format excluding the option type and
155  * length) to a hardware address.
156  * The response has the same format as for an AR_ENTRY_SQUERY - an M_CTL with
157  * arel_hw_addr updated.
158  * An IPv6 address will be passed in AR_ENTRY_LLAQUERY so that atmip
159  * can send it in AR_CLIENT_NOTIFY messages.
160  */
161 typedef	struct ar_entry_llaquery_s {
162 	uint32_t	arel_cmd;
163 	uint32_t	arel_name_offset;
164 	uint32_t	arel_name_length;
165 	uint32_t	arel_link_addr_offset;
166 	uint32_t	arel_link_addr_length;
167 	uint32_t	arel_hw_addr_offset;
168 	uint32_t	arel_hw_addr_length;
169 	uint32_t	arel_ip_addr_offset;
170 	uint32_t	arel_ip_addr_length;
171 } arel_t;
172 
173 typedef	struct ar_mapping_add_s {
174 	uint32_t	arma_cmd;
175 	uint32_t	arma_name_offset;
176 	uint32_t	arma_name_length;
177 	uint32_t	arma_proto;
178 	uint32_t	arma_proto_addr_offset;
179 	uint32_t	arma_proto_addr_length;
180 	uint32_t	arma_proto_mask_offset;
181 	uint32_t	arma_proto_extract_mask_offset;
182 	uint32_t	arma_flags;
183 	uint32_t	arma_hw_addr_offset;
184 	uint32_t	arma_hw_addr_length;
185 		/* Offset were we start placing */
186 	uint32_t	arma_hw_mapping_start;
187 					/* the mask&proto_addr */
188 } arma_t;
189 
190 /* Structure used to notify clients of interesting conditions. */
191 typedef struct ar_client_notify_s {
192 	uint32_t	arcn_cmd;
193 	uint32_t	arcn_name_offset;
194 	uint32_t	arcn_name_length;
195 	uint32_t	arcn_code;			/* Notification code. */
196 } arcn_t;
197 
198 /* Client Notification Codes */
199 /*
200  * The following Client Notification codes are private, and not
201  * part of a supported interface. They are subject to change
202  * without notice in any release.
203  */
204 #define	AR_CN_BOGON	1
205 #define	AR_CN_ANNOUNCE	2
206 
207 /* ARP Header */
208 typedef struct arh_s {
209 	uchar_t	arh_hardware[2];
210 	uchar_t	arh_proto[2];
211 	uchar_t	arh_hlen;
212 	uchar_t	arh_plen;
213 	uchar_t	arh_operation[2];
214 	/* The sender and target hw/proto pairs follow */
215 } arh_t;
216 
217 #ifdef	__cplusplus
218 }
219 #endif
220 
221 #endif	/* _INET_ARP_H */
222