/*
 * 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.
 */
 
 /** \brief Bind to a given URI
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param accept_cookie - sender accept cookie, to identify this bind flavor
    @param uri - a URI, e.g. "tcp://0.0.0.0/0/80" [ipv4]
                 "tcp://::/0/80" [ipv6] etc.
    @param options - socket options, fifo sizes, etc.
*/
define bind_uri {
  u32 client_index;
  u32 context;
  u32 accept_cookie;
  u32 initial_segment_size;
  u8 uri[128];
  u64 options[16];
};

/** \brief Unbind a given URI
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param uri - a URI, e.g. "tcp://0.0.0.0/0/80" [ipv4]
                 "tcp://::/0/80" [ipv6], etc.
    @param options - socket options, fifo sizes, etc.
*/
define unbind_uri {
  u32 client_index;
  u32 context;
  u8 uri[128];
};

/** \brief Connect to a given URI
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param accept_cookie - sender accept cookie, to identify this bind flavor
    @param uri - a URI, e.g. "tcp4://0.0.0.0/0/80"
                 "tcp6://::/0/80" [ipv6], etc.
    @param options - socket options, fifo sizes, etc.
*/
define connect_uri {
  u32 client_index;
  u32 context;
  u8 uri[128];
  u64 client_queue_address;
  u64 options[16];
};

/** \brief Bind reply
    @param context - sender context, to match reply w/ request
    @param retval - return code for the request
    @param event_queue_address - vpp event queue address or 0 if this 
                                 connection shouldn't send events
    @param segment_name_length - length of segment name 
    @param segment_name - name of segment client needs to attach to
*/
define bind_uri_reply {
    u32 context;
    i32 retval;
    u64 server_event_queue_address;
    u8 segment_name_length;
    u32 segment_size;
    u8 segment_name[128];
};

/** \brief unbind reply
    @param context - sender context, to match reply w/ request
    @param retval - return code for the request
*/
define unbind_uri_reply {
    u32 context;
    i32 retval;
};

/** \brief vpp->client, connect reply
    @param context - sender context, to match reply w/ request
    @param retval - return code for the request
    @param server_rx_fifo - rx (vpp -> vpp-client) fifo address 
    @param server_tx_fifo - tx (vpp-client -> vpp) fifo address 
    @param session_index - session index;
    @param session_thread_index - session thread index
    @param session_type - session thread type
    @param vpp_event_queue_address - vpp's event queue address
    @param client_event_queue_address - client's event queue address
    @param segment_name_length - non-zero if the client needs to attach to 
                                 the fifo segment
    @param segment_name - set if the client needs to attach to the segment
*/
define connect_uri_reply {
  u32 context;
  i32 retval;
  u64 server_rx_fifo;
  u64 server_tx_fifo;
  u32 session_index;
  u32 session_thread_index;
  u8 session_type;
  u64 client_event_queue_address;
  u64 vpp_event_queue_address;
  u32 segment_size;
  u8 segment_name_length;
  u8 segment_name[128];
};

/** \brief vpp->client, please map an additional shared memory segment
    @param context - sender context, to match reply w/ request
    @param segment_name - 
*/
define map_another_segment {
    u32 client_index;
    u32 context;
    u32 segment_size;
    u8 segment_name[128];
};

/** \brief client->vpp
    @param context - sender context, to match reply w/ request
    @param retval - return code for the request
*/
define map_another_segment_reply {
    u32 context;
    i32 retval;
};

/** \brief vpp->client, accept this session
    @param context - sender context, to match reply w/ request
    @param accept_cookie - tells client which bind flavor just occurred
    @param rx_fifo_address - rx (vpp -> vpp-client) fifo address 
    @param tx_fifo_address - tx (vpp-client -> vpp) fifo address 
    @param session_index - index of new session
    @param session_thread_index - thread index of new session
    @param vpp_event_queue_address - vpp's event queue address
    @param session_type - type of session
    
*/
define accept_session {
  u32 client_index;
  u32 context;
  u32 accept_cookie;
  u64 server_rx_fifo;
  u64 server_tx_fifo;
  u32 session_index;
  u32 session_thread_index;
  u64 vpp_event_queue_address;
  u8 session_type;
};

