2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A
2N/A/*
2N/A * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A#ifndef _LIBLLDP_LLDPD_H
2N/A#define _LIBLLDP_LLDPD_H
2N/A
2N/A/*
2N/A * Includes data structures and functions needed for library - lldpd
2N/A * interactions.
2N/A */
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#include <lldp.h>
2N/A#include <liblldp.h>
2N/A#include <libscf.h>
2N/A#include <libscf_priv.h>
2N/A
2N/A#define LLDPD_DOOR "/etc/svc/volatile/dladm/lldpd_door"
2N/A
2N/A#define LLDP_SVC_NAME "network/lldp"
2N/A#define LLDP_SVC_DEFAULT_INSTANCE "default"
2N/A
2N/A/*
2N/A * nvpair names which holds information.
2N/A */
2N/A#define LLDP_NVP_CHASSISID "chassisid"
2N/A#define LLDP_NVP_CHASSISID_TYPE "chassisid_type"
2N/A#define LLDP_NVP_CHASSISID_VALUE "chassisid_value"
2N/A#define LLDP_NVP_PORTID "portid"
2N/A#define LLDP_NVP_PORTID_TYPE "portid_type"
2N/A#define LLDP_NVP_PORTID_VALUE "portid_value"
2N/A#define LLDP_NVP_TTL "ttl"
2N/A#define LLDP_NVP_RXINFOVALID_FOR "rxinfovalid"
2N/A#define LLDP_NVP_NEXTTX_IN "nexttx"
2N/A#define LLDP_NVP_AGGR "aggregation"
2N/A#define LLDP_NVP_AGGR_ID "aggr_id"
2N/A#define LLDP_NVP_AGGR_STATUS "aggr_status"
2N/A#define LLDP_NVP_PVID "pvid"
2N/A#define LLDP_NVP_MAXFRAMESZ "maxframesz"
2N/A#define LLDP_NVP_PORTDESC "portdesc"
2N/A#define LLDP_NVP_SYSNAME "sysname"
2N/A#define LLDP_NVP_SYSDESCR "sysdescr"
2N/A#define LLDP_NVP_SYSCAPAB "syscapab"
2N/A#define LLDP_NVP_SUPPORTED_SYSCAPAB "supcapab"
2N/A#define LLDP_NVP_ENABLED_SYSCAPAB "enabcapab"
2N/A#define LLDP_NVP_MGMTADDR "mgmtaddress"
2N/A#define LLDP_NVP_MGMTADDRTYPE "mgmtaddrtype"
2N/A#define LLDP_NVP_MGMTADDRVALUE "mgmtaddrvalue"
2N/A#define LLDP_NVP_MGMTADDR_IFTYPE "mgmtaddriftype"
2N/A#define LLDP_NVP_MGMTADDR_IFNUM "mgmtaddrifnumber"
2N/A#define LLDP_NVP_MGMTADDR_OIDSTR "mgmtaddroidstr"
2N/A#define LLDP_NVP_RESERVED "reserved"
2N/A#define LLDP_NVP_ORGANIZATION "organization"
2N/A#define LLDP_NVP_UNREC_ORGANIZATION "unrec_organization"
2N/A#define LLDP_NVP_VLANID "vlanid"
2N/A#define LLDP_NVP_VLANNAME "vlanname"
2N/A#define LLDP_NVP_VNIC_PORTID "vnicportid"
2N/A#define LLDP_NVP_VNIC_PORTIDLEN "vnicportidlen"
2N/A#define LLDP_NVP_VNIC_LINKID "vniclinkid"
2N/A#define LLDP_NVP_VNICNAME "vnicname"
2N/A#define LLDP_NVP_VNIC_VLANID "vnicvlanid"
2N/A#define LLDP_NVP_PFC "pfc"
2N/A#define LLDP_NVP_WILLING "willing"
2N/A#define LLDP_NVP_PFC_MBC "mbc"
2N/A#define LLDP_NVP_PFC_CAP "pfccap"
2N/A#define LLDP_NVP_PFC_ENABLE "pfcenable"
2N/A#define LLDP_NVP_PFC_PENDING "pfcpending"
2N/A#define LLDP_NVP_APPLN "appln"
2N/A#define LLDP_NVP_EVB "evb"
2N/A#define LLDP_NVP_EVB_MODE "evbmode"
2N/A#define LLDP_NVP_EVB_ROLRWD "rolrwd"
2N/A#define LLDP_NVP_EVB_RWD "rwd"
2N/A#define LLDP_NVP_EVB_ROLRKA "rolrka"
2N/A#define LLDP_NVP_EVB_RKA "rka"
2N/A#define LLDP_NVP_EVB_R "rmax"
2N/A#define LLDP_NVP_EVB_RTE "rte"
2N/A#define LLDP_NVP_EVBS_SGID "sgid"
2N/A#define LLDP_NVP_EVBS_RRREQ "rrreq"
2N/A#define LLDP_NVP_EVBS_RRSTAT "rrstat"
2N/A#define LLDP_NVP_EVBB_BGID "bgid"
2N/A#define LLDP_NVP_EVBB_RRCAP "rrcap"
2N/A#define LLDP_NVP_EVBB_RRCTR "rrctr"
2N/A#define LLDP_NVP_ETSCFG "etscfg"
2N/A#define LLDP_NVP_ETSRECO "etsreco"
2N/A#define LLDP_NVP_ETS_CBS "etscbs"
2N/A#define LLDP_NVP_ETS_TCS "etstcs"
2N/A#define LLDP_NVP_ETS_PAT "etspat"
2N/A#define LLDP_NVP_ETS_BAT "etsbat"
2N/A#define LLDP_NVP_ETS_TSA "etstsa"
2N/A
2N/A#define LLDP_BASIC_OUI_LIST "basicOUI"
2N/A#define LLDP_8021_OUI_LIST "8021OUI"
2N/A#define LLDP_8023_OUI_LIST "8023OUI"
2N/A#define LLDP_ORACLE_OUI_LIST "oracleOUI"
2N/A
2N/A/*
2N/A * NOTE: Please maintain the order. All the Global properites should come
2N/A * before the agent properties.
2N/A */
2N/Atypedef enum lldp_proptype_e {
2N/A LLDP_PROPTYPE_NONE,
2N/A LLDP_PROPTYPE_MODE,
2N/A LLDP_PROPTYPE_BASICTLV,
2N/A LLDP_PROPTYPE_8021TLV,
2N/A LLDP_PROPTYPE_8023TLV,
2N/A LLDP_PROPTYPE_VIRTTLV,
2N/A LLDP_PROPTYPE_SUP_SYSCAPAB,
2N/A LLDP_PROPTYPE_ENAB_SYSCAPAB,
2N/A LLDP_PROPTYPE_IPADDR,
2N/A LLDP_PROPTYPE_PFCMAP,
2N/A LLDP_PROPTYPE_WILLING,
2N/A LLDP_PROPTYPE_APPLN,
2N/A LLDP_PROPTYPE_EVB_SET,
2N/A LLDP_PROPTYPE_EVB_UNSET,
2N/A LLDP_PROPTYPE_ETSBAT
2N/A} lldp_proptype_t;
2N/A
2N/Atypedef struct lldp_val_desc {
2N/A char *lvd_name;
2N/A uintptr_t lvd_val;
2N/A} lldp_val_desc_t;
2N/A
2N/A#define LLDP_VALCNT(vals) (sizeof ((vals)) / sizeof (lldp_val_desc_t))
2N/A
2N/A/*
2N/A * door commands to the lldpd daemon
2N/A */
2N/Atypedef enum {
2N/A LLDPD_CMD_GET_INFO,
2N/A LLDPD_CMD_GET_STATS,
2N/A LLDPD_CMD_SET_PROP,
2N/A LLDPD_CMD_GET_PROP,
2N/A LLDPD_CMD_UPDATE_VLINKS
2N/A} lldp_door_cmd_type_t;
2N/A
2N/Atypedef struct lldpd_door_arg_s {
2N/A int ld_cmd;
2N/A} lldpd_door_arg_t;
2N/A
2N/Atypedef struct lldpd_door_lstats_s {
2N/A int ld_cmd;
2N/A char ld_laname[MAXLINKNAMELEN];
2N/A} lldpd_door_lstats_t;
2N/A
2N/Atypedef struct lldpd_lstats_retval_s {
2N/A uint_t lr_err;
2N/A lldp_stats_t lr_stat;
2N/A} lldpd_lstats_retval_t;
2N/A
2N/Atypedef struct lldpd_retval_s {
2N/A uint_t lr_err; /* return error code */
2N/A} lldpd_retval_t;
2N/A
2N/Atypedef union lldp_pval_u {
2N/A uint32_t lpv_u32;
2N/A char lpv_strval[LLDP_MAXPROPVALLEN];
2N/A} lldp_pval_t;
2N/A
2N/Atypedef struct lldpd_door_lprops_s {
2N/A int lp_cmd;
2N/A lldp_propclass_t lp_pclass;
2N/A lldp_proptype_t lp_ptype;
2N/A char lp_laname[MAXLINKNAMELEN];
2N/A uint32_t lp_flags;
2N/A lldp_pval_t lp_pval;
2N/A} lldpd_door_lprops_t;
2N/A
2N/Atypedef struct lldpd_gprops_retval_s {
2N/A int lpr_err;
2N/A char lpr_pval[LLDP_MAXPROPVALLEN];
2N/A} lldpd_gprops_retval_t;
2N/A
2N/Atypedef struct lldpd_retval_s lldpd_sprops_retval_t;
2N/A
2N/A/* Update VLAN/VNIC information */
2N/Atypedef struct lldpd_vinfo_s {
2N/A int lvi_cmd;
2N/A datalink_id_t lvi_plinkid;
2N/A datalink_id_t lvi_vlinkid;
2N/A uint16_t lvi_vid;
2N/A boolean_t lvi_isvnic;
2N/A int lvi_operation;
2N/A} lldp_vinfo_t;
2N/A
2N/Atypedef struct lldpd_door_minfo_s {
2N/A int ldm_cmd;
2N/A boolean_t ldm_neighbor;
2N/A char ldm_laname[MAXLINKNAMELEN];
2N/A} lldpd_door_minfo_t;
2N/A
2N/Atypedef struct lldpd_minfo_retval_s {
2N/A uint_t lmr_err;
2N/A uint_t lmr_listsz;
2N/A} lldpd_minfo_retval_t;
2N/A
2N/Aextern char *lldp_alloc_fmri(const char *, const char *);
2N/Aextern boolean_t lldp_check_valid_link(dladm_handle_t, datalink_id_t,
2N/A datalink_id_t *, uint8_t *);
2N/Aextern int lldp_create_nested_nvl(nvlist_t *, const char *,
2N/A const char *, const char *, nvlist_t **);
2N/Aextern int lldp_get_nested_nvl(nvlist_t *, const char *,
2N/A const char *, const char *, nvlist_t **);
2N/Aextern int lldp_merge_nested_nvl(nvlist_t *, nvlist_t *,
2N/A const char *, const char *, const char *);
2N/Aextern int lldp_del_nested_nvl(nvlist_t *, const char *,
2N/A const char *, const char *);
2N/Aextern char *lldp_ptype2pname(lldp_proptype_t);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _LIBLLDP_LLDPD_H */