4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
29 #include <sys/types.h>
37 * Maximum Physical (hardware) address length, in bytes.
38 * Must be as large as MAXMACADDRLEN (see <sys/mac.h>).
40 #define DLPI_PHYSADDR_MAX 64
43 * Maximum link name length, including terminating NUL, in bytes.
44 * Must be no larger than MAXLINKNAMELEN (see <sys/param.h>).
46 #define DLPI_LINKNAME_MAX 32
49 * Constant used to indicate bind to any SAP value
51 #define DLPI_ANY_SAP (uint_t)-1
54 * Flag values for dlpi_open(); those not documented in dlpi_open(3DLPI)
55 * are Consolidation Private and subject to change or removal.
57 #define DLPI_EXCL 0x0001 /* Exclusive open */
58 #define DLPI_PASSIVE 0x0002 /* Open DLPI link in passive mode */
59 #define DLPI_RAW 0x0004 /* Open DLPI link in raw mode */
60 #define DLPI_SERIAL 0x0008 /* Synchronous serial line interface */
61 #define DLPI_NOATTACH 0x0010 /* Do not attach PPA */
62 #define DLPI_NATIVE 0x0020 /* Open DLPI link in native mode */
63 #define DLPI_DEVONLY 0x0040 /* Open DLPI link under /dev only */
64 #define DLPI_DEVIPNET 0x0080 /* Open IP DLPI link under /dev/ipnet */
65 #define DLPI_IPNETINFO 0x0100 /* Request ipnetinfo headers */
67 * Timeout to be used in DLPI-related operations, in seconds.
69 #define DLPI_DEF_TIMEOUT 5
72 * Since this library returns error codes defined in either <sys/dlpi.h> or
73 * <libdlpi.h>, libdlpi specific error codes will start at value 10000 to
74 * avoid overlap. DLPI_SUCCESS cannot be 0 because 0 is already DL_BADSAP in
78 DLPI_SUCCESS
= 10000, /* DLPI operation succeeded */
79 DLPI_EINVAL
, /* invalid argument */
80 DLPI_ELINKNAMEINVAL
, /* invalid DLPI linkname */
81 DLPI_ENOLINK
, /* DLPI link does not exist */
82 DLPI_EBADLINK
, /* bad DLPI link */
83 DLPI_EINHANDLE
, /* invalid DLPI handle */
84 DLPI_ETIMEDOUT
, /* DLPI operation timed out */
85 DLPI_EVERNOTSUP
, /* unsupported DLPI Version */
86 DLPI_EMODENOTSUP
, /* unsupported DLPI connection mode */
87 DLPI_EUNAVAILSAP
, /* unavailable DLPI SAP */
88 DLPI_FAILURE
, /* DLPI operation failed */
89 DLPI_ENOTSTYLE2
, /* DLPI style-2 node reports style-1 */
90 DLPI_EBADMSG
, /* bad DLPI message */
91 DLPI_ERAWNOTSUP
, /* DLPI raw mode not supported */
92 DLPI_ENOTEINVAL
, /* invalid DLPI notification type */
93 DLPI_ENOTENOTSUP
, /* DLPI notification not supported by link */
94 DLPI_ENOTEIDINVAL
, /* invalid DLPI notification id */
95 DLPI_EIPNETINFONOTSUP
, /* DLPI_IPNETINFO not supported */
96 DLPI_ERRMAX
/* Highest + 1 libdlpi error code */
100 * DLPI information; see dlpi_info(3DLPI).
108 char di_linkname
[DLPI_LINKNAME_MAX
];
109 uchar_t di_physaddr
[DLPI_PHYSADDR_MAX
];
110 uchar_t di_physaddrlen
;
111 uchar_t di_bcastaddr
[DLPI_PHYSADDR_MAX
];
112 uchar_t di_bcastaddrlen
;
115 dl_qos_cl_sel1_t di_qos_sel
;
116 dl_qos_cl_range1_t di_qos_range
;
120 * DLPI send information; see dlpi_send(3DLPI).
124 dl_priority_t dsi_prio
;
128 * Destination DLPI address type; see dlpi_recv(3DLPI).
131 DLPI_ADDRTYPE_UNICAST
,
136 * DLPI receive information; see dlpi_recv(3DLPI).
139 uchar_t dri_destaddr
[DLPI_PHYSADDR_MAX
];
140 uchar_t dri_destaddrlen
;
141 dlpi_addrtype_t dri_destaddrtype
;
142 size_t dri_totmsglen
;
146 * DLPI notification, (DL_NOTIFY_IND) payload information;
147 * see dlpi_enabnotify(3DLPI).
155 uchar_t physaddr
[DLPI_PHYSADDR_MAX
];
161 #define dni_speed dni_data.dniu_speed
162 #define dni_size dni_data.dniu_size
163 #define dni_physaddr dni_data.dniu_addr.physaddr
164 #define dni_physaddrlen dni_data.dniu_addr.physaddrlen
166 typedef struct __dlpi_handle
*dlpi_handle_t
;
169 * dlpi_notifyid_t refers to a registered notification. Its value should
170 * not be interpreted by the interface consumer.
172 typedef struct __dlpi_notifyid
*dlpi_notifyid_t
;
175 * Callback function invoked with arguments; see dlpi_enabnotify(3DLPI).
177 typedef void dlpi_notifyfunc_t(dlpi_handle_t
, dlpi_notifyinfo_t
*, void *);
179 extern const char *dlpi_mactype(uint_t
);
180 extern const char *dlpi_strerror(int);
181 extern const char *dlpi_linkname(dlpi_handle_t
);
183 typedef boolean_t
dlpi_walkfunc_t(const char *, void *);
185 extern void dlpi_walk(dlpi_walkfunc_t
*, void *, uint_t
);
186 extern int dlpi_open(const char *, dlpi_handle_t
*, uint_t
);
187 extern void dlpi_close(dlpi_handle_t
);
188 extern int dlpi_info(dlpi_handle_t
, dlpi_info_t
*, uint_t
);
189 extern int dlpi_bind(dlpi_handle_t
, uint_t
, uint_t
*);
190 extern int dlpi_unbind(dlpi_handle_t
);
191 extern int dlpi_enabmulti(dlpi_handle_t
, const void *, size_t);
192 extern int dlpi_disabmulti(dlpi_handle_t
, const void *, size_t);
193 extern int dlpi_promiscon(dlpi_handle_t
, uint_t
);
194 extern int dlpi_promiscoff(dlpi_handle_t
, uint_t
);
195 extern int dlpi_get_physaddr(dlpi_handle_t
, uint_t
, void *, size_t *);
196 extern int dlpi_set_physaddr(dlpi_handle_t
, uint_t
, const void *, size_t);
197 extern int dlpi_recv(dlpi_handle_t
, void *, size_t *, void *, size_t *,
198 int, dlpi_recvinfo_t
*);
199 extern int dlpi_send(dlpi_handle_t
, const void *, size_t, const void *, size_t,
200 const dlpi_sendinfo_t
*);
201 extern int dlpi_enabnotify(dlpi_handle_t
, uint_t
, dlpi_notifyfunc_t
*,
202 void *arg
, dlpi_notifyid_t
*);
203 extern int dlpi_disabnotify(dlpi_handle_t
, dlpi_notifyid_t
, void **);
204 extern int dlpi_fd(dlpi_handle_t
);
205 extern int dlpi_set_timeout(dlpi_handle_t
, int);
206 extern uint_t
dlpi_arptype(uint_t
);
207 extern uint_t
dlpi_iftype(uint_t
);
210 * These are Consolidation Private interfaces and are subject to change.
212 extern int dlpi_parselink(const char *, char *, uint_t
*);
213 extern int dlpi_makelink(char *, const char *, uint_t
);
214 extern uint_t
dlpi_style(dlpi_handle_t
);
220 #endif /* _LIBDLPI_H */