1 #ifndef KERNEL_VPP_SHARED_H_
2 #define KERNEL_VPP_SHARED_H_
4 * Copyright (c) 2022 Intel and/or its affiliates.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 typedef struct vac_t vac_t;
21 * Callback function invoked for received event messages.
23 * @param data associated event message, destroyed by VPP API wrapper
24 * @param data_len length of the event message
25 * @param ctx user data, as passed to register_event
27 typedef void (*event_cb_t) (char *data, int data_len, void *ctx);
30 * Wrapper around VPP binary API client.
36 * Destroy the VPP API client.
38 void (*destroy) (vac_t *this);
41 * Send VPP API message and wait for a reply
43 * @param in VPP API message to send
44 * @param in_len length of the message to send
45 * @param out received VPP API message
46 * @param out_len length of the received message
48 status_t (*send) (vac_t *this, char *in, int in_len, char **out,
52 * Send VPP API dump message and wait for a reply.
54 * @param in VPP API message to send
55 * @param in_len length of the message to send
56 * @param out received VPP API message
57 * @param out_len length of the received message
59 status_t (*send_dump) (vac_t *this, char *in, int in_len, char **out,
63 * Register for VPP API event of a given kind.
65 * @param in VPP API event message to register
66 * @param in_len length of the event message to register
67 * @param cb callback function to register
68 * @param event_id event ID
69 * @param ctx user data passed to callback invocations
71 status_t (*register_event) (vac_t *this, char *in, int in_len, event_cb_t cb,
72 uint16_t event_id, void *ctx);
78 * Establishing a binary API connection to VPP.
80 * @param name client name
81 * @return vac_t instance
83 vac_t *vac_create (char *name);
85 #endif /* KERNEL_VPP_SHARED_H_ */