/*
 *------------------------------------------------------------------
 * 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.
 *------------------------------------------------------------------
 */

option version = "1.0.0";

/** \brief 
    Used by a 'host' to enable the recption/listening of packets for a specific
    multicast group
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param enable - if set, enable igmp messages on configuration
    @param sw_if_index - interface sw index
    @param saddr - source address
    @param gaddr - group address
*/
autoreply define igmp_listen
{
  u32 client_index;
  u32 context;

  u8 enable;
  u32 sw_if_index;
  u8 saddr[4];
  u8 gaddr[4];
};

/** \brief 
    Used by a 'router' to enable the recption of IGMP packets and the
    construction of group state for hosts on the link
    multicast group
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param enable - if set, enable igmp messages on configuration
    @param sw_if_index - interface sw index
*/
autoreply define igmp_enable_disable
{
  u32 client_index;
  u32 context;

  u8 enable;
  u32 sw_if_index;
};

/** \brief dump (S,G)s from interface
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - interface sw index
    @param dump_all - get (S,G)s from all interfaces
*/
define igmp_dump
{
  u32 client_index;
  u32 context;

  u32 sw_if_index;
  u8 dump_all;
};

/** \brief igmp details
    @param context - sender context, to match reply w/ request
    @param sw_if_index - interface sw index
    @param saddr - source address
    @param gaddr - group address
*/
define igmp_details
{
  u32 context;

  u32 sw_if_index;
  u8 saddr[4];
  u8 gaddr[4];
};

/** \brief remove all (S,G)s from an interface
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - interface sw index
*/
autoreply define igmp_clear_interface
{
  u32 client_index;
  u32 context;

  u32 sw_if_index;
};

/** \brief register for igmp events
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param pid - sender's pid
    @param enable - 1 enable, 0 disable igmp events
*/
autoreply define want_igmp_events
{
  u32 client_index;
  u32 context;

  u32 enable;
  u32 pid;
};

service {
  rpc want_igmp_events returns want_igmp_events_reply
    events igmp_event;
};

/** \brief igmp event details
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - interface sw index
    @param saddr - source address
    @param gaddr - group address
    @param is_join - if set source is joining the group, else leaving
*/
define igmp_event
{
  u32 context;

  u32 sw_if_index;
  u8 saddr[4];
  u8 gaddr[4];
  u8 is_join;
};

/*
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */