#ifndef _LIBDLPI_H
#define _LIBDLPI_H
#include <sys/types.h>
#include <sys/dlpi.h>
#ifdef __cplusplus
extern "C" {
#endif
#define DLPI_PHYSADDR_MAX 64
#define DLPI_LINKNAME_MAX 32
#define DLPI_ANY_SAP (uint_t)-1
#define DLPI_EXCL 0x0001
#define DLPI_PASSIVE 0x0002
#define DLPI_RAW 0x0004
#define DLPI_SERIAL 0x0008
#define DLPI_NOATTACH 0x0010
#define DLPI_NATIVE 0x0020
#define DLPI_DEVONLY 0x0040
#define DLPI_DEVIPNET 0x0080
#define DLPI_IPNETINFO 0x0100
#define DLPI_DEF_TIMEOUT 5
enum {
DLPI_SUCCESS = 10000,
DLPI_EINVAL,
DLPI_ELINKNAMEINVAL,
DLPI_ENOLINK,
DLPI_EBADLINK,
DLPI_EINHANDLE,
DLPI_ETIMEDOUT,
DLPI_EVERNOTSUP,
DLPI_EMODENOTSUP,
DLPI_EUNAVAILSAP,
DLPI_FAILURE,
DLPI_ENOTSTYLE2,
DLPI_EBADMSG,
DLPI_ERAWNOTSUP,
DLPI_ENOTEINVAL,
DLPI_ENOTENOTSUP,
DLPI_ENOTEIDINVAL,
DLPI_EIPNETINFONOTSUP,
DLPI_ERRMAX
};
typedef struct {
uint_t di_opts;
uint_t di_max_sdu;
uint_t di_min_sdu;
uint_t di_state;
uint_t di_mactype;
char di_linkname[DLPI_LINKNAME_MAX];
uchar_t di_physaddr[DLPI_PHYSADDR_MAX];
uchar_t di_physaddrlen;
uchar_t di_bcastaddr[DLPI_PHYSADDR_MAX];
uchar_t di_bcastaddrlen;
uint_t di_sap;
int di_timeout;
dl_qos_cl_sel1_t di_qos_sel;
dl_qos_cl_range1_t di_qos_range;
} dlpi_info_t;
typedef struct {
uint_t dsi_sap;
dl_priority_t dsi_prio;
} dlpi_sendinfo_t;
typedef enum {
DLPI_ADDRTYPE_UNICAST,
DLPI_ADDRTYPE_GROUP
} dlpi_addrtype_t;
typedef struct {
uchar_t dri_destaddr[DLPI_PHYSADDR_MAX];
uchar_t dri_destaddrlen;
dlpi_addrtype_t dri_destaddrtype;
size_t dri_totmsglen;
} dlpi_recvinfo_t;
typedef struct {
uint_t dni_note;
union {
uint_t dniu_speed;
uint_t dniu_size;
struct {
uchar_t physaddr[DLPI_PHYSADDR_MAX];
uchar_t physaddrlen;
} dniu_addr;
} dni_data;
} dlpi_notifyinfo_t;
#define dni_speed dni_data.dniu_speed
#define dni_size dni_data.dniu_size
#define dni_physaddr dni_data.dniu_addr.physaddr
#define dni_physaddrlen dni_data.dniu_addr.physaddrlen
typedef struct __dlpi_handle *dlpi_handle_t;
typedef struct __dlpi_notifyid *dlpi_notifyid_t;
typedef void dlpi_notifyfunc_t(dlpi_handle_t, dlpi_notifyinfo_t *, void *);
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_walk(dlpi_walkfunc_t *, void *, uint_t);
extern int dlpi_open(const char *, dlpi_handle_t *, uint_t);
extern void dlpi_close(dlpi_handle_t);
extern int dlpi_info(dlpi_handle_t, dlpi_info_t *, uint_t);
extern int dlpi_bind(dlpi_handle_t, uint_t, uint_t *);
extern int dlpi_unbind(dlpi_handle_t);
extern int dlpi_enabmulti(dlpi_handle_t, const void *, size_t);
extern int dlpi_disabmulti(dlpi_handle_t, const void *, size_t);
extern int dlpi_promiscon(dlpi_handle_t, uint_t);
extern int dlpi_promiscoff(dlpi_handle_t, uint_t);
extern int dlpi_get_physaddr(dlpi_handle_t, uint_t, void *, size_t *);
extern int dlpi_set_physaddr(dlpi_handle_t, uint_t, const void *, size_t);
extern int dlpi_recv(dlpi_handle_t, void *, size_t *, void *, size_t *,
int, dlpi_recvinfo_t *);
extern int dlpi_send(dlpi_handle_t, const void *, size_t, const void *, size_t,
const dlpi_sendinfo_t *);
extern int dlpi_enabnotify(dlpi_handle_t, uint_t, dlpi_notifyfunc_t *,
void *arg, dlpi_notifyid_t *);
extern int dlpi_disabnotify(dlpi_handle_t, dlpi_notifyid_t, void **);
extern int dlpi_fd(dlpi_handle_t);
extern int dlpi_set_timeout(dlpi_handle_t, int);
extern uint_t dlpi_arptype(uint_t);
extern uint_t dlpi_iftype(uint_t);
extern int dlpi_parselink(const char *, char *, uint_t *);
extern int dlpi_makelink(char *, const char *, uint_t);
extern uint_t dlpi_style(dlpi_handle_t);
#ifdef __cplusplus
}
#endif
#endif