msp_fdb_api.h File Reference

API to access the forwarding database (fdb), which includes route entries, associated outgoing interfaces, SNMP index and other miscellaneous information. More...


Data Structures

struct  msp_fdb_rt_query_s
 msp_fdb_rt_query_s More...
struct  msp_fdb_rt_info_s
 msp_fdb_rt_info_t More...
struct  msp_fdb_snmp_info_s
 msp_fdb_snmp_info_t More...
struct  msp_fdb_vrf_info_s
 msp_fdb_vrf_info_t More...
struct  msp_fdb_ifl_info_s
 msp_fdb_ifl_info_s More...
struct  msp_fdb_as_info_s
 msp_fdb_as_info_s More...
struct  msp_fdb_stats_s
 msp_fdb_stats_s More...
struct  msp_fdb_cfg_info_s
 msp_fdb_cfg_info_t More...

Defines

#define MSP_FDB_MAX_VRF_INDEX   65535
 VRF index can vary from 0 to 65534.
#define MSP_FDB_MAX_SNMP_INDEX   65535
 SNMP index can vary from 0 to 65534.
#define MSP_FDB_MAX_IFL_INDEX   65535
 Logical interface index can vary from 0 to 65534.
#define MSP_FDB_MAX_DEST_ADDR_LEN   16
 Destination addresses of type IPv4 to IPv6.
#define MSP_FDB_RT_QUERY_KEY_IIF   0x0
 Route query using logical input interface on which packet was received.
#define MSP_FDB_RT_QUERY_KEY_RT_INDEX   0x01
 Route query where route table identifier is given.

Typedefs

typedef void * msp_fdb_handle_t
 msp_fdb_handle_t
typedef void * msp_fdb_attach_opt_t
 msp_fdb_attach_opt_t
typedef msp_fdb_rt_query_s msp_fdb_rt_query_t
 msp_fdb_rt_query_s
typedef msp_fdb_rt_info_s msp_fdb_rt_info_t
 msp_fdb_rt_info_t
typedef msp_fdb_snmp_info_s msp_fdb_snmp_info_t
 msp_fdb_snmp_info_t
typedef msp_fdb_vrf_info_s msp_fdb_vrf_info_t
 msp_fdb_vrf_info_t
typedef msp_fdb_ifl_info_s msp_fdb_ifl_info_t
 msp_fdb_ifl_info_s
typedef msp_fdb_as_info_s msp_fdb_as_info_t
 msp_fdb_as_info_s
typedef msp_fdb_stats_s msp_fdb_stats_t
 msp_fdb_stats_s
typedef msp_fdb_cfg_info_s msp_fdb_cfg_info_t
 msp_fdb_cfg_info_t
typedef msp_fdb_iter_res_t(* msp_fdb_route_handler_t )(msp_fdb_rt_info_t *route, void *ctxt)
 Type definition for a user function to invoke while iterating through all route records of a particular protocol in a VRF.
typedef msp_fdb_iter_res_t(* msp_fdb_as_rec_handler_t )(msp_fdb_as_info_t *as_info, void *ctxt)
 Type definition for user function to invoke while iterating through all autonomous system (AS) records in the forwarding database.
typedef msp_fdb_iter_res_t(* msp_fdb_ifl_handler_t )(msp_fdb_ifl_info_t *p_ifl, void *ctxt)
 Type definition for a user function to invoke while iterating through all logical interface records in the forwarding database.
typedef msp_fdb_iter_res_t(* msp_fdb_vrf_handler_t )(msp_fdb_vrf_info_t *vrf, void *ctxt)
 Type definition for a user function to invoke while iterating through all VRF records in the forwarding database.
typedef msp_fdb_iter_res_t(* msp_fdb_snmp_handler_t )(msp_fdb_snmp_info_t *snmp, void *ctxt)
 Type definition for a user function to invoke while iterating through all SNMP records in the forwarding database.

Enumerations

enum  msp_fdb_iter_res_t { msp_fdb_iter_continue = 0, msp_fdb_iter_stop, msp_fdb_iter_error }
 msp_fdb_iter_res_t Return values of iterator functions. More...

Functions