/** \brief client->vpp, reply to an accept message
    @param context - sender context, to match reply w/ request
    @param retval - return code for the request
    @param session_index - session index from accept_session / connect_reply
    @param session_thread_index - thread index from accept_session /
                                  connect_reply
*/
define accept_session_reply {
  u32 context;
  i32 retval;
  u8 session_type;
  u8 session_thread_index;
  u32 session_index;
};

/** \brief bidirectional disconnect API
    @param client_index - opaque cookie to identify the sender
                          client to vpp direction only
    @param context - sender context, to match reply w/ request
    @param session_index - cookie #1 from accept_session / connect_reply
    @param session_thread_index - cookie #2
*/
define disconnect_session {
  u32 client_index;
  u32 context;
  u32 session_index;
  u32 session_thread_index;
};

/** \brief bidirectional disconnect reply API
    @param client_index - opaque cookie to identify the sender
                          client to vpp direction only
    @param context - sender context, to match reply w/ request
    @param retval - return code for the request
    @param session_index - session index from accept_session / connect_reply
    @param session_thread_index - thread index from accept_session /
                                  connect_reply
*/
define disconnect_session_reply {
  u32 client_index;
  u32 context;
  i32 retval;
  u32 session_index;
  u32 session_thread_index;
};

/** \brief vpp->client reset session API
    @param client_index - opaque cookie to identify the sender
                          client to vpp direction only
    @param context - sender context, to match reply w/ request
    @param session_index - session index from accept_session / connect_reply
    @param session_thread_index - thread index from accept_session /
                                  connect_reply
*/
define reset_session {
  u32 client_index;
  u32 context;
  u32 session_index;
  u32 session_thread_index;
};

/** \brief client->vpp reset session reply
    @param client_index - opaque cookie to identify the sender
                          client to vpp direction only
    @param context - sender context, to match reply w/ request
    @param retval - return code for the request
    @param session_index - session index from accept_session / connect_reply
    @param session_thread_index - thread index from accept_session /
                                  connect_reply
*/
define reset_session_reply {
  u32 client_index;
  u32 context;
  i32 retval;
  u32 session_index;
  u32 session_thread_index;
};

/** \brief Bind to an ip:port pair for a given transport protocol
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param vrf - bind namespace
    @param is_ip4 - flag that is 1 if ip address family is IPv4
    @param ip - ip address
    @param port - port 
    @param proto - protocol 0 - TCP 1 - UDP
    @param options - socket options, fifo sizes, etc.
*/
define bind_sock {
  u32 client_index;
  u32 context;
  u32 vrf;
  u8 is_ip4;
  u8 ip[16];
  u16 port;
  u8 proto;
  u64 options[16];
};

/** \brief Unbind 
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param handle - bind handle obtained from bind reply
*/
define unbind_sock {
  u32 client_index;
  u32 context;
  u64 handle;
};

/** \brief Connect to a remote peer
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param vrf - connection namespace
    @param is_ip4 - flag that is 1 if ip address family is IPv4
    @param ip - ip address
    @param port - port 
    @param proto - protocol 0 - TCP 1 - UDP
    @param client_queue_address - client's API queue address. Non-zero when 
                                  used to perform redirects
    @param options - socket options, fifo sizes, etc.
*/
define connect_sock {
  u32 client_index;
  u32 context;
  u32 vrf;
  u8 is_ip4;
  u8 ip[16];
  u16 port;
  u8 proto;
  u64 client_queue_address;
  u64 options[16];
};

/** \brief Bind reply
    @param context - sender context, to match reply w/ request
    @param handle - bind handle
    @param retval - return code for the request
    @param event_queue_address - vpp event queue address or 0 if this 
                                 connection shouldn't send events
    @param segment_name_length - length of segment name 
    @param segment_name - name of segment client needs to attach to
*/
define bind_sock_reply {
  u32 context;
  u64 handle;
  i32 retval;
  u64 server_event_queue_address;
  u32 segment_size;
  u8 segment_name_length;
  u8 segment_name[128];
};

