libdlpi.h revision d62bc4badc1c1f1549c961cfb8b420e650e1272b
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _LIBDLPI_H
#define _LIBDLPI_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Maximum Physical (hardware) address length, in bytes.
*/
#define DLPI_PHYSADDR_MAX 64
/*
* Maximum link name length, including terminating NUL, in bytes.
*/
#define DLPI_LINKNAME_MAX 32
/*
* Constant used to indicate bind to any SAP value
*/
/*
* Flag values for dlpi_open(); those not documented in dlpi_open(3DLPI)
* are Consolidation Private and subject to change or removal.
*/
/*
* Timeout to be used in DLPI-related operations, in seconds.
*/
#define DLPI_DEF_TIMEOUT 5
/*
* <libdlpi.h>, libdlpi specific error codes will start at value 10000 to
* avoid overlap. DLPI_SUCCESS cannot be 0 because 0 is already DL_BADSAP in
*/
enum {
DLPI_EINVAL, /* invalid argument */
DLPI_ELINKNAMEINVAL, /* invalid DLPI linkname */
DLPI_ENOLINK, /* DLPI link does not exist */
DLPI_EBADLINK, /* bad DLPI link */
DLPI_EINHANDLE, /* invalid DLPI handle */
DLPI_ETIMEDOUT, /* DLPI operation timed out */
DLPI_EVERNOTSUP, /* unsupported DLPI Version */
DLPI_EMODENOTSUP, /* unsupported DLPI connection mode */
DLPI_EUNAVAILSAP, /* unavailable DLPI SAP */
DLPI_FAILURE, /* DLPI operation failed */
DLPI_ENOTSTYLE2, /* DLPI style-2 node reports style-1 */
DLPI_EBADMSG, /* bad DLPI message */
DLPI_ERAWNOTSUP, /* DLPI raw mode not supported */
DLPI_ENOTEINVAL, /* invalid DLPI notification type */
DLPI_ENOTENOTSUP, /* DLPI notification not supported by link */
DLPI_ENOTEIDINVAL, /* invalid DLPI notification id */
DLPI_ERRMAX /* Highest + 1 libdlpi error code */
};
/*
* DLPI information; see dlpi_info(3DLPI).
*/
typedef struct {
char di_linkname[DLPI_LINKNAME_MAX];
int di_timeout;
} dlpi_info_t;
/*
* DLPI send information; see dlpi_send(3DLPI).
*/
typedef struct {
/*
* Destination DLPI address type; see dlpi_recv(3DLPI).
*/
typedef enum {
/*
* DLPI receive information; see dlpi_recv(3DLPI).
*/
typedef struct {
/*
* DLPI notification, (DL_NOTIFY_IND) payload information;
* see dlpi_enabnotify(3DLPI).
*/
typedef struct {
union {
struct {
} dniu_addr;
} dni_data;
typedef struct __dlpi_handle *dlpi_handle_t;
/*
* dlpi_notifyid_t refers to a registered notification. Its value should
* not be interpreted by the interface consumer.
*/
typedef struct __dlpi_notifyid *dlpi_notifyid_t;
/*
* Callback function invoked with arguments; see dlpi_enabnotify(3DLPI).
*/
extern const char *dlpi_mactype(uint_t);
extern const char *dlpi_strerror(int);
extern const char *dlpi_linkname(dlpi_handle_t);
typedef boolean_t dlpi_walkfunc_t(const char *, void *);
extern void dlpi_close(dlpi_handle_t);
extern int dlpi_unbind(dlpi_handle_t);
int, dlpi_recvinfo_t *);
const dlpi_sendinfo_t *);
void *arg, dlpi_notifyid_t *);
extern int dlpi_fd(dlpi_handle_t);
extern int dlpi_set_timeout(dlpi_handle_t, int);
/*
* These are Consolidation Private interfaces and are subject to change.
*/
extern int dlpi_parselink(const char *, char *, uint_t *);
extern int dlpi_makelink(char *, const char *, uint_t);
#ifdef __cplusplus
}
#endif
#endif /* _LIBDLPI_H */