FD.io VPP
v20.01-48-g3e0dafb74
Vector Packet Processing
vapi_dbg.h
Go to the documentation of this file.
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 __included_vapi_debug_h__
19
#define __included_vapi_debug_h__
20
21
/* controls debug prints */
22
#define VAPI_DEBUG (0)
23
#define VAPI_DEBUG_CONNECT (0)
24
#define VAPI_DEBUG_ALLOC (0)
25
#define VAPI_CPP_DEBUG_LEAKS (0)
26
27
#if VAPI_DEBUG
28
#include <stdio.h>
29
#define VAPI_DEBUG_FILE_DEF \
30
static const char *__file = NULL; \
31
{ \
32
__file = strrchr (__FILE__, '/'); \
33
if (__file) \
34
{ \
35
++__file; \
36
} \
37
else \
38
{ \
39
__file = __FILE__; \
40
} \
41
}
42
43
#define VAPI_DBG(fmt, ...) \
44
do \
45
{ \
46
VAPI_DEBUG_FILE_DEF \
47
printf ("DBG:%s:%d:%s():" fmt, __file, __LINE__, __func__, \
48
##__VA_ARGS__); \
49
printf ("\n"); \
50
fflush (stdout); \
51
} \
52
while (0);
53
54
#define VAPI_ERR(fmt, ...) \
55
do \
56
{ \
57
VAPI_DEBUG_FILE_DEF \
58
printf ("ERR:%s:%d:%s():" fmt, __file, __LINE__, __func__, \
59
##__VA_ARGS__); \
60
printf ("\n"); \
61
fflush (stdout); \
62
} \
63
while (0);
64
#else
65
#define VAPI_DBG(...)
66
#define VAPI_ERR(...)
67
#endif
68
69
#endif
/* __included_vapi_debug_h__ */
70
71
/*
72
* fd.io coding-style-patch-verification: ON
73
*
74
* Local Variables:
75
* eval: (c-set-style "gnu")
76
* End:
77
*/
src
vpp-api
vapi
vapi_dbg.h
Generated on Wed Sep 9 2020 00:05:46 for FD.io VPP by
1.8.13