route-manager.h File Reference

Contains includes and definitions and prototypes. More...

Go to the source code of this file.

Data Structures

struct  route_s
struct  nh_t

Defines

#define RM_NAME_SIZE   64
#define RM_NH_MAX   64
#define RM_BLOB_ID_CLIENT_ID   1
#define RM_RT_PREFERENCE_DEFAULT   3
#define RM_TRACE(_msg_type, _fmt,...)   junos_trace((_msg_type), _fmt, ##__VA_ARGS__)
#define RM_LOG(_level, _fmt,...)   ERRMSG(ROUTE_MANAGER, (_level), _fmt, ##__VA_ARGS__)

Typedefs

typedef route_s route_t

Enumerations

enum  route_op_state_e {
  RT_STATE_ADD_PENDING = 1, RT_STATE_ADD_OK, RT_STATE_ADD_ERR, RT_STATE_DEL_PENDING,
  RT_STATE_DEL_OK, RT_STATE_DEL_ERR
}
enum  nh_op_state_e {
  NH_STATE_FREE = 0, NH_STATE_ADD_PENDING, NH_STATE_ADD_OK, NH_STATE_ADD_ERR,
  NH_STATE_DEL_PENDING, NH_STATE_DEL_OK, NH_STATE_DEL_ERR
}

Functions

int config_init (void)
 Initialize configuration.
void config_clear (void)
 Clear local configuration.
int config_read (int check)
 Read configuration from the database.
void config_rt_proc (route_t *rt)
 Walk through all routes and process them according to the state.
int config_rt_add (route_t *rt)
 Add the route.
int config_rt_del (route_t *rt)
 Delete the route.
int kcom_init (evContext ev_ctx)
 Initialize KCOM.
void kcom_close (void)
 Close KCOM.
int kcom_client_id_save (int id)
 Save SSD client ID as GENCFG blob.
int kcom_client_id_restore (void)
 Restore SSD client ID from GENCFG blob.
int kcom_ifl_get_idx_by_name (char *name)
 Get IFL index by IFL name.
int ssd_open (evContext ev_ctx)
 Initialize SSD connection.
void ssd_close (void)
 Close SSD connection.
int ssd_nh_del (route_t *rt, int nh_id)
 Setup parameters and call SSD API to delete next-hop.
int ssd_nh_add (route_t *rt, int nh_id)
 Setup parameters and call SSD API to add next-hop.
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.


Detailed Description

Contains includes and definitions and prototypes.

Definition in file route-manager.h.


Define Documentation

#define RM_BLOB_ID_CLIENT_ID   1

The blob ID for SSD client ID.

Definition at line 31 of file route-manager.h.

Referenced by kcom_client_id_restore(), and kcom_client_id_save().

#define RM_LOG ( _level,
_fmt,
...   )     ERRMSG(ROUTE_MANAGER, (_level), _fmt, ##__VA_ARGS__)

The macro to log syslog message.

Definition at line 62 of file route-manager.h.

Referenced by config_rt_add(), config_rt_proc(), config_rt_read(), kcom_client_id_restore(), kcom_client_id_save(), kcom_init(), ssd_client_msg_hdlr(), and ssd_nh_add().

#define RM_NAME_SIZE   64

The maximum length of name string.

Definition at line 25 of file route-manager.h.

Referenced by config_rt_read().

#define RM_NH_MAX   64

The maximum number of next-hops.

Definition at line 28 of file route-manager.h.

Referenced by config_nh_id_get().

#define RM_RT_PREFERENCE_DEFAULT   3

Default route preference count.

Definition at line 34 of file route-manager.h.

Referenced by config_rt_read().

#define RM_TRACE ( _msg_type,
_fmt,
...   )     junos_trace((_msg_type), _fmt, ##__VA_ARGS__)

The macro to log tracing message.

Definition at line 58 of file route-manager.h.

Referenced by config_nh_add(), config_read(), config_rt_add(), config_rt_proc(), config_rt_read(), kcom_client_id_restore(), kcom_client_id_save(), main_exit(), main_init(), ssd_client_conn_close(), ssd_client_conn_open(), ssd_client_msg_hdlr(), and ssd_nh_add().


Typedef Documentation

typedef struct route_s route_t

Route


Enumeration Type Documentation

enum nh_op_state_e

The next-hop state

Definition at line 47 of file route-manager.h.

enum route_op_state_e

The route state

Definition at line 37 of file route-manager.h.


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

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

int kcom_client_id_restore ( void   ) 

Restore SSD client ID from GENCFG blob.

Returns:
Client ID on success, -1 on failure

Definition at line 106 of file route-manager_kcom.c.

References RM_BLOB_ID_CLIENT_ID, RM_LOG, and RM_TRACE.

Referenced by ssd_open().

int kcom_client_id_save ( int  id  ) 

Save SSD client ID as GENCFG blob.

Parameters:
[in] id SSD client ID
Returns:
0 on success, -1 on failure

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

References RM_BLOB_ID_CLIENT_ID, RM_LOG, and RM_TRACE.

Referenced by ssd_client_msg_hdlr().

int kcom_ifl_get_idx_by_name ( char *  name  ) 

Get IFL index by IFL name.

Parameters:
[in] name IFL name
Returns:
IFL index on success, -1 on failure

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

Referenced by ssd_nh_add().

int kcom_init ( evContext  ev_ctx  ) 

Initialize KCOM.

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

Definition at line 178 of file route-manager_kcom.c.

References kcom_gencfg_async_hdlr(), and RM_LOG.

Referenced by main_init().

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


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