route-manager_config.c File Reference

Relating to loading and storing the configuration data. More...

#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <isc/eventlib.h>
#include <arpa/inet.h>
#include <jnx/trace.h>
#include <jnx/junos_trace.h>
#include <jnx/ssd_ipc_msg.h>
#include <jnx/parse_ip.h>
#include <ddl/ddl.h>
#include <ddl/dax.h>
#include "route-manager.h"

Go to the source code of this file.

Functions

static LIST_HEAD (route_s)
static int config_nh_id_get (char *name)
 Get next-hop ID by name, if it doesn't exist, allocate one.
static int config_rt_read (dax_walk_data_t *dwd, ddl_handle_t *dop, int action, void *data UNUSED)
 Handler of dax_walk_list to read routes.
static int config_nh_add (route_t *rt)
 Add next-hop.
static int config_nh_del (route_t *rt)
 Delete the next-hop.
int config_rt_del (route_t *rt)
 Delete the route.
int config_rt_add (route_t *rt)
 Add the route.
void config_rt_proc (route_t *rt)
 Walk through all routes and process them according to the state.
int config_read (int check)
 Read configuration from the database.
void config_clear (void)
 Clear local configuration.
int config_init (void)
 Initialize configuration.

Variables

bool svc_ready
nh_t nh_pool [RM_NH_MAX]


Detailed Description

Relating to loading and storing the configuration data.

These functions parse and load the configuration data.

Definition in file route-manager_config.c.


Function Documentation

int config_init ( void   ) 

Initialize configuration.

Returns:
0 on success, -1 on failure
Note:
Do not use ERRMSG during config check normally.

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

References nh_pool.

Referenced by main_init().

static int config_nh_add ( route_t rt  )  [static]

Add next-hop.

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

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

References route_s::gw_num, nh_t::name, route_s::nh_id, nh_pool, nh_t::op_state, RM_TRACE, and ssd_nh_add().

Referenced by config_rt_add().

static int config_nh_del ( route_t rt  )  [static]

Delete the next-hop.

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

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

References nh_t::count, route_s::gw_num, route_s::nh_id, and nh_pool.

Referenced by config_rt_del().

static int config_nh_id_get ( char *  name  )  [static]

Get next-hop ID by name, if it doesn't exist, allocate one.

Parameters:
[in] name Next-hop IFL name
Returns:
Next-hop ID (> 0) on success, -1 on failure

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

References nh_pool, nh_t::op_state, and RM_NH_MAX.

Referenced by config_rt_read().

int config_read ( int  check  ) 

Read configuration from the database.

Parameters:
[in] check 1 if this function being invoked because of a commit check
Returns:
0 on success, -1 on failure
Note:
Do not use ERRMSG during config check normally.

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

References config_rt_proc(), config_rt_read(), RM_TRACE, and svc_ready.

Referenced by main().

int config_rt_add ( route_t rt  ) 

Add the route.

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

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

References config_nh_add(), route_s::ctx_id, route_s::dst_addr, nh_t::idx, nh_t::name, nh_pool, route_s::op_state, RM_LOG, RM_TRACE, route_s::rtt_id, ssd_nh_add(), and ssd_rt_add().

Referenced by config_rt_proc().

int config_rt_del ( route_t rt  ) 

Delete the route.

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

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

References config_nh_del(), route_s::ctx_id, route_s::op_state, and ssd_rt_del().

Referenced by config_rt_proc().

static int config_rt_read ( dax_walk_data_t *  dwd,
ddl_handle_t *  dop,
int  action,
void *data  UNUSED 
) [static]

Handler of dax_walk_list to read routes.

Parameters:
[in] dwd Opaque dax data
[in] dop DAX Object Pointer
[in] action The action on the given object
[in] data User data passed to handler
Returns:
DAX_WALK_OK on success, DAX_WALK_ABORT on failure

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

References config_nh_id_get(), route_s::op_state, RM_LOG, RM_NAME_SIZE, RM_RT_PREFERENCE_DEFAULT, and RM_TRACE.

Referenced by config_read().

static LIST_HEAD ( route_s   )  [static]

The list head of routes.

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

References route_s::dst_addr, and route_s::prefix_len.


Variable Documentation

nh_t nh_pool[RM_NH_MAX]

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().

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