Klement Sekera | dc15be2 | 2017-06-12 06:49:33 +0200 | [diff] [blame] | 1 | /* |
| 2 | *------------------------------------------------------------------ |
| 3 | * Copyright (c) 2017 Cisco and/or its affiliates. |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at: |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | *------------------------------------------------------------------ |
| 16 | */ |
| 17 | |
| 18 | #ifndef vapi_common_h_included |
| 19 | #define vapi_common_h_included |
| 20 | |
| 21 | #ifdef __cplusplus |
| 22 | extern "C" { |
| 23 | #endif |
| 24 | |
| 25 | typedef enum |
| 26 | { |
| 27 | VAPI_OK = 0, /**< success */ |
| 28 | VAPI_EINVAL, /**< invalid value encountered */ |
| 29 | VAPI_EAGAIN, /**< operation would block */ |
| 30 | VAPI_ENOTSUP, /**< operation not supported */ |
| 31 | VAPI_ENOMEM, /**< out of memory */ |
| 32 | VAPI_ENORESP, /**< no response to request */ |
| 33 | VAPI_EMAP_FAIL, /**< failure while mapping api */ |
| 34 | VAPI_ECON_FAIL, /**< failure while connecting to vpp */ |
| 35 | VAPI_EINCOMPATIBLE, /**< fundamental incompatibility while connecting to vpp |
| 36 | (control ping/control ping reply mismatch) */ |
| 37 | VAPI_MUTEX_FAILURE, /**< failure manipulating internal mutex(es) */ |
| 38 | VAPI_EUSER, /**< user error used for breaking dispatch, |
| 39 | never used by VAPI */ |
| 40 | } vapi_error_e; |
| 41 | |
| 42 | typedef enum |
| 43 | { |
| 44 | VAPI_MODE_BLOCKING = 1, /**< operations block until response received */ |
| 45 | VAPI_MODE_NONBLOCKING = 2, /**< operations never block */ |
| 46 | } vapi_mode_e; |
| 47 | |
| 48 | typedef enum |
| 49 | { |
| 50 | VAPI_WAIT_FOR_READ, /**< wait until some message is readable */ |
| 51 | VAPI_WAIT_FOR_WRITE, /**< wait until a message can be written */ |
| 52 | VAPI_WAIT_FOR_READ_WRITE, /**< wait until a read or write can be done */ |
| 53 | } vapi_wait_mode_e; |
| 54 | |
Neale Ranns | fd67ece | 2017-11-02 11:59:14 -0700 | [diff] [blame] | 55 | typedef unsigned int vapi_msg_id_t; |
| 56 | |
Klement Sekera | dab732a | 2018-07-04 13:43:46 +0200 | [diff] [blame] | 57 | #define VAPI_INVALID_MSG_ID ((vapi_msg_id_t)(~0)) |
Klement Sekera | dc15be2 | 2017-06-12 06:49:33 +0200 | [diff] [blame] | 58 | |
| 59 | #ifdef __cplusplus |
| 60 | } |
| 61 | #endif |
| 62 | |
| 63 | #endif |