/*
 * Copyright (c) 2015-2019 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.6.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
    @param app_index - index of the newly created app
    @param segment_handle - handle for segment
*/
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];
    u32 app_index;
    u64 segment_handle;
};

/** \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
    @param segment_handle - unique identifier for segment
*/
autoreply define map_another_segment {
    u32 client_index;
    u32 context;
    u8 fd_flags;
    u32 segment_size;
    u8 segment_name[128];
    u64 segment_handle;
};

/** \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 - segment name
    @param segment_handle - handle of the segment to be unmapped 
*/
autoreply define unmap_segment {
    u32 client_index;
    u32 context;
    u64 segment_handle;
};

 /** \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 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 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.
*/
autoreply 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 wrk_index - index of worker requesting the bind
    @param handle - bind handle obtained from bind reply
*/
autoreply define unbind_sock {
  u32 client_index;
  u32 context;
  u32 wrk_index;
  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.
    @param transport_opts - transport option (e.g. session id for quic).
*/
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];
  u64 transport_opts;
};

/** \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_index - application 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_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
    @param segment_handle - handle for segment
*/
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];
  u64 segment_handle;
  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:
 */