int msp_fdb_get_stats (msp_fdb_handle_t fdb_handle, msp_fdb_stats_t *fdb_stats)
 Return size of forwarding database statistics.
int msp_fdb_attach (void *opt, msp_fdb_handle_t *fdb_handle)
 Attaches an application to the forwarding database.
int msp_fdb_detach (msp_fdb_handle_t fdb_handle)
 Destroys Application-specific forwarding database context.
int msp_fdb_get_route_record (msp_fdb_handle_t fdb_handle, msp_fdb_rt_query_t *rt_query, msp_fdb_rt_info_t *rt_res)
 Performs a route lookup for a specific destination address.
int msp_fdb_get_snmp_index (msp_fdb_handle_t fdb_handle, u_int32_t ifl_index, u_int32_t *snmp_index)
 Gets the SNMP index for a given logical interface.
int msp_fdb_get_aspath (msp_fdb_handle_t fdb_handle, u_int32_t as_index, msp_fdb_as_info_t *as_info)
 Gets autonomous system (AS) path detail for a given AS index.
int msp_fdb_get_ifl_index (msp_fdb_handle_t fdb_handle, u_int32_t snmp_index, u_int32_t *ifl_index)
 Gets the logical interface index for a given SNMP index.
int msp_fdb_get_vrf_index (msp_fdb_handle_t fdb_handle, u_int32_t ifl_index, u_int32_t *rtt_index)
 Gets the route table index for a given logical interface index.
int msp_fdb_get_all_route_records_in_vrf (msp_fdb_handle_t fdb_handle, u_int32_t rtt_idx, u_int8_t proto_family, msp_fdb_route_handler_t user_func, void *ctxt)
 Iterator to get all route records of a VRF.
int msp_fdb_get_all_route_records (msp_fdb_handle_t fdb_handle, u_int8_t proto_family, msp_fdb_route_handler_t user_func, void *ctxt)
 Iterator to get all route records across all route tables available in the forwarding database.
int msp_fdb_get_all_as_records (msp_fdb_handle_t fdb_handle, msp_fdb_as_rec_handler_t user_func, void *ctxt)
 Iterator to get all AS records available in the forwarding database.
int msp_fdb_get_all_ifl_records (msp_fdb_handle_t fdb_handle, msp_fdb_ifl_handler_t user_func, void *ctxt)
 Iterator to get all IFL records available in the forwarding database.
int msp_fdb_get_all_vrf_records (msp_fdb_handle_t fdb_handle, msp_fdb_vrf_handler_t user_func, void *ctxt)
 Iterator to get all VRF records available in the forwarding database.
int msp_fdb_get_all_snmp_records (msp_fdb_handle_t fdb_handle, msp_fdb_snmp_handler_t user_func, void *ctxt)
 Iterator to get all SNMP records available in the forwarding database.
int msp_fdb_is_configured (void)
 Indicates whether or not the forwarding database has been configured.
int msp_fdb_get_configuration (msp_fdb_cfg_info_t *fdb_cfg_info)
 Returns configuration-related information, such as the size of the forwarding database.


Detailed Description

API to access the forwarding database (fdb), which includes route entries, associated outgoing interfaces, SNMP index and other miscellaneous information.

This file provide APIs to access the forwarding database (fdb) that is exported by the JUNOS Routing Engine. The forwarding database typically includes information related to route entries, the associated outgoing interfaces, autonomous system information, and other miscellaneous information that is added to the database over time.

These APIs provide read-only access to the forwarding database.

Note:
When using libmsp-svcs in conjunction with radix.h from the libjunos-sdk library in the same application, you must list ${LIBJUNIPER} before ${LIBMSP-SVCS} in the DPLIBS list.

Typedef Documentation

typedef struct msp_fdb_as_info_s msp_fdb_as_info_t
 

msp_fdb_as_info_s

Information related to an autonomous system (AS) record.

typedef msp_fdb_iter_res_t(* msp_fdb_as_rec_handler_t)(msp_fdb_as_info_t *as_info, void *ctxt)
 

Type definition for user function to invoke while iterating through all autonomous system (AS) records in the forwarding database.

See also:
msp_fdb_get_all_as_records

