summaryrefslogtreecommitdiffstats
path: root/src/vnet/srv6/sr.h
diff options
context:
space:
mode:
authorTetsuya Murakami <tetsuya.mrk@gmail.com>2019-12-04 18:57:46 -0800
committerOle Trøan <otroan@employees.org>2019-12-05 15:11:03 +0000
commit70d8ef89a5d9e38d4f35517c0f64009c47b76c4d (patch)
tree4dbd294a57d34dd82d755ae465847f5ede7244d7 /src/vnet/srv6/sr.h
parent66cea092c7a584bb7b82000fbfad349e6f0af7e1 (diff)
srv6-mobile
Type: feature Plug-in for IPv6 Segment Routing Mobile Support the plug-in function in SR Policy. Support GTP4.D plug-in as SR Policy plug-in. Signed-off-by: Tetsuya Murakami <tetsuya.mrk@gmail.com> Change-Id: I306160b7203921d879940193868944158867c482
Diffstat (limited to 'src/vnet/srv6/sr.h')
-rwxr-xr-xsrc/vnet/srv6/sr.h55
1 files changed, 54 insertions, 1 deletions
diff --git a/src/vnet/srv6/sr.h b/src/vnet/srv6/sr.h
index 11935833394..6a228c8fc23 100755
--- a/src/vnet/srv6/sr.h
+++ b/src/vnet/srv6/sr.h
@@ -77,6 +77,9 @@ typedef struct
dpo_id_t bsid_dpo; /**< DPO for Encaps/Insert for BSID */
dpo_id_t ip6_dpo; /**< DPO for Encaps/Insert IPv6 */
dpo_id_t ip4_dpo; /**< DPO for Encaps IPv6 */
+
+ u16 plugin;
+ void *plugin_mem;
} ip6_sr_sl_t;
/* SR policy types */
@@ -102,8 +105,13 @@ typedef struct
u32 fib_table; /**< FIB table */
u8 is_encap; /**< Mode (0 is SRH insert, 1 Encaps) */
+
+ u16 plugin;
+ void *plugin_mem;
} ip6_sr_policy_t;
+typedef int (sr_p_plugin_callback_t) (ip6_sr_policy_t * sr);
+
/**
* @brief SR LocalSID
*/
@@ -165,6 +173,34 @@ typedef struct
} sr_localsid_fn_registration_t;
/**
+ * @brief SR Policy behavior registration
+ */
+typedef struct
+{
+ u16 sr_policy_function_number; /**< SR Policy plugin function */
+
+ u8 *function_name; /**< Function name. (key). */
+
+ u8 *keyword_str; /**< Behavior keyword (i.e. End.X) */
+
+ u8 *def_str; /**< Behavior definition (i.e. Endpoint with cross-connect) */
+
+ u8 *params_str; /**< Behavior parameters (i.e. <oif> <IP46next_hop>) */
+
+ u8 prefix_length;
+
+ dpo_type_t dpo; /**< DPO type registration */
+
+ format_function_t *ls_format; /**< LocalSID format function */
+
+ unformat_function_t *ls_unformat; /**< LocalSID unformat function */
+
+ sr_p_plugin_callback_t *creation; /**< Function within plugin that will be called after localsid creation*/
+
+ sr_p_plugin_callback_t *removal; /**< Function within plugin that will be called before localsid removal */
+} sr_policy_fn_registration_t;
+
+/**
* @brief Steering db key
*
* L3 is IPv4/IPv6 + mask
@@ -236,6 +272,12 @@ typedef struct
/* Find plugin function by name */
uword *plugin_functions_by_key;
+ /* Plugin functions for Policy */
+ sr_policy_fn_registration_t *policy_plugin_functions;
+
+ /* Find plugin function by name */
+ uword *policy_plugin_functions_by_key;
+
/* Counters */
vlib_combined_counter_main_t sr_ls_valid_counters;
vlib_combined_counter_main_t sr_ls_invalid_counters;
@@ -270,8 +312,19 @@ sr_localsid_register_function (vlib_main_t * vm, u8 * fn_name,
sr_plugin_callback_t * removal_fn);
extern int
+sr_policy_register_function (vlib_main_t * vm, u8 * fn_name,
+ u8 * keyword_str, u8 * def_str,
+ u8 * params_str, u8 prefix_length,
+ dpo_type_t * dpo,
+ format_function_t * ls_format,
+ unformat_function_t * ls_unformat,
+ sr_p_plugin_callback_t * creation_fn,
+ sr_p_plugin_callback_t * removal_fn);
+
+extern int
sr_policy_add (ip6_address_t * bsid, ip6_address_t * segments,
- u32 weight, u8 behavior, u32 fib_table, u8 is_encap);
+ u32 weight, u8 behavior, u32 fib_table, u8 is_encap,
+ u16 plugin, void *plugin_mem);
extern int sr_policy_mod (ip6_address_t * bsid, u32 index, u32 fib_table,
u8 operation, ip6_address_t * segments,
u32 sl_index, u32 weight);