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 _LLDP_H
2N/A#define _LLDP_H
2N/A
2N/A/*
2N/A * WARNING
2N/A *
2N/A * The interfaces defined in this file are private to the implementation
2N/A * of Solaris and are subject to change at any time without notice.
2N/A * Applications using these interfaces may fail to run on future releases.
2N/A */
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#include <sys/types.h>
2N/A
2N/A/*
2N/A * Multicast addresses used by LLDP agents. These MAC addresses define the
2N/A * transmission scope of the LLDPDU packets sent.
2N/A */
2N/A#define LLDP_GROUP_ADDRESS { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x0e }
2N/A#define LLDP_NEAREST_NONTPMR_BRIDGE_MCAST_ADDR \
2N/A { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x03 }
2N/A#define LLDP_CUSTOMER_BRIDGE_MCAST_ADDR \
2N/A { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 }
2N/A
2N/A/* LLDP Agent operation modes */
2N/Atypedef enum lldp_admin_status_e {
2N/A LLDP_MODE_UNKNOWN,
2N/A LLDP_MODE_TXONLY,
2N/A LLDP_MODE_RXONLY,
2N/A LLDP_MODE_RXTX,
2N/A LLDP_MODE_DISABLE
2N/A} lldp_admin_status_t;
2N/A
2N/Atypedef enum {
2N/A LLDP_TLVTYPE_END,
2N/A LLDP_TLVTYPE_CHASSIS_ID,
2N/A LLDP_TLVTYPE_PORT_ID,
2N/A LLDP_TLVTYPE_TTL,
2N/A LLDP_TLVTYPE_PORT_DESC,
2N/A LLDP_TLVTYPE_SYS_NAME,
2N/A LLDP_TLVTYPE_SYS_DESC,
2N/A LLDP_TLVTYPE_SYS_CAPAB,
2N/A LLDP_TLVTYPE_MGMT_ADDR,
2N/A /* types 9-126 are reserved */
2N/A LLDP_TLVTYPE_RESERVED,
2N/A LLDP_ORGSPECIFIC_TLVTYPE = 127
2N/A} lldp_tlv_type_t;
2N/A
2N/Atypedef enum {
2N/A LLDP_CHASSIS_ID_CHASSIS_COMPONENT = 1,
2N/A LLDP_CHASSIS_ID_IFALIAS,
2N/A LLDP_CHASSIS_ID_PORT_COMPONENT,
2N/A LLDP_CHASSIS_ID_MACADDRESS,
2N/A LLDP_CHASSIS_ID_IPADDRESS,
2N/A LLDP_CHASSIS_ID_IFNAME,
2N/A LLDP_CHASSIS_ID_LOCAL
2N/A} lldp_chassis_subtype_t;
2N/A
2N/Atypedef enum {
2N/A LLDP_PORT_ID_IFALIAS = 1, /* RFC 2863 - DisplayString */
2N/A LLDP_PORT_ID_PORT_COMPONENT, /* RFC 4133 - DisplayString */
2N/A LLDP_PORT_ID_MACADDRESS, /* IEEE Std 802 */
2N/A LLDP_PORT_ID_IPADDRESS, /* IPv4 or IPv6 address */
2N/A LLDP_PORT_ID_IFNAME, /* RFC 2863 - DisaplayString */
2N/A LLDP_PORT_ID_AGENT_CICRUITID, /* RFC 3046 - NumericString */
2N/A LLDP_PORT_ID_LOCAL /* alpha-numeric string */
2N/A} lldp_port_subtype_t;
2N/A
2N/A#define LLDP_SYSCAPAB_OTHER 0x0001
2N/A#define LLDP_SYSCAPAB_REPEATER 0x0002
2N/A#define LLDP_SYSCAPAB_MACBRIDGE 0x0004
2N/A#define LLDP_SYSCAPAB_WLAN_AP 0x0008
2N/A#define LLDP_SYSCAPAB_ROUTER 0x0010
2N/A#define LLDP_SYSCAPAB_TELEPHONE 0x0020
2N/A#define LLDP_SYSCAPAB_DOCSIS_CDEV 0x0040
2N/A#define LLDP_SYSCAPAB_STATION_ONLY 0x0080
2N/A#define LLDP_SYSCAPAB_CVLAN 0x0100
2N/A#define LLDP_SYSCAPAB_SVLAN 0x0200
2N/A#define LLDP_SYSCAPAB_TPMR 0x0400
2N/A
2N/A/* Change this number if we add/remove capabilities */
2N/A#define LLDP_MAX_SYSCAPAB_TYPE 11
2N/A
2N/A#define LLDP_TLV_TYPE(typelen) ((ntohs(*(uint16_t *)(void *)typelen)) >> 9)
2N/A#define LLDP_TLV_LEN(typelen) ((ntohs(*(uint16_t *)(void *)typelen)) & 0x01ff)
2N/A
2N/A#define LLDP_TLVHDR_SZ (sizeof (uint16_t))
2N/A#define LLDP_ORGSPECHDR_SZ (sizeof (uint32_t))
2N/A#define LLDP_OUI_LEN 3
2N/A
2N/A#define LLDP_ORGTLV_OUI(ouistype) \
2N/A (ntohl(*(uint32_t *)(void *)(ouistype)) >> 8)
2N/A#define LLDP_ORGTLV_STYPE(ouistype) \
2N/A (ntohl(*(uint32_t *)(void *)(ouistype)) & 0x000000FF)
2N/A
2N/A#define LLDP_802dot1_OUI 0x0080C2
2N/A#define LLDP_802dot3_OUI 0x00120F
2N/A#define LLDP_MED_OUI 0x0012BB
2N/A#define LLDP_ORACLE_OUI 0x0003BA
2N/A
2N/A/* IEEE 802.1 Organizationally Specific TLV Subtypes */
2N/A#define LLDP_802dot1OUI_PVID_SUBTYPE 1
2N/A#define LLDP_802dot1OUI_PPVID_SUBTYPE 2
2N/A#define LLDP_802dot1OUI_VLAN_NAME_SUBTYPE 3
2N/A#define LLDP_802dot1OUI_PROTOCOLID_SUBTYPE 4
2N/A#define LLDP_802dot1OUI_LINK_AGGR_SUBTYPE 7
2N/A#define LLDP_802dot1OUI_ETSCFG_SUBTYPE 9
2N/A#define LLDP_802dot1OUI_ETSRECO_SUBTYPE 10
2N/A#define LLDP_802dot1OUI_PFC_SUBTYPE 11
2N/A#define LLDP_802dot1OUI_APPLN_SUBTYPE 12
2N/A/* Subtype TBA by IEEE */
2N/A#define LLDP_802dot1OUI_EVB_SUBTYPE 13
2N/A
2N/A/* IEEE 802.3 Organizationally Specific TLV Subtypes */
2N/A#define LLDP_802dot3OUI_MACPHYS_SUBTYPE 1
2N/A#define LLDP_802dot3OUI_POWVIAMDI_SUBTYPE 2
2N/A#define LLDP_802dot3OUI_MAXFRAMESZ_SUBTYPE 4
2N/A
2N/A/* Oracle OUI subtype */
2N/A#define LLDP_ORACLEOUI_VNIC_SUBTYPE 1
2N/A
2N/A#define LLDP_MAX_PORTIDLEN 255
2N/A#define LLDP_MAX_CHASSISIDLEN 255
2N/A#define LLDP_MAX_MSAPLEN \
2N/A (LLDP_MAX_PORTIDLEN + LLDP_MAX_CHASSISIDLEN)
2N/A#define LLDP_MAX_PORTIDSTRLEN 512 /* octets represented as string */
2N/A#define LLDP_MAX_CHASSISIDSTRLEN 512 /* octets represented as string */
2N/A#define LLDP_MAX_MSAPSTRLEN 1024
2N/A#define LLDP_MAX_PORTDESCLEN 256 /* includes NUL terminating char */
2N/A#define LLDP_MAX_SYSNAMELEN 256 /* includes NUL terminating char */
2N/A#define LLDP_MAX_SYSDESCLEN 256
2N/A#define LLDP_MAX_VLANNAMELEN 33 /* includes NUL terminating char */
2N/A#define LLDP_MAX_VNICNAMELEN 33 /* includes NUL terminating char */
2N/A#define LLDP_MIN_VNICTLV_LEN 12
2N/A#define LLDP_MAX_VNICTLV_LEN 266
2N/A#define LLDP_MGMTADDR_ADDRLEN 31
2N/A#define LLDP_MGMTADDR_OIDLEN 128
2N/A#define LLDP_STRSIZE 256
2N/A
2N/A#define LLDP_MAX_PDULEN 1500
2N/A
2N/A/* variaous ianaAddressFamilyNumbers from (www.iana.org) */
2N/A#define LLDP_MGMTADDR_TYPE_IPV4 0x1
2N/A#define LLDP_MGMTADDR_TYPE_IPV6 0x2
2N/A#define LLDP_MGMTADDR_TYPE_ALL802 0x6
2N/A
2N/A#define LLDP_MGMTADDR_IFTYPE_UNKNOWN 0x1
2N/A#define LLDP_MGMTADDR_IFTYPE_IFINDEX 0x2
2N/A#define LLDP_MGMTADDR_IFTYPE_SYSPORT 0x3
2N/A
2N/Atypedef struct lldp_tlv_s {
2N/A uint8_t lt_type;
2N/A uint16_t lt_len;
2N/A uint8_t *lt_value;
2N/A} lldp_tlv_t;
2N/A
2N/Atypedef struct lldp_chassid_s {
2N/A uint8_t lc_subtype;
2N/A uint_t lc_cidlen;
2N/A uint8_t lc_cid[LLDP_MAX_CHASSISIDLEN];
2N/A} lldp_chassisid_t;
2N/A
2N/Atypedef struct lldp_portid_s {
2N/A uint8_t lp_subtype;
2N/A uint_t lp_pidlen;
2N/A uint8_t lp_pid[LLDP_MAX_PORTIDLEN];
2N/A} lldp_portid_t;
2N/A
2N/Atypedef struct lldp_syscapab_s {
2N/A uint16_t ls_sup_syscapab;
2N/A uint16_t ls_enab_syscapab;
2N/A} lldp_syscapab_t;
2N/A
2N/Atypedef struct lldp_vlan_info_s {
2N/A uint16_t lvi_vid;
2N/A uint8_t lvi_vlen;
2N/A char lvi_name[LLDP_MAX_VLANNAMELEN];
2N/A} lldp_vlan_info_t;
2N/A
2N/Atypedef struct lldp_vnic_info_s {
2N/A uint32_t lvni_linkid;
2N/A uint16_t lvni_vid;
2N/A lldp_portid_t lvni_portid;
2N/A char lvni_name[LLDP_MAX_VNICNAMELEN];
2N/A} lldp_vnic_info_t;
2N/A
2N/Atypedef struct lldp_aggr_s {
2N/A uint8_t la_status;
2N/A uint32_t la_id;
2N/A} lldp_aggr_t;
2N/A
2N/Atypedef struct lldp_pfc_s {
2N/A boolean_t lp_willing;
2N/A boolean_t lp_mbc;
2N/A uint8_t lp_cap;
2N/A uint8_t lp_enable;
2N/A} lldp_pfc_t;
2N/A
2N/Atypedef struct lldp_appln_s {
2N/A uint8_t la_pri;
2N/A uint8_t la_sel;
2N/A uint16_t la_id;
2N/A} lldp_appln_t;
2N/A
2N/Atypedef struct lldp_evb_s {
2N/A uint8_t le_mode;
2N/A boolean_t le_bgid;
2N/A boolean_t le_sgid;
2N/A uint8_t le_r;
2N/A uint8_t le_rte;
2N/A boolean_t le_rol_rwd; /* TRUE -> remote, FALSE -> local */
2N/A uint8_t le_rwd;
2N/A boolean_t le_rol_rka; /* TRUE -> remote, FALSE -> local */
2N/A uint8_t le_rka;
2N/A boolean_t le_rrcap;
2N/A boolean_t le_rrctr;
2N/A boolean_t le_rrreq;
2N/A uint8_t le_rrstat;
2N/A} lldp_evb_t;
2N/A
2N/A#define LLDP_EVB_UNKNOWN 0
2N/A#define LLDP_EVB_BRIDGE 1
2N/A#define LLDP_EVB_STATION 2
2N/A
2N/A#define LLDP_EVB_MODE(mrlrwd) (mrlrwd) >> 6
2N/A#define LLDP_EVB_ROL_RWD(mrlrwd) ((mrlrwd) & 0x20) >> 5
2N/A#define LLDP_EVB_RWD(mrlrwd) (mrlrwd) & 0x1F
2N/A
2N/A#define LLDP_EVB_R(rrte) (rrte) >> 5
2N/A#define LLDP_EVB_RTE(rrte) (rrte) & 0x1F
2N/A
2N/A#define LLDP_EVB_ROL_RKA(rolrka) ((rolrka) & 0x20) >> 5
2N/A#define LLDP_EVB_RKA(rolrka) (rolrka) & 0x1F
2N/A
2N/A#define LLDP_EVBB_BGID(bcap) (bcap) & 0x4
2N/A#define LLDP_EVBB_RRCAP(bcap) (bcap) & 0x2
2N/A#define LLDP_EVBB_RRCTR(bcap) (bcap) & 0x1
2N/A
2N/A#define LLDP_EVBS_SGID(scap) (scap) & 0x8
2N/A#define LLDP_EVBS_RRREQ(scap) (scap) & 0x4
2N/A#define LLDP_EVBS_RRSTAT(scap) (scap) & 0x3
2N/A
2N/A#define LLDP_EVB_TLVLEN 5 /* 5-bytes */
2N/A
2N/Atypedef struct lldp_ets_s {
2N/A boolean_t le_willing; /* only for config TLV */
2N/A boolean_t le_cbs; /* only for config TLV */
2N/A uint8_t le_ntcs; /* only for config TLV */
2N/A uint8_t le_pat[8]; /* Priority Assignment Table */
2N/A uint8_t le_bat[8]; /* Bandwidth Assignment Table */
2N/A uint8_t le_tsa[8]; /* TSA Assignment Table */
2N/A} lldp_ets_t;
2N/A
2N/A/* ETS configuration/recommendation TLV information string length */
2N/A#define LLDP_ETS_INFOSTR_LEN 25
2N/A
2N/A/* ETS Transmission selection algorithm */
2N/A#define LLDP_TSA_ETS 2
2N/A
2N/A
2N/A#define LLDP_AGGR_CAPABLE 0x1
2N/A#define LLDP_AGGR_MEMBER 0x2
2N/A
2N/Atypedef struct lldp_mgmtaddr_s {
2N/A uint8_t lm_subtype;
2N/A uint8_t lm_addrlen;
2N/A uint8_t lm_addr[LLDP_MGMTADDR_ADDRLEN];
2N/A uint8_t lm_iftype;
2N/A uint32_t lm_ifnumber;
2N/A uint8_t lm_oidlen;
2N/A uint8_t lm_oid[LLDP_MGMTADDR_OIDLEN];
2N/A} lldp_mgmtaddr_t;
2N/A
2N/A/* DCBX Types */
2N/Atypedef enum dcbx_protocol_type_s {
2N/A DCBX_TYPE_PFC = 1,
2N/A DCBX_TYPE_APPLICATION,
2N/A DCBX_TYPE_ETS
2N/A} dcbx_protocol_type_t;
2N/A
2N/A/* DCB Application TLV Selector Field types */
2N/A#define DCB_APPLICATION_SF_ETHERTYPE 0x01
2N/A#define DCB_APPLICATION_SF_TCP_SCTP 0x02
2N/A#define DCB_APPLICATION_SF_UDP_DCCP 0x03
2N/A#define DCB_APPLICATION_SF_TCP_SCTP_UDP_DCCP 0x04
2N/A
2N/A#define DCBX_FCOE_APPLICATION_ID1 0x8906
2N/A#define DCBX_FCOE_APPLICATION_ID2 0x8914
2N/A#define DCBX_FCOE_APPLICATION_SF DCB_APPLICATION_SF_ETHERTYPE
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _LLDP_H */