2 Unix SMB/CIFS implementation.
3 Copyright (C) Andrew Tridgell 2003
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #define TEVENT_DEPRECATED 1
21 #include "lib/events/events.h"
24 this is used to catch debug messages from events
26 static void ev_wrap_debug(void *context
, enum tevent_debug_level level
,
27 const char *fmt
, va_list ap
) PRINTF_ATTRIBUTE(3,0);
29 static void ev_wrap_debug(void *context
, enum tevent_debug_level level
,
30 const char *fmt
, va_list ap
)
35 case TEVENT_DEBUG_FATAL
:
38 case TEVENT_DEBUG_ERROR
:
41 case TEVENT_DEBUG_WARNING
:
44 case TEVENT_DEBUG_TRACE
:
49 if (CHECK_DEBUGLVL(samba_level
)) {
50 vasprintf(&s
, fmt
, ap
);
52 DEBUG(samba_level
, ("tevent: %s", s
));
58 create a event_context structure. This must be the first events
59 call, and all subsequent calls pass this event_context as the first
60 element. Event handlers also receive this as their first argument.
62 This samba4 specific call sets the samba4 debug handler.
64 struct tevent_context
*s4_event_context_init(TALLOC_CTX
*mem_ctx
)
66 struct tevent_context
*ev
;
68 ev
= tevent_context_init_byname(mem_ctx
, NULL
);
70 tevent_set_debug(ev
, ev_wrap_debug
, NULL
);
71 tevent_loop_allow_nesting(ev
);