2 Unix SMB/CIFS implementation.
5 Copyright (C) Simo Sorce <idra@samba.org> 2010
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 struct tevent_context
*server_event_ctx
= NULL
;
25 struct tevent_context
*server_event_context(void)
27 if (!server_event_ctx
) {
29 * Note we MUST use the NULL context here, not the
30 * autofree context, to avoid side effects in forked
33 server_event_ctx
= s3_tevent_context_init(NULL
);
35 if (!server_event_ctx
) {
36 smb_panic("Could not init server's event context");
38 return server_event_ctx
;
41 void server_event_context_free(void)
43 TALLOC_FREE(server_event_ctx
);
46 struct messaging_context
*server_msg_ctx
= NULL
;
48 struct messaging_context
*server_messaging_context(void)
50 if (server_msg_ctx
== NULL
) {
52 * Note we MUST use the NULL context here, not the
53 * autofree context, to avoid side effects in forked
56 server_msg_ctx
= messaging_init(NULL
,
58 server_event_context());
60 if (server_msg_ctx
== NULL
) {
61 DEBUG(0, ("Could not init server's messaging context.\n"));
63 return server_msg_ctx
;
66 void server_messaging_context_free(void)
68 TALLOC_FREE(server_msg_ctx
);