/*
 *------------------------------------------------------------------
 * api.h
 * 
 * Copyright (c) 2009 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.
 *------------------------------------------------------------------
 */

#ifndef included_vlibsocket_api_h
#define included_vlibsocket_api_h

#include <vlibapi/api.h>

typedef struct {
    /* Server port number */
    int portno;
    
    /* By default, localhost... */
    u32 bind_address;

    /*
     * (listen, server, client) registrations. Shared memory
     * registrations are in shared memory 
     */
    vl_api_registration_t *registration_pool;
    /*
     * Chain-drag variables, so message API handlers
     * (generally) don't know whether they're talking to a socket
     * or to a shared-memory connection.
     */
    vl_api_registration_t *current_rp;
    unix_file_t *current_uf;
    /* One input buffer, shared across all sockets */
    i8 *input_buffer;
} socket_main_t;

socket_main_t socket_main;

void socksvr_add_pending_output (struct unix_file * uf,
                                  struct vl_api_registration_ * cf,
                                  u8 * buffer, uword buffer_bytes);

#define SOCKSVR_DEFAULT_PORT 32741 /* whatever */

void vl_free_socket_registration_index (u32 pool_index);
void vl_socket_process_msg (struct unix_file *uf, 
                            struct vl_api_registration_ *rp, i8 *input_v);
clib_error_t * vl_socket_read_ready (struct unix_file * uf);
void vl_socket_add_pending_output (struct unix_file * uf,
                                   struct vl_api_registration_ * rp,
                                   u8 * buffer,
                                   uword buffer_bytes);
clib_error_t * vl_socket_write_ready (struct unix_file * uf);
void vl_socket_api_send (vl_api_registration_t *rp, u8 *elem) ;
void vl_socket_api_send_with_data (vl_api_registration_t *rp, 
                                   u8 *elem, u8 *data_vector);
void vl_socket_api_send_with_length (vl_api_registration_t *rp, 
                                     u8 *elem, u32 msg_length);
void vl_socket_api_send_with_length_no_free (vl_api_registration_t *rp, 
                                             u8 *elem, u32 msg_length);
u32 sockclnt_open_index (char *client_name, char *hostname, int port);
void sockclnt_close_index (u32 index);
void vl_client_msg_api_send (vl_api_registration_t *cm, u8 *elem);
vl_api_registration_t *sockclnt_get_registration (u32 index);
void socksvr_set_port (u16 port);
void socksvr_set_bind_address (u32 bind_address);

#endif /* included_vlibsocket_api_h */