typedef void* msp_fdb_attach_opt_t
 

msp_fdb_attach_opt_t

This is a placeholder for options that might be passed to msp_fdb_attach() in future releases.

typedef struct msp_fdb_cfg_info_s msp_fdb_cfg_info_t
 

msp_fdb_cfg_info_t

Structure to return the forwarding database configuration detail.

typedef void* msp_fdb_handle_t
 

msp_fdb_handle_t

Opaque handle to the forwarding database. Most of the forwarding database APIs require this handle to maintain database-specific contexts.

typedef msp_fdb_iter_res_t(* msp_fdb_ifl_handler_t)(msp_fdb_ifl_info_t *p_ifl, void *ctxt)
 

Type definition for a user function to invoke while iterating through all logical interface records in the forwarding database.

See also:
msp_fdb_get_all_ifl_records

typedef struct msp_fdb_ifl_info_s msp_fdb_ifl_info_t
 

msp_fdb_ifl_info_s

Information related to an IFL record.

typedef msp_fdb_iter_res_t(* msp_fdb_route_handler_t)(msp_fdb_rt_info_t *route, void *ctxt)
 

Type definition for a user function to invoke while iterating through all route records of a particular protocol in a VRF.

See also:
msp_fdb_get_all_route_records_in_vrf

typedef struct msp_fdb_rt_info_s msp_fdb_rt_info_t
 

msp_fdb_rt_info_t

Result of a route query.

typedef struct msp_fdb_rt_query_s msp_fdb_rt_query_t
 

msp_fdb_rt_query_s

Input parameters for route query.

typedef msp_fdb_iter_res_t(* msp_fdb_snmp_handler_t)(msp_fdb_snmp_info_t *snmp, void *ctxt)
 

Type definition for a user function to invoke while iterating through all SNMP records in the forwarding database.

See also:
msp_fdb_get_all_snmp_records

typedef struct msp_fdb_snmp_info_s msp_fdb_snmp_info_t
 

msp_fdb_snmp_info_t

Information related to an SNMP record.

typedef struct msp_fdb_stats_s msp_fdb_stats_t
 

msp_fdb_stats_s

Various statistics related to the forwarding database.

typedef msp_fdb_iter_res_t(* msp_fdb_vrf_handler_t)(msp_fdb_vrf_info_t *vrf, void *ctxt)
 

Type definition for a user function to invoke while iterating through all VRF records in the forwarding database.

See also:
msp_fdb_get_all_vrf_records

typedef struct msp_fdb_vrf_info_s msp_fdb_vrf_info_t
 

msp_fdb_vrf_info_t

Summarized information related to a route table.


Enumeration Type Documentation

enum msp_fdb_iter_res_t
 

msp_fdb_iter_res_t Return values of iterator functions.

Enumerator:
msp_fdb_iter_continue  Continue to next record.
msp_fdb_iter_stop  Stop iteration and return.
msp_fdb_iter_error  Unknown error has occured.

Stop iteration and return


Function Documentation

int msp_fdb_attach void *  opt,
msp_fdb_handle_t fdb_handle
 

Attaches an application to the forwarding database.

This function creates the application-specific context of the forwarding database. It also maps shared memory where the forwarding database resides in process address space.

Note:
While it is not recommended, msp_fdb_attach() can be used to attach to the forwarding database multiple times.
Parameters:
[in] *opt Pointer to options being passed at the time of attachment. Null implies default values. These options are not currently defined; the application should pass NULL only.
[out] *msp_fdb_handle_t Pointer to application-specific context in case of success.
Returns:
MSP_OK on success; otherwise returns an error code:
  • MSP_EAGAIN Try again later: the forwarding database initialization is in progress.
  • MSP_MEM_ALLOC_FAIL Memory allocation for creating application-specific context failed.
  • MSP_ERROR Unknown generic error has occured.
  • MSP_INVALID_ARG An invalid argument was passed.
  • MSP_FDB_NOT_CONFIGURED The forwarding database has not been configured.

int msp_fdb_detach msp_fdb_handle_t  fdb_handle  ) 
 

Destroys Application-specific forwarding database context.

