libdllink.h revision 8118:88925232392f
1285612Sdelphij/* 2132451Sroberto * CDDL HEADER START 354359Sroberto * 4285612Sdelphij * The contents of this file are subject to the terms of the 5285612Sdelphij * Common Development and Distribution License (the "License"). 654359Sroberto * You may not use this file except in compliance with the License. 754359Sroberto * 854359Sroberto * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 954359Sroberto * or http://www.opensolaris.org/os/licensing. 1054359Sroberto * See the License for the specific language governing permissions 1154359Sroberto * and limitations under the License. 1254359Sroberto * 1354359Sroberto * When distributing Covered Code, include this CDDL HEADER in each 1454359Sroberto * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15106163Sroberto * If applicable, add the following below this CDDL HEADER, with the 16106163Sroberto * fields enclosed by brackets "[]" replaced with your own identifying 17182007Sroberto * information: Portions Copyright [yyyy] [name of copyright owner] 1854359Sroberto * 19285612Sdelphij * CDDL HEADER END 20285612Sdelphij */ 21285612Sdelphij/* 22285612Sdelphij * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23285612Sdelphij * Use is subject to license terms. 24285612Sdelphij */ 25285612Sdelphij 26285612Sdelphij#ifndef _LIBDLLINK_H 27285612Sdelphij#define _LIBDLLINK_H 28285612Sdelphij 29285612Sdelphij/* 30285612Sdelphij * This file includes structures, macros and routines used by general 31285612Sdelphij * link administration (i.e. not limited to one specific type of link). 32285612Sdelphij */ 33285612Sdelphij 34285612Sdelphij#include <sys/types.h> 35285612Sdelphij#include <sys/param.h> 36285612Sdelphij#include <libdladm.h> 37285612Sdelphij#include <kstat.h> 38285612Sdelphij 39285612Sdelphij#ifdef __cplusplus 40285612Sdelphijextern "C" { 41285612Sdelphij#endif 42285612Sdelphij 43285612Sdelphijtypedef struct dladm_attr { 44285612Sdelphij uint_t da_max_sdu; 45285612Sdelphij} dladm_attr_t; 46285612Sdelphij 47285612Sdelphijtypedef struct dladm_phys_attr { 48285612Sdelphij char dp_dev[MAXLINKNAMELEN]; 49285612Sdelphij /* 50285612Sdelphij * Whether this physical link supports vanity naming (links with media 51285612Sdelphij * types not supported by GLDv3 don't have vanity naming support). 52285612Sdelphij */ 53285612Sdelphij boolean_t dp_novanity; 54285612Sdelphij} dladm_phys_attr_t; 55285612Sdelphij 56285612Sdelphijtypedef enum { 57285612Sdelphij DLADM_PROP_VAL_CURRENT = 1, 58285612Sdelphij DLADM_PROP_VAL_DEFAULT, 59285612Sdelphij DLADM_PROP_VAL_PERM, 60285612Sdelphij DLADM_PROP_VAL_MODIFIABLE, 61285612Sdelphij DLADM_PROP_VAL_PERSISTENT 62285612Sdelphij} dladm_prop_type_t; 63285612Sdelphij 64285612Sdelphij/* 65285612Sdelphij * Maximum size of secobj value. Note that it should not be greater than 66285612Sdelphij * DLD_SECOBJ_VAL_MAX. 67285612Sdelphij */ 68285612Sdelphij#define DLADM_SECOBJ_VAL_MAX 256 69285612Sdelphij 70285612Sdelphij/* 71285612Sdelphij * Maximum size of secobj name. Note that it should not be greater than 72285612Sdelphij * DLD_SECOBJ_NAME_MAX. 73285612Sdelphij */ 7454359Sroberto#define DLADM_SECOBJ_NAME_MAX 32 75200576Sroberto 7654359Sroberto#define DLADM_MAX_PROP_VALCNT 32 77200576Sroberto/* 78132451Sroberto * Size of prop_val buffer passed to pd_get function must be at 79132451Sroberto * least DLADM_PROP_VAL_MAX 80132451Sroberto */ 81132451Sroberto#define DLADM_PROP_VAL_MAX 128 8282498Sroberto 83132451Sroberto#define DLADM_SECOBJ_CLASS_WEP 0 8454359Sroberto#define DLADM_SECOBJ_CLASS_WPA 1 8554359Srobertotypedef int dladm_secobj_class_t; 8654359Sroberto 8754359Srobertotypedef int (dladm_walkcb_t)(const char *, void *); 8854359Sroberto 8954359Srobertoextern dladm_status_t dladm_walk(dladm_walkcb_t *, void *, datalink_class_t, 9054359Sroberto datalink_media_t, uint32_t); 9154359Srobertoextern dladm_status_t dladm_mac_walk(dladm_walkcb_t *, void *); 92182007Srobertoextern dladm_status_t dladm_info(datalink_id_t, dladm_attr_t *); 93182007Srobertoextern dladm_status_t dladm_setzid(const char *, char *); 94182007Sroberto 95285612Sdelphijextern dladm_status_t dladm_rename_link(const char *, const char *); 96285612Sdelphij 97285612Sdelphijextern dladm_status_t dladm_set_linkprop(datalink_id_t, const char *, 98285612Sdelphij char **, uint_t, uint_t); 99285612Sdelphijextern dladm_status_t dladm_get_linkprop(datalink_id_t, dladm_prop_type_t, 100285612Sdelphij const char *, char **, uint_t *); 101285612Sdelphijextern dladm_status_t dladm_walk_linkprop(datalink_id_t, void *, 102285612Sdelphij int (*)(datalink_id_t, const char *, void *)); 103285612Sdelphij 104285612Sdelphijextern dladm_status_t dladm_set_secobj(const char *, dladm_secobj_class_t, 105285612Sdelphij uint8_t *, uint_t, uint_t); 106285612Sdelphijextern dladm_status_t dladm_get_secobj(const char *, dladm_secobj_class_t *, 107285612Sdelphij uint8_t *, uint_t *, uint_t); 108285612Sdelphijextern dladm_status_t dladm_unset_secobj(const char *, uint_t); 109285612Sdelphijextern dladm_status_t dladm_walk_secobj(void *, 110285612Sdelphij boolean_t (*)(void *, const char *), uint_t); 111285612Sdelphij 112285612Sdelphijextern const char *dladm_linkstate2str(link_state_t, char *); 113285612Sdelphijextern const char *dladm_linkduplex2str(link_duplex_t, char *); 114285612Sdelphijextern const char *dladm_secobjclass2str(dladm_secobj_class_t, char *); 115285612Sdelphijextern dladm_status_t dladm_str2secobjclass(const char *, 116285612Sdelphij dladm_secobj_class_t *); 117285612Sdelphij 118285612Sdelphijextern dladm_status_t dladm_init_linkprop(datalink_id_t, boolean_t); 119285612Sdelphijextern dladm_status_t dladm_init_secobj(void); 120285612Sdelphij 121285612Sdelphijextern dladm_status_t dladm_create_datalink_id(const char *, datalink_class_t, 122285612Sdelphij uint_t, uint32_t, datalink_id_t *); 123285612Sdelphijextern dladm_status_t dladm_destroy_datalink_id(datalink_id_t, uint32_t); 124285612Sdelphijextern dladm_status_t dladm_remap_datalink_id(datalink_id_t, const char *); 125285612Sdelphijextern dladm_status_t dladm_up_datalink_id(datalink_id_t); 126285612Sdelphijextern dladm_status_t dladm_name2info(const char *, datalink_id_t *, 127285612Sdelphij uint32_t *, datalink_class_t *, uint32_t *); 128285612Sdelphijextern dladm_status_t dladm_datalink_id2info(datalink_id_t, uint32_t *, 129285612Sdelphij datalink_class_t *, uint32_t *, char *, size_t); 130285612Sdelphijextern dladm_status_t dladm_walk_datalink_id(int (*)(datalink_id_t, void *), 131285612Sdelphij void *, datalink_class_t, datalink_media_t, 132182007Sroberto uint32_t); 133182007Srobertoextern dladm_status_t dladm_create_conf(const char *, datalink_id_t, 134285612Sdelphij datalink_class_t, uint32_t, dladm_conf_t *); 135182007Srobertoextern dladm_status_t dladm_read_conf(datalink_id_t, dladm_conf_t *); 136182007Srobertoextern dladm_status_t dladm_write_conf(dladm_conf_t); 137182007Srobertoextern dladm_status_t dladm_remove_conf(datalink_id_t); 138200576Srobertoextern void dladm_destroy_conf(dladm_conf_t); 139182007Srobertoextern dladm_status_t dladm_get_conf_field(dladm_conf_t, const char *, 140243933Seadler void *, size_t); 141285612Sdelphijextern dladm_status_t dladm_set_conf_field(dladm_conf_t, const char *, 142285612Sdelphij dladm_datatype_t, const void *); 143285612Sdelphijextern dladm_status_t dladm_unset_conf_field(dladm_conf_t, const char *); 144285612Sdelphij 145182007Srobertoextern dladm_status_t dladm_dev2linkid(const char *, datalink_id_t *); 146182007Srobertoextern dladm_status_t dladm_linkid2legacyname(datalink_id_t, char *, size_t); 147285612Sdelphijextern dladm_status_t dladm_phys_delete(datalink_id_t); 148285612Sdelphij 149285612Sdelphijextern dladm_status_t dladm_phys_info(datalink_id_t, dladm_phys_attr_t *, 150285612Sdelphij uint32_t); 151285612Sdelphijextern dladm_status_t dladm_get_single_mac_stat(datalink_id_t, const char *, 152285612Sdelphij uint8_t, void *); 153285612Sdelphijextern int dladm_kstat_value(kstat_t *, const char *, uint8_t, 154285612Sdelphij void *); 155285612Sdelphijextern dladm_status_t dladm_parselink(const char *, char *, uint_t *); 156285612Sdelphij 157285612Sdelphij#ifdef __cplusplus 158182007Sroberto} 159182007Sroberto#endif 160285612Sdelphij 161285612Sdelphij#endif /* _LIBDLLINK_H */ 162285612Sdelphij