qualifier name in session_enum was being assumed to exist. if NULL, the
[bbaumbach/samba-autobuild/.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-1997,
7  *  Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
8  *  Copyright (C) Paul Ashton                       1997.
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 void make_srv_share_info1_str(SH_INFO_1_STR *sh1, char *net_name, char *remark)
35 {
36         if (sh1 == NULL) return;
37
38         DEBUG(5,("make_srv_share_info1_str\n"));
39
40         make_unistr2(&(sh1->uni_netname), net_name, strlen(net_name));
41         make_unistr2(&(sh1->uni_remark ), remark  , strlen(remark  ));
42 }
43
44 /*******************************************************************
45 reads or writes a structure.
46 ********************************************************************/
47 static void srv_io_share_info1_str(char *desc,  SH_INFO_1_STR *sh1, prs_struct *ps, int depth)
48 {
49         if (sh1 == NULL) return;
50
51         prs_debug(ps, depth, desc, "srv_io_share_info1_str");
52         depth++;
53
54         prs_align(ps);
55
56         smb_io_unistr2("", &(sh1->uni_netname), True, ps, depth); 
57         smb_io_unistr2("", &(sh1->uni_remark ), True, ps, depth); 
58 }
59
60 /*******************************************************************
61  makes a SH_INFO_1 structure
62 ********************************************************************/
63 void make_srv_share_info1(SH_INFO_1 *sh1, char *net_name, uint32 type, char *remark)
64 {
65         if (sh1 == NULL) return;
66
67         DEBUG(5,("make_srv_share_info1: %s %8x %s\n", net_name, type, remark));
68
69         sh1->ptr_netname = net_name != NULL ? 1 : 0;
70         sh1->type        = type;
71         sh1->ptr_remark  = remark   != NULL ? 1 : 0;
72 }
73
74 /*******************************************************************
75 reads or writes a structure.
76 ********************************************************************/
77 static void srv_io_share_info1(char *desc,  SH_INFO_1 *sh1, prs_struct *ps, int depth)
78 {
79         if (sh1 == NULL) return;
80
81         prs_debug(ps, depth, desc, "srv_io_share_info1");
82         depth++;
83
84         prs_align(ps);
85
86         prs_uint32("ptr_netname", ps, depth, &(sh1->ptr_netname));
87         prs_uint32("type       ", ps, depth, &(sh1->type       ));
88         prs_uint32("ptr_remark ", ps, depth, &(sh1->ptr_remark));
89 }
90
91 /*******************************************************************
92 reads or writes a structure.
93 ********************************************************************/
94 static void srv_io_srv_share_info_1(char *desc,  SRV_SHARE_INFO_1 *ctr, prs_struct *ps, int depth)
95 {
96         if (ctr == NULL) return;
97
98         prs_debug(ps, depth, desc, "srv_io_share_1_ctr");
99         depth++;
100
101         prs_align(ps);
102
103         prs_uint32("num_entries_read", ps, depth, &(ctr->num_entries_read));
104         prs_uint32("ptr_share_info", ps, depth, &(ctr->ptr_share_info));
105
106         if (ctr->ptr_share_info != 0)
107         {
108                 int i;
109                 int num_entries = ctr->num_entries_read;
110                 if (num_entries > MAX_SHARE_ENTRIES)
111                 {
112                         num_entries = MAX_SHARE_ENTRIES; /* report this! */
113                 }
114
115                 prs_uint32("num_entries_read2", ps, depth, &(ctr->num_entries_read2));
116
117                 SMB_ASSERT_ARRAY(ctr->info_1, num_entries);
118
119                 for (i = 0; i < num_entries; i++)
120                 {
121                         prs_grow(ps);
122                         srv_io_share_info1("", &(ctr->info_1[i]), ps, depth); 
123                 }
124
125                 for (i = 0; i < num_entries; i++)
126                 {
127                         prs_grow(ps);
128                         srv_io_share_info1_str("", &(ctr->info_1_str[i]), ps, depth); 
129                 }
130
131                 prs_align(ps);
132         }
133 }
134
135 /*******************************************************************
136  makes a SH_INFO_2_STR structure
137 ********************************************************************/
138 void make_srv_share_info2_str(SH_INFO_2_STR *sh2,
139                                 char *net_name, char *remark,
140                                 char *path, char *passwd)
141 {
142         if (sh2 == NULL) return;
143
144         DEBUG(5,("make_srv_share_info2_str\n"));
145
146         make_unistr2(&(sh2->uni_netname), net_name, strlen(net_name)+1);
147         make_unistr2(&(sh2->uni_remark ), remark  , strlen(remark  )+1);
148         make_unistr2(&(sh2->uni_path   ), path    , strlen(path    )+1);
149         make_unistr2(&(sh2->uni_passwd ), passwd  , strlen(passwd  )+1);
150 }
151
152 /*******************************************************************
153 reads or writes a structure.
154 ********************************************************************/
155 static void srv_io_share_info2_str(char *desc,  SH_INFO_2_STR *sh2, prs_struct *ps, int depth)
156 {
157         if (sh2 == NULL) return;
158
159         prs_debug(ps, depth, desc, "srv_io_share_info2_str");
160         depth++;
161
162         prs_align(ps);
163
164         smb_io_unistr2("", &(sh2->uni_netname), True, ps, depth); 
165         smb_io_unistr2("", &(sh2->uni_remark ), True, ps, depth); 
166         smb_io_unistr2("", &(sh2->uni_path   ), True, ps, depth); 
167         smb_io_unistr2("", &(sh2->uni_passwd ), True, ps, depth); 
168 }
169
170 /*******************************************************************
171  makes a SH_INFO_2 structure
172 ********************************************************************/
173 void make_srv_share_info2(SH_INFO_2 *sh2,
174                                 char *net_name, uint32 type, char *remark,
175                                 uint32 perms, uint32 max_uses, uint32 num_uses,
176                                 char *path, char *passwd)
177 {
178         if (sh2 == NULL) return;
179
180         DEBUG(5,("make_srv_share_info2: %s %8x %s\n", net_name, type, remark));
181
182         sh2->ptr_netname = net_name != NULL ? 1 : 0;
183         sh2->type        = type;
184         sh2->ptr_remark  = remark   != NULL ? 1 : 0;
185         sh2->perms       = perms;
186         sh2->max_uses    = max_uses;
187         sh2->num_uses    = num_uses;
188         sh2->type        = type;
189         sh2->ptr_path    = path     != NULL ? 1 : 0;
190         sh2->ptr_passwd  = passwd   != NULL ? 1 : 0;
191 }
192
193 /*******************************************************************
194 reads or writes a structure.
195 ********************************************************************/
196 static void srv_io_share_info2(char *desc,  SH_INFO_2 *sh2, prs_struct *ps, int depth)
197 {
198         if (sh2 == NULL) return;
199
200         prs_debug(ps, depth, desc, "srv_io_share_info2");
201         depth++;
202
203         prs_align(ps);
204
205         prs_uint32("ptr_netname", ps, depth, &(sh2->ptr_netname));
206         prs_uint32("type       ", ps, depth, &(sh2->type       ));
207         prs_uint32("ptr_remark ", ps, depth, &(sh2->ptr_remark ));
208         prs_uint32("perms      ", ps, depth, &(sh2->perms      ));
209         prs_uint32("max_uses   ", ps, depth, &(sh2->max_uses   ));
210         prs_uint32("num_uses   ", ps, depth, &(sh2->num_uses   ));
211         prs_uint32("ptr_path   ", ps, depth, &(sh2->ptr_path   ));
212         prs_uint32("ptr_passwd ", ps, depth, &(sh2->ptr_passwd ));
213 }
214
215 /*******************************************************************
216 reads or writes a structure.
217 ********************************************************************/
218 static void srv_io_srv_share_info_2(char *desc,  SRV_SHARE_INFO_2 *ctr, prs_struct *ps, int depth)
219 {
220         if (ctr == NULL) return;
221
222         prs_debug(ps, depth, desc, "srv_io_share_2_ctr");
223         depth++;
224
225         prs_align(ps);
226
227         prs_uint32("num_entries_read", ps, depth, &(ctr->num_entries_read));
228         prs_uint32("ptr_share_info", ps, depth, &(ctr->ptr_share_info));
229
230         if (ctr->ptr_share_info != 0)
231         {
232                 int i;
233                 int num_entries = ctr->num_entries_read;
234                 if (num_entries > MAX_SHARE_ENTRIES)
235                 {
236                         num_entries = MAX_SHARE_ENTRIES; /* report this! */
237                 }
238
239                 prs_uint32("num_entries_read2", ps, depth, &(ctr->num_entries_read2));
240
241                 SMB_ASSERT_ARRAY(ctr->info_2, num_entries);
242
243                 for (i = 0; i < num_entries; i++)
244                 {
245                         prs_grow(ps);
246                         srv_io_share_info2("", &(ctr->info_2[i]), ps, depth); 
247                 }
248
249                 for (i = 0; i < num_entries; i++)
250                 {
251                         prs_grow(ps);
252                         srv_io_share_info2_str("", &(ctr->info_2_str[i]), ps, depth); 
253                 }
254
255                 prs_align(ps);
256         }
257 }
258
259 /*******************************************************************
260 reads or writes a structure.
261 ********************************************************************/
262 static void srv_io_srv_share_ctr(char *desc,  SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth)
263 {
264         if (ctr == NULL) return;
265
266         prs_debug(ps, depth, desc, "srv_io_srv_share_ctr");
267         depth++;
268
269         prs_align(ps);
270
271         prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
272         prs_uint32("ptr_share_ctr", ps, depth, &(ctr->ptr_share_ctr));
273
274         if (ctr->ptr_share_ctr != 0)
275         {
276                 switch (ctr->switch_value)
277                 {
278                         case 2:
279                         {
280                                 srv_io_srv_share_info_2("", &(ctr->share.info2), ps, depth); 
281                                 break;
282                         }
283                         case 1:
284                         {
285                                 srv_io_srv_share_info_1("", &(ctr->share.info1), ps, depth); 
286                                 break;
287                         }
288                         default:
289                         {
290                                 DEBUG(5,("%s no share info at switch_value %d\n",
291                                          tab_depth(depth), ctr->switch_value));
292                                 break;
293                         }
294                 }
295         }
296 }
297
298 /*******************************************************************
299 reads or writes a structure.
300 ********************************************************************/
301 void srv_io_q_net_share_enum(char *desc,  SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth)
302 {
303         if (q_n == NULL) return;
304
305         prs_debug(ps, depth, desc, "srv_io_q_net_share_enum");
306         depth++;
307
308         prs_align(ps);
309
310         prs_uint32("ptr_srv_name", ps, depth, &(q_n->ptr_srv_name));
311         smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth); 
312
313         prs_align(ps);
314
315         prs_uint32("share_level", ps, depth, &(q_n->share_level  ));
316
317         if (q_n->share_level != -1)
318         {
319                 srv_io_srv_share_ctr("share_ctr", q_n->ctr, ps, depth);
320         }
321
322         prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
323
324         smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth); 
325 }
326
327 /*******************************************************************
328 reads or writes a structure.
329 ********************************************************************/
330 void srv_io_r_net_share_enum(char *desc,  SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth)
331 {
332         if (r_n == NULL) return;
333
334         prs_debug(ps, depth, desc, "srv_io_r_net_share_enum");
335         depth++;
336
337         prs_align(ps);
338
339         prs_uint32("share_level", ps, depth, &(r_n->share_level));
340
341         if (r_n->share_level != 0)
342         {
343                 srv_io_srv_share_ctr("share_ctr", r_n->ctr, ps, depth);
344         }
345
346         prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
347         smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth); 
348         prs_uint32("status     ", ps, depth, &(r_n->status));
349 }
350
351 /*******************************************************************
352  makes a SESS_INFO_0_STR structure
353 ********************************************************************/
354 void make_srv_sess_info0_str(SESS_INFO_0_STR *ss0, char *name)
355 {
356         if (ss0 == NULL) return;
357
358         DEBUG(5,("make_srv_sess_info0_str\n"));
359
360         make_unistr2(&(ss0->uni_name), name, strlen(name));
361 }
362
363 /*******************************************************************
364 reads or writes a structure.
365 ********************************************************************/
366 static void srv_io_sess_info0_str(char *desc,  SESS_INFO_0_STR *ss0, prs_struct *ps, int depth)
367 {
368         if (ss0 == NULL) return;
369
370         prs_debug(ps, depth, desc, "srv_io_sess_info0_str");
371         depth++;
372
373         prs_align(ps);
374
375         smb_io_unistr2("", &(ss0->uni_name), True, ps, depth); 
376 }
377
378 /*******************************************************************
379  makes a SESS_INFO_0 structure
380 ********************************************************************/
381 void make_srv_sess_info0(SESS_INFO_0 *ss0, char *name)
382 {
383         if (ss0 == NULL) return;
384
385         DEBUG(5,("make_srv_sess_info0: %s\n", name));
386
387         ss0->ptr_name = name != NULL ? 1 : 0;
388 }
389
390 /*******************************************************************
391 reads or writes a structure.
392 ********************************************************************/
393 static void srv_io_sess_info0(char *desc,  SESS_INFO_0 *ss0, prs_struct *ps, int depth)
394 {
395         if (ss0 == NULL) return;
396
397         prs_debug(ps, depth, desc, "srv_io_sess_info0");
398         depth++;
399
400         prs_align(ps);
401
402         prs_uint32("ptr_name", ps, depth, &(ss0->ptr_name));
403 }
404
405 /*******************************************************************
406 reads or writes a structure.
407 ********************************************************************/
408 static void srv_io_srv_sess_info_0(char *desc,  SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth)
409 {
410         if (ss0 == NULL) return;
411
412         prs_debug(ps, depth, desc, "srv_io_srv_sess_info_0");
413         depth++;
414
415         prs_align(ps);
416
417         prs_uint32("num_entries_read", ps, depth, &(ss0->num_entries_read));
418         prs_uint32("ptr_sess_info", ps, depth, &(ss0->ptr_sess_info));
419
420         if (ss0->ptr_sess_info != 0)
421         {
422                 int i;
423                 int num_entries = ss0->num_entries_read;
424                 if (num_entries > MAX_SESS_ENTRIES)
425                 {
426                         num_entries = MAX_SESS_ENTRIES; /* report this! */
427                 }
428
429                 prs_uint32("num_entries_read2", ps, depth, &(ss0->num_entries_read2));
430
431                 SMB_ASSERT_ARRAY(ss0->info_0, num_entries);
432
433                 for (i = 0; i < num_entries; i++)
434                 {
435                         prs_grow(ps);
436                         srv_io_sess_info0("", &(ss0->info_0[i]), ps, depth); 
437                 }
438
439                 for (i = 0; i < num_entries; i++)
440                 {
441                         prs_grow(ps);
442                         srv_io_sess_info0_str("", &(ss0->info_0_str[i]), ps, depth); 
443                 }
444
445                 prs_align(ps);
446         }
447 }
448
449 /*******************************************************************
450  makes a SESS_INFO_1_STR structure
451 ********************************************************************/
452 void make_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user)
453 {
454         if (ss1 == NULL) return;
455
456         DEBUG(5,("make_srv_sess_info1_str\n"));
457
458         make_unistr2(&(ss1->uni_name), name, strlen(name));
459         make_unistr2(&(ss1->uni_user), name, strlen(user));
460 }
461
462 /*******************************************************************
463 reads or writes a structure.
464 ********************************************************************/
465 static void srv_io_sess_info1_str(char *desc,  SESS_INFO_1_STR *ss1, prs_struct *ps, int depth)
466 {
467         if (ss1 == NULL) return;
468
469         prs_debug(ps, depth, desc, "srv_io_sess_info1_str");
470         depth++;
471
472         prs_align(ps);
473
474         smb_io_unistr2("", &(ss1->uni_name), True, ps, depth); 
475         smb_io_unistr2("", &(ss1->uni_user), True, ps, depth); 
476 }
477
478 /*******************************************************************
479  makes a SESS_INFO_1 structure
480 ********************************************************************/
481 void make_srv_sess_info1(SESS_INFO_1 *ss1, 
482                                 char *name, char *user,
483                                 uint32 num_opens, uint32 open_time, uint32 idle_time,
484                                 uint32 user_flags)
485 {
486         if (ss1 == NULL) return;
487
488         DEBUG(5,("make_srv_sess_info1: %s\n", name));
489
490         ss1->ptr_name = name != NULL ? 1 : 0;
491         ss1->ptr_user = user != NULL ? 1 : 0;
492
493         ss1->num_opens  = num_opens;
494         ss1->open_time  = open_time;
495         ss1->idle_time  = idle_time;
496         ss1->user_flags = user_flags;
497 }
498
499 /*******************************************************************
500 reads or writes a structure.
501 ********************************************************************/
502 static void srv_io_sess_info1(char *desc,  SESS_INFO_1 *ss1, prs_struct *ps, int depth)
503 {
504         if (ss1 == NULL) return;
505
506         prs_debug(ps, depth, desc, "srv_io_sess_info1");
507         depth++;
508
509         prs_align(ps);
510
511         prs_uint32("ptr_name  ", ps, depth, &(ss1->ptr_name  ));
512         prs_uint32("ptr_user  ", ps, depth, &(ss1->ptr_user  ));
513
514         prs_uint32("num_opens ", ps, depth, &(ss1->num_opens ));
515         prs_uint32("open_time ", ps, depth, &(ss1->open_time ));
516         prs_uint32("idle_time ", ps, depth, &(ss1->idle_time ));
517         prs_uint32("user_flags", ps, depth, &(ss1->user_flags));
518 }
519
520 /*******************************************************************
521 reads or writes a structure.
522 ********************************************************************/
523 static void srv_io_srv_sess_info_1(char *desc,  SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth)
524 {
525         if (ss1 == NULL) return;
526
527         prs_debug(ps, depth, desc, "srv_io_srv_sess_info_1");
528         depth++;
529
530         prs_align(ps);
531
532         prs_uint32("num_entries_read", ps, depth, &(ss1->num_entries_read));
533         prs_uint32("ptr_sess_info", ps, depth, &(ss1->ptr_sess_info));
534
535         if (ss1->ptr_sess_info != 0)
536         {
537                 int i;
538                 int num_entries = ss1->num_entries_read;
539                 if (num_entries > MAX_SESS_ENTRIES)
540                 {
541                         num_entries = MAX_SESS_ENTRIES; /* report this! */
542                 }
543
544                 prs_uint32("num_entries_read2", ps, depth, &(ss1->num_entries_read2));
545
546                 SMB_ASSERT_ARRAY(ss1->info_1, num_entries);
547
548                 for (i = 0; i < num_entries; i++)
549                 {
550                         prs_grow(ps);
551                         srv_io_sess_info1("", &(ss1->info_1[i]), ps, depth); 
552                 }
553
554                 for (i = 0; i < num_entries; i++)
555                 {
556                         prs_grow(ps);
557                         srv_io_sess_info1_str("", &(ss1->info_1_str[i]), ps, depth); 
558                 }
559
560                 prs_align(ps);
561         }
562 }
563
564 /*******************************************************************
565 reads or writes a structure.
566 ********************************************************************/
567 static void srv_io_srv_sess_ctr(char *desc,  SRV_SESS_INFO_CTR *ctr, prs_struct *ps, int depth)
568 {
569         if (ctr == NULL) return;
570
571         prs_debug(ps, depth, desc, "srv_io_srv_sess_ctr");
572         depth++;
573
574         prs_align(ps);
575
576         prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
577         prs_uint32("ptr_sess_ctr", ps, depth, &(ctr->ptr_sess_ctr));
578
579         if (ctr->ptr_sess_ctr != 0)
580         {
581                 switch (ctr->switch_value)
582                 {
583                         case 0:
584                         {
585                                 srv_io_srv_sess_info_0("", &(ctr->sess.info0), ps, depth); 
586                                 break;
587                         }
588                         case 1:
589                         {
590                                 srv_io_srv_sess_info_1("", &(ctr->sess.info1), ps, depth); 
591                                 break;
592                         }
593                         default:
594                         {
595                                 DEBUG(5,("%s no session info at switch_value %d\n",
596                                          tab_depth(depth), ctr->switch_value));
597                                 break;
598                         }
599                 }
600         }
601 }
602
603 /*******************************************************************
604 reads or writes a structure.
605 ********************************************************************/
606 void srv_io_q_net_sess_enum(char *desc,  SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps, int depth)
607 {
608         if (q_n == NULL) return;
609
610         prs_debug(ps, depth, desc, "srv_io_q_net_sess_enum");
611         depth++;
612
613         prs_align(ps);
614
615         prs_uint32("ptr_srv_name", ps, depth, &(q_n->ptr_srv_name));
616         smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth); 
617
618         prs_align(ps);
619
620         prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name));
621         smb_io_unistr2("", &(q_n->uni_qual_name), q_n->ptr_qual_name, ps, depth); 
622
623         prs_align(ps);
624
625         prs_uint32("sess_level", ps, depth, &(q_n->sess_level  ));
626         
627         if (q_n->sess_level != -1)
628         {
629                 srv_io_srv_sess_ctr("sess_ctr", q_n->ctr, ps, depth);
630         }
631
632         prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
633
634         smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth); 
635 }
636
637 /*******************************************************************
638 reads or writes a structure.
639 ********************************************************************/
640 void srv_io_r_net_sess_enum(char *desc,  SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth)
641 {
642         if (r_n == NULL) return;
643
644         prs_debug(ps, depth, desc, "srv_io_r_net_sess_enum");
645         depth++;
646
647         prs_align(ps);
648
649         prs_uint32("sess_level", ps, depth, &(r_n->sess_level));
650
651         if (r_n->sess_level != -1)
652         {
653                 srv_io_srv_sess_ctr("sess_ctr", r_n->ctr, ps, depth);
654         }
655
656         prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
657         smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth); 
658         prs_uint32("status     ", ps, depth, &(r_n->status));
659 }
660
661 /*******************************************************************
662  makes a CONN_INFO_0 structure
663 ********************************************************************/
664 void make_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id)
665 {
666         if (ss0 == NULL) return;
667
668         DEBUG(5,("make_srv_conn_info0\n"));
669
670         ss0->id = id;
671 }
672
673 /*******************************************************************
674 reads or writes a structure.
675 ********************************************************************/
676 static void srv_io_conn_info0(char *desc,  CONN_INFO_0 *ss0, prs_struct *ps, int depth)
677 {
678         if (ss0 == NULL) return;
679
680         prs_debug(ps, depth, desc, "srv_io_conn_info0");
681         depth++;
682
683         prs_align(ps);
684
685         prs_uint32("id", ps, depth, &(ss0->id));
686 }
687
688 /*******************************************************************
689 reads or writes a structure.
690 ********************************************************************/
691 static void srv_io_srv_conn_info_0(char *desc,  SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth)
692 {
693         if (ss0 == NULL) return;
694
695         prs_debug(ps, depth, desc, "srv_io_srv_conn_info_0");
696         depth++;
697
698         prs_align(ps);
699
700         prs_uint32("num_entries_read", ps, depth, &(ss0->num_entries_read));
701         prs_uint32("ptr_conn_info", ps, depth, &(ss0->ptr_conn_info));
702
703         if (ss0->ptr_conn_info != 0)
704         {
705                 int i;
706                 int num_entries = ss0->num_entries_read;
707                 if (num_entries > MAX_CONN_ENTRIES)
708                 {
709                         num_entries = MAX_CONN_ENTRIES; /* report this! */
710                 }
711
712                 prs_uint32("num_entries_read2", ps, depth, &(ss0->num_entries_read2));
713
714                 for (i = 0; i < num_entries; i++)
715                 {
716                         prs_grow(ps);
717                         srv_io_conn_info0("", &(ss0->info_0[i]), ps, depth); 
718                 }
719
720                 prs_align(ps);
721         }
722 }
723
724 /*******************************************************************
725  makes a CONN_INFO_1_STR structure
726 ********************************************************************/
727 void make_srv_conn_info1_str(CONN_INFO_1_STR *ss1, char *usr_name, char *net_name)
728 {
729         if (ss1 == NULL) return;
730
731         DEBUG(5,("make_srv_conn_info1_str\n"));
732
733         make_unistr2(&(ss1->uni_usr_name), usr_name, strlen(usr_name));
734         make_unistr2(&(ss1->uni_net_name), net_name, strlen(net_name));
735 }
736
737 /*******************************************************************
738 reads or writes a structure.
739 ********************************************************************/
740 static void srv_io_conn_info1_str(char *desc,  CONN_INFO_1_STR *ss1, prs_struct *ps, int depth)
741 {
742         if (ss1 == NULL) return;
743
744         prs_debug(ps, depth, desc, "srv_io_conn_info1_str");
745         depth++;
746
747         prs_align(ps);
748
749         smb_io_unistr2("", &(ss1->uni_usr_name), True, ps, depth); 
750         smb_io_unistr2("", &(ss1->uni_net_name), True, ps, depth); 
751 }
752
753 /*******************************************************************
754  makes a CONN_INFO_1 structure
755 ********************************************************************/
756 void make_srv_conn_info1(CONN_INFO_1 *ss1, 
757                                 uint32 id, uint32 type,
758                                 uint32 num_opens, uint32 num_users, uint32 open_time,
759                                 char *usr_name, char *net_name)
760 {
761         if (ss1 == NULL) return;
762
763         DEBUG(5,("make_srv_conn_info1: %s %s\n", usr_name, net_name));
764
765         ss1->id        = id       ;
766         ss1->type      = type     ;
767         ss1->num_opens = num_opens ;
768         ss1->num_users = num_users;
769         ss1->open_time = open_time;
770
771         ss1->ptr_usr_name = usr_name != NULL ? 1 : 0;
772         ss1->ptr_net_name = net_name != NULL ? 1 : 0;
773 }
774
775 /*******************************************************************
776 reads or writes a structure.
777 ********************************************************************/
778 static void srv_io_conn_info1(char *desc,  CONN_INFO_1 *ss1, prs_struct *ps, int depth)
779 {
780         if (ss1 == NULL) return;
781
782         prs_debug(ps, depth, desc, "srv_io_conn_info1");
783         depth++;
784
785         prs_align(ps);
786
787         prs_uint32("id          ", ps, depth, &(ss1->id        ));
788         prs_uint32("type        ", ps, depth, &(ss1->type      ));
789         prs_uint32("num_opens   ", ps, depth, &(ss1->num_opens ));
790         prs_uint32("num_users   ", ps, depth, &(ss1->num_users ));
791         prs_uint32("open_time   ", ps, depth, &(ss1->open_time ));
792
793         prs_uint32("ptr_usr_name", ps, depth, &(ss1->ptr_usr_name));
794         prs_uint32("ptr_net_name", ps, depth, &(ss1->ptr_net_name));
795 }
796
797 /*******************************************************************
798 reads or writes a structure.
799 ********************************************************************/
800 static void srv_io_srv_conn_info_1(char *desc,  SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth)
801 {
802         if (ss1 == NULL) return;
803
804         prs_debug(ps, depth, desc, "srv_io_srv_conn_info_1");
805         depth++;
806
807         prs_align(ps);
808
809         prs_uint32("num_entries_read", ps, depth, &(ss1->num_entries_read));
810         prs_uint32("ptr_conn_info", ps, depth, &(ss1->ptr_conn_info));
811
812         if (ss1->ptr_conn_info != 0)
813         {
814                 int i;
815                 int num_entries = ss1->num_entries_read;
816                 if (num_entries > MAX_CONN_ENTRIES)
817                 {
818                         num_entries = MAX_CONN_ENTRIES; /* report this! */
819                 }
820
821                 prs_uint32("num_entries_read2", ps, depth, &(ss1->num_entries_read2));
822
823                 for (i = 0; i < num_entries; i++)
824                 {
825                         prs_grow(ps);
826                         srv_io_conn_info1("", &(ss1->info_1[i]), ps, depth); 
827                 }
828
829                 for (i = 0; i < num_entries; i++)
830                 {
831                         prs_grow(ps);
832                         srv_io_conn_info1_str("", &(ss1->info_1_str[i]), ps, depth); 
833                 }
834
835                 prs_align(ps);
836         }
837 }
838
839 /*******************************************************************
840 reads or writes a structure.
841 ********************************************************************/
842 static void srv_io_srv_conn_ctr(char *desc,  SRV_CONN_INFO_CTR *ctr, prs_struct *ps, int depth)
843 {
844         if (ctr == NULL) return;
845
846         prs_debug(ps, depth, desc, "srv_io_srv_conn_ctr");
847         depth++;
848
849         prs_align(ps);
850
851         prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
852         prs_uint32("ptr_conn_ctr", ps, depth, &(ctr->ptr_conn_ctr));
853
854         if (ctr->ptr_conn_ctr != 0)
855         {
856                 switch (ctr->switch_value)
857                 {
858                         case 0:
859                         {
860                                 srv_io_srv_conn_info_0("", &(ctr->conn.info0), ps, depth); 
861                                 break;
862                         }
863                         case 1:
864                         {
865                                 srv_io_srv_conn_info_1("", &(ctr->conn.info1), ps, depth); 
866                                 break;
867                         }
868                         default:
869                         {
870                                 DEBUG(5,("%s no connection info at switch_value %d\n",
871                                          tab_depth(depth), ctr->switch_value));
872                                 break;
873                         }
874                 }
875         }
876 }
877
878 /*******************************************************************
879 reads or writes a structure.
880 ********************************************************************/
881 void srv_io_q_net_conn_enum(char *desc,  SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth)
882 {
883         if (q_n == NULL) return;
884
885         prs_debug(ps, depth, desc, "srv_io_q_net_conn_enum");
886         depth++;
887
888         prs_align(ps);
889
890         prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name));
891         smb_io_unistr2("", &(q_n->uni_srv_name), q_n->ptr_srv_name, ps, depth); 
892
893         prs_align(ps);
894
895         prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name));
896         smb_io_unistr2("", &(q_n->uni_qual_name), q_n->ptr_qual_name, ps, depth); 
897
898         prs_align(ps);
899
900         prs_uint32("conn_level", ps, depth, &(q_n->conn_level  ));
901         
902         if (q_n->conn_level != -1)
903         {
904                 srv_io_srv_conn_ctr("conn_ctr", q_n->ctr, ps, depth);
905         }
906
907         prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
908
909         smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth); 
910 }
911
912 /*******************************************************************
913 reads or writes a structure.
914 ********************************************************************/
915 void srv_io_r_net_conn_enum(char *desc,  SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth)
916 {
917         if (r_n == NULL) return;
918
919         prs_debug(ps, depth, desc, "srv_io_r_net_conn_enum");
920         depth++;
921
922         prs_align(ps);
923
924         prs_uint32("conn_level", ps, depth, &(r_n->conn_level));
925
926         if (r_n->conn_level != -1)
927         {
928                 srv_io_srv_conn_ctr("conn_ctr", r_n->ctr, ps, depth);
929         }
930
931         prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
932         smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth); 
933         prs_uint32("status     ", ps, depth, &(r_n->status));
934 }
935
936 /*******************************************************************
937  makes a FILE_INFO_3_STR structure
938 ********************************************************************/
939 void make_srv_file_info3_str(FILE_INFO_3_STR *fi3, char *user_name, char *path_name)
940 {
941         if (fi3 == NULL) return;
942
943         DEBUG(5,("make_srv_file_info3_str\n"));
944
945         make_unistr2(&(fi3->uni_path_name), path_name, strlen(path_name)+1);
946         make_unistr2(&(fi3->uni_user_name), user_name, strlen(user_name)+1);
947 }
948
949 /*******************************************************************
950 reads or writes a structure.
951 ********************************************************************/
952 static void srv_io_file_info3_str(char *desc,  FILE_INFO_3_STR *sh1, prs_struct *ps, int depth)
953 {
954         if (sh1 == NULL) return;
955
956         prs_debug(ps, depth, desc, "srv_io_file_info3_str");
957         depth++;
958
959         prs_align(ps);
960
961         smb_io_unistr2("", &(sh1->uni_path_name), True, ps, depth); 
962         smb_io_unistr2("", &(sh1->uni_user_name), True, ps, depth); 
963 }
964
965 /*******************************************************************
966  makes a FILE_INFO_3 structure
967 ********************************************************************/
968 void make_srv_file_info3(FILE_INFO_3 *fl3,
969                                 uint32 id, uint32 perms, uint32 num_locks,
970                                 char *path_name, char *user_name)
971 {
972         if (fl3 == NULL) return;
973
974         DEBUG(5,("make_srv_file_info3: %s %s\n", path_name, user_name));
975
976         fl3->id        = id;    
977         fl3->perms     = perms;
978         fl3->num_locks = num_locks;
979
980         fl3->ptr_path_name = path_name != NULL ? 1 : 0;
981         fl3->ptr_user_name = user_name != NULL ? 1 : 0;
982 }
983
984 /*******************************************************************
985 reads or writes a structure.
986 ********************************************************************/
987 static void srv_io_file_info3(char *desc,  FILE_INFO_3 *fl3, prs_struct *ps, int depth)
988 {
989         if (fl3 == NULL) return;
990
991         prs_debug(ps, depth, desc, "srv_io_file_info3");
992         depth++;
993
994         prs_align(ps);
995
996         prs_uint32("id           ", ps, depth, &(fl3->id           ));
997         prs_uint32("perms        ", ps, depth, &(fl3->perms        ));
998         prs_uint32("num_locks    ", ps, depth, &(fl3->num_locks    ));
999         prs_uint32("ptr_path_name", ps, depth, &(fl3->ptr_path_name));
1000         prs_uint32("ptr_user_name", ps, depth, &(fl3->ptr_user_name));
1001 }
1002
1003 /*******************************************************************
1004 reads or writes a structure.
1005 ********************************************************************/
1006 static void srv_io_srv_file_info_3(char *desc,  SRV_FILE_INFO_3 *fl3, prs_struct *ps, int depth)
1007 {
1008         if (fl3 == NULL) return;
1009
1010         prs_debug(ps, depth, desc, "srv_io_file_3_fl3");
1011         depth++;
1012
1013         prs_align(ps);
1014
1015         prs_uint32("num_entries_read", ps, depth, &(fl3->num_entries_read));
1016         prs_uint32("ptr_file_fl3", ps, depth, &(fl3->ptr_file_info));
1017         if (fl3->ptr_file_info != 0)
1018         {
1019                 int i;
1020                 int num_entries = fl3->num_entries_read;
1021                 if (num_entries > MAX_FILE_ENTRIES)
1022                 {
1023                         num_entries = MAX_FILE_ENTRIES; /* report this! */
1024                 }
1025
1026                 prs_uint32("num_entries_read2", ps, depth, &(fl3->num_entries_read2));
1027
1028                 for (i = 0; i < num_entries; i++)
1029                 {
1030                         prs_grow(ps);
1031                         srv_io_file_info3("", &(fl3->info_3[i]), ps, depth); 
1032                 }
1033
1034                 for (i = 0; i < num_entries; i++)
1035                 {
1036                         prs_grow(ps);
1037                         srv_io_file_info3_str("", &(fl3->info_3_str[i]), ps, depth); 
1038                 }
1039
1040                 prs_align(ps);
1041         }
1042 }
1043
1044 /*******************************************************************
1045 reads or writes a structure.
1046 ********************************************************************/
1047 static void srv_io_srv_file_ctr(char *desc,  SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth)
1048 {
1049         if (ctr == NULL) return;
1050
1051         prs_debug(ps, depth, desc, "srv_io_srv_file_ctr");
1052         depth++;
1053
1054         prs_align(ps);
1055
1056         prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
1057         prs_uint32("ptr_file_ctr", ps, depth, &(ctr->ptr_file_ctr));
1058
1059         if (ctr->ptr_file_ctr != 0)
1060         {
1061                 switch (ctr->switch_value)
1062                 {
1063                         case 3:
1064                         {
1065                                 srv_io_srv_file_info_3("", &(ctr->file.info3), ps, depth); 
1066                                 break;
1067                         }
1068                         default:
1069                         {
1070                                 DEBUG(5,("%s no file info at switch_value %d\n",
1071                                          tab_depth(depth), ctr->switch_value));
1072                                 break;
1073                         }
1074                 }
1075         }
1076 }
1077
1078 /*******************************************************************
1079 reads or writes a structure.
1080 ********************************************************************/
1081 void srv_io_q_net_file_enum(char *desc,  SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps, int depth)
1082 {
1083         if (q_n == NULL) return;
1084
1085         prs_debug(ps, depth, desc, "srv_io_q_net_file_enum");
1086         depth++;
1087
1088         prs_align(ps);
1089
1090         prs_uint32("ptr_srv_name", ps, depth, &(q_n->ptr_srv_name));
1091         smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth); 
1092
1093         prs_align(ps);
1094
1095         prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name));
1096         smb_io_unistr2("", &(q_n->uni_qual_name), q_n->ptr_qual_name, ps, depth); 
1097
1098         prs_align(ps);
1099
1100         prs_uint32("file_level", ps, depth, &(q_n->file_level  ));
1101
1102         if (q_n->file_level != -1)
1103         {
1104                 srv_io_srv_file_ctr("file_ctr", q_n->ctr, ps, depth);
1105         }
1106
1107         prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
1108
1109         smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth); 
1110 }
1111
1112 /*******************************************************************
1113 reads or writes a structure.
1114 ********************************************************************/
1115 void srv_io_r_net_file_enum(char *desc,  SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth)
1116 {
1117         if (r_n == NULL) return;
1118
1119         prs_debug(ps, depth, desc, "srv_io_r_net_file_enum");
1120         depth++;
1121
1122         prs_align(ps);
1123
1124         prs_uint32("file_level", ps, depth, &(r_n->file_level));
1125
1126         if (r_n->file_level != 0)
1127         {
1128                 srv_io_srv_file_ctr("file_ctr", r_n->ctr, ps, depth);
1129         }
1130
1131         prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
1132         smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth); 
1133         prs_uint32("status     ", ps, depth, &(r_n->status));
1134 }
1135
1136 /*******************************************************************
1137  makes a SRV_INFO_101 structure.
1138  ********************************************************************/
1139 void make_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, char *name,
1140                                 uint32 ver_major, uint32 ver_minor,
1141                                 uint32 srv_type, char *comment)
1142 {
1143         if (sv101 == NULL) return;
1144
1145         DEBUG(5,("make_srv_info_101\n"));
1146
1147         sv101->platform_id  = platform_id;
1148         make_buf_unistr2(&(sv101->uni_name    ), &(sv101->ptr_name   ) , name    );
1149         sv101->ver_major    = ver_major;
1150         sv101->ver_minor    = ver_minor;
1151         sv101->srv_type     = srv_type;
1152         make_buf_unistr2(&(sv101->uni_comment ), &(sv101->ptr_comment) , comment );
1153 }
1154
1155
1156 /*******************************************************************
1157  reads or writes a SRV_INFO_101 structure.
1158  ********************************************************************/
1159 static void srv_io_info_101(char *desc,  SRV_INFO_101 *sv101, prs_struct *ps, int depth)
1160 {
1161         if (sv101 == NULL) return;
1162
1163         prs_debug(ps, depth, desc, "srv_io_info_101");
1164         depth++;
1165
1166         prs_align(ps);
1167
1168         prs_uint32("platform_id ", ps, depth, &(sv101->platform_id ));
1169         prs_uint32("ptr_name    ", ps, depth, &(sv101->ptr_name    ));
1170         prs_uint32("ver_major   ", ps, depth, &(sv101->ver_major   ));
1171         prs_uint32("ver_minor   ", ps, depth, &(sv101->ver_minor   ));
1172         prs_uint32("srv_type    ", ps, depth, &(sv101->srv_type    ));
1173         prs_uint32("ptr_comment ", ps, depth, &(sv101->ptr_comment ));
1174
1175         prs_align(ps);
1176
1177         smb_io_unistr2("uni_name    ", &(sv101->uni_name    ), True, ps, depth); 
1178         smb_io_unistr2("uni_comment ", &(sv101->uni_comment ), True, ps, depth); 
1179 }
1180
1181 /*******************************************************************
1182  makes a SRV_INFO_102 structure.
1183  ********************************************************************/
1184 void make_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, char *name,
1185                                 char *comment, uint32 ver_major, uint32 ver_minor,
1186                                 uint32 srv_type, uint32 users, uint32 disc, uint32 hidden,
1187                                 uint32 announce, uint32 ann_delta, uint32 licenses,
1188                                 char *usr_path)
1189 {
1190         if (sv102 == NULL) return;
1191
1192         DEBUG(5,("make_srv_info_102\n"));
1193
1194         sv102->platform_id  = platform_id;
1195         make_buf_unistr2(&(sv102->uni_name    ), &(sv102->ptr_name    ), name    );
1196         sv102->ver_major    = ver_major;
1197         sv102->ver_minor    = ver_minor;
1198         sv102->srv_type     = srv_type;
1199         make_buf_unistr2(&(sv102->uni_comment ), &(sv102->ptr_comment ), comment );
1200
1201         /* same as 101 up to here */
1202
1203         sv102->users        = users;
1204         sv102->disc         = disc;
1205         sv102->hidden       = hidden;
1206         sv102->announce     = announce;
1207         sv102->ann_delta    =ann_delta;
1208         sv102->licenses     = licenses;
1209         make_buf_unistr2(&(sv102->uni_usr_path), &(sv102->ptr_usr_path), usr_path);
1210 }
1211
1212
1213 /*******************************************************************
1214  reads or writes a SRV_INFO_102 structure.
1215  ********************************************************************/
1216 static void srv_io_info_102(char *desc,  SRV_INFO_102 *sv102, prs_struct *ps, int depth)
1217 {
1218         if (sv102 == NULL) return;
1219
1220         prs_debug(ps, depth, desc, "srv_io_info102");
1221         depth++;
1222
1223         prs_align(ps);
1224
1225         prs_uint32("platform_id ", ps, depth, &(sv102->platform_id ));
1226         prs_uint32("ptr_name    ", ps, depth, &(sv102->ptr_name    ));
1227         prs_uint32("ver_major   ", ps, depth, &(sv102->ver_major   ));
1228         prs_uint32("ver_minor   ", ps, depth, &(sv102->ver_minor   ));
1229         prs_uint32("srv_type    ", ps, depth, &(sv102->srv_type    ));
1230         prs_uint32("ptr_comment ", ps, depth, &(sv102->ptr_comment ));
1231
1232         /* same as 101 up to here */
1233
1234         prs_uint32("users       ", ps, depth, &(sv102->users       ));
1235         prs_uint32("disc        ", ps, depth, &(sv102->disc        ));
1236         prs_uint32("hidden      ", ps, depth, &(sv102->hidden      ));
1237         prs_uint32("announce    ", ps, depth, &(sv102->announce    ));
1238         prs_uint32("ann_delta   ", ps, depth, &(sv102->ann_delta   ));
1239         prs_uint32("licenses    ", ps, depth, &(sv102->licenses    ));
1240         prs_uint32("ptr_usr_path", ps, depth, &(sv102->ptr_usr_path));
1241
1242         smb_io_unistr2("uni_name    ", &(sv102->uni_name    ), True, ps, depth); 
1243         prs_align(ps);
1244         smb_io_unistr2("uni_comment ", &(sv102->uni_comment ), True, ps, depth); 
1245         prs_align(ps);
1246         smb_io_unistr2("uni_usr_path", &(sv102->uni_usr_path), True, ps, depth); 
1247 }
1248
1249 /*******************************************************************
1250  reads or writes a SRV_INFO_102 structure.
1251  ********************************************************************/
1252 static void srv_io_info_ctr(char *desc,  SRV_INFO_CTR *ctr, prs_struct *ps, int depth)
1253 {
1254         if (ctr == NULL) return;
1255
1256         prs_debug(ps, depth, desc, "srv_io_info_ctr");
1257         depth++;
1258
1259         prs_align(ps);
1260
1261         prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
1262         prs_uint32("ptr_srv_ctr ", ps, depth, &(ctr->ptr_srv_ctr ));
1263
1264         if (ctr->ptr_srv_ctr != 0 && ctr->switch_value != 0 && ctr != NULL)
1265         {
1266                 switch (ctr->switch_value)
1267                 {
1268                         case 101:
1269                         {
1270                                 srv_io_info_101("sv101", &(ctr->srv.sv101), ps, depth); 
1271                                 break;
1272                         }
1273                         case 102:
1274                         {
1275                                 srv_io_info_102("sv102", &(ctr->srv.sv102), ps, depth); 
1276                                 break;
1277                         }
1278                         default:
1279                         {
1280                                 DEBUG(5,("%s no server info at switch_value %d\n",
1281                                                  tab_depth(depth), ctr->switch_value));
1282                                 break;
1283                         }
1284                 }
1285         }
1286 }
1287
1288
1289 /*******************************************************************
1290 reads or writes a structure.
1291 ********************************************************************/
1292 void srv_io_q_net_srv_get_info(char *desc,  SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth)
1293 {
1294         if (q_n == NULL) return;
1295
1296         prs_debug(ps, depth, desc, "srv_io_q_net_srv_get_info");
1297         depth++;
1298
1299         prs_align(ps);
1300
1301         prs_uint32("ptr_srv_name  ", ps, depth, &(q_n->ptr_srv_name));
1302         smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth); 
1303
1304         prs_align(ps);
1305
1306         prs_uint32("switch_value  ", ps, depth, &(q_n->switch_value));
1307 }
1308
1309 /*******************************************************************
1310  makes a SRV_R_NET_SRV_GET_INFO structure.
1311  ********************************************************************/
1312 void make_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv,
1313                                 uint32 switch_value, SRV_INFO_CTR *ctr, uint32 status)
1314 {
1315         if (srv == NULL) return;
1316
1317         DEBUG(5,("make_srv_r_net_srv_get_info\n"));
1318
1319         srv->ctr = ctr;
1320
1321         if (status == 0x0)
1322         {
1323                 srv->ctr->switch_value = switch_value;
1324                 srv->ctr->ptr_srv_ctr  = 1;
1325         }
1326         else
1327         {
1328                 srv->ctr->switch_value = 0;
1329                 srv->ctr->ptr_srv_ctr  = 0;
1330         }
1331
1332         srv->status = status;
1333 }
1334
1335 /*******************************************************************
1336  reads or writes a structure.
1337  ********************************************************************/
1338 void srv_io_r_net_srv_get_info(char *desc,  SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth)
1339 {
1340         if (r_n == NULL) return;
1341
1342         prs_debug(ps, depth, desc, "srv_io_r_net_srv_get_info");
1343         depth++;
1344
1345         prs_align(ps);
1346
1347         srv_io_info_ctr("ctr", r_n->ctr, ps, depth); 
1348
1349         prs_uint32("status      ", ps, depth, &(r_n->status      ));
1350 }
1351
1352
1353 /*******************************************************************
1354  reads or writes a structure.
1355  ********************************************************************/
1356 void srv_io_q_net_remote_tod(char *desc,  SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth)
1357 {
1358         if (q_n == NULL) return;
1359
1360         prs_debug(ps, depth, desc, "srv_io_q_net_remote_tod");
1361         depth++;
1362
1363         prs_align(ps);
1364
1365         prs_uint32("ptr_srv_name  ", ps, depth, &(q_n->ptr_srv_name));
1366         smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth); 
1367 }
1368
1369 /*******************************************************************
1370  reads or writes a TIME_OF_DAY_INFO structure.
1371  ********************************************************************/
1372 static void srv_io_time_of_day_info(char *desc, TIME_OF_DAY_INFO  *tod, prs_struct *ps, int depth)
1373 {
1374         if (tod == NULL) return;
1375
1376         prs_debug(ps, depth, desc, "srv_io_time_of_day_info");
1377         depth++;
1378
1379         prs_align(ps);
1380         
1381         prs_uint32("elapsedt   ", ps, depth, &(tod->elapsedt  ));
1382         prs_uint32("msecs      ", ps, depth, &(tod->msecs     ));
1383         prs_uint32("hours      ", ps, depth, &(tod->hours     ));
1384         prs_uint32("mins       ", ps, depth, &(tod->mins      ));
1385         prs_uint32("secs       ", ps, depth, &(tod->secs      ));
1386         prs_uint32("hunds      ", ps, depth, &(tod->hunds     ));
1387         prs_uint32("timezone   ", ps, depth, &(tod->zone  ));
1388         prs_uint32("tintervals ", ps, depth, &(tod->tintervals));
1389         prs_uint32("day        ", ps, depth, &(tod->day       ));
1390         prs_uint32("month      ", ps, depth, &(tod->month     ));
1391         prs_uint32("year       ", ps, depth, &(tod->year      ));
1392         prs_uint32("weekday    ", ps, depth, &(tod->weekday   ));
1393
1394 }
1395
1396 /*******************************************************************
1397  makes a TIME_OF_DAY_INFO structure.
1398  ********************************************************************/
1399 void make_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs,
1400                            uint32 hours, uint32 mins, uint32 secs, uint32 hunds,
1401                            uint32 zone, uint32 tintervals, uint32 day,
1402                            uint32 month, uint32 year, uint32 weekday)
1403 {
1404         if (tod == NULL) return;
1405
1406         DEBUG(5,("make_time_of_day_info\n"));
1407
1408         tod->elapsedt   = elapsedt;
1409         tod->msecs      = msecs;
1410         tod->hours      = hours;
1411         tod->mins       = mins;
1412         tod->secs       = secs;
1413         tod->hunds      = hunds;
1414         tod->zone       = zone;
1415         tod->tintervals = tintervals;
1416         tod->day        = day;
1417         tod->month      = month;
1418         tod->year       = year;
1419         tod->weekday    = weekday;
1420 }
1421
1422
1423 /*******************************************************************
1424  reads or writes a structure.
1425  ********************************************************************/
1426 void srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth)
1427 {
1428         if (r_n == NULL) return;
1429
1430         prs_debug(ps, depth, desc, "srv_io_r_net_remote_tod");
1431         depth++;
1432
1433         prs_align(ps);
1434         
1435         prs_uint32("ptr_srv_tod ", ps, depth, &(r_n->ptr_srv_tod));
1436
1437         srv_io_time_of_day_info("tod", r_n->tod, ps, depth); 
1438
1439         prs_uint32("status      ", ps, depth, &(r_n->status));
1440 }