Miroslav Zagorac | 70230c6 | 2020-12-09 16:54:31 +0100 | [diff] [blame] | 1 | /*** |
| 2 | * Copyright 2020 HAProxy Technologies |
| 3 | * |
| 4 | * This file is part of the HAProxy OpenTracing filter. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * as published by the Free Software Foundation; either version 2 |
| 9 | * of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 19 | */ |
| 20 | #ifndef _OPENTRACING_FILTER_H_ |
| 21 | #define _OPENTRACING_FILTER_H_ |
| 22 | |
| 23 | #define FLT_OT_FMT_NAME "'" FLT_OT_OPT_NAME "' : " |
| 24 | #define FLT_OT_FMT_TYPE "'filter' : " |
| 25 | #define FTL_OT_VAR_UUID "sess", "ot", "uuid" |
| 26 | #define FLT_OT_ALERT(f, ...) ha_alert(FLT_OT_FMT_TYPE FLT_OT_FMT_NAME f "\n", ##__VA_ARGS__) |
| 27 | |
| 28 | #define FLT_OT_CONDITION_IF "if" |
| 29 | #define FLT_OT_CONDITION_UNLESS "unless" |
| 30 | |
| 31 | enum FLT_OT_RET_enum { |
| 32 | FLT_OT_RET_ERROR = -1, |
| 33 | FLT_OT_RET_WAIT = 0, |
| 34 | FLT_OT_RET_IGNORE = 0, |
| 35 | FLT_OT_RET_OK = 1, |
| 36 | }; |
| 37 | |
| 38 | #define FLT_OT_DBG_LIST(d,m,p,t,v,f) \ |
| 39 | do { \ |
| 40 | if (LIST_ISEMPTY(&((d)->m##s))) { \ |
| 41 | FLT_OT_DBG(3, p "- no " #m "s " t); \ |
| 42 | } else { \ |
| 43 | const struct flt_ot_conf_##m *v; \ |
| 44 | \ |
| 45 | FLT_OT_DBG(3, p "- " t " " #m "s: %s", \ |
| 46 | flt_ot_list_debug(&((d)->m##s))); \ |
| 47 | list_for_each_entry(v, &((d)->m##s), list) \ |
| 48 | do { f; } while (0); \ |
| 49 | } \ |
| 50 | } while (0) |
| 51 | |
| 52 | |
| 53 | extern const char *ot_flt_id; |
| 54 | extern struct flt_ops flt_ot_ops; |
| 55 | |
| 56 | |
| 57 | bool flt_ot_is_disabled(const struct filter *f FLT_OT_DBG_ARGS(, int event)); |
| 58 | |
| 59 | #endif /* _OPENTRACING_FILTER_H_ */ |
| 60 | |
| 61 | /* |
| 62 | * Local variables: |
| 63 | * c-indent-level: 8 |
| 64 | * c-basic-offset: 8 |
| 65 | * End: |
| 66 | * |
| 67 | * vi: noexpandtab shiftwidth=8 tabstop=8 |
| 68 | */ |