summaryrefslogtreecommitdiffstats
path: root/binapi/af_packet/af_packet_rest.ba.go
diff options
context:
space:
mode:
Diffstat (limited to 'binapi/af_packet/af_packet_rest.ba.go')
-rw-r--r--binapi/af_packet/af_packet_rest.ba.go83
1 files changed, 0 insertions, 83 deletions
diff --git a/binapi/af_packet/af_packet_rest.ba.go b/binapi/af_packet/af_packet_rest.ba.go
deleted file mode 100644
index e6c498c..0000000
--- a/binapi/af_packet/af_packet_rest.ba.go
+++ /dev/null
@@ -1,83 +0,0 @@
-// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
-
-package af_packet
-
-import (
- "encoding/json"
- "io/ioutil"
- "net/http"
-)
-
-func RESTHandler(rpc RPCService) http.Handler {
- mux := http.NewServeMux()
- mux.HandleFunc("/af_packet_create", func(w http.ResponseWriter, req *http.Request) {
- var request = new(AfPacketCreate)
- b, err := ioutil.ReadAll(req.Body)
- if err != nil {
- http.Error(w, "read body failed", http.StatusBadRequest)
- return
- }
- if err := json.Unmarshal(b, request); err != nil {
- http.Error(w, "unmarshal data failed", http.StatusBadRequest)
- return
- }
- reply, err := rpc.AfPacketCreate(req.Context(), request)
- if err != nil {
- http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- rep, err := json.MarshalIndent(reply, "", " ")
- if err != nil {
- http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- w.Write(rep)
- })
- mux.HandleFunc("/af_packet_delete", func(w http.ResponseWriter, req *http.Request) {
- var request = new(AfPacketDelete)
- b, err := ioutil.ReadAll(req.Body)
- if err != nil {
- http.Error(w, "read body failed", http.StatusBadRequest)
- return
- }
- if err := json.Unmarshal(b, request); err != nil {
- http.Error(w, "unmarshal data failed", http.StatusBadRequest)
- return
- }
- reply, err := rpc.AfPacketDelete(req.Context(), request)
- if err != nil {
- http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- rep, err := json.MarshalIndent(reply, "", " ")
- if err != nil {
- http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- w.Write(rep)
- })
- mux.HandleFunc("/af_packet_set_l4_cksum_offload", func(w http.ResponseWriter, req *http.Request) {
- var request = new(AfPacketSetL4CksumOffload)
- b, err := ioutil.ReadAll(req.Body)
- if err != nil {
- http.Error(w, "read body failed", http.StatusBadRequest)
- return
- }
- if err := json.Unmarshal(b, request); err != nil {
- http.Error(w, "unmarshal data failed", http.StatusBadRequest)
- return
- }
- reply, err := rpc.AfPacketSetL4CksumOffload(req.Context(), request)
- if err != nil {
- http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- rep, err := json.MarshalIndent(reply, "", " ")
- if err != nil {
- http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- w.Write(rep)
- })
- return http.HandlerFunc(mux.ServeHTTP)
-}