Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 1 | How to construct a complete plugin using the emacs skeletons |
| 2 | |
| 3 | 0. Install open-vpp, including the development package. |
| 4 | |
| 5 | 1. Load emacs skeletons |
| 6 | |
| 7 | M-x find-file all-skel.el |
| 8 | M-x eval-buffer |
| 9 | |
| 10 | 2. Pick a single-word, lower-case name for your plugin. For example: macswap. |
| 11 | Hereafter, we'll refer to the selected name as <plugin-name>. |
| 12 | |
| 13 | 3. Generate the entire plugin: |
| 14 | |
| 15 | M-x make-plugin |
| 16 | Plugin-name: <plugin-name> |
| 17 | |
| 18 | Or, generate each file individually: |
| 19 | |
| 20 | 3. Create the required directories, e.g. under .../vpp |
| 21 | |
| 22 | $ mkdir -p <plugin-name>-plugin/<plugin-name> |
| 23 | |
| 24 | 4. Create <plugin-name>-plugin/{configure.ac,Makefile.am} |
| 25 | |
| 26 | M-x find-file <plugin-name>-plugin/configure.ac |
| 27 | M-x plugin-configure-skel |
| 28 | |
| 29 | M-x find-file <plugin-name>-plugin/Makefile.am |
Keith Burns (alagalah) | ca46d8c | 2016-03-18 07:22:15 -0700 | [diff] [blame] | 30 | M-x skel-plugin-makefile |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 31 | |
| 32 | 5. Create the api skeleton |
| 33 | 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] | 34 | M-x skel-plugin-api |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 35 | |
| 36 | 6. Create the api message enumeration header file |
| 37 | 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] | 38 | M-x skel-plugin-msg-enum |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 39 | |
| 40 | 7. Create the "all-api" header file |
| 41 | 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] | 42 | M-x skel-plugin-all-apih |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 43 | |
| 44 | 8. Create the main data structure definition header file |
| 45 | 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] | 46 | M-x skel-plugin-h |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 47 | |
| 48 | 9. Create the plugin main C file |
| 49 | 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] | 50 | M-x skel-plugin-main |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 51 | |
| 52 | 10. Create the vpp-api-test plugin main C file |
| 53 | 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] | 54 | M-x skel-plugin-test |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 55 | |
| 56 | 11. Create the data plane packet processing node |
| 57 | M-x find-file <plugin-name>-plugin/<plugin-name>/node.c |
Keith Burns (alagalah) | ca46d8c | 2016-03-18 07:22:15 -0700 | [diff] [blame] | 58 | M-x skel-plugin-node |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 59 | |
| 60 | 12. Process autotools input files |
| 61 | |
| 62 | $ cd <plugin-name>-plugin |
| 63 | $ autoreconf -i -f |
| 64 | |
| 65 | 13. Build the plugin skeleton |
| 66 | |
| 67 | $ mkdir build |
| 68 | $ cd build |
Damjan Marion | 724f64c | 2017-01-11 11:11:00 +0100 | [diff] [blame] | 69 | $ ../configure |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 70 | $ make |
| 71 | $ sudo make install |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |