Hybrid ICN (hICN) plugin  v21.06-rc0-4-g18fa668
error.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2019 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 
20 #ifndef HICN_ERROR_H
21 #define HICN_ERROR_H
22 
23 /******************************************************************************
24  * Error definitions
25  ******************************************************************************/
26 
27 #define foreach_libhicn_error \
28 _(NONE, 0, "OK") \
29 _(UNSPECIFIED, 128, "Unspecified Error") \
30 _(NOT_IMPLEMENTED, 180, "Function not yet implemented") \
31 _(NOT_HICN, 202, "Non hICN packet") \
32 _(UNKNOWN_ADDRESS, 210, "Unknown address") \
33 _(INVALID_PARAMETER, 220, "Invalid parameter") \
34 _(INVALID_IP_ADDRESS, 221, "Invalid IP address") \
35 _(CORRUPTED_PACKET, 222, "Corrupted packet ") \
36 _(REWRITE_CKSUM_REQUIRED, 223, "Incremental csum calculation error: cksum required.") \
37 _(UNEXPECTED, 298, "Unexpected error")
38 
39 typedef enum
40 {
41 #define _(a,b,c) HICN_LIB_ERROR_##a = (-b),
42  foreach_libhicn_error
43 #undef _
44  HICN_LIB_N_ERROR,
45 } hicn_lib_error_t;
46 
47 extern const char *HICN_LIB_ERROR_STRING[];
48 
49 #define hicn_strerror(errno) (char *)(HICN_LIB_ERROR_STRING[-errno])
50 
51 #endif /* HICN_ERROR_H */
52 
53 /*
54  * fd.io coding-style-patch-verification: ON
55  *
56  * Local Variables:
57  * eval: (c-set-style "gnu")
58  * End:
59  */