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.
19 * Every 2 seconds, the thread responsible for collecting the available
20 * interfaces will be executed.
21 * Retrying 5 times every 1 second ensures that there is enough time to check
22 * if the interface will be available.
24 #define N_RETRY_GET_IF 5
26 typedef struct vac_t vac_t;
29 * Callback function invoked for received event messages.
31 * @param data associated event message, destroyed by VPP API wrapper
32 * @param data_len length of the event message
33 * @param ctx user data, as passed to register_event
35 typedef void (*event_cb_t) (char *data, int data_len, void *ctx);
38 * Wrapper around VPP binary API client.
44 * Destroy the VPP API client.
46 void (*destroy) (vac_t *this);
49 * Send VPP API message and wait for a reply
51 * @param in VPP API message to send
52 * @param in_len length of the message to send
53 * @param out received VPP API message
54 * @param out_len length of the received message
56 status_t (*send) (vac_t *this, char *in, int in_len, char **out,
60 * Send VPP API dump message and wait for a reply.
62 * @param in VPP API message to send
63 * @param in_len length of the message to send
64 * @param out received VPP API message
65 * @param out_len length of the received message
67 status_t (*send_dump) (vac_t *this, char *in, int in_len, char **out,
71 * Register for VPP API event of a given kind.
73 * @param in VPP API event message to register
74 * @param in_len length of the event message to register
75 * @param cb callback function to register
76 * @param event_id event ID
77 * @param ctx user data passed to callback invocations
79 status_t (*register_event) (vac_t *this, char *in, int in_len, event_cb_t cb,
80 uint16_t event_id, void *ctx);
86 * Establishing a binary API connection to VPP.
88 * @param name client name
89 * @return vac_t instance
91 vac_t *vac_create (char *name);
93 #endif /* KERNEL_VPP_SHARED_H_ */