aboutsummaryrefslogtreecommitdiffstats
path: root/src/examples/sample-plugin/sample/sample.c
diff options
context:
space:
mode:
authorRay Kinsella <ray.kinsella@intel.com>2017-06-08 15:54:19 +0100
committerChris Luke <chris_luke@comcast.com>2017-06-09 16:34:40 +0000
commit583dc8d3e23a780c85ebe48ea59f0338aad4df17 (patch)
treec52c9ef7a020b0cce27917bc5e3a6a09f4423639 /src/examples/sample-plugin/sample/sample.c
parent7d5fae861ed243983155ade90c81fc27a47bf376 (diff)
Sample plugin: Add sample plugin documentation
Added some user documentation to sample plugin. Change-Id: I518910f80499307e8fcac8dcef7baaeab5ea8e35 Signed-off-by: Ray Kinsella <ray.kinsella@intel.com>
Diffstat (limited to 'src/examples/sample-plugin/sample/sample.c')
-rw-r--r--src/examples/sample-plugin/sample/sample.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/examples/sample-plugin/sample/sample.c b/src/examples/sample-plugin/sample/sample.c
index 2f8ac4c9857..3929ac23701 100644
--- a/src/examples/sample-plugin/sample/sample.c
+++ b/src/examples/sample-plugin/sample/sample.c
@@ -12,10 +12,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- *------------------------------------------------------------------
- * sample.c - simple MAC-swap API / debug CLI handling
- *------------------------------------------------------------------
+/**
+ * @file
+ * @brief Sample Plugin, plugin API / trace / CLI handling.
*/
#include <vnet/vnet.h>
@@ -65,7 +64,11 @@ VLIB_PLUGIN_REGISTER () = {
};
/* *INDENT-ON* */
-/* Action function shared between message handler and debug CLI */
+/**
+ * @brief Enable/disable the macswap plugin.
+ *
+ * Action function shared between message handler and debug CLI.
+ */
int sample_macswap_enable_disable (sample_main_t * sm, u32 sw_if_index,
int enable_disable)
@@ -135,6 +138,9 @@ macswap_enable_disable_command_fn (vlib_main_t * vm,
return 0;
}
+/**
+ * @brief CLI command to enable/disable the sample macswap plugin.
+ */
VLIB_CLI_COMMAND (sr_content_command, static) = {
.path = "sample macswap",
.short_help =
@@ -142,7 +148,9 @@ VLIB_CLI_COMMAND (sr_content_command, static) = {
.function = macswap_enable_disable_command_fn,
};
-/* API message handler */
+/**
+ * @brief Plugin API message handler.
+ */
static void vl_api_sample_macswap_enable_disable_t_handler
(vl_api_sample_macswap_enable_disable_t * mp)
{
@@ -156,7 +164,9 @@ static void vl_api_sample_macswap_enable_disable_t_handler
REPLY_MACRO(VL_API_SAMPLE_MACSWAP_ENABLE_DISABLE_REPLY);
}
-/* Set up the API message handling tables */
+/**
+ * @brief Set up the API message handling tables.
+ */
static clib_error_t *
sample_plugin_api_hookup (vlib_main_t *vm)
{
@@ -188,6 +198,9 @@ setup_message_id_table (sample_main_t * sm, api_main_t *am)
#undef _
}
+/**
+ * @brief Initialize the sample plugin.
+ */
static clib_error_t * sample_init (vlib_main_t * vm)
{
sample_main_t * sm = &sample_main;
@@ -214,6 +227,9 @@ static clib_error_t * sample_init (vlib_main_t * vm)
VLIB_INIT_FUNCTION (sample_init);
+/**
+ * @brief Hook the sample plugin into the VPP graph hierarchy.
+ */
VNET_FEATURE_INIT (sample, static) =
{
.arc_name = "device-input",