/** \brief unbind reply
    @param context - sender context, to match reply w/ request
    @param retval - return code for the request
*/
define unbind_sock_reply {
  u32 context;
  i32 retval;
};

/** \brief vpp/server->client, connect reply
    @param context - sender context, to match reply w/ request
    @param retval - return code for the request
    @param handle - connection handle
    @param server_rx_fifo - rx (vpp -> vpp-client) fifo address 
    @param server_tx_fifo - tx (vpp-client -> vpp) fifo address 
    @param vpp_event_queue_address - vpp's event queue address
    @param client_event_queue_address - client's event queue address
    @param segment_name_length - non-zero if the client needs to attach to 
                                 the fifo segment
    @param segment_name - set if the client needs to attach to the segment
*/
define connect_sock_reply {
  u32 context;
  i32 retval;
  u64 handle;
  u64 server_rx_fifo;
  u64 server_tx_fifo;
  u64 client_event_queue_address;
  u64 vpp_event_queue_address;
  u32 segment_size;
  u8 segment_name_length;
  u8 segment_name[128];
};

/** \brief bidirectional disconnect API
    @param client_index - opaque cookie to identify the sender
                          client to vpp direction only
    @param context - sender context, to match reply w/ request
    @param handle - session handle obtained through accept/connect
*/
define disconnect_sock {
  u32 client_index;
  u32 context;
  u64 handle;
};

/** \brief bidirectional disconnect reply API
    @param client_index - opaque cookie to identify the sender
                          client to vpp direction only
    @param client_context - sender context, to match reply w/ request
    @param handle - session handle obtained through accept/connect
*/
define disconnect_sock_reply {
  u32 client_index;
  u32 context;
  i32 retval;
  u64 handle;
};

/** \brief vpp->client, accept this session
    @param context - sender context, to match reply w/ request
    @param accept_cookie - tells client which bind flavor just occurred
    @param handle - session handle obtained through accept/connect
    @param rx_fifo_address - rx (vpp -> vpp-client) fifo address 
    @param tx_fifo_address - tx (vpp-client -> vpp) fifo address 
    @param vpp_event_queue_address - vpp's event queue address
*/
define accept_sock {
  u32 client_index;
  u32 context;
  u32 accept_cookie;
  u64 handle;
  u64 server_rx_fifo;
  u64 server_tx_fifo;
  u64 vpp_event_queue_address;
};

/** \brief client->vpp, reply to an accept message
    @param context - sender context, to match reply w/ request
    @param retval - return code for the request
    @param handle - session handle obtained through accept/connect
*/
define accept_sock_reply {
  u32 context;
  i32 retval;
  u64 handle;
};

/** \brief vpp->client reset session API
    @param client_index - opaque cookie to identify the sender
                          client to vpp direction only
    @param context - sender context, to match reply w/ request
    @param handle - session handle obtained through accept/connect
*/
define reset_sock {
  u32 client_index;
  u32 context;
  u64 handle;
};

/** \brief client->vpp reset session reply
    @param client_index - opaque cookie to identify the sender
                          client to vpp direction only
    @param context - sender context, to match reply w/ request
    @param handle - session handle obtained through accept/connect
*/
define reset_sock_reply {
  u32 client_index;
  u32 context;
  i32 retval;
  u64 handle;
};

/** \brief enable/disable session layer
    @param client_index - opaque cookie to identify the sender
                          client to vpp direction only
    @param context - sender context, to match reply w/ request
    @param is_enable - disable session layer if 0, enable otherwise
*/
define session_enable_disable {
  u32 client_index;
  u32 context;
  u8 is_enable;
};

/** \brief Reply for session enable/disable
    @param context - returned sender context, to match reply w/ request
    @param retval - return code
*/
define session_enable_disable_reply {
  u32 context;
  i32 retval;
};

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