/*
 * Copyright (c) 2017 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

vl_api_version 1.0.0

/** \brief configure global parameter for LLDP
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param system_name - VPP system name
    @param tx_hold - multiplier for tx_interval when setting time-to-live (TTL)
                     value in the LLDP packets
    @param tx_interval - time interval, in seconds, between each LLDP frames
*/
autoreply define lldp_config
{
  u32 client_index;
  u32 context;
  u8 system_name[256];
  u32 tx_hold;
  u32 tx_interval;
};

/** \brief Interface set LLDP request
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - interface for which to enable/disable LLDP
    @param port_desc - local port description
    @param mgmt_ip4_addr - management ip4 address of the interface
    @param mgmt_ip6_addr - management ip6 address of the interface
    @param mgmt_oid - OID(Object Identifier) of the interface
    @param enable - if non-zero enable, else disable
*/
autoreply define sw_interface_set_lldp
{
  u32 client_index;
  u32 context;
  u32 sw_if_index;
  u8 port_desc[256];
  u8 mgmt_ip4[4];
  u8 mgmt_ip6[16];
  u8 mgmt_oid[128];
  u8 enable;
};
