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