xref: /titanic_50/usr/src/lib/libdladm/common/libdllink.h (revision a237e38e9161f0acd6451439d4a7dd597e66291d)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
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.
12  *
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]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _LIBDLLINK_H
27 #define	_LIBDLLINK_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*
32  * This file includes strcutures, macros and routines used by general
33  * link administration, which applies not limited to one specific
34  * type of link.
35  */
36 
37 #include <sys/types.h>
38 #include <sys/param.h>
39 #include <sys/mac.h>
40 #include <libdladm.h>
41 
42 #ifdef	__cplusplus
43 extern "C" {
44 #endif
45 
46 typedef struct dladm_attr {
47 	char		da_dev[MAXNAMELEN];
48 	uint_t		da_max_sdu;
49 	uint16_t	da_vid;
50 } dladm_attr_t;
51 
52 /*
53  * Maximum size of secobj value. Note that it should not be greater than
54  * DLD_SECOBJ_VAL_MAX.
55  */
56 #define	DLADM_SECOBJ_VAL_MAX	256
57 
58 /*
59  * Maximum size of secobj name. Note that it should not be greater than
60  * DLD_SECOBJ_NAME_MAX.
61  */
62 #define	DLADM_SECOBJ_NAME_MAX	32
63 
64 #define	DLADM_PROP_VAL_MAX	25
65 
66 #define		DLADM_SECOBJ_CLASS_WEP	0
67 typedef int	dladm_secobj_class_t;
68 
69 typedef void (dladm_walkcb_t)(void *, const char *);
70 
71 extern int	dladm_walk(dladm_walkcb_t *, void *);
72 extern int	dladm_mac_walk(void (*fn)(void *, const char *), void *);
73 extern int	dladm_info(const char *, dladm_attr_t *);
74 extern int	dladm_hold_link(const char *, zoneid_t, boolean_t);
75 extern int	dladm_rele_link(const char *, zoneid_t, boolean_t);
76 
77 extern dladm_status_t	dladm_set_prop(const char *, const char *,
78 			    char **, uint_t, uint_t, char **);
79 extern dladm_status_t	dladm_get_prop(const char *, dladm_prop_type_t,
80 			    const char *, char **, uint_t *);
81 extern dladm_status_t	dladm_walk_prop(const char *, void *,
82 			    boolean_t (*)(void *, const char *));
83 extern dladm_status_t	dladm_set_secobj(const char *, dladm_secobj_class_t,
84 			    uint8_t *, uint_t, uint_t);
85 extern dladm_status_t	dladm_get_secobj(const char *, dladm_secobj_class_t *,
86 			    uint8_t *, uint_t *, uint_t);
87 extern dladm_status_t	dladm_unset_secobj(const char *, uint_t);
88 extern dladm_status_t	dladm_walk_secobj(void *,
89 			    boolean_t (*)(void *, const char *), uint_t);
90 
91 extern const char	*dladm_linkstate2str(link_state_t, char *);
92 extern const char	*dladm_linkduplex2str(link_duplex_t, char *);
93 extern const char	*dladm_secobjclass2str(dladm_secobj_class_t, char *);
94 extern dladm_status_t	dladm_str2secobjclass(const char *,
95 			    dladm_secobj_class_t *);
96 
97 extern dladm_status_t	dladm_init_linkprop(void);
98 extern dladm_status_t	dladm_init_secobj(void);
99 
100 #ifdef	__cplusplus
101 }
102 #endif
103 
104 #endif	/* _LIBDLLINK_H */
105