libdladm_impl.h revision 4784fcbddec533c366d5e92ce1ca3a4a2ce69495
563N/A/*
563N/A * CDDL HEADER START
563N/A *
563N/A * The contents of this file are subject to the terms of the
563N/A * Common Development and Distribution License (the "License").
563N/A * You may not use this file except in compliance with the License.
563N/A *
563N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
563N/A * or http://www.opensolaris.org/os/licensing.
563N/A * See the License for the specific language governing permissions
563N/A * and limitations under the License.
563N/A *
563N/A * When distributing Covered Code, include this CDDL HEADER in each
563N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
563N/A * If applicable, add the following below this CDDL HEADER, with the
563N/A * fields enclosed by brackets "[]" replaced with your own identifying
563N/A * information: Portions Copyright [yyyy] [name of copyright owner]
563N/A *
873N/A * CDDL HEADER END
563N/A */
563N/A/*
563N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
563N/A * Use is subject to license terms.
563N/A */
868N/A
563N/A#ifndef _LIBDLADM_IMPL_H
563N/A#define _LIBDLADM_IMPL_H
563N/A
563N/A#include <libdladm.h>
563N/A#include <stdio.h>
563N/A
563N/A#ifdef __cplusplus
563N/Aextern "C" {
563N/A#endif
563N/A
563N/A#define MAXLINELEN 1024
563N/A#define BUFLEN(lim, ptr) (((lim) > (ptr)) ? ((lim) - (ptr)) : 0)
563N/A
563N/Aextern dladm_status_t dladm_errno2status(int);
563N/Aextern dladm_status_t i_dladm_rw_db(const char *, mode_t,
563N/A dladm_status_t (*)(void *, FILE *, FILE *),
563N/A void *, boolean_t);
563N/Aextern dladm_status_t i_dladm_get_state(datalink_id_t, link_state_t *);
563N/A
623N/Aextern const char *dladm_pri2str(mac_priority_level_t, char *);
563N/Aextern dladm_status_t dladm_str2pri(char *, mac_priority_level_t *);
563N/Aextern dladm_status_t dladm_parse_args(char *, dladm_arg_list_t **,
563N/A boolean_t);
563N/Aextern void dladm_free_args(dladm_arg_list_t *);
563N/A
563N/A/*
563N/A * Link attributes persisted by dlmgmtd.
563N/A */
563N/A/*
563N/A * Set for VLANs only
563N/A */
563N/A#define FVLANID "vid" /* uint64_t */
563N/A#define FLINKOVER "linkover" /* uint64_t */
563N/A
563N/A/*
563N/A * Set for AGGRs only
563N/A */
563N/A#define FKEY "key" /* uint64_t */
563N/A#define FNPORTS "nports" /* uint64_t */
563N/A#define FPORTS "portnames" /* string */
563N/A#define FPOLICY "policy" /* uint64_t */
563N/A#define FFIXMACADDR "fix_macaddr" /* boolean_t */
563N/A#define FFORCE "force" /* boolean_t */
563N/A#define FLACPMODE "lacp_mode" /* uint64_t */
623N/A#define FLACPTIMER "lacp_timer" /* uint64_t */
623N/A
563N/A/*
563N/A * Set for VNICs only
563N/A */
563N/A#define FMADDRTYPE "maddrtype" /* uint64_t */
563N/A#define FMADDRLEN "maddrlen" /* uint64_t */
563N/A#define FMADDRSLOT "maddrslot" /* uint64_t */
563N/A#define FMADDRPREFIXLEN "maddrpreflen" /* uint64_t */
563N/A#define FHWRINGS "hwrings" /* boolean_t */
563N/A
563N/A/*
563N/A * Common fields
563N/A */
563N/A#define FMACADDR "macaddr" /* string */
563N/A
563N/A/*
563N/A * Data structures used for implementing temporary properties
563N/A */
563N/A
563N/Atypedef struct val_desc {
563N/A char *vd_name;
563N/A uintptr_t vd_val;
563N/A} val_desc_t;
563N/A
563N/A#define VALCNT(vals) (sizeof ((vals)) / sizeof (val_desc_t))
563N/A
563N/Aextern dladm_status_t dladm_link_proplist_extract(dladm_arg_list_t *,
563N/A mac_resource_props_t *);
563N/A
563N/Aextern dladm_status_t dladm_flow_proplist_extract(dladm_arg_list_t *,
563N/A mac_resource_props_t *);
563N/A
563N/A/*
563N/A * The prop extract() callback.
563N/A *
563N/A * rp_extract extracts the kernel structure from the val_desc_t created
563N/A * by the pd_check function.
563N/A */
563N/Atypedef dladm_status_t rp_extractf_t(val_desc_t *propval, void *arg,
563N/A uint_t cnt);
563N/Aextern rp_extractf_t do_extract_maxbw, do_extract_priority,
563N/A do_extract_cpus;
563N/A
563N/Atypedef struct resource_prop_s {
563N/A /*
563N/A * resource property name
563N/A */
623N/A char *rp_name;
563N/A
563N/A /*
563N/A * callback to extract kernel structure
563N/A */
563N/A rp_extractf_t *rp_extract;
563N/A} resource_prop_t;
563N/A
563N/A#ifdef __cplusplus
563N/A}
563N/A#endif
623N/A
563N/A#endif /* _LIBDLADM_IMPL_H */
563N/A