route-manager.h

Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  * This code is provided as is by Juniper Networks SDK Developer Support.
00005  * It is provided with no warranties or guarantees, and Juniper Networks
00006  * will not provide support or maintenance of this code in any fashion.
00007  * The code is provided only to help a developer better understand how
00008  * the SDK can be used.
00009  * 
00010  * Copyright (c) 2010, Juniper Networks, Inc.
00011  * All rights reserved.
00012  */
00013  
00021 #ifndef __ROUTE_MANAGER_H__
00022 #define __ROUTE_MANAGER_H__
00023 
00025 #define RM_NAME_SIZE                64
00026 
00028 #define RM_NH_MAX                   64
00029 
00031 #define RM_BLOB_ID_CLIENT_ID        1
00032 
00034 #define RM_RT_PREFERENCE_DEFAULT    3
00035 
00037 typedef enum {
00038     RT_STATE_ADD_PENDING = 1,
00039     RT_STATE_ADD_OK,
00040     RT_STATE_ADD_ERR,
00041     RT_STATE_DEL_PENDING,
00042     RT_STATE_DEL_OK,
00043     RT_STATE_DEL_ERR
00044 } route_op_state_e;
00045 
00047 typedef enum {
00048     NH_STATE_FREE = 0,
00049     NH_STATE_ADD_PENDING,
00050     NH_STATE_ADD_OK,
00051     NH_STATE_ADD_ERR,
00052     NH_STATE_DEL_PENDING,
00053     NH_STATE_DEL_OK,
00054     NH_STATE_DEL_ERR
00055 } nh_op_state_e;
00056 
00058 #define RM_TRACE(_msg_type, _fmt, ...) \
00059     junos_trace((_msg_type), _fmt, ##__VA_ARGS__)
00060 
00062 #define RM_LOG(_level, _fmt, ...)   \
00063         ERRMSG(ROUTE_MANAGER, (_level), _fmt, ##__VA_ARGS__)
00064 
00066 typedef struct route_s {
00067     LIST_ENTRY(route_s)     entry;      
00068     ssd_sockaddr_un         dst_addr;   
00069     uint16_t                prefix_len; 
00070     int                     rtt_id;     
00071     uint32_t                preference; 
00072     uint16_t                state;      
00073     uint16_t                flag;       
00074     uint8_t                 nh_type;    
00075     uint8_t                 gw_num;     
00076     ssd_sockaddr_un         gw_addr[SSD_ROUTE_N_MULTIPATH];
00078     ssd_sockaddr_un         gw_ifl_addr[SSD_ROUTE_N_MULTIPATH];
00080     char                    gw_ifl_name[SSD_ROUTE_N_MULTIPATH][RM_NAME_SIZE];
00082     int                     gw_ifl_idx; 
00083     int                     nh_id[SSD_ROUTE_N_MULTIPATH];
00085     int                     ctx_id;     
00086     route_op_state_e        op_state;   
00087 } route_t;
00088 
00090 typedef struct {
00091     char              name[RM_NAME_SIZE];  
00092     int               idx;        
00093     int               id;         
00094     int               count;      
00095     nh_op_state_e     op_state;   
00096 } nh_t;
00097 
00098 int config_init(void);
00099 void config_clear(void);
00100 int config_read(int check);
00101 void config_rt_proc(route_t *rt);
00102 int config_rt_add(route_t *rt);
00103 int config_rt_del(route_t *rt);
00104 int kcom_init(evContext ev_ctx);
00105 void kcom_close(void);
00106 int kcom_client_id_save(int id);
00107 int kcom_client_id_restore(void);
00108 int kcom_ifl_get_idx_by_name(char *name);
00109 int ssd_open(evContext ev_ctx);
00110 void ssd_close(void);
00111 int ssd_nh_del(route_t *rt, int nh_id);
00112 int ssd_nh_add(route_t *rt, int nh_id);
00113 int ssd_rt_add(route_t *rt);
00114 int ssd_rt_del(route_t *rt);
00115 
00116 #endif
00117 

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