blob: 2f1bd6c97e9c04275af8bcdcdcc47a968653d55a [file] [log] [blame]
Dave Barach8d0f2f02018-03-12 09:31:36 -04001;;; 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 Barachb852bfa2016-01-04 15:27:42 -050014How to construct a complete plugin using the emacs skeletons
15
160. Install open-vpp, including the development package.
17
181. Load emacs skeletons
19
20 M-x find-file all-skel.el
21 M-x eval-buffer
22
232. Pick a single-word, lower-case name for your plugin. For example: macswap.
24Hereafter, we'll refer to the selected name as <plugin-name>.
25
263. Generate the entire plugin:
27
28 M-x make-plugin
29 Plugin-name: <plugin-name>
30
31Or, generate each file individually:
32
333. Create the required directories, e.g. under .../vpp
34
35 $ mkdir -p <plugin-name>-plugin/<plugin-name>
36
374. 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)ca46d8c2016-03-18 07:22:15 -070043 M-x skel-plugin-makefile
Dave Barachb852bfa2016-01-04 15:27:42 -050044
455. Create the api skeleton
46 M-x find-file <plugin-name>-plugin/<plugin-name>/<plugin-name>.api
Keith Burns (alagalah)ca46d8c2016-03-18 07:22:15 -070047 M-x skel-plugin-api
Dave Barachb852bfa2016-01-04 15:27:42 -050048
496. 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)ca46d8c2016-03-18 07:22:15 -070051 M-x skel-plugin-msg-enum
Dave Barachb852bfa2016-01-04 15:27:42 -050052
537. 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)ca46d8c2016-03-18 07:22:15 -070055 M-x skel-plugin-all-apih
Dave Barachb852bfa2016-01-04 15:27:42 -050056
578. Create the main data structure definition header file
58 M-x find-file <plugin-name>-plugin/<plugin-name>/<plugin-name>.h
Keith Burns (alagalah)ca46d8c2016-03-18 07:22:15 -070059 M-x skel-plugin-h
Dave Barachb852bfa2016-01-04 15:27:42 -050060
619. Create the plugin main C file
62 M-x find-file <plugin-name>-plugin/<plugin-name>/<plugin-name>.c
Keith Burns (alagalah)ca46d8c2016-03-18 07:22:15 -070063 M-x skel-plugin-main
Dave Barachb852bfa2016-01-04 15:27:42 -050064
6510. 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)ca46d8c2016-03-18 07:22:15 -070067 M-x skel-plugin-test
Dave Barachb852bfa2016-01-04 15:27:42 -050068
6911. Create the data plane packet processing node
70 M-x find-file <plugin-name>-plugin/<plugin-name>/node.c
Keith Burns (alagalah)ca46d8c2016-03-18 07:22:15 -070071 M-x skel-plugin-node
Dave Barachb852bfa2016-01-04 15:27:42 -050072
7312. Process autotools input files
74
75 $ cd <plugin-name>-plugin
76 $ autoreconf -i -f
77
7813. Build the plugin skeleton
79
80 $ mkdir build
81 $ cd build
Damjan Marion724f64c2017-01-11 11:11:00 +010082 $ ../configure
Dave Barachb852bfa2016-01-04 15:27:42 -050083 $ make
84 $ sudo make install
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99