Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 1 | ;;; plugin-h-skel.el - vpp engine plug-in "main.c" skeleton |
| 2 | ;;; |
| 3 | ;;; Copyright (c) 2016 Cisco and/or its affiliates. |
| 4 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | ;;; you may not use this file except in compliance with the License. |
| 6 | ;;; You may obtain a copy of the License at: |
| 7 | ;;; |
| 8 | ;;; http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | ;;; |
| 10 | ;;; Unless required by applicable law or agreed to in writing, software |
| 11 | ;;; distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | ;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | ;;; See the License for the specific language governing permissions and |
| 14 | ;;; limitations under the License. |
| 15 | |
| 16 | (require 'skeleton) |
| 17 | |
Keith Burns (alagalah) | ca46d8c | 2016-03-18 07:22:15 -0700 | [diff] [blame] | 18 | (define-skeleton skel-plugin-h |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 19 | "Insert a plug-in 'main.c' skeleton " |
| 20 | nil |
| 21 | '(if (not (boundp 'plugin-name)) |
| 22 | (setq plugin-name (read-string "Plugin name: "))) |
| 23 | '(setq PLUGIN-NAME (upcase plugin-name)) |
Dave Barach | 1044043 | 2018-04-03 14:58:14 -0400 | [diff] [blame] | 24 | '(setq capital-oh-en "ON") |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 25 | " |
| 26 | /* |
Dave Barach | 11965c7 | 2019-05-28 16:31:05 -0400 | [diff] [blame] | 27 | * " plugin-name ".h - skeleton vpp engine plug-in header file |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 28 | * |
| 29 | * Copyright (c) <current-year> <your-organization> |
| 30 | * Licensed under the Apache License, Version 2.0 (the \"License\"); |
| 31 | * you may not use this file except in compliance with the License. |
| 32 | * You may obtain a copy of the License at: |
| 33 | * |
| 34 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 35 | * |
| 36 | * Unless required by applicable law or agreed to in writing, software |
| 37 | * distributed under the License is distributed on an \"AS IS\" BASIS, |
| 38 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 39 | * See the License for the specific language governing permissions and |
| 40 | * limitations under the License. |
| 41 | */ |
| 42 | #ifndef __included_" plugin-name "_h__ |
| 43 | #define __included_" plugin-name "_h__ |
| 44 | |
| 45 | #include <vnet/vnet.h> |
| 46 | #include <vnet/ip/ip.h> |
| 47 | #include <vnet/ethernet/ethernet.h> |
| 48 | |
| 49 | #include <vppinfra/hash.h> |
| 50 | #include <vppinfra/error.h> |
| 51 | |
| 52 | typedef struct { |
| 53 | /* API message ID base */ |
| 54 | u16 msg_id_base; |
| 55 | |
Dave Barach | f4addbd | 2018-04-30 13:03:46 -0400 | [diff] [blame] | 56 | /* on/off switch for the periodic function */ |
| 57 | u8 periodic_timer_enabled; |
Dave Barach | 11965c7 | 2019-05-28 16:31:05 -0400 | [diff] [blame] | 58 | /* Node index, non-zero if the periodic process has been created */ |
| 59 | u32 periodic_node_index; |
Dave Barach | f4addbd | 2018-04-30 13:03:46 -0400 | [diff] [blame] | 60 | |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 61 | /* convenience */ |
| 62 | vlib_main_t * vlib_main; |
| 63 | vnet_main_t * vnet_main; |
| 64 | ethernet_main_t * ethernet_main; |
| 65 | } " plugin-name "_main_t; |
| 66 | |
Dave Barach | 3f2e775 | 2018-10-03 16:10:04 -0400 | [diff] [blame] | 67 | extern " plugin-name "_main_t " plugin-name "_main; |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 68 | |
Dave Barach | 3f2e775 | 2018-10-03 16:10:04 -0400 | [diff] [blame] | 69 | extern vlib_node_registration_t " plugin-name "_node; |
| 70 | extern vlib_node_registration_t " plugin-name "_periodic_node; |
Dave Barach | f4addbd | 2018-04-30 13:03:46 -0400 | [diff] [blame] | 71 | |
| 72 | /* Periodic function events */ |
| 73 | #define " PLUGIN-NAME "_EVENT1 1 |
| 74 | #define " PLUGIN-NAME "_EVENT2 2 |
| 75 | #define " PLUGIN-NAME "_EVENT_PERIODIC_ENABLE_DISABLE 3 |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 76 | |
Dave Barach | 11965c7 | 2019-05-28 16:31:05 -0400 | [diff] [blame] | 77 | void " plugin-name "_create_periodic_process (" plugin-name "_main_t *); |
| 78 | |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 79 | #endif /* __included_" plugin-name "_h__ */ |
Dave Barach | 1044043 | 2018-04-03 14:58:14 -0400 | [diff] [blame] | 80 | |
| 81 | /* |
| 82 | * fd.io coding-style-patch-verification: " capital-oh-en " |
| 83 | * |
| 84 | * Local Variables: |
| 85 | * eval: (c-set-style \"gnu\") |
| 86 | * End: |
| 87 | */ |
| 88 | |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 89 | ") |