r1925: now we lookup the domain controller
[samba.git] / source4 / libnet / libnet.h
1 /* 
2    Unix SMB/CIFS implementation.
3    
4    Copyright (C) Stefan Metzmacher      2004
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 2 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, write to the Free Software
18    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21 struct libnet_context {
22         TALLOC_CTX *mem_ctx;
23
24         /* here we need:
25          * a client env context
26          * a user env context
27          */
28         struct {
29                 const char *account_name;
30                 const char *domain_name;
31                 const char *password;
32         } user;
33 };
34
35 /* struct and enum for finding a domain controller */
36 enum libnet_find_pdc_level {
37         LIBNET_FIND_PDC_GENERIC
38 };
39
40 union libnet_find_pdc {
41         /* find to a domains PDC */
42         struct {
43                 enum libnet_find_pdc_level level;
44
45                 struct {
46                         const char *domain_name;
47                 } in;
48
49                 struct  {
50                         const char *pdc_name;
51                 } out;
52         } generic;
53 };
54
55 /* struct and enum for connecting to a dcerpc inferface */
56 enum libnet_rpc_connect_level {
57         LIBNET_RPC_CONNECT_PDC
58 };
59
60 union libnet_rpc_connect {
61         /* connect to a domains PDC */
62         struct {
63                 enum libnet_rpc_connect_level level;
64
65                 struct {
66                         const char *domain_name;
67                         const char *dcerpc_iface_name;
68                         const char *dcerpc_iface_uuid;
69                         uint32 dcerpc_iface_version;
70                 } in;
71
72                 struct  {
73                         struct dcerpc_pipe *dcerpc_pipe;
74                 } out;
75         } pdc;
76 };
77
78
79 /* struct and enum for doing a remote password change */
80 enum libnet_ChangePassword_level {
81         LIBNET_CHANGE_PASSWORD_GENERIC,
82         LIBNET_CHANGE_PASSWORD_RPC,
83         LIBNET_CHANGE_PASSWORD_KRB5,
84         LIBNET_CHANGE_PASSWORD_LDAP,
85         LIBNET_CHANGE_PASSWORD_RAP
86 };
87
88 union libnet_ChangePassword {
89         struct {
90                 enum libnet_ChangePassword_level level;
91
92                 struct _libnet_ChangePassword_in {
93                         const char *account_name;
94                         const char *domain_name;
95                         const char *oldpassword;
96                         const char *newpassword;
97                 } in;
98
99                 struct _libnet_ChangePassword_out {
100                         const char *error_string;
101                 } out;
102         } generic;
103
104         struct {
105                 enum libnet_ChangePassword_level level;
106                 struct _libnet_ChangePassword_in in;
107                 struct _libnet_ChangePassword_out out;
108         } rpc;
109
110         struct {
111                 enum libnet_ChangePassword_level level;
112                 struct _libnet_ChangePassword_in in;
113                 struct _libnet_ChangePassword_out out;
114         } krb5;
115
116         struct {
117                 enum libnet_ChangePassword_level level;
118                 struct _libnet_ChangePassword_in in;
119                 struct _libnet_ChangePassword_out out;
120         } ldap;
121
122         struct {
123                 enum libnet_ChangePassword_level level;
124                 struct _libnet_ChangePassword_in in;
125                 struct _libnet_ChangePassword_out out;
126         } rap;
127 };
128
129 /* struct and enum for doing a remote password set */
130 enum libnet_SetPassword_level {
131         LIBNET_SET_PASSWORD_GENERIC,
132         LIBNET_SET_PASSWORD_RPC,
133         LIBNET_SET_PASSWORD_KRB5,
134         LIBNET_SET_PASSWORD_LDAP,
135         LIBNET_SET_PASSWORD_RAP
136 };
137
138 union libnet_SetPassword {
139         struct {
140                 enum libnet_SetPassword_level level;
141
142                 struct _libnet_SetPassword_in {
143                         const char *account_name;
144                         const char *domain_name;
145                         const char *newpassword;
146                 } in;
147
148                 struct _libnet_SetPassword_out {
149                         const char *error_string;
150                 } out;
151         } generic;
152
153         struct {
154                 enum libnet_SetPassword_level level;
155                 struct _libnet_SetPassword_in in;
156                 struct _libnet_SetPassword_out out;
157         } rpc;
158
159         struct {
160                 enum libnet_SetPassword_level level;
161                 struct _libnet_SetPassword_in in;
162                 struct _libnet_SetPassword_out out;
163         } krb5;
164
165         struct {
166                 enum libnet_SetPassword_level level;
167                 struct _libnet_SetPassword_in in;
168                 struct _libnet_SetPassword_out out;
169         } ldap;
170
171         struct {
172                 enum libnet_ChangePassword_level level;
173                 struct _libnet_SetPassword_in in;
174                 struct _libnet_SetPassword_out out;
175         } rap;
176 };