blob: 4e91e132b8967c8e806774d8aaeaeb536ddd8869 [file] [log] [blame]
Ed Warnickecb9cada2015-12-08 15:45:58 -07001/*
2 * Copyright (c) 2015 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15#ifndef included_vnet_api_errno_h
16#define included_vnet_api_errno_h
17
Klement Sekeraff92efe2017-11-30 07:00:31 +010018#include <stdarg.h>
19#include <vppinfra/types.h>
20#include <vppinfra/format.h>
Damjan Marion81bb6fc2022-01-16 22:47:55 +010021#include <vnet/error.h>
Klement Sekeraff92efe2017-11-30 07:00:31 +010022
Damjan Marion81bb6fc2022-01-16 22:47:55 +010023#define foreach_vnet_api_error foreach_vnet_error
Dave Barach2c41a612019-10-07 12:04:31 -040024
Dave Barachba868bb2016-08-08 09:51:21 -040025typedef enum
26{
Ed Warnickecb9cada2015-12-08 15:45:58 -070027#define _(a,b,c) VNET_API_ERROR_##a = (b),
Dave Barachba868bb2016-08-08 09:51:21 -040028 foreach_vnet_api_error
Ed Warnickecb9cada2015-12-08 15:45:58 -070029#undef _
30 VNET_API_N_ERROR,
31} vnet_api_error_t;
32
Damjan Marion81bb6fc2022-01-16 22:47:55 +010033format_function_t format_vnet_api_errno;
34
35static_always_inline vnet_api_error_t
36vnet_api_error (clib_error_t *err)
Klement Sekeraff92efe2017-11-30 07:00:31 +010037{
Damjan Marion81bb6fc2022-01-16 22:47:55 +010038 if (err->code >= 0)
39 return VNET_API_ERROR_BUG;
40 return err->code;
Klement Sekeraff92efe2017-11-30 07:00:31 +010041}
Klement Sekeraff92efe2017-11-30 07:00:31 +010042
Ed Warnickecb9cada2015-12-08 15:45:58 -070043#endif /* included_vnet_api_errno_h */
Dave Barachba868bb2016-08-08 09:51:21 -040044
45/*
46 * fd.io coding-style-patch-verification: ON
47 *
48 * Local Variables:
49 * eval: (c-set-style "gnu")
50 * End:
51 */