/*
 * 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.2.0";

/** \brief client->vpp, attach application to session layer
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param initial_segment_size - size of the initial shm segment to be 
    							  allocated
    @param options - segment size, fifo sizes, etc.
    @param namespace_id_len - length of the namespace id c-string
    @param namespace_id - 0 terminted c-string
*/
 define application_attach {
    u32 client_index;
    u32 context;
    u32 initial_segment_size;
    u64 options[16];
    u8 namespace_id_len;
    u8 namespace_id [64];
 };
 
 /** \brief Application attach reply
    @param context - sender context, to match reply w/ request
    @param retval - return code for the request
    @param app_event_queue_address - vpp event queue address or 0 if this 
                                 	 connection shouldn't send events
    @param n_fds - number of fds exchanged
    @param fd_flags - set of flags that indicate which fds are to be expected
    				  over the socket (set only if socket transport available) 
    @param segment_size - size of first shm segment
    @param segment_name_length - length of segment name 
    @param segment_name - name of segment client needs to attach to
*/
define application_attach_reply {
    u32 context;
    i32 retval;
    u64 app_event_queue_address;
    u8 n_fds;
    u8 fd_flags;
    u32 segment_size;
    u8 segment_name_length;
    u8 segment_name[128];
};

/** \brief Application add TLS certificate
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param cert_len - certificate length
    @param cert - certificate as a string
*/
autoreply define application_tls_cert_add {
    u32 client_index;
    u32 context;
    u32 app_index;
    u16 cert_len;
    u8 cert[cert_len];
};

/** \brief Application add TLS key
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param key_len - certificate length
    @param key - PEM encoded key as a string
*/
autoreply define application_tls_key_add {
    u32 client_index;
    u32 context;
    u32 app_index;
    u16 key_len;
    u8 key[key_len];
};

 /** \brief client->vpp, attach application to session layer
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
autoreply define application_detach {
    u32 client_index;
    u32 context;
 };
 
/** \brief vpp->client, please map an additional shared memory segment
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
   	@param fd_flags - set of flags that indicate which, if any, fds are 
   					  to be expected over the socket. This is set only if 
   					  socket transport available
    @param segment_size - size of the segment to be mapped
    @param segment_name - name of the segment to be mapped
*/
autoreply define map_another_segment {
    u32 client_index;
    u32 context;
    u8 fd_flags;
    u32 segment_size;
    u8 segment_name[128];
};

/** \brief vpp->client unmap shared memory segment
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param segment_name - 
*/
autoreply define unmap_segment {
    u32 client_index;
    u32 context;
    u8 segment_name[128];
};

 /** \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;
  u8 uri[128];
};

define bind_uri_reply {
  u32 context;
  u64 handle;
  i32 retval;
  u64 rx_fifo;
  u64 tx_fifo;
  u8 lcl_is_ip4;
  u8 lcl_ip[16];
  u16 lcl_port;
  u64 vpp_evt_q;
};

/** \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.
*/
autoreply 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 client_queue_address - binary API client queue address. Used by 
    							  local server when connect was redirected.
    @param options - socket options, fifo sizes, etc. passed by vpp to the
    				 server when redirecting connects 
    @param uri - a URI, e.g. "tcp4://0.0.0.0/0/80"
                 "tcp6://::/0/80" [ipv6], etc.
*/
autoreply define connect_uri {
  u32 client_index;
  u32 context;
  u64 client_queue_address;
  u64 options[16];
  u8 uri[128];
};

/** \brief vpp->client, accept this session
    @param context - sender context, to match reply w/ request
    @param listener_handle - tells client which listener this pertains to
    @param handle - unique session identifier
    @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 or client's
    									event queue for cut through
    @param server_event_queue_address - server's event queue address for
    									   cut through sessions
    @param port - remote port
    @param is_ip4 - 1 if the ip is ip4
    @param ip - remote ip
*/
define accept_session {
  u32 client_index;
  u32 context;
  u64 listener_handle;
  u64 handle; 
  u64 server_rx_fifo;
  u64 server_tx_fifo;
  u64 vpp_event_queue_address;
  u64 server_event_queue_address;
  u16 port;
  u8 is_ip4;
  u8 ip[16];
};

