8ad275229e8cabe69838981a4b69288823452d34
[tprouty/samba.git] / source / rpc_parse / parse_srv.c
1
2 /* 
3  *  Unix SMB/Netbios implementation.
4  *  Version 1.9.
5  *  RPC Pipe client / server routines
6  *  Copyright (C) Andrew Tridgell              1992-1999,
7  *  Copyright (C) Luke Kenneth Casson Leighton 1996-1999,
8  *  Copyright (C) Paul Ashton                  1997-1999.
9  *  
10  *  This program is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU General Public License as published by
12  *  the Free Software Foundation; either version 2 of the License, or
13  *  (at your option) any later version.
14  *  
15  *  This program is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *  GNU General Public License for more details.
19  *  
20  *  You should have received a copy of the GNU General Public License
21  *  along with this program; if not, write to the Free Software
22  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23  */
24
25
26 #include "includes.h"
27
28 extern int DEBUGLEVEL;
29
30
31 /*******************************************************************
32  makes a SH_INFO_1_STR structure
33 ********************************************************************/
34 BOOL make_srv_share_info1_str(SH_INFO_1_STR *sh1, char *net_name, char *remark)
35 {
36         if (sh1 == NULL) return False;
37
38         DEBUG(5,("make_srv_share_info1_str\n"));
39
40         make_unistr2(&(sh1->uni_netname), net_name, strlen(net_name)+1);
41         make_unistr2(&(sh1->uni_remark ), remark  , strlen(remark  )+1);
42
43         return True;
44 }
45
46 /*******************************************************************
47 reads or writes a structure.
48 ********************************************************************/
49 static BOOL srv_io_share_info1_str(char *desc,  SH_INFO_1_STR *sh1, prs_struct *ps, int depth)
50 {
51         if (sh1 == NULL) return False;
52
53         prs_debug(ps, depth, desc, "srv_io_share_info1_str");
54         depth++;
55
56         prs_align(ps);
57
58         smb_io_unistr2("", &(sh1->uni_netname), True, ps, depth); 
59         prs_align(ps);
60         smb_io_unistr2("", &(sh1->uni_remark ), True, ps, depth); 
61         prs_align(ps);
62
63
64         return True;
65 }
66
67 /*******************************************************************
68  makes a SH_INFO_1 structure
69 ********************************************************************/
70 BOOL make_srv_share_info1(SH_INFO_1 *sh1, char *net_name, uint32 type, char *remark)
71 {
72         if (sh1 == NULL) return False;
73
74         DEBUG(5,("make_srv_share_info1: %s %8x %s\n", net_name, type, remark));
75
76         sh1->ptr_netname = net_name != NULL ? 1 : 0;
77         sh1->type        = type;
78         sh1->ptr_remark  = remark   != NULL ? 1 : 0;
79
80         return True;
81 }
82
83 /*******************************************************************
84 reads or writes a structure.
85 ********************************************************************/
86 static BOOL srv_io_share_info1(char *desc,  SH_INFO_1 *sh1, prs_struct *ps, int depth)
87 {
88         if (sh1 == NULL) return False;
89
90         prs_debug(ps, depth, desc, "srv_io_share_info1");
91         depth++;
92
93         prs_align(ps);
94
95         prs_uint32("ptr_netname", ps, depth, &(sh1->ptr_netname));
96         prs_uint32("type       ", ps, depth, &(sh1->type       ));
97         prs_uint32("ptr_remark ", ps, depth, &(sh1->ptr_remark));
98
99         return True;
100 }
101
102 /*******************************************************************
103 reads or writes a structure.
104 ********************************************************************/
105 static BOOL srv_io_srv_share_info_1(char *desc,  SRV_SHARE_INFO_1 *ctr, prs_struct *ps, int depth)
106 {
107         if (ctr == NULL) return False;
108
109         prs_debug(ps, depth, desc, "srv_io_share_1_ctr");
110         depth++;
111
112         prs_align(ps);
113
114         prs_uint32("num_entries_read", ps, depth, &(ctr->num_entries_read));
115         prs_uint32("ptr_share_info", ps, depth, &(ctr->ptr_share_info));
116
117         if (ctr->ptr_share_info != 0)
118         {
119                 uint32 i;
120                 uint32 num_entries = ctr->num_entries_read;
121                 if (num_entries > MAX_SHARE_ENTRIES)
122                 {
123                         num_entries = MAX_SHARE_ENTRIES; /* report this! */
124                 }
125
126                 prs_uint32("num_entries_read2", ps, depth, &(ctr->num_entries_read2));
127
128                 SMB_ASSERT_ARRAY(ctr->info_1, num_entries);
129
130                 for (i = 0; i < num_entries; i++)
131                 {
132                         prs_grow(ps);
133                         srv_io_share_info1("", &(ctr->info_1[i]), ps, depth); 
134                 }
135
136                 for (i = 0; i < num_entries; i++)
137                 {
138                         prs_grow(ps);
139                         srv_io_share_info1_str("", &(ctr->info_1_str[i]), ps, depth); 
140                 }
141
142                 prs_align(ps);
143         }
144
145         return True;
146 }
147
148 /*******************************************************************
149  makes a SH_INFO_2_STR structure
150 ********************************************************************/
151 BOOL make_srv_share_info2_str(SH_INFO_2_STR *sh2,
152                                 char *net_name, char *remark,
153                                 char *path, char *pass)
154 {
155         if (sh2 == NULL) return False;
156
157         DEBUG(5,("make_srv_share_info2_str\n"));
158
159         make_unistr2(&(sh2->uni_netname), net_name, strlen(net_name)+1);
160         make_unistr2(&(sh2->uni_remark ), remark  , strlen(remark  )+1);
161         make_unistr2(&(sh2->uni_path   ), path    , strlen(path    )+1);
162         make_unistr2(&(sh2->uni_passwd ), pass    , strlen(pass    )+1);
163
164         return True;
165 }
166
167 /*******************************************************************
168 reads or writes a structure.
169 ********************************************************************/
170 static BOOL srv_io_share_info2_str(char *desc,  SH_INFO_2_STR *ss2, SH_INFO_2 *sh2, prs_struct *ps, int depth)
171 {
172         if (ss2 == NULL) return False;
173
174         prs_debug(ps, depth, desc, "srv_io_share_info2_str");
175         depth++;
176
177         prs_align(ps);
178
179         smb_io_unistr2("", &(ss2->uni_netname), sh2->ptr_netname, ps, depth); 
180         prs_align(ps);
181         smb_io_unistr2("", &(ss2->uni_remark ), sh2->ptr_remark , ps, depth); 
182         prs_align(ps);
183         smb_io_unistr2("", &(ss2->uni_path   ), sh2->ptr_path   , ps, depth); 
184         prs_align(ps);
185         smb_io_unistr2("", &(ss2->uni_passwd ), sh2->ptr_passwd , ps, depth); 
186         prs_align(ps);
187
188         return True;
189 }
190
191 /*******************************************************************
192  makes a SH_INFO_2 structure
193 ********************************************************************/
194 BOOL make_srv_share_info2(SH_INFO_2 *sh2,
195                                 char *net_name, uint32 type, char *remark,
196                                 uint32 perms, uint32 max_uses, uint32 num_uses,
197                                 char *path, char *pass)
198 {
199         if (sh2 == NULL) return False;
200
201         DEBUG(5,("make_srv_share_info2: %s %8x %s\n", net_name, type, remark));
202
203         sh2->ptr_netname = net_name != NULL ? 1 : 0;
204         sh2->type        = type;
205         sh2->ptr_remark  = remark   != NULL ? 1 : 0;
206         sh2->perms       = perms;
207         sh2->max_uses    = max_uses;
208         sh2->num_uses    = num_uses;
209         sh2->type        = type;
210         sh2->ptr_path    = path     != NULL ? 1 : 0;
211         sh2->ptr_passwd  = pass     != NULL ? 1 : 0;
212
213         return True;
214 }
215
216 /*******************************************************************
217 reads or writes a structure.
218 ********************************************************************/
219 static BOOL srv_io_share_info2(char *desc,  SH_INFO_2 *sh2, prs_struct *ps, int depth)
220 {
221         if (sh2 == NULL) return False;
222
223         prs_debug(ps, depth, desc, "srv_io_share_info2");
224         depth++;
225
226         prs_align(ps);
227
228         prs_uint32("ptr_netname", ps, depth, &(sh2->ptr_netname));
229         prs_uint32("type       ", ps, depth, &(sh2->type       ));
230         prs_uint32("ptr_remark ", ps, depth, &(sh2->ptr_remark ));
231         prs_uint32("perms      ", ps, depth, &(sh2->perms      ));
232         prs_uint32("max_uses   ", ps, depth, &(sh2->max_uses   ));
233         prs_uint32("num_uses   ", ps, depth, &(sh2->num_uses   ));
234         prs_uint32("ptr_path   ", ps, depth, &(sh2->ptr_path   ));
235         prs_uint32("ptr_passwd ", ps, depth, &(sh2->ptr_passwd ));
236
237         return True;
238 }
239
240 /*******************************************************************
241 reads or writes a structure.
242 ********************************************************************/
243 static BOOL srv_io_srv_share_info_2(char *desc,  SRV_SHARE_INFO_2 *ctr, prs_struct *ps, int depth)
244 {
245         if (ctr == NULL) return False;
246
247         prs_debug(ps, depth, desc, "srv_io_share_2_ctr");
248         depth++;
249
250         prs_align(ps);
251
252         prs_uint32("num_entries_read", ps, depth, &(ctr->num_entries_read));
253         prs_uint32("ptr_share_info", ps, depth, &(ctr->ptr_share_info));
254
255         if (ctr->ptr_share_info != 0)
256         {
257                 uint32 i;
258                 uint32 num_entries = ctr->num_entries_read;
259                 if (num_entries > MAX_SHARE_ENTRIES)
260                 {
261                         num_entries = MAX_SHARE_ENTRIES; /* report this! */
262                 }
263
264                 prs_uint32("num_entries_read2", ps, depth, &(ctr->num_entries_read2));
265
266                 SMB_ASSERT_ARRAY(ctr->info_2, num_entries);
267
268                 for (i = 0; i < num_entries; i++)
269                 {
270                         prs_grow(ps);
271                         if (!srv_io_share_info2("", &(ctr->info_2[i]), ps, depth)) return False;
272                 }
273
274                 for (i = 0; i < num_entries; i++)
275                 {
276                         prs_grow(ps);
277                         if (!srv_io_share_info2_str("", &(ctr->info_2_str[i]), &(ctr->info_2[i]), ps, depth)) return False;
278                 }
279
280                 prs_align(ps);
281         }
282
283         return True;
284 }
285
286 /*******************************************************************
287 reads or writes a structure.
288 ********************************************************************/
289 static BOOL srv_io_srv_share_ctr(char *desc,  SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth)
290 {
291         if (ctr == NULL) return False;
292
293         prs_debug(ps, depth, desc, "srv_io_srv_share_ctr");
294         depth++;
295
296         prs_align(ps);
297
298         prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
299         prs_uint32("ptr_share_ctr", ps, depth, &(ctr->ptr_share_ctr));
300
301         if (ctr->ptr_share_ctr != 0)
302         {
303                 switch (ctr->switch_value)
304                 {
305                         case 2:
306                         {
307                                 srv_io_srv_share_info_2("", &(ctr->share.info2), ps, depth); 
308                                 break;
309                         }
310                         case 1:
311                         {
312                                 srv_io_srv_share_info_1("", &(ctr->share.info1), ps, depth); 
313                                 break;
314                         }
315                         default:
316                         {
317                                 DEBUG(5,("%s no share info at switch_value %d\n",
318                                          tab_depth(depth), ctr->switch_value));
319                                 break;
320                         }
321                 }
322         }
323
324         return True;
325 }
326
327 /*******************************************************************
328 reads or writes a structure.
329 ********************************************************************/
330 BOOL make_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, 
331                                 const char *srv_name, 
332                                 uint32 share_level, SRV_SHARE_INFO_CTR *ctr,
333                                 uint32 preferred_len,
334                                 ENUM_HND *hnd)
335 {
336         if (q_n == NULL || ctr == NULL || hnd == NULL) return False;
337
338         q_n->ctr = ctr;
339
340         DEBUG(5,("make_q_net_share_enum\n"));
341
342         make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name);
343
344         q_n->share_level    = share_level;
345         q_n->preferred_len = preferred_len;
346
347         memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd));
348
349         return True;
350 }
351
352 /*******************************************************************
353 reads or writes a structure.
354 ********************************************************************/
355 BOOL srv_io_q_net_share_enum(char *desc,  SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth)
356 {
357         if (q_n == NULL) return False;
358
359         prs_debug(ps, depth, desc, "srv_io_q_net_share_enum");
360         depth++;
361
362         prs_align(ps);
363
364         prs_uint32("ptr_srv_name", ps, depth, &(q_n->ptr_srv_name));
365         smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth); 
366
367         prs_align(ps);
368
369         prs_uint32("share_level", ps, depth, &(q_n->share_level  ));
370
371         if (((int)q_n->share_level) != -1)
372         {
373                 srv_io_srv_share_ctr("share_ctr", q_n->ctr, ps, depth);
374         }
375
376         prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
377
378         smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth); 
379
380         return True;
381 }
382
383 /*******************************************************************
384 reads or writes a structure.
385 ********************************************************************/
386 BOOL srv_io_r_net_share_enum(char *desc,  SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth)
387 {
388         if (r_n == NULL) return False;
389
390         prs_debug(ps, depth, desc, "srv_io_r_net_share_enum");
391         depth++;
392
393         prs_align(ps);
394
395         prs_uint32("share_level", ps, depth, &(r_n->share_level));
396
397         if (r_n->share_level != 0)
398         {
399                 srv_io_srv_share_ctr("share_ctr", r_n->ctr, ps, depth);
400         }
401
402         prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
403         smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth); 
404         prs_uint32("status     ", ps, depth, &(r_n->status));
405
406         return True;
407 }
408
409 /*******************************************************************
410  makes a SESS_INFO_0_STR structure
411 ********************************************************************/
412 BOOL make_srv_sess_info0_str(SESS_INFO_0_STR *ss0, char *name)
413 {
414         if (ss0 == NULL) return False;
415
416         DEBUG(5,("make_srv_sess_info0_str\n"));
417
418         make_unistr2(&(ss0->uni_name), name, strlen(name)+1);
419
420         return True;
421 }
422
423 /*******************************************************************
424 reads or writes a structure.
425 ********************************************************************/
426 static BOOL srv_io_sess_info0_str(char *desc,  SESS_INFO_0_STR *ss0, 
427 const SESS_INFO_0 *si0, prs_struct *ps, int depth)
428 {
429         if (ss0 == NULL) return False;
430
431         prs_debug(ps, depth, desc, "srv_io_sess_info0_str");
432         depth++;
433
434         prs_align(ps);
435
436         smb_io_unistr2("", &(ss0->uni_name), si0->ptr_name, ps, depth); 
437
438         return True;
439 }
440
441 /*******************************************************************
442  makes a SESS_INFO_0 structure
443 ********************************************************************/
444 BOOL make_srv_sess_info0(SESS_INFO_0 *ss0, char *name)
445 {
446         if (ss0 == NULL) return False;
447
448         DEBUG(5,("make_srv_sess_info0: %s\n", name));
449
450         ss0->ptr_name = name != NULL ? 1 : 0;
451
452         return True;
453 }
454
455 /*******************************************************************
456 reads or writes a structure.
457 ********************************************************************/
458 static BOOL srv_io_sess_info0(char *desc,  SESS_INFO_0 *ss0, prs_struct *ps, int depth)
459 {
460         if (ss0 == NULL) return False;
461
462         prs_debug(ps, depth, desc, "srv_io_sess_info0");
463         depth++;
464
465         prs_align(ps);
466
467         prs_uint32("ptr_name", ps, depth, &(ss0->ptr_name));
468
469         return True;
470 }
471
472 /*******************************************************************
473 reads or writes a structure.
474 ********************************************************************/
475 static BOOL srv_io_srv_sess_info_0(char *desc,  SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth)
476 {
477         if (ss0 == NULL) return False;
478
479         prs_debug(ps, depth, desc, "srv_io_srv_sess_info_0");
480         depth++;
481
482         prs_align(ps);
483
484         prs_uint32("num_entries_read", ps, depth, &(ss0->num_entries_read));
485         prs_uint32("ptr_sess_info", ps, depth, &(ss0->ptr_sess_info));
486
487         if (ss0->ptr_sess_info != 0)
488         {
489                 uint32 i;
490                 uint32 num_entries = ss0->num_entries_read;
491                 if (num_entries > MAX_SESS_ENTRIES)
492                 {
493                         num_entries = MAX_SESS_ENTRIES; /* report this! */
494                 }
495
496                 prs_uint32("num_entries_read2", ps, depth, &(ss0->num_entries_read2));
497
498                 SMB_ASSERT_ARRAY(ss0->info_0, num_entries);
499
500                 for (i = 0; i < num_entries; i++)
501                 {
502                         prs_grow(ps);
503                         srv_io_sess_info0("", &(ss0->info_0[i]), ps, depth); 
504                 }
505
506                 for (i = 0; i < num_entries; i++)
507                 {
508                         prs_grow(ps);
509                         srv_io_sess_info0_str("", &(ss0->info_0_str[i]),
510                                                   &(ss0->info_0[i]),
511                                                   ps, depth); 
512                 }
513
514                 prs_align(ps);
515         }
516
517         return True;
518 }
519
520 /*******************************************************************
521  makes a SESS_INFO_1_STR structure
522 ********************************************************************/
523 BOOL make_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user)
524 {
525         if (ss1 == NULL) return False;
526
527         DEBUG(5,("make_srv_sess_info1_str\n"));
528
529         make_unistr2(&(ss1->uni_name), name, strlen(name)+1);
530         make_unistr2(&(ss1->uni_user), name, strlen(user)+1);
531
532         return True;
533 }
534
535 /*******************************************************************
536 reads or writes a structure.
537 ********************************************************************/
538 static BOOL srv_io_sess_info1_str(char *desc,  SESS_INFO_1_STR *ss1,
539                                 SESS_INFO_1 *si1,
540                                 prs_struct *ps, int depth)
541 {
542         if (ss1 == NULL) return False;
543
544         prs_debug(ps, depth, desc, "srv_io_sess_info1_str");
545         depth++;
546
547         prs_align(ps);
548
549         smb_io_unistr2("", &(ss1->uni_name), si1->ptr_name, ps, depth); 
550         smb_io_unistr2("", &(ss1->uni_user), si1->ptr_user, ps, depth); 
551
552         return True;
553 }
554
555 /*******************************************************************
556  makes a SESS_INFO_1 structure
557 ********************************************************************/
558 BOOL make_srv_sess_info1(SESS_INFO_1 *ss1, 
559                                 char *name, char *user,
560                                 uint32 num_opens, uint32 open_time, uint32 idle_time,
561                                 uint32 user_flags)
562 {
563         if (ss1 == NULL) return False;
564
565         DEBUG(5,("make_srv_sess_info1: %s\n", name));
566
567         ss1->ptr_name = name != NULL ? 1 : 0;
568         ss1->ptr_user = user != NULL ? 1 : 0;
569
570         ss1->num_opens  = num_opens;
571         ss1->open_time  = open_time;
572         ss1->idle_time  = idle_time;
573         ss1->user_flags = user_flags;
574
575         return True;
576 }
577
578 /*******************************************************************
579 reads or writes a structure.
580 ********************************************************************/
581 static BOOL srv_io_sess_info1(char *desc,  SESS_INFO_1 *ss1, prs_struct *ps, int depth)
582 {
583         if (ss1 == NULL) return False;
584
585         prs_debug(ps, depth, desc, "srv_io_sess_info1");
586         depth++;
587
588         prs_align(ps);
589
590         prs_uint32("ptr_name  ", ps, depth, &(ss1->ptr_name  ));
591         prs_uint32("ptr_user  ", ps, depth, &(ss1->ptr_user  ));
592
593         prs_uint32("num_opens ", ps, depth, &(ss1->num_opens ));
594         prs_uint32("open_time ", ps, depth, &(ss1->open_time ));
595         prs_uint32("idle_time ", ps, depth, &(ss1->idle_time ));
596         prs_uint32("user_flags", ps, depth, &(ss1->user_flags));
597
598         return True;
599 }
600
601 /*******************************************************************
602 reads or writes a structure.
603 ********************************************************************/
604 static BOOL srv_io_srv_sess_info_1(char *desc,  SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth)
605 {
606         if (ss1 == NULL) return False;
607
608         prs_debug(ps, depth, desc, "srv_io_srv_sess_info_1");
609         depth++;
610
611         prs_align(ps);
612
613         prs_uint32("num_entries_read", ps, depth, &(ss1->num_entries_read));
614         prs_uint32("ptr_sess_info", ps, depth, &(ss1->ptr_sess_info));
615
616         if (ss1->ptr_sess_info != 0)
617         {
618                 uint32 i;
619                 uint32 num_entries = ss1->num_entries_read;
620                 if (num_entries > MAX_SESS_ENTRIES)
621                 {
622                         num_entries = MAX_SESS_ENTRIES; /* report this! */
623                 }
624
625                 prs_uint32("num_entries_read2", ps, depth, &(ss1->num_entries_read2));
626
627                 SMB_ASSERT_ARRAY(ss1->info_1, num_entries);
628
629                 for (i = 0; i < num_entries; i++)
630                 {
631                         prs_grow(ps);
632                         srv_io_sess_info1("", &(ss1->info_1[i]), ps, depth); 
633                 }
634
635                 for (i = 0; i < num_entries; i++)
636                 {
637                         prs_grow(ps);
638                         srv_io_sess_info1_str("", &(ss1->info_1_str[i]),
639                                               &(ss1->info_1[i]),
640                                               ps, depth); 
641                 }
642
643                 prs_align(ps);
644         }
645
646         return True;
647 }
648
649 /*******************************************************************
650 reads or writes a structure.
651 ********************************************************************/
652 static BOOL srv_io_srv_sess_ctr(char *desc,  SRV_SESS_INFO_CTR *ctr, prs_struct *ps, int depth)
653 {
654         if (ctr == NULL) return False;
655
656         prs_debug(ps, depth, desc, "srv_io_srv_sess_ctr");
657         depth++;
658
659         prs_align(ps);
660
661         prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
662         prs_uint32("ptr_sess_ctr", ps, depth, &(ctr->ptr_sess_ctr));
663
664         if (ctr->ptr_sess_ctr != 0)
665         {
666                 switch (ctr->switch_value)
667                 {
668                         case 0:
669                         {
670                                 srv_io_srv_sess_info_0("", &(ctr->sess.info0), ps, depth); 
671                                 break;
672                         }
673                         case 1:
674                         {
675                                 srv_io_srv_sess_info_1("", &(ctr->sess.info1), ps, depth); 
676                                 break;
677                         }
678                         default:
679                         {
680                                 DEBUG(5,("%s no session info at switch_value %d\n",
681                                          tab_depth(depth), ctr->switch_value));
682                                 break;
683                         }
684                 }
685         }
686
687         return True;
688 }
689
690 /*******************************************************************
691 reads or writes a structure.
692 ********************************************************************/
693 BOOL make_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n, 
694                                 const char *srv_name, const char *qual_name,
695                                 char *user_name,
696                                 uint32 sess_level, SRV_SESS_INFO_CTR *ctr,
697                                 uint32 preferred_len,
698                                 ENUM_HND *hnd)
699 {
700         if (q_n == NULL || ctr == NULL || hnd == NULL) return False;
701
702         q_n->ctr = ctr;
703
704         DEBUG(5,("make_q_net_sess_enum\n"));
705
706         make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name);
707         make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name);
708         make_buf_unistr2(&(q_n->uni_user_name), &(q_n->ptr_user_name), user_name);
709
710         q_n->sess_level    = sess_level;
711         q_n->preferred_len = preferred_len;
712
713         memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd));
714
715         return True;
716 }
717
718 /*******************************************************************
719 reads or writes a structure.
720 ********************************************************************/
721 BOOL srv_io_q_net_sess_enum(char *desc,  SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps, int depth)
722 {
723         if (q_n == NULL) return False;
724
725         prs_debug(ps, depth, desc, "srv_io_q_net_sess_enum");
726         depth++;
727
728         prs_align(ps);
729
730         prs_uint32("ptr_srv_name", ps, depth, &(q_n->ptr_srv_name));
731         smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth); 
732
733         prs_align(ps);
734
735         prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name));
736         smb_io_unistr2("", &(q_n->uni_qual_name), q_n->ptr_qual_name, ps, depth); 
737         prs_align(ps);
738
739         prs_uint32("ptr_user_name", ps, depth, &(q_n->ptr_user_name));
740         smb_io_unistr2("", &(q_n->uni_user_name), q_n->ptr_user_name, ps, depth); 
741         prs_align(ps);
742
743         prs_uint32("sess_level", ps, depth, &(q_n->sess_level  ));
744         
745         if (((int)q_n->sess_level) != -1)
746         {
747                 srv_io_srv_sess_ctr("sess_ctr", q_n->ctr, ps, depth);
748         }
749
750         prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
751
752         smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth); 
753
754         return True;
755 }
756
757 /*******************************************************************
758 reads or writes a structure.
759 ********************************************************************/
760 BOOL srv_io_r_net_sess_enum(char *desc,  SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth)
761 {
762         if (r_n == NULL) return False;
763
764         prs_debug(ps, depth, desc, "srv_io_r_net_sess_enum");
765         depth++;
766
767         prs_align(ps);
768
769         prs_uint32("sess_level", ps, depth, &(r_n->sess_level));
770
771         if (((int)r_n->sess_level) != -1)
772         {
773                 srv_io_srv_sess_ctr("sess_ctr", r_n->ctr, ps, depth);
774         }
775
776         prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
777         smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth); 
778         prs_uint32("status     ", ps, depth, &(r_n->status));
779
780         return True;
781 }
782
783 /*******************************************************************
784  makes a CONN_INFO_0 structure
785 ********************************************************************/
786 BOOL make_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id)
787 {
788         if (ss0 == NULL) return False;
789
790         DEBUG(5,("make_srv_conn_info0\n"));
791
792         ss0->id = id;
793
794         return True;
795 }
796
797 /*******************************************************************
798 reads or writes a structure.
799 ********************************************************************/
800 static BOOL srv_io_conn_info0(char *desc,  CONN_INFO_0 *ss0, prs_struct *ps, int depth)
801 {
802         if (ss0 == NULL) return False;
803
804         prs_debug(ps, depth, desc, "srv_io_conn_info0");
805         depth++;
806
807         prs_align(ps);
808
809         prs_uint32("id", ps, depth, &(ss0->id));
810
811         return True;
812 }
813
814 /*******************************************************************
815 reads or writes a structure.
816 ********************************************************************/
817 static BOOL srv_io_srv_conn_info_0(char *desc,  SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth)
818 {
819         if (ss0 == NULL) return False;
820
821         prs_debug(ps, depth, desc, "srv_io_srv_conn_info_0");
822         depth++;
823
824         prs_align(ps);
825
826         prs_uint32("num_entries_read", ps, depth, &(ss0->num_entries_read));
827         prs_uint32("ptr_conn_info", ps, depth, &(ss0->ptr_conn_info));
828
829         if (ss0->ptr_conn_info != 0)
830         {
831                 uint32 i;
832                 uint32 num_entries = ss0->num_entries_read;
833                 if (num_entries > MAX_CONN_ENTRIES)
834                 {
835                         num_entries = MAX_CONN_ENTRIES; /* report this! */
836                 }
837
838                 prs_uint32("num_entries_read2", ps, depth, &(ss0->num_entries_read2));
839
840                 for (i = 0; i < num_entries; i++)
841                 {
842                         prs_grow(ps);
843                         srv_io_conn_info0("", &(ss0->info_0[i]), ps, depth); 
844                 }
845
846                 prs_align(ps);
847         }
848
849         return True;
850 }
851
852 /*******************************************************************
853  makes a CONN_INFO_1_STR structure
854 ********************************************************************/
855 BOOL make_srv_conn_info1_str(CONN_INFO_1_STR *ss1, char *usr_name, char *net_name)
856 {
857         if (ss1 == NULL) return False;
858
859         DEBUG(5,("make_srv_conn_info1_str\n"));
860
861         make_unistr2(&(ss1->uni_usr_name), usr_name, strlen(usr_name)+1);
862         make_unistr2(&(ss1->uni_net_name), net_name, strlen(net_name)+1);
863
864         return True;
865 }
866
867 /*******************************************************************
868 reads or writes a structure.
869 ********************************************************************/
870 static BOOL srv_io_conn_info1_str(char *desc, CONN_INFO_1_STR *ss1,
871                                 CONN_INFO_1 *ci1, prs_struct *ps, int depth)
872 {
873         if (ss1 == NULL) return False;
874
875         prs_debug(ps, depth, desc, "srv_io_conn_info1_str");
876         depth++;
877
878         prs_align(ps);
879
880         smb_io_unistr2("", &(ss1->uni_usr_name), ci1->ptr_usr_name, ps, depth); 
881         smb_io_unistr2("", &(ss1->uni_net_name), ci1->ptr_net_name, ps, depth); 
882
883         return True;
884 }
885
886 /*******************************************************************
887  makes a CONN_INFO_1 structure
888 ********************************************************************/
889 BOOL make_srv_conn_info1(CONN_INFO_1 *ss1, 
890                                 uint32 id, uint32 type,
891                                 uint32 num_opens, uint32 num_users, uint32 open_time,
892                                 char *usr_name, char *net_name)
893 {
894         if (ss1 == NULL) return False;
895
896         DEBUG(5,("make_srv_conn_info1: %s %s\n", usr_name, net_name));
897
898         ss1->id        = id       ;
899         ss1->type      = type     ;
900         ss1->num_opens = num_opens ;
901         ss1->num_users = num_users;
902         ss1->open_time = open_time;
903
904         ss1->ptr_usr_name = usr_name != NULL ? 1 : 0;
905         ss1->ptr_net_name = net_name != NULL ? 1 : 0;
906
907         return True;
908 }
909
910 /*******************************************************************
911 reads or writes a structure.
912 ********************************************************************/
913 static BOOL srv_io_conn_info1(char *desc,  CONN_INFO_1 *ss1, prs_struct *ps, int depth)
914 {
915         if (ss1 == NULL) return False;
916
917         prs_debug(ps, depth, desc, "srv_io_conn_info1");
918         depth++;
919
920         prs_align(ps);
921
922         prs_uint32("id          ", ps, depth, &(ss1->id        ));
923         prs_uint32("type        ", ps, depth, &(ss1->type      ));
924         prs_uint32("num_opens   ", ps, depth, &(ss1->num_opens ));
925         prs_uint32("num_users   ", ps, depth, &(ss1->num_users ));
926         prs_uint32("open_time   ", ps, depth, &(ss1->open_time ));
927
928         prs_uint32("ptr_usr_name", ps, depth, &(ss1->ptr_usr_name));
929         prs_uint32("ptr_net_name", ps, depth, &(ss1->ptr_net_name));
930
931         return True;
932 }
933
934 /*******************************************************************
935 reads or writes a structure.
936 ********************************************************************/
937 static BOOL srv_io_srv_conn_info_1(char *desc,  SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth)
938 {
939         if (ss1 == NULL) return False;
940
941         prs_debug(ps, depth, desc, "srv_io_srv_conn_info_1");
942         depth++;
943
944         prs_align(ps);
945
946         prs_uint32("num_entries_read", ps, depth, &(ss1->num_entries_read));
947         prs_uint32("ptr_conn_info", ps, depth, &(ss1->ptr_conn_info));
948
949         if (ss1->ptr_conn_info != 0)
950         {
951                 uint32 i;
952                 uint32 num_entries = ss1->num_entries_read;
953                 if (num_entries > MAX_CONN_ENTRIES)
954                 {
955                         num_entries = MAX_CONN_ENTRIES; /* report this! */
956                 }
957
958                 prs_uint32("num_entries_read2", ps, depth, &(ss1->num_entries_read2));
959
960                 for (i = 0; i < num_entries; i++)
961                 {
962                         prs_grow(ps);
963                         srv_io_conn_info1("", &(ss1->info_1[i]), ps, depth); 
964                 }
965
966                 for (i = 0; i < num_entries; i++)
967                 {
968                         prs_grow(ps);
969                         srv_io_conn_info1_str("", &(ss1->info_1_str[i]),
970                                                   &(ss1->info_1[i]),
971                                                   ps, depth); 
972                 }
973
974                 prs_align(ps);
975         }
976
977         return True;
978 }
979
980 /*******************************************************************
981 reads or writes a structure.
982 ********************************************************************/
983 static BOOL srv_io_srv_conn_ctr(char *desc,  SRV_CONN_INFO_CTR *ctr, prs_struct *ps, int depth)
984 {
985         if (ctr == NULL) return False;
986
987         prs_debug(ps, depth, desc, "srv_io_srv_conn_ctr");
988         depth++;
989
990         prs_align(ps);
991
992         prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
993         prs_uint32("ptr_conn_ctr", ps, depth, &(ctr->ptr_conn_ctr));
994
995         if (ctr->ptr_conn_ctr != 0)
996         {
997                 switch (ctr->switch_value)
998                 {
999                         case 0:
1000                         {
1001                                 srv_io_srv_conn_info_0("", &(ctr->conn.info0), ps, depth); 
1002                                 break;
1003                         }
1004                         case 1:
1005                         {
1006                                 srv_io_srv_conn_info_1("", &(ctr->conn.info1), ps, depth); 
1007                                 break;
1008                         }
1009                         default:
1010                         {
1011                                 DEBUG(5,("%s no connection info at switch_value %d\n",
1012                                          tab_depth(depth), ctr->switch_value));
1013                                 break;
1014                         }
1015                 }
1016         }
1017
1018         return True;
1019 }
1020
1021 /*******************************************************************
1022 reads or writes a structure.
1023 ********************************************************************/
1024 BOOL make_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n, 
1025                                 const char *srv_name, const char *qual_name,
1026                                 uint32 conn_level, SRV_CONN_INFO_CTR *ctr,
1027                                 uint32 preferred_len,
1028                                 ENUM_HND *hnd)
1029 {
1030         if (q_n == NULL || ctr == NULL || hnd == NULL) return False;
1031
1032         q_n->ctr = ctr;
1033
1034         DEBUG(5,("make_q_net_conn_enum\n"));
1035
1036         make_buf_unistr2(&(q_n->uni_srv_name ), &(q_n->ptr_srv_name ), srv_name );
1037         make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name);
1038
1039         q_n->conn_level    = conn_level;
1040         q_n->preferred_len = preferred_len;
1041
1042         memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd));
1043
1044         return True;
1045 }
1046
1047 /*******************************************************************
1048 reads or writes a structure.
1049 ********************************************************************/
1050 BOOL srv_io_q_net_conn_enum(char *desc,  SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth)
1051 {
1052         if (q_n == NULL) return False;
1053
1054         prs_debug(ps, depth, desc, "srv_io_q_net_conn_enum");
1055         depth++;
1056
1057         prs_align(ps);
1058
1059         prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name));
1060         smb_io_unistr2("", &(q_n->uni_srv_name), q_n->ptr_srv_name, ps, depth); 
1061
1062         prs_align(ps);
1063
1064         prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name));
1065         smb_io_unistr2("", &(q_n->uni_qual_name), q_n->ptr_qual_name, ps, depth); 
1066
1067         prs_align(ps);
1068
1069         prs_uint32("conn_level", ps, depth, &(q_n->conn_level  ));
1070         
1071         if (((int)q_n->conn_level) != -1)
1072         {
1073                 srv_io_srv_conn_ctr("conn_ctr", q_n->ctr, ps, depth);
1074         }
1075
1076         prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
1077
1078         smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth); 
1079
1080         return True;
1081 }
1082
1083 /*******************************************************************
1084 reads or writes a structure.
1085 ********************************************************************/
1086 BOOL srv_io_r_net_conn_enum(char *desc,  SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth)
1087 {
1088         if (r_n == NULL) return False;
1089
1090         prs_debug(ps, depth, desc, "srv_io_r_net_conn_enum");
1091         depth++;
1092
1093         prs_align(ps);
1094
1095         prs_uint32("conn_level", ps, depth, &(r_n->conn_level));
1096
1097         if (((int)r_n->conn_level) != -1)
1098         {
1099                 srv_io_srv_conn_ctr("conn_ctr", r_n->ctr, ps, depth);
1100         }
1101
1102         prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
1103         smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth); 
1104         prs_uint32("status     ", ps, depth, &(r_n->status));
1105
1106         return True;
1107 }
1108
1109 /*******************************************************************
1110  makes a TPRT_INFO_0_STR structure
1111 ********************************************************************/
1112 BOOL make_srv_tprt_info0_str(TPRT_INFO_0_STR *tp0,
1113                                 char *trans_name,
1114                                 char *trans_addr, uint32 trans_addr_len,
1115                                 char *addr_name)
1116 {
1117         if (tp0 == NULL) return False;
1118
1119         DEBUG(5,("make_srv_tprt_info0_str\n"));
1120
1121         make_unistr2(&(tp0->uni_trans_name), trans_name, strlen(trans_name)+1);
1122         make_buffer4_str(&(tp0->buf_trans_addr), trans_addr, trans_addr_len);
1123         make_unistr2(&(tp0->uni_addr_name ), addr_name, strlen(addr_name)+1);
1124
1125         return True;
1126 }
1127
1128 /*******************************************************************
1129 reads or writes a structure.
1130 ********************************************************************/
1131 static BOOL srv_io_tprt_info0_str(char *desc,  TPRT_INFO_0_STR *tp0,
1132                                 TPRT_INFO_0 *ti0,
1133                                 prs_struct *ps, int depth)
1134 {
1135         if (tp0 == NULL) return False;
1136
1137         prs_debug(ps, depth, desc, "srv_io_tprt_info0_str");
1138         depth++;
1139
1140         prs_align(ps);
1141
1142         smb_io_unistr2("", &(tp0->uni_trans_name), ti0->ptr_trans_name, ps, depth); 
1143         smb_io_buffer4("", &(tp0->buf_trans_addr), ti0->ptr_trans_addr, ps, depth); 
1144         smb_io_unistr2("", &(tp0->uni_addr_name ), ti0->ptr_addr_name, ps, depth); 
1145
1146         return True;
1147 }
1148
1149 /*******************************************************************
1150  makes a TPRT_INFO_0 structure
1151 ********************************************************************/
1152 BOOL make_srv_tprt_info0(TPRT_INFO_0 *tp0, 
1153                                 uint32 num_vcs, uint32 trans_addr_len,
1154                                 char *trans_name, char *trans_addr,
1155                                 char *addr_name)
1156 {
1157         if (tp0 == NULL) return False;
1158
1159         DEBUG(5,("make_srv_tprt_info0: %s %s\n", trans_name, addr_name));
1160
1161         tp0->num_vcs = num_vcs;
1162         tp0->ptr_trans_name = trans_name != NULL ? 1 : 0;
1163         tp0->ptr_trans_addr = trans_addr != NULL ? 1 : 0;
1164         tp0->trans_addr_len = trans_addr_len;
1165         tp0->ptr_addr_name  = addr_name  != NULL ? 1 : 0;
1166
1167         return True;
1168 }
1169
1170 /*******************************************************************
1171 reads or writes a structure.
1172 ********************************************************************/
1173 static BOOL srv_io_tprt_info0(char *desc,  TPRT_INFO_0 *tp0, prs_struct *ps, int depth)
1174 {
1175         if (tp0 == NULL) return False;
1176
1177         prs_debug(ps, depth, desc, "srv_io_tprt_info0");
1178         depth++;
1179
1180         prs_align(ps);
1181
1182         prs_uint32("num_vcs       ", ps, depth, &(tp0->num_vcs       ));
1183         prs_uint32("ptr_trans_name", ps, depth, &(tp0->ptr_trans_name));
1184         prs_uint32("ptr_trans_addr", ps, depth, &(tp0->ptr_trans_addr));
1185         prs_uint32("trans_addr_len", ps, depth, &(tp0->trans_addr_len));
1186         prs_uint32("ptr_addr_name ", ps, depth, &(tp0->ptr_addr_name ));
1187
1188         return True;
1189 }
1190
1191 /*******************************************************************
1192 reads or writes a structure.
1193 ********************************************************************/
1194 static BOOL srv_io_srv_tprt_info_0(char *desc,  SRV_TPRT_INFO_0 *tp0, prs_struct *ps, int depth)
1195 {
1196         if (tp0 == NULL) return False;
1197
1198         prs_debug(ps, depth, desc, "srv_io_srv_tprt_info_0");
1199         depth++;
1200
1201         prs_align(ps);
1202
1203         prs_uint32("num_entries_read", ps, depth, &(tp0->num_entries_read));
1204         prs_uint32("ptr_tprt_info", ps, depth, &(tp0->ptr_tprt_info));
1205
1206         if (tp0->ptr_tprt_info != 0)
1207         {
1208                 uint32 i;
1209                 uint32 num_entries = tp0->num_entries_read;
1210
1211                 prs_uint32("num_entries_read2", ps, depth, &(tp0->num_entries_read2));
1212
1213                 if (ps->io)
1214                 {
1215                         /* reading */
1216                         tp0->info_0 = (TPRT_INFO_0*)malloc(num_entries *
1217                                       sizeof(tp0->info_0[0]));
1218
1219                         tp0->info_0_str = (TPRT_INFO_0_STR*)malloc(num_entries *
1220                                       sizeof(tp0->info_0_str[0]));
1221
1222                         if (tp0->info_0 == NULL || tp0->info_0_str == NULL)
1223                         {
1224                                 free_srv_tprt_info_0(tp0);
1225                                 return False;
1226                         }
1227                 }
1228
1229                 for (i = 0; i < num_entries; i++)
1230                 {
1231                         prs_grow(ps);
1232                         srv_io_tprt_info0("", &(tp0->info_0[i]), ps, depth); 
1233                 }
1234
1235                 for (i = 0; i < num_entries; i++)
1236                 {
1237                         prs_grow(ps);
1238                         srv_io_tprt_info0_str("", &(tp0->info_0_str[i]),
1239                                                   &(tp0->info_0[i]),
1240                                                   ps, depth); 
1241                 }
1242
1243                 prs_align(ps);
1244         }
1245
1246         if (!ps->io)
1247         {
1248                 /* writing */
1249                 free_srv_tprt_info_0(tp0);
1250         }
1251
1252         return True;
1253 }
1254
1255 /*******************************************************************
1256 frees a structure.
1257 ********************************************************************/
1258 void free_srv_tprt_info_0(SRV_TPRT_INFO_0 *tp0)
1259 {
1260         if (tp0->info_0 != NULL)
1261         {
1262                 free(tp0->info_0);
1263                 tp0->info_0 = NULL;
1264         }
1265         if (tp0->info_0_str != NULL)
1266         {
1267                 free(tp0->info_0_str);
1268                 tp0->info_0_str = NULL;
1269         }
1270 }
1271
1272 /*******************************************************************
1273 reads or writes a structure.
1274 ********************************************************************/
1275 static BOOL srv_io_srv_tprt_ctr(char *desc,  SRV_TPRT_INFO_CTR *ctr, prs_struct *ps, int depth)
1276 {
1277         if (ctr == NULL) return False;
1278
1279         prs_debug(ps, depth, desc, "srv_io_srv_tprt_ctr");
1280         depth++;
1281
1282         prs_align(ps);
1283
1284         prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
1285         prs_uint32("ptr_tprt_ctr", ps, depth, &(ctr->ptr_tprt_ctr));
1286
1287         if (ctr->ptr_tprt_ctr != 0)
1288         {
1289                 switch (ctr->switch_value)
1290                 {
1291                         case 0:
1292                         {
1293                                 srv_io_srv_tprt_info_0("", &(ctr->tprt.info0), ps, depth); 
1294                                 break;
1295                         }
1296                         default:
1297                         {
1298                                 DEBUG(5,("%s no transport info at switch_value %d\n",
1299                                          tab_depth(depth), ctr->switch_value));
1300                                 break;
1301                         }
1302                 }
1303         }
1304
1305         return True;
1306 }
1307
1308 /*******************************************************************
1309 reads or writes a structure.
1310 ********************************************************************/
1311 void free_srv_tprt_ctr(SRV_TPRT_INFO_CTR *ctr)
1312 {
1313         switch (ctr->switch_value)
1314         {
1315                 case 0:
1316                 {
1317                         free_srv_tprt_info_0(&(ctr->tprt.info0));
1318                         break;
1319                 }
1320                 default:
1321                 {
1322                         DEBUG(5,("no transport info at switch_value %d\n",
1323                                  ctr->switch_value));
1324                         break;
1325                 }
1326         }
1327 }
1328
1329 /*******************************************************************
1330 reads or writes a structure.
1331 ********************************************************************/
1332 BOOL make_srv_q_net_tprt_enum(SRV_Q_NET_TPRT_ENUM *q_n, 
1333                                 const char *srv_name, 
1334                                 uint32 tprt_level, SRV_TPRT_INFO_CTR *ctr,
1335                                 uint32 preferred_len,
1336                                 ENUM_HND *hnd)
1337 {
1338         if (q_n == NULL || ctr == NULL || hnd == NULL) return False;
1339
1340         q_n->ctr = ctr;
1341
1342         DEBUG(5,("make_q_net_tprt_enum\n"));
1343
1344         make_buf_unistr2(&(q_n->uni_srv_name ), &(q_n->ptr_srv_name ), srv_name );
1345
1346         q_n->tprt_level    = tprt_level;
1347         q_n->preferred_len = preferred_len;
1348
1349         memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd));
1350
1351         return True;
1352 }
1353
1354 /*******************************************************************
1355 reads or writes a structure.
1356 ********************************************************************/
1357 BOOL srv_io_q_net_tprt_enum(char *desc,  SRV_Q_NET_TPRT_ENUM *q_n, prs_struct *ps, int depth)
1358 {
1359         if (q_n == NULL) return False;
1360
1361         prs_debug(ps, depth, desc, "srv_io_q_net_tprt_enum");
1362         depth++;
1363
1364         prs_align(ps);
1365
1366         prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name));
1367         smb_io_unistr2("", &(q_n->uni_srv_name), q_n->ptr_srv_name, ps, depth); 
1368
1369         prs_align(ps);
1370
1371         prs_uint32("tprt_level", ps, depth, &(q_n->tprt_level  ));
1372         
1373         if (((int)q_n->tprt_level) != -1)
1374         {
1375                 srv_io_srv_tprt_ctr("tprt_ctr", q_n->ctr, ps, depth);
1376         }
1377
1378         prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
1379
1380         smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth); 
1381
1382         return True;
1383 }
1384
1385 /*******************************************************************
1386 reads or writes a structure.
1387 ********************************************************************/
1388 BOOL srv_io_r_net_tprt_enum(char *desc,  SRV_R_NET_TPRT_ENUM *r_n, prs_struct *ps, int depth)
1389 {
1390         if (r_n == NULL) return False;
1391
1392         prs_debug(ps, depth, desc, "srv_io_r_net_tprt_enum");
1393         depth++;
1394
1395         prs_align(ps);
1396
1397         prs_uint32("tprt_level", ps, depth, &(r_n->tprt_level));
1398
1399         if (((int)r_n->tprt_level) != -1)
1400         {
1401                 srv_io_srv_tprt_ctr("tprt_ctr", r_n->ctr, ps, depth);
1402         }
1403
1404         prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
1405         smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth); 
1406         prs_uint32("status     ", ps, depth, &(r_n->status));
1407
1408         return True;
1409 }
1410
1411 /*******************************************************************
1412  makes a FILE_INFO_3_STR structure
1413 ********************************************************************/
1414 BOOL make_srv_file_info3_str(FILE_INFO_3_STR *fi3, char *user_name, char *path_name)
1415 {
1416         if (fi3 == NULL) return False;
1417
1418         DEBUG(5,("make_srv_file_info3_str\n"));
1419
1420         make_unistr2(&(fi3->uni_path_name), path_name, strlen(path_name)+1);
1421         make_unistr2(&(fi3->uni_user_name), user_name, strlen(user_name)+1);
1422
1423         return True;
1424 }
1425
1426 /*******************************************************************
1427 reads or writes a structure.
1428 ********************************************************************/
1429 static BOOL srv_io_file_info3_str(char *desc,  FILE_INFO_3_STR *sh1, prs_struct *ps, int depth)
1430 {
1431         if (sh1 == NULL) return False;
1432
1433         prs_debug(ps, depth, desc, "srv_io_file_info3_str");
1434         depth++;
1435
1436         prs_align(ps);
1437
1438         smb_io_unistr2("", &(sh1->uni_path_name), True, ps, depth); 
1439         smb_io_unistr2("", &(sh1->uni_user_name), True, ps, depth); 
1440
1441         return True;
1442 }
1443
1444 /*******************************************************************
1445  makes a FILE_INFO_3 structure
1446 ********************************************************************/
1447 BOOL make_srv_file_info3(FILE_INFO_3 *fl3,
1448                                 uint32 id, uint32 perms, uint32 num_locks,
1449                                 char *path_name, char *user_name)
1450 {
1451         if (fl3 == NULL) return False;
1452
1453         DEBUG(5,("make_srv_file_info3: %s %s\n", path_name, user_name));
1454
1455         fl3->id        = id;    
1456         fl3->perms     = perms;
1457         fl3->num_locks = num_locks;
1458
1459         fl3->ptr_path_name = path_name != NULL ? 1 : 0;
1460         fl3->ptr_user_name = user_name != NULL ? 1 : 0;
1461
1462         return True;
1463 }
1464
1465 /*******************************************************************
1466 reads or writes a structure.
1467 ********************************************************************/
1468 static BOOL srv_io_file_info3(char *desc,  FILE_INFO_3 *fl3, prs_struct *ps, int depth)
1469 {
1470         if (fl3 == NULL) return False;
1471
1472         prs_debug(ps, depth, desc, "srv_io_file_info3");
1473         depth++;
1474
1475         prs_align(ps);
1476
1477         prs_uint32("id           ", ps, depth, &(fl3->id           ));
1478         prs_uint32("perms        ", ps, depth, &(fl3->perms        ));
1479         prs_uint32("num_locks    ", ps, depth, &(fl3->num_locks    ));
1480         prs_uint32("ptr_path_name", ps, depth, &(fl3->ptr_path_name));
1481         prs_uint32("ptr_user_name", ps, depth, &(fl3->ptr_user_name));
1482
1483         return True;
1484 }
1485
1486 /*******************************************************************
1487 reads or writes a structure.
1488 ********************************************************************/
1489 static BOOL srv_io_srv_file_info_3(char *desc,  SRV_FILE_INFO_3 *fl3, prs_struct *ps, int depth)
1490 {
1491         if (fl3 == NULL) return False;
1492
1493         prs_debug(ps, depth, desc, "srv_io_file_3_fl3");
1494         depth++;
1495
1496         prs_align(ps);
1497
1498         prs_uint32("num_entries_read", ps, depth, &(fl3->num_entries_read));
1499         prs_uint32("ptr_file_fl3", ps, depth, &(fl3->ptr_file_info));
1500         if (fl3->ptr_file_info != 0)
1501         {
1502                 uint32 i;
1503                 uint32 num_entries = fl3->num_entries_read;
1504
1505                 if (num_entries > MAX_FILE_ENTRIES)
1506                 {
1507                         num_entries = MAX_FILE_ENTRIES; /* report this! */
1508                 }
1509
1510                 prs_uint32("num_entries_read2", ps, depth, &(fl3->num_entries_read2));
1511
1512                 for (i = 0; i < num_entries; i++)
1513                 {
1514                         prs_grow(ps);
1515                         srv_io_file_info3("", &(fl3->info_3[i]), ps, depth); 
1516                 }
1517
1518                 for (i = 0; i < num_entries; i++)
1519                 {
1520                         prs_grow(ps);
1521                         srv_io_file_info3_str("", &(fl3->info_3_str[i]), ps, depth); 
1522                 }
1523
1524                 prs_align(ps);
1525         }
1526
1527         return True;
1528 }
1529
1530 /*******************************************************************
1531 reads or writes a structure.
1532 ********************************************************************/
1533 static BOOL srv_io_srv_file_ctr(char *desc,  SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth)
1534 {
1535         if (ctr == NULL) return False;
1536
1537         prs_debug(ps, depth, desc, "srv_io_srv_file_ctr");
1538         depth++;
1539
1540         prs_align(ps);
1541
1542         prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
1543         prs_uint32("ptr_file_ctr", ps, depth, &(ctr->ptr_file_ctr));
1544
1545         if (ctr->ptr_file_ctr != 0)
1546         {
1547                 switch (ctr->switch_value)
1548                 {
1549                         case 3:
1550                         {
1551                                 srv_io_srv_file_info_3("", &(ctr->file.info3), ps, depth); 
1552                                 break;
1553                         }
1554                         default:
1555                         {
1556                                 DEBUG(5,("%s no file info at switch_value %d\n",
1557                                          tab_depth(depth), ctr->switch_value));
1558                                 break;
1559                         }
1560                 }
1561         }
1562
1563         return True;
1564 }
1565
1566 /*******************************************************************
1567 reads or writes a structure.
1568 ********************************************************************/
1569 BOOL make_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, 
1570                                 const char *srv_name, const char *qual_name,
1571                                 uint32 file_id,
1572                                 uint32 file_level, SRV_FILE_INFO_CTR *ctr,
1573                                 uint32 preferred_len,
1574                                 ENUM_HND *hnd)
1575 {
1576         if (q_n == NULL || ctr == NULL || hnd == NULL) return False;
1577
1578         q_n->ctr = ctr;
1579
1580         DEBUG(5,("make_q_net_file_enum\n"));
1581
1582         make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name);
1583         make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name);
1584
1585         q_n->file_id       = file_id;
1586         q_n->file_level    = file_level;
1587         q_n->preferred_len = preferred_len;
1588
1589         memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd));
1590
1591         return True;
1592 }
1593
1594 /*******************************************************************
1595 reads or writes a structure.
1596 ********************************************************************/
1597 BOOL srv_io_q_net_file_enum(char *desc,  SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps, int depth)
1598 {
1599         if (q_n == NULL) return False;
1600
1601         prs_debug(ps, depth, desc, "srv_io_q_net_file_enum");
1602         depth++;
1603
1604         prs_align(ps);
1605
1606         prs_uint32("ptr_srv_name", ps, depth, &(q_n->ptr_srv_name));
1607         smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth); 
1608
1609         prs_align(ps);
1610
1611         prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name));
1612         smb_io_unistr2("", &(q_n->uni_qual_name), q_n->ptr_qual_name, ps, depth); 
1613
1614         prs_align(ps);
1615
1616         prs_uint32("file_id   ", ps, depth, &(q_n->file_id   ));
1617         prs_uint32("file_level", ps, depth, &(q_n->file_level));
1618
1619         if (((int)q_n->file_level) != -1)
1620         {
1621                 srv_io_srv_file_ctr("file_ctr", q_n->ctr, ps, depth);
1622         }
1623
1624         prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
1625
1626         smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth); 
1627
1628         return True;
1629 }
1630
1631 /*******************************************************************
1632 reads or writes a structure.
1633 ********************************************************************/
1634 BOOL srv_io_r_net_file_enum(char *desc,  SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth)
1635 {
1636         if (r_n == NULL) return False;
1637
1638         prs_debug(ps, depth, desc, "srv_io_r_net_file_enum");
1639         depth++;
1640
1641         prs_align(ps);
1642
1643         prs_uint32("file_level", ps, depth, &(r_n->file_level));
1644
1645         if (r_n->file_level != 0)
1646         {
1647                 srv_io_srv_file_ctr("file_ctr", r_n->ctr, ps, depth);
1648         }
1649
1650         prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
1651         smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth); 
1652         prs_uint32("status     ", ps, depth, &(r_n->status));
1653
1654         return True;
1655 }
1656
1657 /*******************************************************************
1658  makes a SRV_INFO_101 structure.
1659  ********************************************************************/
1660 BOOL make_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, char *name,
1661                                 uint32 ver_major, uint32 ver_minor,
1662                                 uint32 srv_type, char *comment)
1663 {
1664         if (sv101 == NULL) return False;
1665
1666         DEBUG(5,("make_srv_info_101\n"));
1667
1668         sv101->platform_id  = platform_id;
1669         make_buf_unistr2(&(sv101->uni_name    ), &(sv101->ptr_name   ) , name    );
1670         sv101->ver_major    = ver_major;
1671         sv101->ver_minor    = ver_minor;
1672         sv101->srv_type     = srv_type;
1673         make_buf_unistr2(&(sv101->uni_comment ), &(sv101->ptr_comment) , comment );
1674
1675         return True;
1676 }
1677
1678
1679 /*******************************************************************
1680  reads or writes a SRV_INFO_101 structure.
1681  ********************************************************************/
1682 static BOOL srv_io_info_101(char *desc,  SRV_INFO_101 *sv101, prs_struct *ps, int depth)
1683 {
1684         if (sv101 == NULL) return False;
1685
1686         prs_debug(ps, depth, desc, "srv_io_info_101");
1687         depth++;
1688
1689         prs_align(ps);
1690
1691         prs_uint32("platform_id ", ps, depth, &(sv101->platform_id ));
1692         prs_uint32("ptr_name    ", ps, depth, &(sv101->ptr_name    ));
1693         prs_uint32("ver_major   ", ps, depth, &(sv101->ver_major   ));
1694         prs_uint32("ver_minor   ", ps, depth, &(sv101->ver_minor   ));
1695         prs_uint32("srv_type    ", ps, depth, &(sv101->srv_type    ));
1696         prs_uint32("ptr_comment ", ps, depth, &(sv101->ptr_comment ));
1697
1698         prs_align(ps);
1699
1700         smb_io_unistr2("uni_name    ", &(sv101->uni_name    ), True, ps, depth); 
1701         smb_io_unistr2("uni_comment ", &(sv101->uni_comment ), True, ps, depth); 
1702
1703         return True;
1704 }
1705
1706 /*******************************************************************
1707  makes a SRV_INFO_102 structure.
1708  ********************************************************************/
1709 BOOL make_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, char *name,
1710                                 char *comment, uint32 ver_major, uint32 ver_minor,
1711                                 uint32 srv_type, uint32 users, uint32 disc, uint32 hidden,
1712                                 uint32 announce, uint32 ann_delta, uint32 licenses,
1713                                 char *usr_path)
1714 {
1715         if (sv102 == NULL) return False;
1716
1717         DEBUG(5,("make_srv_info_102\n"));
1718
1719         sv102->platform_id  = platform_id;
1720         make_buf_unistr2(&(sv102->uni_name    ), &(sv102->ptr_name    ), name    );
1721         sv102->ver_major    = ver_major;
1722         sv102->ver_minor    = ver_minor;
1723         sv102->srv_type     = srv_type;
1724         make_buf_unistr2(&(sv102->uni_comment ), &(sv102->ptr_comment ), comment );
1725
1726         /* same as 101 up to here */
1727
1728         sv102->users        = users;
1729         sv102->disc         = disc;
1730         sv102->hidden       = hidden;
1731         sv102->announce     = announce;
1732         sv102->ann_delta    =ann_delta;
1733         sv102->licenses     = licenses;
1734         make_buf_unistr2(&(sv102->uni_usr_path), &(sv102->ptr_usr_path), usr_path);
1735
1736         return True;
1737 }
1738
1739
1740 /*******************************************************************
1741  reads or writes a SRV_INFO_102 structure.
1742  ********************************************************************/
1743 static BOOL srv_io_info_102(char *desc,  SRV_INFO_102 *sv102, prs_struct *ps, int depth)
1744 {
1745         if (sv102 == NULL) return False;
1746
1747         prs_debug(ps, depth, desc, "srv_io_info102");
1748         depth++;
1749
1750         prs_align(ps);
1751
1752         prs_uint32("platform_id ", ps, depth, &(sv102->platform_id ));
1753         prs_uint32("ptr_name    ", ps, depth, &(sv102->ptr_name    ));
1754         prs_uint32("ver_major   ", ps, depth, &(sv102->ver_major   ));
1755         prs_uint32("ver_minor   ", ps, depth, &(sv102->ver_minor   ));
1756         prs_uint32("srv_type    ", ps, depth, &(sv102->srv_type    ));
1757         prs_uint32("ptr_comment ", ps, depth, &(sv102->ptr_comment ));
1758
1759         /* same as 101 up to here */
1760
1761         prs_uint32("users       ", ps, depth, &(sv102->users       ));
1762         prs_uint32("disc        ", ps, depth, &(sv102->disc        ));
1763         prs_uint32("hidden      ", ps, depth, &(sv102->hidden      ));
1764         prs_uint32("announce    ", ps, depth, &(sv102->announce    ));
1765         prs_uint32("ann_delta   ", ps, depth, &(sv102->ann_delta   ));
1766         prs_uint32("licenses    ", ps, depth, &(sv102->licenses    ));
1767         prs_uint32("ptr_usr_path", ps, depth, &(sv102->ptr_usr_path));
1768
1769         smb_io_unistr2("uni_name    ", &(sv102->uni_name    ), True, ps, depth); 
1770         prs_align(ps);
1771         smb_io_unistr2("uni_comment ", &(sv102->uni_comment ), True, ps, depth); 
1772         prs_align(ps);
1773         smb_io_unistr2("uni_usr_path", &(sv102->uni_usr_path), True, ps, depth); 
1774
1775         return True;
1776 }
1777
1778 /*******************************************************************
1779  reads or writes a SRV_INFO_102 structure.
1780  ********************************************************************/
1781 static BOOL srv_io_info_ctr(char *desc,  SRV_INFO_CTR *ctr, prs_struct *ps, int depth)
1782 {
1783         if (ctr == NULL) return False;
1784
1785         prs_debug(ps, depth, desc, "srv_io_info_ctr");
1786         depth++;
1787
1788         prs_align(ps);
1789
1790         prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
1791         prs_uint32("ptr_srv_ctr ", ps, depth, &(ctr->ptr_srv_ctr ));
1792
1793         if (ctr->ptr_srv_ctr != 0 && ctr->switch_value != 0 && ctr != NULL)
1794         {
1795                 switch (ctr->switch_value)
1796                 {
1797                         case 101:
1798                         {
1799                                 srv_io_info_101("sv101", &(ctr->srv.sv101), ps, depth); 
1800                                 break;
1801                         }
1802                         case 102:
1803                         {
1804                                 srv_io_info_102("sv102", &(ctr->srv.sv102), ps, depth); 
1805                                 break;
1806                         }
1807                         default:
1808                         {
1809                                 DEBUG(5,("%s no server info at switch_value %d\n",
1810                                                  tab_depth(depth), ctr->switch_value));
1811                                 break;
1812                         }
1813                 }
1814                 prs_align(ps);
1815         }
1816
1817         return True;
1818 }
1819
1820 /*******************************************************************
1821  makes a SRV_Q_NET_SRV_GET_INFO structure.
1822  ********************************************************************/
1823 BOOL make_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv,
1824                                 char *server_name, uint32 switch_value)
1825 {
1826         if (srv == NULL) return False;
1827
1828         DEBUG(5,("make_srv_q_net_srv_get_info\n"));
1829
1830         make_buf_unistr2(&(srv->uni_srv_name), &(srv->ptr_srv_name), server_name);
1831
1832         srv->switch_value = switch_value;
1833
1834         return True;
1835 }
1836
1837 /*******************************************************************
1838 reads or writes a structure.
1839 ********************************************************************/
1840 BOOL srv_io_q_net_srv_get_info(char *desc,  SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth)
1841 {
1842         if (q_n == NULL) return False;
1843
1844         prs_debug(ps, depth, desc, "srv_io_q_net_srv_get_info");
1845         depth++;
1846
1847         prs_align(ps);
1848
1849         prs_uint32("ptr_srv_name  ", ps, depth, &(q_n->ptr_srv_name));
1850         smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth); 
1851
1852         prs_align(ps);
1853
1854         prs_uint32("switch_value  ", ps, depth, &(q_n->switch_value));
1855
1856         return True;
1857 }
1858
1859 /*******************************************************************
1860  makes a SRV_R_NET_SRV_GET_INFO structure.
1861  ********************************************************************/
1862 BOOL make_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv,
1863                                 uint32 switch_value, SRV_INFO_CTR *ctr, uint32 status)
1864 {
1865         if (srv == NULL) return False;
1866
1867         DEBUG(5,("make_srv_r_net_srv_get_info\n"));
1868
1869         srv->ctr = ctr;
1870
1871         if (status == 0x0)
1872         {
1873                 srv->ctr->switch_value = switch_value;
1874                 srv->ctr->ptr_srv_ctr  = 1;
1875         }
1876         else
1877         {
1878                 srv->ctr->switch_value = 0;
1879                 srv->ctr->ptr_srv_ctr  = 0;
1880         }
1881
1882         srv->status = status;
1883
1884         return True;
1885 }
1886
1887 /*******************************************************************
1888  reads or writes a structure.
1889  ********************************************************************/
1890 BOOL srv_io_r_net_srv_get_info(char *desc,  SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth)
1891 {
1892         if (r_n == NULL) return False;
1893
1894         prs_debug(ps, depth, desc, "srv_io_r_net_srv_get_info");
1895         depth++;
1896
1897         prs_align(ps);
1898
1899         srv_io_info_ctr("ctr", r_n->ctr, ps, depth); 
1900
1901         prs_uint32("status      ", ps, depth, &(r_n->status      ));
1902
1903         return True;
1904 }
1905
1906 /*******************************************************************
1907  makes a SRV_Q_NET_REMOTE_TOD structure.
1908  ********************************************************************/
1909 BOOL make_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_t, char *server_name)
1910 {
1911         if (q_t == NULL) return False;
1912
1913         DEBUG(5,("make_srv_q_net_remote_tod\n"));
1914
1915         make_buf_unistr2(&(q_t->uni_srv_name), &(q_t->ptr_srv_name), server_name);
1916
1917         return True;
1918 }
1919
1920 /*******************************************************************
1921  reads or writes a structure.
1922  ********************************************************************/
1923 BOOL srv_io_q_net_remote_tod(char *desc,  SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth)
1924 {
1925         if (q_n == NULL) return False;
1926
1927         prs_debug(ps, depth, desc, "srv_io_q_net_remote_tod");
1928         depth++;
1929
1930         prs_align(ps);
1931
1932         prs_uint32("ptr_srv_name  ", ps, depth, &(q_n->ptr_srv_name));
1933         smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth); 
1934
1935         return True;
1936 }
1937
1938 /*******************************************************************
1939  reads or writes a TIME_OF_DAY_INFO structure.
1940  ********************************************************************/
1941 static BOOL srv_io_time_of_day_info(char *desc, TIME_OF_DAY_INFO  *tod, prs_struct *ps, int depth)
1942 {
1943         if (tod == NULL) return False;
1944
1945         prs_debug(ps, depth, desc, "srv_io_time_of_day_info");
1946         depth++;
1947
1948         prs_align(ps);
1949         
1950         prs_uint32("elapsedt   ", ps, depth, &(tod->elapsedt  ));
1951         prs_uint32("msecs      ", ps, depth, &(tod->msecs     ));
1952         prs_uint32("hours      ", ps, depth, &(tod->hours     ));
1953         prs_uint32("mins       ", ps, depth, &(tod->mins      ));
1954         prs_uint32("secs       ", ps, depth, &(tod->secs      ));
1955         prs_uint32("hunds      ", ps, depth, &(tod->hunds     ));
1956         prs_uint32("timezone   ", ps, depth, &(tod->zone  ));
1957         prs_uint32("tintervals ", ps, depth, &(tod->tintervals));
1958         prs_uint32("day        ", ps, depth, &(tod->day       ));
1959         prs_uint32("month      ", ps, depth, &(tod->month     ));
1960         prs_uint32("year       ", ps, depth, &(tod->year      ));
1961         prs_uint32("weekday    ", ps, depth, &(tod->weekday   ));
1962
1963
1964         return True;
1965 }
1966
1967 /*******************************************************************
1968  makes a TIME_OF_DAY_INFO structure.
1969  ********************************************************************/
1970 BOOL make_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs,
1971                            uint32 hours, uint32 mins, uint32 secs, uint32 hunds,
1972                            uint32 zone, uint32 tintervals, uint32 day,
1973                            uint32 month, uint32 year, uint32 weekday)
1974 {
1975         if (tod == NULL) return False;
1976
1977         DEBUG(5,("make_time_of_day_info\n"));
1978
1979         tod->elapsedt   = elapsedt;
1980         tod->msecs      = msecs;
1981         tod->hours      = hours;
1982         tod->mins       = mins;
1983         tod->secs       = secs;
1984         tod->hunds      = hunds;
1985         tod->zone       = zone;
1986         tod->tintervals = tintervals;
1987         tod->day        = day;
1988         tod->month      = month;
1989         tod->year       = year;
1990         tod->weekday    = weekday;
1991
1992         return True;
1993 }
1994
1995
1996 /*******************************************************************
1997  reads or writes a structure.
1998  ********************************************************************/
1999 BOOL srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth)
2000 {
2001         if (r_n == NULL) return False;
2002
2003         prs_debug(ps, depth, desc, "srv_io_r_net_remote_tod");
2004         depth++;
2005
2006         prs_align(ps);
2007         
2008         prs_uint32("ptr_srv_tod ", ps, depth, &(r_n->ptr_srv_tod));
2009
2010         srv_io_time_of_day_info("tod", r_n->tod, ps, depth); 
2011
2012         prs_uint32("status      ", ps, depth, &(r_n->status));
2013
2014         return True;
2015 }