/src/opensips/route_trace.c
Line | Count | Source |
1 | | /* |
2 | | * Route tracing hooks for external instrumentation |
3 | | * |
4 | | * Copyright (C) 2026 OpenSIPS Project |
5 | | * |
6 | | * opensips is free software; you can redistribute it and/or modify |
7 | | * it under the terms of the GNU General Public License as published by |
8 | | * the Free Software Foundation; either version 2 of the License, or |
9 | | * (at your option) any later version. |
10 | | * |
11 | | * opensips 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 | | */ |
21 | | |
22 | | #include "route_trace.h" |
23 | | #include "dprint.h" |
24 | | |
25 | | route_trace_handlers_t *route_trace_handlers; |
26 | | |
27 | | int register_route_tracer(route_trace_handlers_t *handlers) |
28 | 0 | { |
29 | 0 | if (!handlers) |
30 | 0 | return -1; |
31 | | |
32 | 0 | if (route_trace_handlers && route_trace_handlers != handlers) { |
33 | 0 | LM_ERR("route tracer already registered\n"); |
34 | 0 | return -1; |
35 | 0 | } |
36 | | |
37 | 0 | route_trace_handlers = handlers; |
38 | 0 | return 0; |
39 | 0 | } |
40 | | |
41 | | void unregister_route_tracer(route_trace_handlers_t *handlers) |
42 | 0 | { |
43 | 0 | if (route_trace_handlers == handlers) |
44 | 0 | route_trace_handlers = NULL; |
45 | 0 | } |