xref: /titanic_41/usr/src/lib/libdlpi/common/libdlpi.h (revision 70025d765b044c6d8594bb965a2247a61e991a99)
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 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _LIBDLPI_H
28 #define	_LIBDLPI_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/types.h>
33 #include <sys/dlpi.h>
34 #include <net/if.h>
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 #define	MAXADDRLEN	64
41 #define	MAXSAPLEN	64
42 #define	MAX_MODS	9
43 
44 typedef struct dlpi_if_attr {
45 	char	ifname[LIFNAMSIZ];
46 	int	style;
47 	int	ppa;
48 	int	mod_cnt;
49 	int	mod_pushed;
50 	boolean_t	style1_failed;
51 	int	style1_fd;
52 	char	devname[LIFNAMSIZ + 32]; /* added space for /dev path */
53 	char	modlist[MAX_MODS][LIFNAMSIZ];
54 	char	provider[LIFNAMSIZ];
55 } dlpi_if_attr_t;
56 
57 extern const char	*dlpi_mac_type(uint_t);
58 
59 extern int	dlpi_open(const char *);
60 extern int	dlpi_close(int);
61 extern int	dlpi_info(int, int, dl_info_ack_t *, union DL_qos_types *,
62     union DL_qos_types *, uint8_t *, size_t *, uint8_t *, size_t *);
63 extern int	dlpi_attach(int, int, uint_t);
64 extern int	dlpi_detach(int, int);
65 extern int	dlpi_bind(int, int, uint_t, uint16_t, boolean_t, uint32_t *,
66     uint32_t *, uint8_t *, size_t *);
67 extern int	dlpi_unbind(int, int);
68 extern int	dlpi_enabmulti(int, int, uint8_t *, size_t);
69 extern int	dlpi_disabmulti(int, int, uint8_t *, size_t);
70 extern int	dlpi_promiscon(int, int, uint_t);
71 extern int	dlpi_promiscoff(int, int, uint_t);
72 extern int	dlpi_phys_addr(int, int, uint_t, uint8_t *, size_t *);
73 extern int	dlpi_set_phys_addr(int, int, uint8_t *, size_t);
74 extern void	dlpi_passive(int, int);
75 
76 /*
77  * dlpi_if_open()
78  *   Takes interface name in the following formats
79  *   o Specific physical unit (ex. "bge0" or "ce0")
80  *   o Tunnels (ex. "ip.tun0" or "ip6.tun0")
81  */
82 extern int	dlpi_if_open(const char *, dlpi_if_attr_t *, boolean_t);
83 extern int	dlpi_if_parse(const char *, char *, int *);
84 
85 #ifdef	__cplusplus
86 }
87 #endif
88 
89 #endif /* _LIBDLPI_H */
90