route-manager_ssd.c File Reference

Relating to libssd API. More...

#include <stdbool.h>
#include <string.h>
#include <strings.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <isc/eventlib.h>
#include <jnx/aux_types.h>
#include <jnx/junos_trace.h>
#include <jnx/ssd_ipc.h>
#include <jnx/ssd_ipc_msg.h>
#include "route-manager.h"

Go to the source code of this file.

Functions

static int ssd_client_conn_open (int fd)
 The callback when SSD connection is open.
static void ssd_client_conn_close (int fd UNUSED, int cause)
 The callback when SSD connection is closed.
static void ssd_client_msg_hdlr (int fd UNUSED, struct ssd_ipc_msg *msg)
 The callback to handle reply messages.
int ssd_rt_add (route_t *rt)
 Setup parameters and call SSD API to add route.
int ssd_rt_del (route_t *rt)
 Setup parameters and call SSD API to delete route.
int ssd_nh_add (route_t *rt, int nh_id)
 Setup parameters and call SSD API to add next-hop.
int ssd_nh_del (route_t *rt, int nh_id)
 Setup parameters and call SSD API to delete next-hop.
void ssd_close (void)
 Close SSD connection.
int ssd_open (evContext ev_ctx)
 Initialize SSD connection.

Variables

nh_t nh_pool []
bool svc_ready
static int ssd_fd
static int client_id
static struct ssd_ipc_ft ssd_client_cbs


Detailed Description

Relating to libssd API.

These functions manage the connection to SSD and make all types of routing requests.

Definition in file route-manager_ssd.c.


Function Documentation

static void ssd_client_conn_close ( int fd  UNUSED,
int  cause 
) [static]

The callback when SSD connection is closed.

Parameters:
[in] fd Socket FD to SSD

Definition at line 77 of file route-manager_ssd.c.

References RM_TRACE, and ssd_fd.

static int ssd_client_conn_open ( int  fd  )  [static]

The callback when SSD connection is open.

Parameters:
[in] fd Socket FD to SSD
Returns:
0 on success, -1 on failure

Definition at line 59 of file route-manager_ssd.c.

References client_id, RM_TRACE, and ssd_fd.

static void ssd_client_msg_hdlr ( int fd  UNUSED,
struct ssd_ipc_msg *  msg 
) [static]

The callback to handle reply messages.

Parameters:
[in] fd Socket FD to SSD
[in] msg Pointer to the message

Definition at line 93 of file route-manager_ssd.c.

References client_id, config_rt_proc(), route_s::ctx_id, route_s::dst_addr, nh_t::idx, kcom_client_id_save(), nh_t::name, nh_pool, route_s::op_state, nh_t::op_state, RM_LOG, RM_TRACE, and svc_ready.

int ssd_nh_add ( route_t rt,
int  nh_id 
)

Setup parameters and call SSD API to add next-hop.

Parameters:
[in] rt Pointer to route
[in] nh_id Next-hop ID assigned by the client
Returns:
0 on success, -1 on failure

Definition at line 343 of file route-manager_ssd.c.

References kcom_ifl_get_idx_by_name(), nh_pool, route_s::nh_type, RM_LOG, RM_TRACE, route_s::rtt_id, and ssd_fd.

Referenced by config_nh_add(), and config_rt_add().

int ssd_nh_del ( route_t rt,
int  nh_id 
)

Setup parameters and call SSD API to delete next-hop.

Parameters:
[in] rt Pointer to route
[in] nh_id Next-hop ID assigned by the client
Returns:
0 on success, -1 on failure

Definition at line 397 of file route-manager_ssd.c.

References nh_pool, and ssd_fd.

int ssd_open ( evContext  ev_ctx  ) 

Initialize SSD connection.

Parameters:
[in] ev_ctx Event context
Returns:
0 on success, -1 on failure

Definition at line 434 of file route-manager_ssd.c.

References client_id, kcom_client_id_restore(), ssd_client_cbs, ssd_fd, and svc_ready.

Referenced by main_init().

int ssd_rt_add ( route_t rt  ) 

Setup parameters and call SSD API to add route.

Parameters:
[in] rt Pointer to route
Returns:
0 on success, -1 on failure

Definition at line 260 of file route-manager_ssd.c.

References route_s::dst_addr, route_s::flag, route_s::gw_addr, route_s::gw_ifl_addr, route_s::gw_num, nh_t::idx, nh_pool, route_s::nh_type, route_s::op_state, route_s::preference, route_s::prefix_len, and route_s::rtt_id.

Referenced by config_rt_add().

int ssd_rt_del ( route_t rt  ) 

Setup parameters and call SSD API to delete route.

Parameters:
[in] rt Pointer to route
Returns:
0 on success, -1 on failure

Definition at line 314 of file route-manager_ssd.c.

References route_s::dst_addr, nh_t::idx, nh_pool, route_s::prefix_len, route_s::rtt_id, and ssd_fd.

Referenced by config_rt_del().


Variable Documentation

nh_t nh_pool[]

Next-hop pool.

Definition at line 42 of file route-manager_config.c.

Referenced by config_init(), config_nh_add(), config_nh_del(), config_nh_id_get(), config_rt_add(), config_rt_proc(), ssd_client_msg_hdlr(), ssd_nh_add(), ssd_nh_del(), ssd_rt_add(), and ssd_rt_del().

struct ssd_ipc_ft ssd_client_cbs [static]

Initial value:

SSD client callbacks.

Definition at line 243 of file route-manager_ssd.c.

Referenced by ssd_open().

int ssd_fd [static]

SSD connection FD.

Definition at line 43 of file route-manager_ssd.c.

Referenced by ssd_client_conn_close(), ssd_client_conn_open(), ssd_close(), ssd_nh_add(), ssd_nh_del(), ssd_open(), and ssd_rt_del().

bool svc_ready

Service ready flag.

Definition at line 40 of file route-manager_ssd.c.

Referenced by config_read(), ssd_client_msg_hdlr(), ssd_close(), and ssd_open().


2007-2009 Juniper Networks, Inc. All rights reserved. The information contained herein is confidential information of Juniper Networks, Inc., and may not be used, disclosed, distributed, modified, or copied without the prior written consent of Juniper Networks, Inc. in an express license. This information is subject to change by Juniper Networks, Inc. Juniper Networks, the Juniper Networks logo, and JUNOS are registered trademarks of Juniper Networks, Inc. in the United States and other countries. All other trademarks, service marks, registered trademarks, or registered service marks are the property of their respective owners.
Generated on Sun May 30 20:27:07 2010 for SDK Your Net Corporation Route Manager: route-manager 1.0 by Doxygen 1.5.1