Parameters:
[in] fdb_handle - forwarding database context to be destroyed.
Returns:
MSP_OK on success; otherwise returns an error code:
  • MSP_ERROR Unknown generic error has occured.
  • MSP_INVALID_ARG An invalid argument was passed.

int msp_fdb_get_all_as_records msp_fdb_handle_t  fdb_handle,
msp_fdb_as_rec_handler_t  user_func,
void *  ctxt
 

Iterator to get all AS records available in the forwarding database.

Parameters:
[in] fdb_handle Application-specific forwarding database context.
[in] user_func User function to invoke on each record.
[in] ctxt User-supplied data that is passed to the user function.
Returns:
MSP_OK on success; otherwise returns an error code:
  • MSP_ERROR Unknown generic error has occured.
  • MSP_INVALID_ARG An invalid argument was passed.

int msp_fdb_get_all_ifl_records msp_fdb_handle_t  fdb_handle,
msp_fdb_ifl_handler_t  user_func,
void *  ctxt
 

Iterator to get all IFL records available in the forwarding database.

Parameters:
[in] fdb_handle Application-specific forwarding database context.
[in] user_func User function to invoke on each record.
[in] ctxt User-supplied data that is passed to the user function.
Returns:
MSP_OK on success; otherwise returns an error code:
  • MSP_ERROR Unknown generic error has occured.
  • MSP_INVALID_ARG An invalid argument was passed.

int msp_fdb_get_all_route_records msp_fdb_handle_t  fdb_handle,
u_int8_t  proto_family,
msp_fdb_route_handler_t  user_func,
void *  ctxt
 

Iterator to get all route records across all route tables available in the forwarding database.

Parameters:
[in] fdb_handle Application-specific forwarding database context.
[in] proto_family Protocol family whose route records will be iterated.
[in] user_func User function to invoke on each record.
[in] ctxt User-supplied data that is passed to the user function.
Returns:
MSP_OK on success; otherwise returns an error code:
  • MSP_ERROR Unknown generic error has occured.
  • MSP_INVALID_ARG An invalid argument was passed.

int msp_fdb_get_all_route_records_in_vrf msp_fdb_handle_t  fdb_handle,
u_int32_t  rtt_idx,
u_int8_t  proto_family,
msp_fdb_route_handler_t  user_func,
void *  ctxt
 

Iterator to get all route records of a VRF.

Parameters:
[in] fdb_handle Application-specific forwarding database context.
[in] rtt_idx Route table index.
[in] proto_family Protocol family whose route records will be iterated.
[in] user_func User function to invoke on each record.
[in] ctxt User-supplied data that is passed to the user function.
Returns:
MSP_OK on success; otherwise returns an error code:
  • MSP_ERROR Unknown generic error has occured.
  • MSP_INVALID_ARG An invalid argument was passed.

int msp_fdb_get_all_snmp_records msp_fdb_handle_t  fdb_handle,
msp_fdb_snmp_handler_t  user_func,
void *  ctxt
 

Iterator to get all SNMP records available in the forwarding database.

Parameters:
[in] fdb_handle Application-specific forwarding database context.
[in] user_func User function to invoke on each record.
[in] ctxt User supplied data that is passed to the user function.
Returns:
MSP_OK on success; otherwise returns an error code:
  • MSP_ERROR Unknown generic error has occured.
  • MSP_INVALID_ARG An invalid argument was passed.

int msp_fdb_get_all_vrf_records msp_fdb_handle_t  fdb_handle,
msp_fdb_vrf_handler_t  user_func,
void *  ctxt
 

Iterator to get all VRF records available in the forwarding database.

Parameters:
[in] fdb_handle Application-specific forwarding database context.
[in] user_func User function to invoke on each record.
[in] ctxt User-supplied data that is passed to the user function.
Returns:
MSP_OK on success; otherwise returns an error code:
  • MSP_ERROR Unknown generic error has occured.
  • MSP_INVALID_ARG An invalid argument was passed.

int msp_fdb_get_aspath msp_fdb_handle_t  fdb_handle,
u_int32_t  as_index,
msp_fdb_as_info_t as_info
 

Gets autonomous system (AS) path detail for a given AS index.

