vlib: process startup config exec scripts line by line
[vpp.git] / src / vlib / punt.h
index adb25f9..ce94942 100644 (file)
@@ -28,12 +28,24 @@ typedef enum vlib_punt_reason_t_
   PUNT_N_REASONS,
 } vlib_punt_reason_t;
 
+/**
+ * Walk each punt reason
+ */
+typedef int (*punt_reason_walk_cb_t) (vlib_punt_reason_t id, const u8 *name,
+                                     void *ctx);
+
+extern void punt_reason_walk (punt_reason_walk_cb_t cb, void *cxt);
 
 /**
  * @brief Format a punt reason
  */
 extern u8 *format_vlib_punt_reason (u8 * s, va_list * args);
 
+/**
+ * @brief Unformat a punt reason
+ */
+extern uword unformat_punt_reason (unformat_input_t *input, va_list *args);
+
 /**
  * Typedef for a client handle
  */
@@ -49,12 +61,28 @@ typedef int vlib_punt_hdl_t;
  */
 vlib_punt_hdl_t vlib_punt_client_register (const char *who);
 
+typedef void (*punt_interested_listener_t) (vlib_enable_or_disable_t i,
+                                           void *data);
+
 /**
  * Allocate a new punt reason
+ * @param fn            - A callback to invoke when an entity becomes
+ * [un]interested in the punt code.
+ * @param data          - To be passed in the callback function.
+ * @param flags         - flags associated with the punt reason
+ * @param flags_format  - formatting function to display those flags (may be
+ * NULL)
  */
 extern int vlib_punt_reason_alloc (vlib_punt_hdl_t client,
                                   const char *reason_name,
-                                  vlib_punt_reason_t * reason);
+                                  punt_interested_listener_t fn, void *data,
+                                  vlib_punt_reason_t *reason, u32 flags,
+                                  format_function_t *flags_format);
+
+/**
+ * Validate that a punt reason is assigned
+ */
+extern int vlib_punt_reason_validate (vlib_punt_reason_t reason);
 
 /**
  * @brief Register a node to receive particular punted buffers
@@ -68,6 +96,8 @@ extern int vlib_punt_register (vlib_punt_hdl_t client,
 extern int vlib_punt_unregister (vlib_punt_hdl_t client,
                                 vlib_punt_reason_t pr, const char *node);
 
+extern u32 vlib_punt_reason_get_flags (vlib_punt_reason_t pr);
+
 /**
  * FOR USE IN THE DP ONLY
  *