diff options
Diffstat (limited to 'bgpd/rfapi/rfapi.h')
| -rw-r--r-- | bgpd/rfapi/rfapi.h | 568 |
1 files changed, 253 insertions, 315 deletions
diff --git a/bgpd/rfapi/rfapi.h b/bgpd/rfapi/rfapi.h index 11d41c9d1d..8eb0d717df 100644 --- a/bgpd/rfapi/rfapi.h +++ b/bgpd/rfapi/rfapi.h @@ -1,4 +1,4 @@ -/* +/* * * Copyright 2009-2016, LabN Consulting, L.L.C. * @@ -32,138 +32,127 @@ #include "bgpd/bgp_encap_types.h" /* probably ought to have a field-specific define in config.h */ -# ifndef s6_addr32 /* for solaris/bsd */ -# ifdef SOLARIS_IPV6 +#ifndef s6_addr32 /* for solaris/bsd */ +#ifdef SOLARIS_IPV6 # define s6_addr32 _S6_un._S6_u32 -# else +#else # define s6_addr32 __u6_addr.__u6_addr32 -# endif -# endif +#endif +#endif #define RFAPI_V4_ADDR 0x04 #define RFAPI_V6_ADDR 0x06 #define RFAPI_SHOW_STR "VNC information\n" -struct rfapi_ip_addr -{ - uint8_t addr_family; /* AF_INET | AF_INET6 */ - union - { - struct in_addr v4; /* in network order */ - struct in6_addr v6; /* in network order */ - } addr; +struct rfapi_ip_addr { + uint8_t addr_family; /* AF_INET | AF_INET6 */ + union { + struct in_addr v4; /* in network order */ + struct in6_addr v6; /* in network order */ + } addr; }; -struct rfapi_ip_prefix -{ - uint8_t length; - uint8_t cost; /* bgp local pref = 255 - cost */ - struct rfapi_ip_addr prefix; +struct rfapi_ip_prefix { + uint8_t length; + uint8_t cost; /* bgp local pref = 255 - cost */ + struct rfapi_ip_addr prefix; }; -struct rfapi_nexthop -{ - struct prefix addr; - uint8_t cost; +struct rfapi_nexthop { + struct prefix addr; + uint8_t cost; }; -struct rfapi_next_hop_entry -{ - struct rfapi_next_hop_entry *next; - struct rfapi_ip_prefix prefix; - uint32_t lifetime; - struct rfapi_ip_addr un_address; - struct rfapi_ip_addr vn_address; - struct rfapi_vn_option *vn_options; - struct rfapi_un_option *un_options; +struct rfapi_next_hop_entry { + struct rfapi_next_hop_entry *next; + struct rfapi_ip_prefix prefix; + uint32_t lifetime; + struct rfapi_ip_addr un_address; + struct rfapi_ip_addr vn_address; + struct rfapi_vn_option *vn_options; + struct rfapi_un_option *un_options; }; #define RFAPI_REMOVE_RESPONSE_LIFETIME 0 #define RFAPI_INFINITE_LIFETIME 0xFFFFFFFF -struct rfapi_l2address_option -{ - struct ethaddr macaddr; /* use 0 to assign label to IP prefix */ - uint32_t label; /* 20bit label in low bits, no TC, S, or TTL */ - uint32_t logical_net_id; /* ~= EVPN Ethernet Segment Id, - must not be zero for mac regis. */ - uint8_t local_nve_id; - uint16_t tag_id; /* EVPN Ethernet Tag ID, 0 = none */ +struct rfapi_l2address_option { + struct ethaddr macaddr; /* use 0 to assign label to IP prefix */ + uint32_t label; /* 20bit label in low bits, no TC, S, or TTL */ + uint32_t logical_net_id; /* ~= EVPN Ethernet Segment Id, + must not be zero for mac regis. */ + uint8_t local_nve_id; + uint16_t tag_id; /* EVPN Ethernet Tag ID, 0 = none */ }; -typedef enum -{ - RFAPI_UN_OPTION_TYPE_PROVISIONAL, /* internal use only */ - RFAPI_UN_OPTION_TYPE_TUNNELTYPE, +typedef enum { + RFAPI_UN_OPTION_TYPE_PROVISIONAL, /* internal use only */ + RFAPI_UN_OPTION_TYPE_TUNNELTYPE, } rfapi_un_option_type; -struct rfapi_tunneltype_option -{ - bgp_encap_types type; - union - { - struct bgp_encap_type_reserved reserved; - struct bgp_encap_type_l2tpv3_over_ip l2tpv3_ip; - struct bgp_encap_type_gre gre; - struct bgp_encap_type_transmit_tunnel_endpoint transmit_tunnel_endpoint; - struct bgp_encap_type_ipsec_in_tunnel_mode ipsec_tunnel; - struct bgp_encap_type_ip_in_ip_tunnel_with_ipsec_transport_mode ip_ipsec; - struct bgp_encap_type_mpls_in_ip_tunnel_with_ipsec_transport_mode mpls_ipsec; - struct bgp_encap_type_ip_in_ip ip_ip; - struct bgp_encap_type_vxlan vxlan; - struct bgp_encap_type_nvgre nvgre; - struct bgp_encap_type_mpls mpls; - struct bgp_encap_type_mpls_in_gre mpls_gre; - struct bgp_encap_type_vxlan_gpe vxlan_gpe; - struct bgp_encap_type_mpls_in_udp mpls_udp; - struct bgp_encap_type_pbb pbb; - } bgpinfo; +struct rfapi_tunneltype_option { + bgp_encap_types type; + union { + struct bgp_encap_type_reserved reserved; + struct bgp_encap_type_l2tpv3_over_ip l2tpv3_ip; + struct bgp_encap_type_gre gre; + struct bgp_encap_type_transmit_tunnel_endpoint + transmit_tunnel_endpoint; + struct bgp_encap_type_ipsec_in_tunnel_mode ipsec_tunnel; + struct bgp_encap_type_ip_in_ip_tunnel_with_ipsec_transport_mode + ip_ipsec; + struct bgp_encap_type_mpls_in_ip_tunnel_with_ipsec_transport_mode + mpls_ipsec; + struct bgp_encap_type_ip_in_ip ip_ip; + struct bgp_encap_type_vxlan vxlan; + struct bgp_encap_type_nvgre nvgre; + struct bgp_encap_type_mpls mpls; + struct bgp_encap_type_mpls_in_gre mpls_gre; + struct bgp_encap_type_vxlan_gpe vxlan_gpe; + struct bgp_encap_type_mpls_in_udp mpls_udp; + struct bgp_encap_type_pbb pbb; + } bgpinfo; }; -struct rfapi_un_option -{ - struct rfapi_un_option *next; - rfapi_un_option_type type; - union - { - struct rfapi_tunneltype_option tunnel; - } v; +struct rfapi_un_option { + struct rfapi_un_option *next; + rfapi_un_option_type type; + union { + struct rfapi_tunneltype_option tunnel; + } v; }; -typedef enum -{ - RFAPI_VN_OPTION_TYPE_L2ADDR = 3, /* Layer 2 address, 3 for legacy compatibility */ - RFAPI_VN_OPTION_TYPE_LOCAL_NEXTHOP, /* for static routes */ - RFAPI_VN_OPTION_TYPE_INTERNAL_RD, /* internal use only */ +typedef enum { + RFAPI_VN_OPTION_TYPE_L2ADDR = + 3, /* Layer 2 address, 3 for legacy compatibility */ + RFAPI_VN_OPTION_TYPE_LOCAL_NEXTHOP, /* for static routes */ + RFAPI_VN_OPTION_TYPE_INTERNAL_RD, /* internal use only */ } rfapi_vn_option_type; -struct rfapi_vn_option -{ - struct rfapi_vn_option *next; +struct rfapi_vn_option { + struct rfapi_vn_option *next; - rfapi_vn_option_type type; + rfapi_vn_option_type type; - union - { - struct rfapi_l2address_option l2addr; + union { + struct rfapi_l2address_option l2addr; - /* - * If this option is present, the next hop is local to the - * client NVE (i.e., not via a tunnel). - */ - struct rfapi_nexthop local_nexthop; + /* + * If this option is present, the next hop is local to the + * client NVE (i.e., not via a tunnel). + */ + struct rfapi_nexthop local_nexthop; - /* - * For rfapi internal use only - */ - struct prefix_rd internal_rd; - } v; + /* + * For rfapi internal use only + */ + struct prefix_rd internal_rd; + } v; }; -struct rfapi_l2address_option_match -{ - struct rfapi_l2address_option o; - uint32_t flags; +struct rfapi_l2address_option_match { + struct rfapi_l2address_option o; + uint32_t flags; #define RFAPI_L2O_MACADDR 0x00000001 #define RFAPI_L2O_LABEL 0x00000002 @@ -181,7 +170,7 @@ typedef void *rfapi_handle; /*------------------------------------------ * rfapi_response_cb_t (callback typedef) * - * Callbacks of this type are used to provide asynchronous + * Callbacks of this type are used to provide asynchronous * route updates from RFAPI to the RFP client. * * response_cb @@ -200,7 +189,7 @@ typedef void *rfapi_handle; * has been added or deleted. Deleted routes are indicated * with lifetime==RFAPI_REMOVE_RESPONSE_LIFETIME. * - * input: + * input: * next_hops a list of possible next hops. * This is a linked list allocated within the * rfapi. The response_cb callback function is responsible @@ -211,16 +200,16 @@ typedef void *rfapi_handle; * rfapi_open() * *------------------------------------------*/ -typedef void (rfapi_response_cb_t) (struct rfapi_next_hop_entry * next_hops, - void *userdata); +typedef void(rfapi_response_cb_t)(struct rfapi_next_hop_entry *next_hops, + void *userdata); /*------------------------------------------ * rfapi_nve_close_cb_t (callback typedef) * - * Callbacks of this type are used to provide asynchronous + * Callbacks of this type are used to provide asynchronous * notification that an rfapi_handle was invalidated * - * input: + * input: * pHandle Firmerly valid rfapi_handle returned to * client via rfapi_open(). * @@ -228,72 +217,67 @@ typedef void (rfapi_response_cb_t) (struct rfapi_next_hop_entry * next_hops, * ESTALE handle invalidated by configuration change * *------------------------------------------*/ -typedef void (rfapi_nve_close_cb_t) (rfapi_handle pHandle, int reason); +typedef void(rfapi_nve_close_cb_t)(rfapi_handle pHandle, int reason); /*------------------------------------------ * rfp_cfg_write_cb_t (callback typedef) * * This callback is used to generate output for any config parameters - * that may supported by RFP via RFP defined vty commands at the bgp + * that may supported by RFP via RFP defined vty commands at the bgp * level. See loglevel as an example. * - * input: + * input: * vty -- quagga vty context * rfp_start_val -- value returned by rfp_start * * output: * to vty, rfp related configuration * - * return value: + * return value: * lines written --------------------------------------------*/ -typedef int (rfp_cfg_write_cb_t) (struct vty * vty, void *rfp_start_val); +typedef int(rfp_cfg_write_cb_t)(struct vty *vty, void *rfp_start_val); /*------------------------------------------ * rfp_cfg_group_write_cb_t (callback typedef) * * This callback is used to generate output for any config parameters - * that may supported by RFP via RFP defined vty commands at the + * that may supported by RFP via RFP defined vty commands at the * L2 or NVE level. See loglevel as an example. * - * input: + * input: * vty quagga vty context * rfp_start_val value returned by rfp_start * type group type * name group name - * rfp_cfg_group Pointer to configuration structure + * rfp_cfg_group Pointer to configuration structure * * output: * to vty, rfp related configuration * - * return value: + * return value: * lines written --------------------------------------------*/ -typedef enum -{ - RFAPI_RFP_CFG_GROUP_DEFAULT, - RFAPI_RFP_CFG_GROUP_NVE, - RFAPI_RFP_CFG_GROUP_L2 +typedef enum { + RFAPI_RFP_CFG_GROUP_DEFAULT, + RFAPI_RFP_CFG_GROUP_NVE, + RFAPI_RFP_CFG_GROUP_L2 } rfapi_rfp_cfg_group_type; -typedef int (rfp_cfg_group_write_cb_t) (struct vty * vty, - void *rfp_start_val, - rfapi_rfp_cfg_group_type type, - const char *name, - void *rfp_cfg_group); +typedef int(rfp_cfg_group_write_cb_t)(struct vty *vty, void *rfp_start_val, + rfapi_rfp_cfg_group_type type, + const char *name, void *rfp_cfg_group); /*********************************************************************** * Configuration related defines and structures ***********************************************************************/ -struct rfapi_rfp_cb_methods -{ - rfp_cfg_write_cb_t *cfg_cb; /* show top level config */ - rfp_cfg_group_write_cb_t *cfg_group_cb; /* show group level config */ - rfapi_response_cb_t *response_cb; /* unsolicited responses */ - rfapi_response_cb_t *local_cb; /* local route add/delete */ - rfapi_nve_close_cb_t *close_cb; /* handle closed */ - +struct rfapi_rfp_cb_methods { + rfp_cfg_write_cb_t *cfg_cb; /* show top level config */ + rfp_cfg_group_write_cb_t *cfg_group_cb; /* show group level config */ + rfapi_response_cb_t *response_cb; /* unsolicited responses */ + rfapi_response_cb_t *local_cb; /* local route add/delete */ + rfapi_nve_close_cb_t *close_cb; /* handle closed */ }; /* @@ -303,7 +287,7 @@ struct rfapi_rfp_cb_methods */ #define RFAPI_LIFETIME_INFINITE_WITHDRAW_DELAY (60*120) -/* +/* * the factor that should be applied to a prefix's <lifetime> value * before using it to expire a withdrawn prefix, expressed as a percent. * Thus, a value of 100 means to use the exact value of <lifetime>, @@ -312,46 +296,44 @@ struct rfapi_rfp_cb_methods #define RFAPI_RFP_CFG_DEFAULT_HOLDDOWN_FACTOR 150 /* - * This is used by rfapi to determine if RFP is using/supports + * This is used by rfapi to determine if RFP is using/supports * a partial (i.e., cache) or full table download approach for * mapping information. When full table download approach is * used all information is passed to RFP after an initial - * rfapi_query. When partial table download is used, only - * information matching a query is passed. + * rfapi_query. When partial table download is used, only + * information matching a query is passed. */ -typedef enum -{ - RFAPI_RFP_DOWNLOAD_PARTIAL = 0, - RFAPI_RFP_DOWNLOAD_FULL +typedef enum { + RFAPI_RFP_DOWNLOAD_PARTIAL = 0, + RFAPI_RFP_DOWNLOAD_FULL } rfapi_rfp_download_type; #define RFAPI_RFP_CFG_DEFAULT_FTD_ADVERTISEMENT_INTERVAL 1 -struct rfapi_rfp_cfg -{ - /* partial or full table download */ - rfapi_rfp_download_type download_type; /* default=partial */ - /* - * When full-table-download is enabled, this is the minimum - * number of seconds between times a non-queried prefix will - * be updated to a particular NVE. - * default: RFAPI_RFP_CFG_DEFAULT_FTD_ADVERTISEMENT_INTERVAL - */ - uint32_t ftd_advertisement_interval; - /* - * percentage of registration lifetime to continue to use information - * post soft-state refresh timeout - default: RFAPI_RFP_CFG_DEFAULT_HOLDDOWN_FACTOR - */ - uint32_t holddown_factor; - /* Control generation of updated RFP responses */ - uint8_t use_updated_response; /* default=0/no */ - /* when use_updated_response, also generate remove responses */ - uint8_t use_removes; /* default=0/no */ +struct rfapi_rfp_cfg { + /* partial or full table download */ + rfapi_rfp_download_type download_type; /* default=partial */ + /* + * When full-table-download is enabled, this is the minimum + * number of seconds between times a non-queried prefix will + * be updated to a particular NVE. + * default: RFAPI_RFP_CFG_DEFAULT_FTD_ADVERTISEMENT_INTERVAL + */ + uint32_t ftd_advertisement_interval; + /* + * percentage of registration lifetime to continue to use information + * post soft-state refresh timeout + default: RFAPI_RFP_CFG_DEFAULT_HOLDDOWN_FACTOR + */ + uint32_t holddown_factor; + /* Control generation of updated RFP responses */ + uint8_t use_updated_response; /* default=0/no */ + /* when use_updated_response, also generate remove responses */ + uint8_t use_removes; /* default=0/no */ }; /*********************************************************************** - * Process related functions -- MUST be provided by the RFAPI user <<=== + * Process related functions -- MUST be provided by the RFAPI user <<=== ***********************************************************************/ /*------------------------------------------ @@ -359,38 +341,35 @@ struct rfapi_rfp_cfg * * This function will start the RFP code * - * input: + * input: * master quagga thread_master to tie into bgpd threads - * + * * output: - * cfgp Pointer to rfapi_rfp_cfg (null = use defaults), + * cfgp Pointer to rfapi_rfp_cfg (null = use defaults), * copied by caller, updated via rfp_set_configuration * cbmp Pointer to rfapi_rfp_cb_methods, may be null * copied by caller, updated via rfapi_rfp_set_cb_methods - * return value: + * return value: * rfp_start_val rfp returned value passed on rfp_stop and other rfapi calls --------------------------------------------*/ -extern void * -rfp_start ( - struct thread_master *master, - struct rfapi_rfp_cfg **cfgp, - struct rfapi_rfp_cb_methods **cbmp); +extern void *rfp_start(struct thread_master *master, + struct rfapi_rfp_cfg **cfgp, + struct rfapi_rfp_cb_methods **cbmp); /*------------------------------------------ * rfp_stop * * This function is called on shutdown to trigger RFP cleanup * - * input: + * input: * rfp_start_val * * output: * none * - * return value: + * return value: --------------------------------------------*/ -extern void -rfp_stop (void *rfp_start_val); +extern void rfp_stop(void *rfp_start_val); /*********************************************************************** * RFP processing behavior configuration @@ -399,44 +378,40 @@ rfp_stop (void *rfp_start_val); /*------------------------------------------ * rfapi_rfp_set_configuration * - * This is used to change rfapi's processing behavior based on - * RFP requirements. + * This is used to change rfapi's processing behavior based on + * RFP requirements. * - * input: + * input: * rfp_start_val value returned by rfp_start * rfapi_rfp_cfg Pointer to configuration structure * * output: * none * - * return value: + * return value: * 0 Success * ENXIO Unabled to locate configured BGP/VNC --------------------------------------------*/ -extern int -rfapi_rfp_set_configuration ( - void *rfp_start_val, - struct rfapi_rfp_cfg *rfp_cfg); +extern int rfapi_rfp_set_configuration(void *rfp_start_val, + struct rfapi_rfp_cfg *rfp_cfg); /*------------------------------------------ * rfapi_rfp_set_cb_methods * - * Change registered callback functions for asynchronous notifications + * Change registered callback functions for asynchronous notifications * from RFAPI to the RFP client. * - * input: + * input: * rfp_start_val value by rfp_start * methods Pointer to struct rfapi_rfp_cb_methods containing * pointers to callback methods as described above * - * return value: + * return value: * 0 Success * ENXIO BGP or VNC not configured *------------------------------------------*/ -extern int -rfapi_rfp_set_cb_methods ( - void *rfp_start_val, - struct rfapi_rfp_cb_methods *methods); +extern int rfapi_rfp_set_cb_methods(void *rfp_start_val, + struct rfapi_rfp_cb_methods *methods); /*********************************************************************** * RFP group specific configuration @@ -446,12 +421,12 @@ rfapi_rfp_set_cb_methods ( * rfapi_rfp_init_group_config_ptr_vty * * This is used to init or return a previously init'ed group specific - * configuration pointer. Group is identified by vty context. + * configuration pointer. Group is identified by vty context. * NOTE: size is ignored when a previously init'ed value is returned. * RFAPI frees rfp_cfg_group when group is deleted during reconfig, * bgp restart or shutdown. * - * input: + * input: * rfp_start_val value returned by rfp_start * type group type * vty quagga vty context @@ -460,25 +435,23 @@ rfapi_rfp_set_cb_methods ( * output: * none * - * return value: + * return value: * rfp_cfg_group NULL or Pointer to configuration structure --------------------------------------------*/ -extern void * -rfapi_rfp_init_group_config_ptr_vty ( - void *rfp_start_val, - rfapi_rfp_cfg_group_type type, - struct vty *vty, - uint32_t size); +extern void *rfapi_rfp_init_group_config_ptr_vty(void *rfp_start_val, + rfapi_rfp_cfg_group_type type, + struct vty *vty, + uint32_t size); /*------------------------------------------ * rfapi_rfp_get_group_config_ptr_vty * * This is used to get group specific configuration pointer. - * Group is identified by type and vty context. + * Group is identified by type and vty context. * RFAPI frees rfp_cfg_group when group is deleted during reconfig, * bgp restart or shutdown. * - * input: + * input: * rfp_start_val value returned by rfp_start * type group type * vty quagga vty context @@ -487,43 +460,40 @@ rfapi_rfp_init_group_config_ptr_vty ( * none * * return value: - * rfp_cfg_group Pointer to configuration structure + * rfp_cfg_group Pointer to configuration structure --------------------------------------------*/ -extern void * -rfapi_rfp_get_group_config_ptr_vty ( - void *rfp_start_val, - rfapi_rfp_cfg_group_type type, - struct vty *vty); +extern void *rfapi_rfp_get_group_config_ptr_vty(void *rfp_start_val, + rfapi_rfp_cfg_group_type type, + struct vty *vty); /*------------------------------------------ * rfp_group_config_search_cb_t (callback typedef) * - * This callback is used to called from within a + * This callback is used to called from within a * rfapi_rfp_get_group_config_ptr to check if the rfp_cfg_group * matches the search criteria * - * input: + * input: * criteria RFAPI caller provided serach criteria * rfp_cfg_group Pointer to configuration structure | NULL * * output: * - * return value: + * return value: * 0 Match/Success * ENOENT No matching --------------------------------------------*/ -typedef int (rfp_group_config_search_cb_t) (void *criteria, - void *rfp_cfg_group); +typedef int(rfp_group_config_search_cb_t)(void *criteria, void *rfp_cfg_group); /*------------------------------------------ * rfapi_rfp_get_group_config_ptr_name * * This is used to get group specific configuration pointer. - * Group is identified by type and name context. + * Group is identified by type and name context. * RFAPI frees rfp_cfg_group when group is deleted during reconfig, * bgp restart or shutdown. * - * input: + * input: * rfp_start_val value returned by rfp_start * type group type * name group name @@ -534,15 +504,11 @@ typedef int (rfp_group_config_search_cb_t) (void *criteria, * none * * return value: - * rfp_cfg_group Pointer to configuration structure + * rfp_cfg_group Pointer to configuration structure --------------------------------------------*/ -extern void * -rfapi_rfp_get_group_config_ptr_name ( - void *rfp_start_val, - rfapi_rfp_cfg_group_type type, - const char *name, - void *criteria, - rfp_group_config_search_cb_t *search_cb); +extern void *rfapi_rfp_get_group_config_ptr_name( + void *rfp_start_val, rfapi_rfp_cfg_group_type type, const char *name, + void *criteria, rfp_group_config_search_cb_t *search_cb); /*------------------------------------------ * rfapi_rfp_get_l2_group_config_ptr_lni @@ -550,9 +516,9 @@ rfapi_rfp_get_group_config_ptr_name ( * This is used to get group specific configuration pointer. * Group is identified by type and logical network identifier. * RFAPI frees rfp_cfg_group when group is deleted during reconfig, - * bgp restart or shutdown. + * bgp restart or shutdown. * - * input: + * input: * rfp_start_val value returned by rfp_start * logical_net_id group logical network identifier * criteria RFAPI caller provided serach criteria @@ -562,14 +528,12 @@ rfapi_rfp_get_group_config_ptr_name ( * none * * return value: - * rfp_cfg_group Pointer to configuration structure + * rfp_cfg_group Pointer to configuration structure --------------------------------------------*/ extern void * -rfapi_rfp_get_l2_group_config_ptr_lni ( - void *rfp_start_val, - uint32_t logical_net_id, - void *criteria, - rfp_group_config_search_cb_t *search_cb); +rfapi_rfp_get_l2_group_config_ptr_lni(void *rfp_start_val, + uint32_t logical_net_id, void *criteria, + rfp_group_config_search_cb_t *search_cb); /*********************************************************************** * NVE Sessions @@ -581,7 +545,7 @@ rfapi_rfp_get_l2_group_config_ptr_lni ( * This function initializes a NVE record and associates it with * the specified VN and underlay network addresses * - * input: + * input: * rfp_start_val value returned by rfp_start * vn NVE virtual network address * @@ -599,13 +563,13 @@ rfapi_rfp_get_l2_group_config_ptr_lni ( * * output: * response_lifetime The length of time that responses sent to this - * NVE are valid. + * NVE are valid. * * pHandle pointer to location to store rfapi handle. The * handle must be passed on subsequent rfapi_ calls. * * - * return value: + * return value: * 0 Success * EEXIST NVE with this {vn,un} already open * ENOENT No matching nve group config @@ -615,15 +579,11 @@ rfapi_rfp_get_l2_group_config_ptr_lni ( * but underlay network address is not IPv4 * EDEADLK Called from within a callback procedure *------------------------------------------*/ -extern int -rfapi_open ( - void *rfp_start_val, - struct rfapi_ip_addr *vn, - struct rfapi_ip_addr *un, - struct rfapi_un_option *default_options, - uint32_t *response_lifetime, - void *userdata, - rfapi_handle *pHandle); +extern int rfapi_open(void *rfp_start_val, struct rfapi_ip_addr *vn, + struct rfapi_ip_addr *un, + struct rfapi_un_option *default_options, + uint32_t *response_lifetime, void *userdata, + rfapi_handle *pHandle); /*------------------------------------------ @@ -633,7 +593,7 @@ rfapi_open ( * from within a rfapi callback procedure is permitted (the close * will be completed asynchronously after the callback finishes). * - * input: + * input: * rfd: rfapi descriptor returned by rfapi_open * * output: @@ -643,15 +603,14 @@ rfapi_open ( * EBADF invalid handle * ENXIO BGP or VNC not configured *------------------------------------------*/ -extern int -rfapi_close (rfapi_handle rfd); +extern int rfapi_close(rfapi_handle rfd); /*------------------------------------------ * rfapi_check * * Test rfapi descriptor * - * input: + * input: * rfd: rfapi descriptor returned by rfapi_open * * output: @@ -664,8 +623,7 @@ rfapi_close (rfapi_handle rfd); * ENXIO BGP or VNC not configured * EAFNOSUPPORT Internal addressing error *------------------------------------------*/ -extern int -rfapi_check (rfapi_handle rfd); +extern int rfapi_check(rfapi_handle rfd); /*********************************************************************** * NVE Routes @@ -674,14 +632,14 @@ rfapi_check (rfapi_handle rfd); /*------------------------------------------ * rfapi_query * - * This function queries the RIB for a - * particular route. Note that this call may result in subsequent + * This function queries the RIB for a + * particular route. Note that this call may result in subsequent * callbacks to response_cb. Response callbacks can be cancelled * by calling rfapi_query_done. A duplicate query using the same target * will result in only one callback per change in next_hops. (i.e., * cancel/replace the prior query results.) * - * input: + * input: * rfd: rfapi descriptor returned by rfapi_open * target: the destination address * l2o ptr to L2 Options struct, NULL if not present in query @@ -701,20 +659,17 @@ rfapi_check (rfapi_handle rfd); * ESTALE descriptor is no longer usable; should be closed * EDEADLK Called from within a callback procedure --------------------------------------------*/ -extern int -rfapi_query ( - rfapi_handle rfd, - struct rfapi_ip_addr *target, - struct rfapi_l2address_option *l2o, - struct rfapi_next_hop_entry **ppNextHopEntry); +extern int rfapi_query(rfapi_handle rfd, struct rfapi_ip_addr *target, + struct rfapi_l2address_option *l2o, + struct rfapi_next_hop_entry **ppNextHopEntry); /*------------------------------------------ * rfapi_query_done * - * Notifies the rfapi that the user is no longer interested - * in the specified target. + * Notifies the rfapi that the user is no longer interested + * in the specified target. * - * input: + * input: * rfd: rfapi descriptor returned by rfapi_open * target: the destination address * @@ -728,16 +683,15 @@ rfapi_query ( * ESTALE descriptor is no longer usable; should be closed * EDEADLK Called from within a callback procedure --------------------------------------------*/ -extern int -rfapi_query_done (rfapi_handle rfd, struct rfapi_ip_addr *target); +extern int rfapi_query_done(rfapi_handle rfd, struct rfapi_ip_addr *target); /*------------------------------------------ * rfapi_query_done_all * - * Notifies the rfapi that the user is no longer interested - * in any target. + * Notifies the rfapi that the user is no longer interested + * in any target. * - * input: + * input: * rfd: rfapi descriptor returned by rfapi_open * * output: @@ -750,8 +704,7 @@ rfapi_query_done (rfapi_handle rfd, struct rfapi_ip_addr *target); * ESTALE descriptor is no longer usable; should be closed * EDEADLK Called from within a callback procedure --------------------------------------------*/ -extern int -rfapi_query_done_all (rfapi_handle rfd, int *count); +extern int rfapi_query_done_all(rfapi_handle rfd, int *count); /*------------------------------------------ * rfapi_register @@ -759,11 +712,11 @@ rfapi_query_done_all (rfapi_handle rfd, int *count); * Requests that reachability to the indicated prefix via this NVE * be advertised by BGP. If <unregister> is non-zero, then the previously- * advertised prefix should be withdrawn. - * - * (This function should NOT be called if the rfapi_open() function + * + * (This function should NOT be called if the rfapi_open() function * returns NULL) * - * input: + * input: * rfd: rfapi descriptor returned by rfapi_open * prefix: A prefix to be registered or deregistered * lifetime Prefix lifetime in seconds, host byte order @@ -785,21 +738,16 @@ rfapi_query_done_all (rfapi_handle rfd, int *count); * EDEADLK Called from within a callback procedure --------------------------------------------*/ -typedef enum -{ - RFAPI_REGISTER_ADD, - RFAPI_REGISTER_WITHDRAW, - RFAPI_REGISTER_KILL +typedef enum { + RFAPI_REGISTER_ADD, + RFAPI_REGISTER_WITHDRAW, + RFAPI_REGISTER_KILL } rfapi_register_action; -extern int -rfapi_register ( - rfapi_handle rfd, - struct rfapi_ip_prefix *prefix, - uint32_t lifetime, - struct rfapi_un_option *options_un, - struct rfapi_vn_option *options_vn, - rfapi_register_action action); +extern int rfapi_register(rfapi_handle rfd, struct rfapi_ip_prefix *prefix, + uint32_t lifetime, struct rfapi_un_option *options_un, + struct rfapi_vn_option *options_vn, + rfapi_register_action action); /*********************************************************************** * Helper / Utility functions @@ -810,32 +758,30 @@ rfapi_register ( * * Get the virtual network address used by an NVE based on it's RFD * - * input: + * input: * rfd: rfapi descriptor returned by rfapi_open or rfapi_create_generic * * output: * - * return value: + * return value: * vn NVE virtual network address *------------------------------------------*/ -extern struct rfapi_ip_addr * -rfapi_get_vn_addr (void *); +extern struct rfapi_ip_addr *rfapi_get_vn_addr(void *); /*------------------------------------------ * rfapi_get_un_addr * * Get the underlay network address used by an NVE based on it's RFD * - * input: + * input: * rfd: rfapi descriptor returned by rfapi_open or rfapi_create_generic * * output: * - * return value: + * return value: * un NVE underlay network address *------------------------------------------*/ -extern struct rfapi_ip_addr * -rfapi_get_un_addr (void *); +extern struct rfapi_ip_addr *rfapi_get_un_addr(void *); /*------------------------------------------ * rfapi_error_str @@ -850,8 +796,7 @@ rfapi_get_un_addr (void *); * * const char * String *------------------------------------------*/ -extern const char * -rfapi_error_str (int code); +extern const char *rfapi_error_str(int code); /*------------------------------------------ * rfapi_get_rfp_start_val @@ -862,17 +807,16 @@ rfapi_error_str (int code); * void * bgp structure * * returns: - * void * + * void * *------------------------------------------*/ -extern void * -rfapi_get_rfp_start_val (void *bgpv); +extern void *rfapi_get_rfp_start_val(void *bgpv); /*------------------------------------------ * rfapi_compare_rfds * * Compare two generic rfapi descriptors. * - * input: + * input: * rfd1: rfapi descriptor returned by rfapi_open or rfapi_create_generic * rfd2: rfapi descriptor returned by rfapi_open or rfapi_create_generic * @@ -882,24 +826,22 @@ rfapi_get_rfp_start_val (void *bgpv); * 0 Mismatch * 1 Match *------------------------------------------*/ -extern int -rfapi_compare_rfds (void *rfd1, void *rfd2); +extern int rfapi_compare_rfds(void *rfd1, void *rfd2); /*------------------------------------------ * rfapi_free_next_hop_list * * Frees a next_hop_list returned by a rfapi_query invocation * - * input: - * list: a pointer to a response list (as a + * input: + * list: a pointer to a response list (as a * struct rfapi_next_hop_entry) to free. * * output: * * return value: None --------------------------------------------*/ -extern void -rfapi_free_next_hop_list (struct rfapi_next_hop_entry *list); +extern void rfapi_free_next_hop_list(struct rfapi_next_hop_entry *list); /*------------------------------------------ * rfapi_get_response_lifetime_default @@ -908,22 +850,21 @@ rfapi_free_next_hop_list (struct rfapi_next_hop_entry *list); * rfp_start_val value returned by rfp_start or * NULL (=use default instance) * - * input: + * input: * None * * output: * * return value: The bgp instance default lifetime for a response. --------------------------------------------*/ -extern int -rfapi_get_response_lifetime_default (void *rfp_start_val); +extern int rfapi_get_response_lifetime_default(void *rfp_start_val); /*------------------------------------------ * rfapi_is_vnc_configured * * Returns if VNC (BGP VPN messaging /VPN & encap SAFIs) are configured * - * input: + * input: * rfp_start_val value returned by rfp_start or * NULL (=use default instance) * @@ -933,15 +874,14 @@ rfapi_get_response_lifetime_default (void *rfp_start_val); * 0 Success * ENXIO VNC not configured --------------------------------------------*/ -extern int -rfapi_is_vnc_configured (void *rfp_start_val); +extern int rfapi_is_vnc_configured(void *rfp_start_val); /*------------------------------------------ * rfapi_bgp_lookup_by_rfp * * Find bgp instance pointer based on value returned by rfp_start * - * input: + * input: * rfp_start_val value returned by rfp_startor * NULL (=get default instance) * @@ -953,15 +893,14 @@ rfapi_is_vnc_configured (void *rfp_start_val); * NULL = not found * --------------------------------------------*/ -extern struct bgp * -rfapi_bgp_lookup_by_rfp (void *rfp_start_val); +extern struct bgp *rfapi_bgp_lookup_by_rfp(void *rfp_start_val); /*------------------------------------------ * rfapi_get_rfp_start_val_by_bgp * * Find bgp instance pointer based on value returned by rfp_start * - * input: + * input: * bgp bgp instance pointer * * output: @@ -972,8 +911,7 @@ rfapi_bgp_lookup_by_rfp (void *rfp_start_val); * NULL = not found * --------------------------------------------*/ -extern void * -rfapi_get_rfp_start_val_by_bgp (struct bgp *bgp); +extern void *rfapi_get_rfp_start_val_by_bgp(struct bgp *bgp); #endif /* ENABLE_BGP_VNC */ |