Parameters:
[in] fdb_handle Application-specific forwarding database context.
[in] as_index Index that identifies a unique AS path.
[out] *as_info Pointer to an msp_fdb_as_info_t structure. Upon success, this stores the AS path details.
Returns:
MSP_OK on success; otherwise returns an error code:
  • MSP_INVALID_ARG An invalid argument was passed.
  • MSP_FDB_RECORD_NOT_FOUND Matching entry not found.

int msp_fdb_get_configuration msp_fdb_cfg_info_t fdb_cfg_info  ) 
 

Returns configuration-related information, such as the size of the forwarding database.

Returns:
MSP_OK on success; otherwise returns an error code:
  • MSP_ERROR Unknown generic error has occured.
  • MSP_INVALID_ARG An invalid argument was passed.

int msp_fdb_get_ifl_index msp_fdb_handle_t  fdb_handle,
u_int32_t  snmp_index,
u_int32_t *  ifl_index
 

Gets the logical interface index for a given SNMP index.

Parameters:
[in] fdb_handle Application-specific forwarding database context.
[in] snmp_index SNMP index whose corresponding logical interface index is desired.
[out] *ifl_index Pointer of type u_int32_t. Upon success, this stores the IFL index.
Returns:
MSP_OK on success; otherwise returns an error code:
  • MSP_INVALID_ARG An invalid argument was passed.
  • MSP_FDB_RECORD_NOT_FOUND Matching entry not found.

int msp_fdb_get_route_record msp_fdb_handle_t  fdb_handle,
msp_fdb_rt_query_t rt_query,
msp_fdb_rt_info_t rt_res
 

Performs a route lookup for a specific destination address.

Parameters:
[in] fdb_handle Application-specific forwarding database context.
[in] *rt_query Pointer to route query structure.
[out] *rt_res Pointer to route result structure. The details are populated in this structure if the query succeeds.
Returns:
MSP_OK on success; otherwise returns an error code:
  • MSP_INVALID_ARG An invalid argument was passed.
  • MSP_FDB_RECORD_NOT_FOUND Matching entry not found.
  • MSP_ERROR Unknown generic error has occured.

int msp_fdb_get_snmp_index msp_fdb_handle_t  fdb_handle,
u_int32_t  ifl_index,
u_int32_t *  snmp_index
 

Gets the SNMP index for a given logical interface.

Parameters:
[in] fdb_handle Application-specific forwarding database context.
[in] ifl_index Logical interface index whose corresponding SNMP index is desired.
[out] *snmp_index Pointer in which to store the SNMP index upon success.
Returns:
MSP_OK on success; otherwise returns an error code:
  • MSP_INVALID_ARG An invalid argument was passed.
  • MSP_FDB_RECORD_NOT_FOUND Matching entry not found.

int msp_fdb_get_stats msp_fdb_handle_t  fdb_handle,
msp_fdb_stats_t fdb_stats
 

Return size of forwarding database statistics.

Parameters:
[in] fdb_handle Application-specific forwarding database context.
[out] fdb_stats Buffer populated by fdb statistics
Returns:
MSP_OK on success; otherwise returns an error code:
  • MSP_ERROR Unknown generic error has occured.
  • MSP_INVALID_ARG An invalid argument was passed.

int msp_fdb_get_vrf_index msp_fdb_handle_t  fdb_handle,
u_int32_t  ifl_index,
u_int32_t *  rtt_index
 

Gets the route table index for a given logical interface index.

Parameters:
[in] fdb_handle Application-specific forwarding database context.
[in] ifl_index Logical interface index whose corresponding route table index is desired.
[out] *rtt_index Pointer of type u_int32_t. Upon success, this stores the route table index.
Returns:
MSP_OK on success; otherwise returns an error code:
  • MSP_INVALID_ARG An invalid argument was passed.
  • MSP_FDB_RECORD_NOT_FOUND Matching entry not found.

int msp_fdb_is_configured void   ) 
 

Indicates whether or not the forwarding database has been configured.

Returns:
  • TRUE If the forwarding database is configured.
  • FALSE If the forwarding database is not configured.


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:24:53 2010 for libmsp-svcs by Doxygen 1.4.5