/* Hey Emacs use -*- mode: C -*- */ /* * Copyright (c) 2018 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. */ /** \file This file defines vpp IP control-plane API messages which are generally called through a shared memory interface. */ option version = "1.3.0"; import "vnet/ip/ip_types.api"; import "vnet/fib/fib_types.api"; import "vnet/ethernet/ethernet_types.api"; /** \brief Add / del table request A table can be added multiple times, but need be deleted only once. @param client_index - opaque cookie to identify the sender @param context - sender context, to match reply w/ request @param is_ipv6 - V4 or V6 table @param table_id - table ID associated with the route This table ID will apply to both the unicats and mlticast FIBs @param name - A client provided name/tag for the table. If this is not set by the client, then VPP will generate something meaningfull. */ autoreply define ip_table_add_del { u32 client_index; u32 context; u32 table_id; u8 is_ipv6; u8 is_add; u8 name[64]; }; /** \brief Dump IP fib table @param client_index - opaque cookie to identify the sender */ define ip_fib_dump { u32 client_index; u32 context; }; /** \brief IP FIB table response @param table_id - IP fib table id @address_length - mask length @address - ip4 prefix @param count - the number of fib_path in path @param path - array of of fib_path structures */ manual_endian manual_print define ip_fib_details { u32 context; u32 table_id; u8 table_name[64]; u8 address_length; u8 address[4]; u32 count; u32 stats_index; vl_api_fib_path_t path[count]; }; /** \brief Dump IP6 fib table @param client_index - opaque cookie to identify the sender */ define ip6_fib_dump { u32 client_index; u32 context; }; /** \brief IP6 FIB table entry response @param table_id - IP6 fib table id @param address_length - mask length @param address - ip6 prefix @param count - the number of fib_path in path @param path - array of of fib_path structures */ manual_endian manual_print define ip6_fib_details { u32 context; u32 table_id; u8 table_name[64]; u8 address_length; u8 address[16]; u32 count; u32 stats_index; vl_api_fib_path_t path[count]; }; /** \brief Dump IP neighboors @param client_index - opaque cookie to identify the sender @param context - sender context, to match reply w/ request @param sw_if_index - the interface to dump neighboors, ~0 == all @param is_ipv6 - [1|0] to indicate if address family is ipv[6|4] */ define ip_neighbor_dump { u32 client_index; u32 context; u32 sw_if_index; u8 is_ipv6; }; /** \brief IP neighboors dump response @param context - sender context which was passed in the request @param sw_if_index - The interface used to reach the neighbor @param stats_index - An index in the stats segment that can be used to read the counters for this neighbour. @param is_static - [1|0] to indicate if neighbor is statically configured @param is_ipv6 - [1|0] to indicate if address family is ipv[6|4] */ define ip_neighbor_details { u32 context; u32 sw_if_index; u32 stats_index; u8 is_static; u8 is_ipv6; u8 mac_address[6]; u8 ip_address[16]; }; /** \brief IP neighbor add / del request @param client_index - opaque cookie to identify the sender @param context - sender context, to match reply w/ request @param sw_if_index - interface used to reach neighbor @param is_add - 1 to add neighbor, 0 to delete @param is_ipv6 - 1 for IPv6 neighbor, 0 for IPv4 @param is_ipv6 - 1 for IPv6 neighbor, 0 for IPv4 @param is_static - A static neighbor Entry - there are not flushed If the interface goes down. @param is_no_adj_fib - Do not create a corresponding entry in the FIB table for the neighbor. @param mac_address - l2 address of the neighbor @param dst_address - ip4 or ip6 address of the neighbor */ define ip_neighbor_add_del { u32 client_index; u32 context; u32 sw_if_index; /* 1 = add, 0 = delete */ u8 is_add; u8 is_ipv6; u8 is_static; u8 is_no_adj_fib; u8 mac_address[6]; u8 dst_address[16]; }; define ip_neighbor_add_del_reply { u32 context; i32 retval; u32 stats_index; }; /** \brief Set the ip flow hash config for a fib request @param client_index - opaque cookie to identify the sender @param context - sender context, to match reply w/ request @param vrf_id - vrf/fib id @param is_ipv6 - if non-zero the fib is ip6, else ip4 @param src - if non-zero include src in flow hash @param dst - if non-zero include dst in flow hash @param sport - if non-zero include sport in flow hash @param dport - if non-zero include dport in flow hash @param proto -if non-zero include proto in flow hash @param reverse - if non-zero include reverse in flow hash */ autoreply define set_ip_flow_hash { u32 client_index; u32 context; u32 vrf_id; u8 is_ipv6; u8 src; u8 dst; u8 sport; u8 dport; u8 proto; u8 reverse; }; /** \brief IPv6 router advertisement config request @param client_index - opaque cookie to identify the sender @param context - sender context, to match reply w/ request @param suppress - @param managed - @param other - @param ll_option - @param send_unicast - @param cease - @param is_no - @param default_router - @param max_interval - @param min_interval - @param lifetime - @param initial_count - @param initial_interval - */ autoreply define sw_interface_ip6nd_ra_config { u32 client_index; u32 context; u32 sw_if_index; u8 suppress; u8 managed; u8 other; u8 ll_option; u8 send_unicast; u8 cease; u8 is_no; u8 default_router; u32 max_interval; u32 min_interval; u32 lifetime; u32 initial_count; u32 initial_interval; }; /** \brief IPv6 router advertisement prefix config request @param client_index - opaque cookie to identify the sender @param context - sender context, to match reply w/ request @param sw_if_index - The interface the RA prefix information is for @param address[] - The prefix to advertise @param address_length - the prefix length @param use_default - Revert to default settings @param no_advertise - Do not advertise this prefix @param off_link - The prefix is off link (it is not configured on the interface) Configures the L-flag, When set, indicates that this prefix can be used for on-link determination. @param no_autoconfig - Setting for the A-flag. When set indicates that this prefix can be used for stateless address configuration. @param no_onlink - The prefix is not on link. Make sure this is consistent with the off_link parameter else YMMV @param is_no - add/delete @param val_lifetime - The length of time in seconds (relative to the time the packet is sent) that the prefix is valid for the purpose of on-link determination. A value of all one bits (0xffffffff) represents infinity @param pref_lifetime - The length of time in seconds (relative to the time the packet is sent) that addresses generated from the prefix via stateless address autoconfiguration remain preferred [ADDRCONF]. A value of all one bits (0xffffffff) represents infinity. */ autoreply define sw_interface_ip6nd_ra_prefix { u32 client_index; u32 context; u32 sw_if_index; u8 address[16]; u8 address_length; u8 use_default; u8 no_advertise; u8 off_link; u8 no_autoconfig; u8 no_onlink; u8 is_no; u32 val_lifetime; u32 pref_lifetime; }; /** \brief IPv6 ND proxy config @param client_index - opaque cookie to identify the sender @param context - sender context, to match reply w/ request @param sw_if_index - The interface the host is on @param address - The address of the host for which to proxy for @param is_add - Adding or deleting */ autoreply define ip6nd_proxy_add_del { u32 client_index; u32 context; u32 sw_if_index; u8 is_del; u8 address[16]; }; /** \brief IPv6 ND proxy details returned after request @param context - sender context, to match reply w/ request @param retval - return code for the request */ define ip6nd_proxy_details { u32 context; u32 sw_if_index; u8 address[16]; }; /** \brief IPv6 ND proxy dump request @param context - sender context, to match reply w/ request @param retval - return code for the request @param sw_if_index - The interface the host is on @param address - The address of the host for which to proxy for */ define ip6nd_proxy_dump { u32 client_index; u32 context; }; /** \brief Start / stop sending router solicitation @param client_index - opaque cookie to identify the sender @param context - sender context, to match reply w/ request @param irt - initial retransmission time @param mrt - maximum retransmission time @param mrc - maximum retransmission count @param mrd - maximum retransmission duration @param sw_if_index - software interface index of interface for sending router solicitation @param stop - if non-zero then stop sending router solicitation, otherwise start sending router solicitation */ autoreply define ip6nd_send_router_solicitation { u32 client_index; u32 context; u32 irt; u32 mrt; u32 mrc; u32 mrd; u32 sw_if_index; u8 stop; }; /** \brief IPv6 interface enable / disable request @param client_index - opaque cookie to identify the sender @param context - sender context, to match reply w/ request @param sw_if_index - interface used to reach neighbor @param enable - if non-zero enable ip6 on interface, else disable */ autoreply define sw_interface_ip6_enable_disable { u32 client_index; u32
/*
 * Copyright (c) 2011-2018 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.
 */
#ifndef __included_cdp_protocol_h__
#define __included_cdp_protocol_h__

#include <vnet/ethernet/ethernet.h>	/* for ethernet_header_t */
#include <vnet/llc/llc.h>
#include <vnet/snap/snap.h>
#include <vnet/srp/packet.h>

typedef CLIB_PACKED (struct
		     {
		     u8 version;
		     u8 ttl;
		     u16 checksum;	/* 1's complement of the 1's complement sum */
		     u8 data[0];
		     }) cdp_hdr_t;

typedef struct
{
  u8 dst_address[6];
  u8 src_address[6];
  u16 len;
} ethernet_802_3_header_t;

typedef CLIB_PACKED (struct
		     {
		     ethernet_802_3_header_t ethernet;
		     llc_header_t llc; snap_header_t snap; cdp_hdr_t cdp;
		     }) ethernet_llc_snap_and_cdp_header_t;

typedef CLIB_PACKED (struct
		     {
		     hdlc_header_t hdlc; cdp_hdr_t cdp;
		     }) hdlc_and_cdp_header_t;

typedef CLIB_PACKED (struct
		     {
		     srp_header_t srp;
		     ethernet_header_t ethernet; cdp_hdr_t cdp;
		     }) srp_and_cdp_header_t;

typedef CLIB_PACKED (struct
		     {
		     u16 t;
		     u16 l;
		     u8 v[0];
		     }) cdp_tlv_t;

/*
 * TLV codes.
 */
#define foreach_cdp_tlv_type                                    \
_(unused)                                                       \
_(device_name)		/* uniquely identifies the device    */ \
_(address)              /* list of addresses this device has */ \
_(port_id)              /* port CDP packet was sent out on   */ \
_(capabilities)         /* funct. capabilities of the device */ \
_(version)              /* version                           */ \
_(platform)             /* hardware platform of this device  */ \
_(ipprefix)             /* An IP network prefix              */ \
_(hello)                /* Pprotocol piggyback hello msg     */ \
_(vtp_domain)           /* VTP management domain             */ \
_(native_vlan)          /* Native VLAN number                */ \
_(duplex)               /* The interface duplex mode         */ \
_(appl_vlan)            /* Appliance VLAN-ID TLV             */ \
_(trigger)              /* For sending trigger TLV msgs.     */ \
_(power)                /* Power consumption of that device  */ \
_(mtu)                  /* MTU defined for sending intf.     */ \
_(trust)                /* Extended trust TLV                */ \
_(cos)                  /* COS for Untrusted Port TLV        */ \
_(sysname)              /* System name (FQDN of device)      */ \
_(sysobject)            /* OID of sysObjectID MIB object     */ \
_(mgmt_addr)            /* SNMP manageable addrs. of device  */ \
_(physical_loc)         /* Physical Location of the device   */ \
_(mgmt_addr2)           /* External Port-ID                  */ \
_(power_requested)                                              \
_(power_available)                                              \
_(port_unidirectional)                                          \
_(unknown_28)                                                   \
_(energywise)                                                   \
_(unknown_30)                                                   \
_(spare_poe)

typedef enum
{
#define _(t) CDP_TLV_##t,
  foreach_cdp_tlv_type
#undef _
} cdp_tlv_code_t;

/*
  The address TLV looks as follows:

          +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
          |                    Number of addresses                        |
          +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
          |                   IDRP encoded address                        |
          +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

	  An address is encoded in IDRP format:

	   0                   1                   2                   3
           0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
          +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
          |       PT      |    PT Length  |    Protocol (variable) ...
          +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
          |        Address length         |    Address (variable) ...
          +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

	  PT: Protocol type
	      1 = NLPID format
              2 = 802.2 format

	  PT Length:
	      Length of protocol field, 1 for PT = 1, and either 3 or 8 f