;;; 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.
;;; tunnel-encap-skel.el - tunnel interface output skeleton
(require 'skeleton)
(define-skeleton skel-tunnel-encap
"Insert a tunnel encap implementation"
nil
'(setq encap_stack (skeleton-read "encap_stack (e.g ip4_udp_lisp): "))
'(setq ENCAP_STACK (upcase encap_stack))
'(setq encap-stack (replace-regexp-in-string "_" "-" encap_stack))
'(setq ENCAP-STACK (upcase encap-stack))
"
#include <vppinfra/error.h>
#include <vppinfra/hash.h>
#include <vnet/vnet.h>
#include <vnet/ip/ip.h>
#include <vnet/ethernet/ethernet.h>
#include <vnet/" encap-stack "/" encap_stack ".h>
/* Statistics (not really errors) */
#define foreach_" encap_stack "_encap_error \\
_(ENCAPSULATED, \"good packets encapsulated\")
static char * " encap_stack "_encap_error_strings[] = {
#define _(sym,string) string,
foreach_" encap_stack "_encap_error
#undef _
};
typedef enum {
#define _(sym,str) " ENCAP_STACK "_ENCAP_ERROR_##sym,
foreach_" encap_stack "_encap_error
#undef _
" ENCAP_STACK "_ENCAP_N_ERROR,
} " encap_stack "_encap_error_t;