/*
 * Copyright (c) 2015-2016 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 Punt traffic to the host
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_add - add punt if non-zero, else delete
    @param ipv - L3 protocol 4 - IPv4, 6 - IPv6, ~0 - All
    @param l4_protocol - L4 protocol to be punted, only UDP (0x11) is supported
    @param l4_port - TCP/UDP port to be punted
*/
autoreply define punt {
    u32 client_index;
    u32 context;
    u8 is_add;
    u8 ipv;
    u8 l4_protocol;
    u16 l4_port;
};

/** \brief Punt traffic to the host via socket
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param header_version - expected meta data header version (currently 1)
    @param is_ip4 - L3 protocol 1 - IPv4, 0 - IPv6
    @param l4_protocol - L4 protocol to be punted, only UDP (0x11) is supported
    @param l4_port - TCP/UDP port to be punted
*/
define punt_socket_register {
    u32 client_index;
    u32 context;
    u32 header_version;
    u8 is_ip4;
    u8 l4_protocol;
    u16 l4_port;
    u8 pathname[108]; /* Linux sun_path defined to be 108 bytes, see unix(7) */
};

define punt_socket_register_reply
{
  u32 context;
  i32 retval;
  u8 pathname[64];
};

autoreply define punt_socket_deregister {
    u32 client_index;
    u32 context;
    u8 is_ip4;
    u8 l4_protocol;
    u16 l4_port;
};

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