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 (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
29 * This file includes structures, macros and routines used by general
30 * link administration (i.e. not limited to one specific type of link).
34 #include <sys/types.h>
35 #include <sys/param.h>
44 typedef struct dladm_attr
{
48 typedef struct dladm_phys_attr
{
49 char dp_dev
[MAXLINKNAMELEN
];
51 * Whether this physical link supports vanity naming (links with media
52 * types not supported by GLDv3 don't have vanity naming support).
54 boolean_t dp_novanity
;
58 DLADM_PROP_VAL_CURRENT
= 1,
59 DLADM_PROP_VAL_DEFAULT
,
61 DLADM_PROP_VAL_MODIFIABLE
,
62 DLADM_PROP_VAL_PERSISTENT
66 * Maximum size of secobj value. Note that it should not be greater than
69 #define DLADM_SECOBJ_VAL_MAX 256
72 * Maximum size of secobj name. Note that it should not be greater than
73 * DLD_SECOBJ_NAME_MAX.
75 #define DLADM_SECOBJ_NAME_MAX 32
77 #define DLADM_MAX_PROP_VALCNT 32
79 * Size of prop_val buffer passed to pd_get function must be at
80 * least DLADM_PROP_VAL_MAX
82 #define DLADM_PROP_VAL_MAX 128
84 #define DLADM_SECOBJ_CLASS_WEP 0
85 #define DLADM_SECOBJ_CLASS_WPA 1
86 typedef int dladm_secobj_class_t
;
88 typedef int (dladm_walkcb_t
)(const char *, void *);
90 /* possible flags for ma_flags below */
91 #define DLADM_MACADDR_USED 0x1
94 DLADM_HWGRP_TYPE_RX
= 0x1,
98 typedef struct dladm_hwgrp_attr
{
99 char hg_link_name
[MAXLINKNAMELEN
];
101 dladm_hwgrp_type_t hg_grp_type
;
103 uint_t hg_rings
[MAX_RINGS_PER_GROUP
];
105 char hg_client_names
[MAXCLIENTNAMELEN
];
106 } dladm_hwgrp_attr_t
;
108 typedef struct dladm_macaddr_attr
{
111 uchar_t ma_addr
[MAXMACADDRLEN
];
113 char ma_client_name
[MAXNAMELEN
];
114 datalink_id_t ma_client_linkid
;
115 } dladm_macaddr_attr_t
;
117 extern dladm_status_t
dladm_walk(dladm_walkcb_t
*, dladm_handle_t
, void *,
118 datalink_class_t
, datalink_media_t
, uint32_t);
119 extern dladm_status_t
dladm_mac_walk(dladm_walkcb_t
*, void *);
120 extern dladm_status_t
dladm_info(dladm_handle_t
, datalink_id_t
,
123 extern dladm_status_t
dladm_rename_link(dladm_handle_t
, const char *,
126 extern dladm_status_t
dladm_set_linkprop(dladm_handle_t
, datalink_id_t
,
127 const char *, char **, uint_t
, uint_t
);
128 extern dladm_status_t
dladm_get_linkprop(dladm_handle_t
, datalink_id_t
,
129 dladm_prop_type_t
, const char *, char **, uint_t
*);
130 extern dladm_status_t
dladm_get_linkprop_values(dladm_handle_t
, datalink_id_t
,
131 dladm_prop_type_t
, const char *, uint_t
*,
133 extern dladm_status_t
dladm_walk_linkprop(dladm_handle_t
, datalink_id_t
,
134 void *, int (*)(dladm_handle_t
, datalink_id_t
,
135 const char *, void *));
136 extern boolean_t
dladm_attr_is_linkprop(const char *name
);
137 extern dladm_status_t
dladm_linkprop_is_set(dladm_handle_t
, datalink_id_t
,
138 dladm_prop_type_t
, const char *, boolean_t
*);
140 extern dladm_status_t
dladm_set_secobj(dladm_handle_t
, const char *,
141 dladm_secobj_class_t
, uint8_t *, uint_t
, uint_t
);
142 extern dladm_status_t
dladm_get_secobj(dladm_handle_t
, const char *,
143 dladm_secobj_class_t
*, uint8_t *, uint_t
*,
145 extern dladm_status_t
dladm_unset_secobj(dladm_handle_t
, const char *,
147 extern dladm_status_t
dladm_walk_secobj(dladm_handle_t
, void *,
148 boolean_t (*)(dladm_handle_t
, void *, const char *),
151 extern const char *dladm_linkstate2str(link_state_t
, char *);
152 extern const char *dladm_linkduplex2str(link_duplex_t
, char *);
153 extern const char *dladm_secobjclass2str(dladm_secobj_class_t
, char *);
154 extern dladm_status_t
dladm_str2secobjclass(const char *,
155 dladm_secobj_class_t
*);
157 extern dladm_status_t
dladm_init_linkprop(dladm_handle_t
, datalink_id_t
,
159 extern dladm_status_t
dladm_init_secobj(dladm_handle_t
);
160 extern boolean_t
dladm_valid_secobj_name(const char *);
162 extern dladm_status_t
dladm_create_datalink_id(dladm_handle_t
, const char *,
163 datalink_class_t
, uint_t
, uint32_t,
165 extern dladm_status_t
dladm_destroy_datalink_id(dladm_handle_t
, datalink_id_t
,
167 extern dladm_status_t
dladm_remap_datalink_id(dladm_handle_t
, datalink_id_t
,
169 extern dladm_status_t
dladm_up_datalink_id(dladm_handle_t
, datalink_id_t
);
170 extern dladm_status_t
dladm_name2info(dladm_handle_t
, const char *,
171 datalink_id_t
*, uint32_t *, datalink_class_t
*,
173 extern dladm_status_t
dladm_datalink_id2info(dladm_handle_t
, datalink_id_t
,
174 uint32_t *, datalink_class_t
*, uint32_t *, char *,
176 extern dladm_status_t
dladm_walk_datalink_id(int (*)(dladm_handle_t
,
177 datalink_id_t
, void *), dladm_handle_t
, void *,
178 datalink_class_t
, datalink_media_t
, uint32_t);
179 extern dladm_status_t
dladm_create_conf(dladm_handle_t
, const char *,
180 datalink_id_t
, datalink_class_t
, uint32_t,
182 extern dladm_status_t
dladm_open_conf(dladm_handle_t
, datalink_id_t
,
184 extern dladm_status_t
dladm_getsnap_conf(dladm_handle_t
, datalink_id_t
,
186 extern dladm_status_t
dladm_write_conf(dladm_handle_t
, dladm_conf_t
);
187 extern dladm_status_t
dladm_remove_conf(dladm_handle_t
, datalink_id_t
);
188 extern void dladm_destroy_conf(dladm_handle_t
, dladm_conf_t
);
189 extern dladm_status_t
dladm_get_conf_field(dladm_handle_t
, dladm_conf_t
,
190 const char *, void *, size_t);
191 extern dladm_status_t
dladm_getnext_conf_linkprop(dladm_handle_t
,
192 dladm_conf_t
, const char *, char *, void *,
194 extern dladm_status_t
dladm_set_conf_field(dladm_handle_t
, dladm_conf_t
,
195 const char *, dladm_datatype_t
, const void *);
196 extern dladm_status_t
dladm_unset_conf_field(dladm_handle_t
, dladm_conf_t
,
199 extern dladm_status_t
dladm_dev2linkid(dladm_handle_t
, const char *,
201 extern dladm_status_t
dladm_linkid2legacyname(dladm_handle_t
, datalink_id_t
,
203 extern dladm_status_t
dladm_phys_delete(dladm_handle_t
, datalink_id_t
);
205 extern dladm_status_t
dladm_phys_info(dladm_handle_t
, datalink_id_t
,
206 dladm_phys_attr_t
*, uint32_t);
207 extern dladm_status_t
dladm_parselink(const char *, char *, uint_t
*);
209 extern int dladm_walk_macaddr(dladm_handle_t
, datalink_id_t
,
211 boolean_t (*)(void *, dladm_macaddr_attr_t
*));
212 extern int dladm_walk_hwgrp(dladm_handle_t
, datalink_id_t
, void *,
213 boolean_t (*)(void *, dladm_hwgrp_attr_t
*));
215 extern void dladm_sort_index_list(uint_t
[], uint_t
);
217 extern dladm_status_t
dladm_link_get_proplist(dladm_handle_t
, datalink_id_t
,
218 dladm_arg_list_t
**);
220 extern dladm_status_t
i_dladm_set_link_proplist_db(char *,
227 #endif /* _LIBDLLINK_H */