1e6d35eb78bf04a7b752a0d565708433a14359ec
[mat/samba.git] / source4 / dsdb / kcc / kcc_service.h
1 /* 
2    Unix SMB/CIFS mplementation.
3
4    KCC service
5    
6    Copyright (C) Andrew Tridgell 2009
7    based on drepl service code
8     
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 3 of the License, or
12    (at your option) any later version.
13    
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18    
19    You should have received a copy of the GNU General Public License
20    along with this program.  If not, see <http://www.gnu.org/licenses/>.
21    
22 */
23
24 #ifndef _DSDB_REPL_KCC_SERVICE_H_
25 #define _DSDB_REPL_KCC_SERVICE_H_
26
27 #include "librpc/gen_ndr/ndr_drsuapi_c.h"
28
29 struct kccsrv_partition {
30         struct kccsrv_partition *prev, *next;
31         struct kccsrv_service *service;
32
33         /* the dn of the partition */
34         struct ldb_dn *dn;
35 };
36
37
38 struct kccsrv_service {
39         /* the whole kcc service is in one task */
40         struct task_server *task;
41
42         /* the time the service was started */
43         struct timeval startup_time;
44
45         /* dn of our configuration partition */
46         struct ldb_dn *config_dn;
47
48         /* 
49          * system session info
50          * with machine account credentials
51          */
52         struct auth_session_info *system_session_info;
53
54         /* list of local partitions */
55         struct kccsrv_partition *partitions;
56
57         /*
58          * a connection to the local samdb
59          */
60         struct ldb_context *samdb;
61
62         /* the guid of our NTDS Settings object, which never changes! */
63         struct GUID ntds_guid;
64
65         /* some stuff for periodic processing */
66         struct {
67                 /*
68                  * the interval between to periodic runs
69                  */
70                 uint32_t interval;
71
72                 /*
73                  * the timestamp for the next event,
74                  * this is the timstamp passed to event_add_timed()
75                  */
76                 struct timeval next_event;
77
78                 /* here we have a reference to the timed event the schedules the periodic stuff */
79                 struct tevent_timer *te;
80
81                 /* samba_runcmd_send service for samba_kcc */
82                 struct tevent_req *subreq;
83
84                 /* return status of samba_kcc */
85                 NTSTATUS status;
86
87         } periodic;
88
89         time_t last_deleted_check;
90
91         bool am_rodc;
92
93         /* run new samba_kcc topology generator code */
94         bool samba_kcc_code;
95 };
96
97 struct kcc_connection_list;
98
99 #include "dsdb/kcc/kcc_service_proto.h"
100
101 #endif /* _DSDB_REPL_KCC_SERVICE_H_ */