Dave Barach | 8d0f2f0 | 2018-03-12 09:31:36 -0400 | [diff] [blame] | 1 | ;;; Copyright (c) 2016 Cisco and/or its affiliates. |
| 2 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | ;;; you may not use this file except in compliance with the License. |
| 4 | ;;; You may obtain a copy of the License at: |
| 5 | ;;; |
| 6 | ;;; http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | ;;; |
| 8 | ;;; Unless required by applicable law or agreed to in writing, software |
| 9 | ;;; distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | ;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | ;;; See the License for the specific language governing permissions and |
| 12 | ;;; limitations under the License. |
| 13 | |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 14 | How to construct a complete plugin using the emacs skeletons |
| 15 | |
| 16 | 0. Install open-vpp, including the development package. |
| 17 | |
| 18 | 1. Load emacs skeletons |
| 19 | |
| 20 | M-x find-file all-skel.el |
| 21 | M-x eval-buffer |
| 22 | |
| 23 | 2. Pick a single-word, lower-case name for your plugin. For example: macswap. |
| 24 | Hereafter, we'll refer to the selected name as <plugin-name>. |
| 25 | |
| 26 | 3. Generate the entire plugin: |
| 27 | |
| 28 | M-x make-plugin |
| 29 | Plugin-name: <plugin-name> |
| 30 | |
| 31 | Or, generate each file individually: |
| 32 | |
| 33 | 3. Create the required directories, e.g. under .../vpp |
| 34 | |
| 35 | $ mkdir -p <plugin-name>-plugin/<plugin-name> |
| 36 | |
| 37 | 4. Create <plugin-name>-plugin/{configure.ac,Makefile.am} |
| 38 | |
| 39 | M-x find-file <plugin-name>-plugin/configure.ac |
| 40 | M-x plugin-configure-skel |
| 41 | |
| 42 | M-x find-file <plugin-name>-plugin/Makefile.am |
Keith Burns (alagalah) | ca46d8c | 2016-03-18 07:22:15 -0700 | [diff] [blame] | 43 | M-x skel-plugin-makefile |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 44 | |
| 45 | 5. Create the api skeleton |
| 46 | M-x find-file <plugin-name>-plugin/<plugin-name>/<plugin-name>.api |
Keith Burns (alagalah) | ca46d8c | 2016-03-18 07:22:15 -0700 | [diff] [blame] | 47 | M-x skel-plugin-api |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 48 | |
| 49 | 6. Create the api message enumeration header file |
| 50 | M-x find-file <plugin-name>-plugin/<plugin-name>/<plugin-name>_msg_enum.h |
Keith Burns (alagalah) | ca46d8c | 2016-03-18 07:22:15 -0700 | [diff] [blame] | 51 | M-x skel-plugin-msg-enum |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 52 | |
| 53 | 7. Create the "all-api" header file |
| 54 | M-x find-file <plugin-name>-plugin/<plugin-name>/<plugin-name>_all_api_h.h |
Keith Burns (alagalah) | ca46d8c | 2016-03-18 07:22:15 -0700 | [diff] [blame] | 55 | M-x skel-plugin-all-apih |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 56 | |
| 57 | 8. Create the main data structure definition header file |
| 58 | M-x find-file <plugin-name>-plugin/<plugin-name>/<plugin-name>.h |
Keith Burns (alagalah) | ca46d8c | 2016-03-18 07:22:15 -0700 | [diff] [blame] | 59 | M-x skel-plugin-h |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 60 | |
| 61 | 9. Create the plugin main C file |
| 62 | M-x find-file <plugin-name>-plugin/<plugin-name>/<plugin-name>.c |
Keith Burns (alagalah) | ca46d8c | 2016-03-18 07:22:15 -0700 | [diff] [blame] | 63 | M-x skel-plugin-main |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 64 | |
| 65 | 10. Create the vpp-api-test plugin main C file |
| 66 | M-x find-file <plugin-name>-plugin/<plugin-name>/<plugin-name>_test.c |
Keith Burns (alagalah) | ca46d8c | 2016-03-18 07:22:15 -0700 | [diff] [blame] | 67 | M-x skel-plugin-test |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 68 | |
| 69 | 11. Create the data plane packet processing node |
| 70 | M-x find-file <plugin-name>-plugin/<plugin-name>/node.c |
Keith Burns (alagalah) | ca46d8c | 2016-03-18 07:22:15 -0700 | [diff] [blame] | 71 | M-x skel-plugin-node |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 72 | |
| 73 | 12. Process autotools input files |
| 74 | |
| 75 | $ cd <plugin-name>-plugin |
| 76 | $ autoreconf -i -f |
| 77 | |
| 78 | 13. Build the plugin skeleton |
| 79 | |
| 80 | $ mkdir build |
| 81 | $ cd build |
Damjan Marion | 724f64c | 2017-01-11 11:11:00 +0100 | [diff] [blame] | 82 | $ ../configure |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 83 | $ make |
| 84 | $ sudo make install |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |