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

/** \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 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;
    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 segment_name - 
*/
autoreply define map_another_segment {
    u32 client_index;
    u32 context;
    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.
*/
autoreply define bind_uri {
  u32 client_index;
  u32 context;
  u32 accept_cookie;
  u8 uri[128];
};

/** \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 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 obtained via accept/connect
*/
define reset_session_reply {
  u32 client_index;
  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 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
*/
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 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;
  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 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;
  u8 lcl_is_ip4;
  u8 lcl_ip[16];
  u16 lcl_port;
  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 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:
 */
