r12617: create a winsdb_handle and pass that arround,
[kai/samba.git] / source4 / nbt_server / wins / winsdb.h
1 /* 
2    Unix SMB/CIFS implementation.
3
4    WINS server structures
5
6    Copyright (C) Andrew Tridgell        2005
7    
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 2 of the License, or
11    (at your option) any later version.
12    
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17    
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23 #define WINSDB_OWNER_LOCAL      "0.0.0.0"
24 #define WINSDB_GROUP_ADDRESS    "255.255.255.255"
25
26 #define WINSDB_FLAG_ALLOC_VERSION       (1<<0)
27 #define WINSDB_FLAG_TAKE_OWNERSHIP      (1<<1)
28
29 struct winsdb_addr {
30         const char *address;
31         const char *wins_owner;
32         time_t expire_time;
33 };
34
35 /*
36   each record in the database contains the following information
37 */
38 struct winsdb_record {
39         struct nbt_name *name;
40         enum wrepl_name_type type;
41         enum wrepl_name_state state;
42         enum wrepl_name_node node;
43         BOOL is_static;
44         time_t expire_time;
45         uint64_t version;
46         const char *wins_owner;
47         struct winsdb_addr **addresses;
48
49         /* only needed for debugging problems */
50         const char *registered_by;
51 };
52
53 struct winsdb_handle {
54         /* wins server database handle */
55         struct ldb_context *ldb;
56 };
57
58 struct wins_server {
59         /* wins server database handle */
60         struct winsdb_handle *wins_db;
61
62         /* some configuration */
63         struct {
64                 /* 
65                  * the interval (in secs) till an active record will be marked as RELEASED
66                  */
67                 uint32_t min_renew_interval;
68                 uint32_t max_renew_interval;
69
70                 /* 
71                  * the interval (in secs) a record remains in RELEASED state,
72                  * before it will be marked as TOMBSTONE
73                  * (also known as extinction interval)
74                  */
75                 uint32_t tombstone_interval;
76         } config;
77 };
78
79 #include "nbt_server/wins/winsdb_proto.h"