aboutsummaryrefslogtreecommitdiffstats
path: root/extras/emacs/README
blob: 2f1bd6c97e9c04275af8bcdcdcc47a968653d55a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
;;; Copyright (c) 2016 Cisco and/or its affiliates.
;;; Licensed under the Apache License, Version 2.0 (the "License");
;;; you may not use this file except in compliance with the License.
;;; You may obtain a copy of the License at:
;;;
;;;     http://www.apache.org/licenses/LICENSE-2.0
;;;
;;; Unless required by applicable law or agreed to in writing, software
;;; distributed under the License is distributed on an "AS IS" BASIS,
;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;;; See the License for the specific language governing permissions and
;;; limitations under the License.

How to construct a complete plugin using the emacs skeletons

0. Install open-vpp, including the development package.

1. Load emacs skeletons

   M-x find-file all-skel.el
   M-x eval-buffer

2. Pick a single-word, lower-case name for your plugin. For example: macswap.
Hereafter, we'll refer to the selected name as <plugin-name>.

3. Generate the entire plugin:

   M-x make-plugin
   Plugin-name: <plugin-name>

Or, generate each file individually:

3. Create the required directories, e.g. under .../vpp

   $ mkdir -p <plugin-name>-plugin/<plugin-name>

4. Create <plugin-name>-plugin/{configure.ac,Makefile.am}

   M-x find-file <plugin-name>-plugin/configure.ac
   M-x plugin-configure-skel
   
   M-x find-file <plugin-name>-plugin/Makefile.am
   M-x skel-plugin-makefile

5. Create the api skeleton
   M-x find-file <plugin-name>-plugin/<plugin-name>/<plugin-name>.api
   M-x skel-plugin-api

6. Create the api message enumeration header file
   M-x find-file <plugin-name>-plugin/<plugin-name>/<plugin-name>_msg_enum.h
   M-x skel-plugin-msg-enum

7. Create the "all-api" header file
   M-x find-file <plugin-name>-plugin/<plugin-name>/<plugin-name>_all_api_h.h
   M-x skel-plugin-all-apih

8. Create the main data structure definition header file
   M-x find-file <plugin-name>-plugin/<plugin-name>/<plugin-name>.h
   M-x skel-plugin-h

9. Create the plugin main C file
   M-x find-file <plugin-name>-plugin/<plugin-name>/<plugin-name>.c
   M-x skel-plugin-main

10. Create the vpp-api-test plugin main C file
   M-x find-file <plugin-name>-plugin/<plugin-name>/<plugin-name>_test.c
   M-x skel-plugin-test

11. Create the data plane packet processing node
   M-x find-file <plugin-name>-plugin/<plugin-name>/node.c
   M-x skel-plugin-node

12. Process autotools input files

   $ cd <plugin-name>-plugin
   $ autoreconf -i -f

13. Build the plugin skeleton

   $ mkdir build
   $ cd build
   $ ../configure
   $ make
   $ sudo make install