s3:tldap: simplify read_ldap_more() by using asn1_peek_full_tag()
[samba.git] / source3 / lib / background.h
1 /*
2    Unix SMB/CIFS implementation.
3    Regular background jobs as forked helpers
4    Copyright (C) Volker Lendecke 2012
5
6    This program 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 3 of the License, or
9    (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, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef _LIB_BACKGROUND_H_
21 #define _LIB_BACKGROUND_H_
22
23 #include "replace.h"
24 #include <tevent.h>
25 #include "libcli/util/ntstatus.h"
26
27 struct messaging_context;
28
29 /*
30  * From a parent process regularly fork a process and execute fn(). fn()
31  * returns the number of seconds to wait before it is run next time. Returning
32  * -1 means stop the job.
33  */
34
35 struct tevent_req *background_job_send(TALLOC_CTX *mem_ctx,
36                                        struct tevent_context *ev,
37                                        struct messaging_context *msg,
38                                        uint32_t *trigger_msgs,
39                                        size_t num_trigger_msgs,
40                                        time_t initial_wait_sec,
41                                        int (*fn)(void *private_data),
42                                        void *private_data);
43 NTSTATUS background_job_recv(struct tevent_req *req);
44
45 #endif