r23792: convert Samba4 to GPLv3
[sfrench/samba-autobuild/.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 3 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, see <http://www.gnu.org/licenses/>.
20 */
21
22 #define WINSDB_FLAG_ALLOC_VERSION       (1<<0)
23 #define WINSDB_FLAG_TAKE_OWNERSHIP      (1<<1)
24
25 struct winsdb_addr {
26         const char *address;
27         const char *wins_owner;
28         time_t expire_time;
29 };
30
31 /*
32   each record in the database contains the following information
33 */
34 struct winsdb_record {
35         struct nbt_name *name;
36         enum wrepl_name_type type;
37         enum wrepl_name_state state;
38         enum wrepl_name_node node;
39         BOOL is_static;
40         time_t expire_time;
41         uint64_t version;
42         const char *wins_owner;
43         struct winsdb_addr **addresses;
44
45         /* only needed for debugging problems */
46         const char *registered_by;
47 };
48
49 enum winsdb_handle_caller {
50         WINSDB_HANDLE_CALLER_ADMIN      = 0,
51         WINSDB_HANDLE_CALLER_NBTD       = 1,
52         WINSDB_HANDLE_CALLER_WREPL      = 2
53 };
54
55 struct winsdb_handle {
56         /* wins server database handle */
57         struct ldb_context *ldb;
58
59         /*
60          * the type of the caller, as we pass this to the
61          * 'wins_ldb' ldb module can decide if it needs to verify the 
62          * the records before they're written to disk
63          */
64         enum winsdb_handle_caller caller;
65
66         /* local owner address */
67         const char *local_owner;
68 };
69
70 enum wins_hook_action {
71         WINS_HOOK_ADD           = 0,
72         WINS_HOOK_MODIFY        = 1,
73         WINS_HOOK_DELETE        = 2
74 };
75
76 struct ldb_message;
77
78 #include "nbt_server/wins/winsdb_proto.h"