40452e6034a7170a99b50133894ede3fe5566ae3
[ira/wip.git] / source / include / core.h
1 /* 
2    Unix SMB/CIFS implementation.
3    Core Samba data types
4
5    Copyright (C) Andrew Tridgell              1992-2000
6    Copyright (C) Stefan Metzmacher                        2004
7    Copyright (C) Jelmer Vernooij                          2005
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 2 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, write to the Free Software
21    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24 #ifndef _SAMBA_CORE_H
25 #define _SAMBA_CORE_H
26
27 #include "libcli/util/nt_status.h"
28
29 typedef bool BOOL;
30
31 #define False false
32 #define True true
33
34 /* used to hold an arbitrary blob of data */
35 typedef struct datablob {
36         uint8_t *data;
37         size_t length;
38 } DATA_BLOB;
39
40 struct data_blob_list_item {
41         struct data_blob_list_item *prev,*next;
42         DATA_BLOB blob;
43 };
44
45 /* by making struct ldb_val and DATA_BLOB the same, we can simplify
46    a fair bit of code */
47 #define ldb_val datablob
48
49 /* 64 bit time (100 nanosec) 1601 - cifs6.txt, section 3.5, page 30, 4 byte aligned */
50 typedef uint64_t NTTIME;
51
52 /*
53   we use struct ipv4_addr to avoid having to include all the
54   system networking headers everywhere
55 */
56 struct ipv4_addr {
57         uint32_t addr;
58 };
59
60 typedef NTSTATUS (*init_module_fn) (void);
61
62 /* 
63    use the same structure for dom_sid2 as dom_sid. A dom_sid2 is really
64    just a dom sid, but with the sub_auths represented as a conformant
65    array. As with all in-structure conformant arrays, the array length
66    is placed before the start of the structure. That's what gives rise
67    to the extra num_auths elemenent. We don't want the Samba code to
68    have to bother with such esoteric NDR details, so its easier to just
69    define it as a dom_sid and use pidl magic to make it all work. It
70    just means you need to mark a sid as a "dom_sid2" in the IDL when you
71    know it is of the conformant array variety
72 */
73 #define dom_sid2 dom_sid
74
75 /* same struct as dom_sid but inside a 28 bytes fixed buffer in NDR */
76 #define dom_sid28 dom_sid
77
78 /* protocol types. It assumes that higher protocols include lower protocols
79    as subsets. FIXME: Move to one of the smb-specific headers */
80 enum protocol_types {
81         PROTOCOL_NONE,
82         PROTOCOL_CORE,
83         PROTOCOL_COREPLUS,
84         PROTOCOL_LANMAN1,
85         PROTOCOL_LANMAN2,
86         PROTOCOL_NT1,
87         PROTOCOL_SMB2
88 };
89
90 /* passed to br lock code. FIXME: Move to one of the smb-specific headers */
91 enum brl_type {
92         READ_LOCK,
93         WRITE_LOCK,
94         PENDING_READ_LOCK,
95         PENDING_WRITE_LOCK
96 };
97
98 enum server_role {
99         ROLE_STANDALONE=0,
100         ROLE_DOMAIN_MEMBER=1,
101         ROLE_DOMAIN_CONTROLLER=2,
102 };
103
104 enum announce_as {/* Types of machine we can announce as. */
105         ANNOUNCE_AS_NT_SERVER=1,
106         ANNOUNCE_AS_WIN95=2,
107         ANNOUNCE_AS_WFW=3,
108         ANNOUNCE_AS_NT_WORKSTATION=4
109 };
110
111
112 #endif /* _SAMBA_CORE_H */