/*
 * 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 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.
*/
 define application_attach {
    u32 client_index;
    u32 context;
    u32 initial_segment_size;
    u64 options[16];
 };
 
 /** \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 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 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 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. passed by vpp to the
    				 server when redirecting connects 
    @param client_queue_address - binary API client queue address. Used by 
    							  local server when connect was redirected.
*/
define connect_uri {
  u32 client_index;
  u32 context;
  u8 uri[128];
  u64 client_queue_address;
  u64 options[16];
};

/** \brief vpp->client, connect reply
    @param context - sender context, to match reply w/ request
    @param retval - return code for the request
    @param handle - session 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 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. This should only happen 
                                 if session was redirected.
    @param segment_name - set if the client needs to attach to the segment
*/
define connect_uri_reply {
  u32 context;
  i32 retval;
  u64 handle;
  u64 server_rx_fifo;
  u64 server_tx_fifo;
  u64 vpp_event_queue_address;
  u32 segment_size;
  u8 segment_name_length;
  u8 segment_name[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 session_thread_index - thread index of new session
    @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
    @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;
  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 client_index;
  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 app_connect - application connection id to be returned in reply
    @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. when doing redirects
*/
define connect_sock {
  u32 client_index;
  u32 context;
  u32 app_connect;
  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 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 app_connect - application connection id from connect msg
    @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 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
*/
define connect_sock_reply {
  u32 context;
  i32 retval;
  u64 handle;
  u32 app_connect;
  u64 server_rx_fifo;
  u64 server_tx_fifo;
  u64 vpp_event_queue_address;
  u32 segment_size;
  u8 segment_name_length;
  u8 segment_name[128];
};

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

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