Add some srvsvc_NetSessInfo init functions.
[samba.git] / source / rpc_client / init_srvsvc.c
1 /*
2  *  Unix SMB/CIFS implementation.
3  *  RPC Pipe client / server routines
4  *  Copyright (C) Guenther Deschner                  2008.
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 3 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, see <http://www.gnu.org/licenses/>.
18  */
19
20 #include "includes.h"
21
22 /*******************************************************************
23  inits a srvsvc_NetSrvInfo102 structure
24 ********************************************************************/
25
26 void init_srvsvc_NetSrvInfo102(struct srvsvc_NetSrvInfo102 *r,
27                                enum srvsvc_PlatformId platform_id,
28                                const char *server_name,
29                                uint32_t version_major,
30                                uint32_t version_minor,
31                                uint32_t server_type,
32                                const char *comment,
33                                uint32_t users,
34                                uint32_t disc,
35                                uint32_t hidden,
36                                uint32_t announce,
37                                uint32_t anndelta,
38                                uint32_t licenses,
39                                const char *userpath)
40 {
41         r->platform_id = platform_id;
42         r->server_name = server_name;
43         r->version_major = version_major;
44         r->version_minor = version_minor;
45         r->server_type = server_type;
46         r->comment = comment;
47         r->users = users;
48         r->disc = disc;
49         r->hidden = hidden;
50         r->announce = announce;
51         r->anndelta = anndelta;
52         r->licenses = licenses;
53         r->userpath = userpath;
54 }
55
56 /*******************************************************************
57  inits a srvsvc_NetSrvInfo101 structure
58 ********************************************************************/
59
60 void init_srvsvc_NetSrvInfo101(struct srvsvc_NetSrvInfo101 *r,
61                                enum srvsvc_PlatformId platform_id,
62                                const char *server_name,
63                                uint32_t version_major,
64                                uint32_t version_minor,
65                                uint32_t server_type,
66                                const char *comment)
67 {
68         r->platform_id = platform_id;
69         r->server_name = server_name;
70         r->version_major = version_major;
71         r->version_minor = version_minor;
72         r->server_type = server_type;
73         r->comment = comment;
74 }
75
76 /*******************************************************************
77  inits a srvsvc_NetSrvInfo100 structure
78 ********************************************************************/
79
80 void init_srvsvc_NetSrvInfo100(struct srvsvc_NetSrvInfo100 *r,
81                                enum srvsvc_PlatformId platform_id,
82                                const char *server_name)
83 {
84         r->platform_id = platform_id;
85         r->server_name = server_name;
86 }
87
88 /*******************************************************************
89  inits a srvsvc_NetShareInfo0 structure
90 ********************************************************************/
91
92 void init_srvsvc_NetShareInfo0(struct srvsvc_NetShareInfo0 *r,
93                                const char *name)
94 {
95         r->name = name;
96 }
97
98 /*******************************************************************
99  inits a srvsvc_NetShareInfo1 structure
100 ********************************************************************/
101
102 void init_srvsvc_NetShareInfo1(struct srvsvc_NetShareInfo1 *r,
103                                const char *name,
104                                enum srvsvc_ShareType type,
105                                const char *comment)
106 {
107         r->name = name;
108         r->type = type;
109         r->comment = comment;
110 }
111
112 /*******************************************************************
113  inits a srvsvc_NetShareInfo2 structure
114 ********************************************************************/
115
116 void init_srvsvc_NetShareInfo2(struct srvsvc_NetShareInfo2 *r,
117                                const char *name,
118                                enum srvsvc_ShareType type,
119                                const char *comment,
120                                uint32_t permissions,
121                                uint32_t max_users,
122                                uint32_t current_users,
123                                const char *path,
124                                const char *password)
125 {
126         r->name = name;
127         r->type = type;
128         r->comment = comment;
129         r->permissions = permissions;
130         r->max_users = max_users;
131         r->current_users = current_users;
132         r->path = path;
133         r->password = password;
134 }
135
136 /*******************************************************************
137  inits a srvsvc_NetShareInfo501 structure
138 ********************************************************************/
139
140 void init_srvsvc_NetShareInfo501(struct srvsvc_NetShareInfo501 *r,
141                                  const char *name,
142                                  enum srvsvc_ShareType type,
143                                  const char *comment,
144                                  uint32_t csc_policy)
145 {
146         r->name = name;
147         r->type = type;
148         r->comment = comment;
149         r->csc_policy = csc_policy;
150 }
151
152 /*******************************************************************
153  inits a srvsvc_NetShareInfo502 structure
154 ********************************************************************/
155
156 void init_srvsvc_NetShareInfo502(struct srvsvc_NetShareInfo502 *r,
157                                  const char *name,
158                                  enum srvsvc_ShareType type,
159                                  const char *comment,
160                                  uint32_t permissions,
161                                  int32_t max_users,
162                                  uint32_t current_users,
163                                  const char *path,
164                                  const char *password,
165                                  uint32_t unknown,
166                                  struct security_descriptor *sd)
167 {
168         r->name = name;
169         r->type = type;
170         r->comment = comment;
171         r->permissions = permissions;
172         r->max_users = max_users;
173         r->current_users = current_users;
174         r->path = path;
175         r->password = password;
176         r->unknown = unknown;
177         r->sd = sd;
178 }
179
180 /*******************************************************************
181  inits a srvsvc_NetShareInfo1004 structure
182 ********************************************************************/
183
184 void init_srvsvc_NetShareInfo1004(struct srvsvc_NetShareInfo1004 *r,
185                                   const char *comment)
186 {
187         r->comment = comment;
188 }
189
190 /*******************************************************************
191  inits a srvsvc_NetShareInfo1005 structure
192 ********************************************************************/
193
194 void init_srvsvc_NetShareInfo1005(struct srvsvc_NetShareInfo1005 *r,
195                                   uint32_t dfs_flags)
196 {
197         r->dfs_flags = dfs_flags;
198 }
199
200 /*******************************************************************
201  inits a srvsvc_NetShareInfo1006 structure
202 ********************************************************************/
203
204 void init_srvsvc_NetShareInfo1006(struct srvsvc_NetShareInfo1006 *r,
205                                   int32_t max_users)
206 {
207         r->max_users = max_users;
208 }
209
210 /*******************************************************************
211  inits a srvsvc_NetShareInfo1007 structure
212 ********************************************************************/
213
214 void init_srvsvc_NetShareInfo1007(struct srvsvc_NetShareInfo1007 *r,
215                                   uint32_t flags,
216                                   const char *alternate_directory_name)
217 {
218         r->flags = flags;
219         r->alternate_directory_name = alternate_directory_name;
220 }
221
222 /*******************************************************************
223  inits a srvsvc_NetRemoteTODInfo structure
224  ********************************************************************/
225
226 void init_srvsvc_NetRemoteTODInfo(struct srvsvc_NetRemoteTODInfo *r,
227                                   uint32_t elapsed,
228                                   uint32_t msecs,
229                                   uint32_t hours,
230                                   uint32_t mins,
231                                   uint32_t secs,
232                                   uint32_t hunds,
233                                   int32_t ttimezone,
234                                   uint32_t tinterval,
235                                   uint32_t day,
236                                   uint32_t month,
237                                   uint32_t year,
238                                   uint32_t weekday)
239 {
240         r->elapsed = elapsed;
241         r->msecs = msecs;
242         r->hours = hours;
243         r->mins = mins;
244         r->secs = secs;
245         r->hunds = hunds;
246         r->timezone = ttimezone;
247         r->tinterval = tinterval;
248         r->day = day;
249         r->month = month;
250         r->year = year;
251         r->weekday = weekday;
252 }
253
254 /*******************************************************************
255  inits a srvsvc_NetSessInfo0 structure
256  ********************************************************************/
257
258 void init_srvsvc_NetSessInfo0(struct srvsvc_NetSessInfo0 *r,
259                               const char *client)
260 {
261         r->client = client;
262 }
263
264 /*******************************************************************
265  inits a srvsvc_NetSessInfo1 structure
266  ********************************************************************/
267
268 void init_srvsvc_NetSessInfo1(struct srvsvc_NetSessInfo1 *r,
269                               const char *client,
270                               const char *user,
271                               uint32_t num_open,
272                               uint32_t _time,
273                               uint32_t idle_time,
274                               uint32_t user_flags)
275 {
276         r->client = client;
277         r->user = user;
278         r->num_open = num_open;
279         r->time = _time;
280         r->idle_time = idle_time;
281         r->user_flags = user_flags;
282 }
283
284 /*******************************************************************
285  inits a srvsvc_NetSessInfo2 structure
286  ********************************************************************/
287
288 void init_srvsvc_NetSessInfo2(struct srvsvc_NetSessInfo2 *r,
289                               const char *client,
290                               const char *user,
291                               uint32_t num_open,
292                               uint32_t _time,
293                               uint32_t idle_time,
294                               uint32_t user_flags,
295                               const char *client_type)
296 {
297         r->client = client;
298         r->user = user;
299         r->num_open = num_open;
300         r->time = _time;
301         r->idle_time = idle_time;
302         r->user_flags = user_flags;
303         r->client_type = client_type;
304 }
305
306 /*******************************************************************
307  inits a srvsvc_NetSessInfo10 structure
308  ********************************************************************/
309
310 void init_srvsvc_NetSessInfo10(struct srvsvc_NetSessInfo10 *r,
311                                const char *client,
312                                const char *user,
313                                uint32_t _time,
314                                uint32_t idle_time)
315 {
316         r->client = client;
317         r->user = user;
318         r->time = _time;
319         r->idle_time = idle_time;
320 }
321
322 /*******************************************************************
323  inits a srvsvc_NetSessInfo502 structure
324  ********************************************************************/
325
326 void init_srvsvc_NetSessInfo502(struct srvsvc_NetSessInfo502 *r,
327                                const char *client,
328                                const char *user,
329                                uint32_t num_open,
330                                uint32_t _time,
331                                uint32_t idle_time,
332                                uint32_t user_flags,
333                                const char *client_type,
334                                const char *transport)
335 {
336         r->client = client;
337         r->user = user;
338         r->num_open = num_open;
339         r->time = _time;
340         r->idle_time = idle_time;
341         r->user_flags = user_flags;
342         r->client_type = client_type;
343         r->transport = transport;
344 }