#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 |
These functions manage the connection to SSD and make all types of routing requests.
Definition in file route-manager_ssd.c.
static void ssd_client_conn_close | ( | int fd | UNUSED, | |
int | cause | |||
) | [static] |
The callback when SSD connection is closed.
[in] | fd | Socket FD to SSD |
Definition at line 77 of file route-manager_ssd.c.
static int ssd_client_conn_open | ( | int | fd | ) | [static] |
The callback when SSD connection is open.
[in] | fd | Socket FD to SSD |
Definition at line 59 of file route-manager_ssd.c.
static void ssd_client_msg_hdlr | ( | int fd | UNUSED, | |
struct ssd_ipc_msg * | msg | |||
) | [static] |
The callback to handle reply messages.
[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.
[in] | rt | Pointer to route |
[in] | nh_id | Next-hop ID assigned by the client |
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.
[in] | rt | Pointer to route |
[in] | nh_id | Next-hop ID assigned by the client |
Definition at line 397 of file route-manager_ssd.c.
int ssd_open | ( | evContext | ev_ctx | ) |
Initialize SSD connection.
[in] | ev_ctx | Event context |
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.
[in] | rt | Pointer to route |
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.
[in] | rt | Pointer to route |
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().
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().