/** \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;
  u64 handle;
};

/** \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 from accept/connect
*/
define disconnect_session {
  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 context - sender context, to match reply w/ request
    @param retval - return code for the request
    @param handle - session handle
*/
define disconnect_session_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 via accept/connects
*/
define reset_session {
  u32 client_index;
  u32 context;
  u64 handle;
};

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

/** \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 wrk_index - index of worker requesting the bind
    @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 wrk_index;
  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
*/
autoreply 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 wrk_index - worker that requests the connect
    @param client_queue_address - client's API queue address. Non-zero when 
                                  used to perform redirects
    @param options - socket options, fifo sizes, etc. when doing redirects
    @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 hostname-len - length of hostname
    @param hostname - destination's hostname. If present, used by protocols
					  like tls.
*/
autoreply define connect_sock {
  u32 client_index;
  u32 context;
  u32 wrk_index;
  u64 client_queue_address;
  u64 options[16];
  u32 vrf;
  u8 is_ip4;
  u8 ip[16];
  u16 port;
  u8 proto;
  u8 hostname_len;
  u8 hostname[hostname_len];
};

/** \brief Bind reply
    @param context - sender context, to match reply w/ request
    @param handle - bind handle
    @param retval - return code for the request
    @param lcl_is_ip4 - local ip address type
    @param lcl_ip6 - local ip address
    @param lcl_port - local port
    @param rx_fifo - rx fifo address if allocated (connectionless)
    @param tx_fifo - tx fifo address if allocated (connectionless) 
    @param vpp_evt_q - vpp event queue address (connectionless)
    @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;
  u8 lcl_is_ip4;
  u8 lcl_ip[16];
  u16 lcl_port;
  u64 rx_fifo;
  u64 tx_fifo;
  u64 vpp_evt_q;
  u32 segment_size;
  u8 segment_name_length;
  u8 segment_name[128];
};

/* Dummy connect message -- needed to satisfy api generators
*
*  NEVER USED, doxygen tags elided on purpose.
*/
define connect_session {
  u32 client_index;
  u32 context;
};

/** \brief vpp/server->client, connect reply -- used for all connect_* messages
    @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_size - size of segment to be attached. Only for redirects.
    @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
    @param lcl_ip - local ip for connection
    @param is_ip4 - flag to indicate if ip is v4 or v6
    @param lcl_port - local port
*/
define connect_session_reply {
  u32 context;
  i32 retval;
  u64 handle;
  u64 server_rx_fifo;
  u64 server_tx_fifo;
  u64 vpp_event_queue_address;
  u64 client_event_queue_address;
  u32 segment_size;
  u8 segment_name_length;
  u8 segment_name[128];
  u8 lcl_ip[16];
  u8 is_ip4;
  u16 lcl_port;
};

/** \brief ask app to add a new cut-through registration
    @param client_index - opaque cookie to identify the sender
                          client to vpp direction only
    @param context - sender context, to match reply w/ request
    @param evt_q_address - address of the mq in ssvm segment
    @param peer_evt_q_address - address of peer's mq in ssvm segment
    @param wrk_index - index of worker to receive the registration
    @param n_fds - number of fds exchanged
    @param fd_flags - flag indicating the fds that will be exchanged over
    				  api socket
*/
autoreply define app_cut_through_registration_add
{
  u32 client_index;
  u32 context;
  u64 evt_q_address;
  u64 peer_evt_q_address;
  u32 wrk_index;
  u8 n_fds;
  u8 fd_flags;
};

/** \brief add/del application worker
    @param client_index - opaque cookie to identify the sender
                          client to vpp direction only
    @param context - sender context, to match reply w/ request
    @param app_api_index - explicit client api index
    @param wrk_index - worker index, if a delete
    @param is_add - set if an add
*/
define app_worker_add_del
{
  u32 client_index;
  u32 context;
  u32 app_api_index;
  u32 wrk_index;
  u8 is_add;
};

/** \brief Reply for app worker add/del
    @param context - returned sender context, to match reply w/ request
    @param retval - return code
    @param wrk_index - worker index, if add
    @param app_event_queue_address - vpp event queue address of new worker
    @param n_fds - number of fds exchanged
    @param fd_flags - set of flags that indicate which fds are to be expected
    				  over the socket (set only if socket transport available) 
    @param segment_name_length - length of segment name 
    @param segment_name - name of segment client needs to attach to
*/
define app_worker_add_del_reply
{
  u32 context;
  i32 retval;
  u32 wrk_index;
  u64 app_event_queue_address;
  u8 n_fds;
  u8 fd_flags;
  u8 segment_name_length;
  u8 segment_name[128];
  u8 is_add;
};

/** \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
*/
autoreply define session_enable_disable {
  u32 client_index;
  u32 context;
  u8 is_enable;
};

/** \brief add/del application namespace
    @param client_index - opaque cookie to identify the sender
                          client to vpp direction only
    @param context - sender context, to match reply w/ request
    @param secret - secret shared between app and vpp 
    @param sw_if_index - local interface that "supports" namespace. Set to
    						~0 if no preference
    @param ip4_fib_id - id of ip4 fib that "supports" the namespace. Ignored 
    						if sw_if_index set.
    @param ip6_fib_id - id of ip6 fib that "supports" the namespace. Ignored 
    						if sw_if_index set.
    @param namespace_id_len - length of namespace id lower
    @param namespace_id - namespace id
*/
define app_namespace_add_del {
  u32 client_index;
  u32 context;
  u64 secret;
  u32 sw_if_index;
  u32 ip4_fib_id;
  u32 ip6_fib_id;
  u8 namespace_id_len;
  u8 namespace_id[64];
};

/** \brief Reply for app namespace add/del
    @param context - returned sender context, to match reply w/ request
    @param retval - return code
    @param appns_index - app namespace index
*/
define app_namespace_add_del_reply
{
  u32 context;
  i32 retval;
  u32 appns_index;
};

/** \brief add/del session rule
    @param client_index - opaque cookie to identify the sender
                          client to vpp direction only
    @param context - sender context, to match reply w/ request
    @param transport_proto - transport protocol (0 - tcp 1 - udp)
    @param is_ip4 - flag to indicate if ip addresses are ip4 or 6
    @param lcl_ip - local ip
    @param lcl_plen - local prefix length
    @param rmt_ip - remote ip
    @param rmt_ple - remote prefix length
    @param lcl_port - local port
    @param rmt_port - remote port
    @param action_index - the only action defined now is forward to 
    						  application with index action_index
    	@param is_add - flag to indicate if add or del
    	@param appns_index - application namespace where rule is to be applied
    						 to
    	@param scope - flag that indicates scope of the rule: global or local.
    				   If 0, default is global, 1 is global 2 is local, 3 is
    				   both
*/
autoreply define session_rule_add_del {
  u32 client_index;
  u32 context;
  u8 transport_proto;
  u8 is_ip4;
  u8 lcl_ip[16];
  u8 lcl_plen;
  u8 rmt_ip[16];
  u8 rmt_plen;
  u16 lcl_port;
  u16 rmt_port;
  u32 action_index;
  u8 is_add;
  u32 appns_index;
  u8 scope;
  u8 tag[64];
};

/** \brief Dump session rules
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
 */
define session_rules_dump
{
  u32 client_index;
  u32 context;
};

/** \brief Session rules details
	@param context - sender context, to match reply w/ request
    @param transport_proto - transport protocol (0 - tcp 1 - udp)
    @param is_ip4 - flag to indicate if ip addresses are ip4 or 6
    @param lcl_ip - local ip
    @param lcl_plen - local prefix length
    @param rmt_ip - remote ip
    @param rmt_ple - remote prefix length
    @param lcl_port - local port
    @param rmt_port - remote port
    @param action_index - the only action defined now is forward to
    						  application with index action_index
    	@param appns_index - application namespace where rule is to be applied
    						 to
    	@param scope - flag that indicates scope of the rule: global or local.
    				   If 0, default is global, 1 is global 2 is local, 3 is
    				   both
  */
define session_rules_details
{
  u32 context;
  u8 transport_proto;
  u8 is_ip4;
  u8 lcl_ip[16];
  u8 lcl_plen;
  u8 rmt_ip[16];
  u8 rmt_plen;
  u16 lcl_port;
  u16 rmt_port;
  u32 action_index;
  u32 appns_index;
  u8 scope;
  u8 tag[64];
};

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