oops, I ot the return type of putenv() wrong
[Samba/gbeck.git] / source / rpc_parse / parse_srv.c
blob27b1ec2257fc711f6e8373402cd907483de8091d
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.
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.
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.
26 #include "includes.h"
28 extern int DEBUGLEVEL;
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)
36 if (sh1 == NULL) return;
38 DEBUG(5,("make_srv_share_info1_str\n"));
40 make_unistr2(&(sh1->uni_netname), net_name, strlen(net_name));
41 make_unistr2(&(sh1->uni_remark ), remark , strlen(remark ));
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)
49 if (sh1 == NULL) return;
51 prs_debug(ps, depth, desc, "srv_io_share_info1_str");
52 depth++;
54 prs_align(ps);
56 smb_io_unistr2("", &(sh1->uni_netname), True, ps, depth);
57 smb_io_unistr2("", &(sh1->uni_remark ), True, ps, depth);
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)
65 if (sh1 == NULL) return;
67 DEBUG(5,("make_srv_share_info1: %s %8x %s\n", net_name, type, remark));
69 sh1->ptr_netname = net_name != NULL ? 1 : 0;
70 sh1->type = type;
71 sh1->ptr_remark = remark != NULL ? 1 : 0;
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)
79 if (sh1 == NULL) return;
81 prs_debug(ps, depth, desc, "srv_io_share_info1");
82 depth++;
84 prs_align(ps);
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));
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)
96 if (ctr == NULL) return;
98 prs_debug(ps, depth, desc, "srv_io_share_1_ctr");
99 depth++;
101 prs_align(ps);
103 prs_uint32("num_entries_read", ps, depth, &(ctr->num_entries_read));
104 prs_uint32("ptr_share_info", ps, depth, &(ctr->ptr_share_info));
106 if (ctr->ptr_share_info != 0)
108 int i;
109 int num_entries = ctr->num_entries_read;
110 if (num_entries > MAX_SHARE_ENTRIES)
112 num_entries = MAX_SHARE_ENTRIES; /* report this! */
115 prs_uint32("num_entries_read2", ps, depth, &(ctr->num_entries_read2));
117 SMB_ASSERT_ARRAY(ctr->info_1, num_entries);
119 for (i = 0; i < num_entries; i++)
121 prs_grow(ps);
122 srv_io_share_info1("", &(ctr->info_1[i]), ps, depth);
125 for (i = 0; i < num_entries; i++)
127 prs_grow(ps);
128 srv_io_share_info1_str("", &(ctr->info_1_str[i]), ps, depth);
131 prs_align(ps);
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)
142 if (sh2 == NULL) return;
144 DEBUG(5,("make_srv_share_info2_str\n"));
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);
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)
157 if (sh2 == NULL) return;
159 prs_debug(ps, depth, desc, "srv_io_share_info2_str");
160 depth++;
162 prs_align(ps);
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);
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)
178 if (sh2 == NULL) return;
180 DEBUG(5,("make_srv_share_info2: %s %8x %s\n", net_name, type, remark));
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;
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)
198 if (sh2 == NULL) return;
200 prs_debug(ps, depth, desc, "srv_io_share_info2");
201 depth++;
203 prs_align(ps);
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 ));
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)
220 if (ctr == NULL) return;
222 prs_debug(ps, depth, desc, "srv_io_share_2_ctr");
223 depth++;
225 prs_align(ps);
227 prs_uint32("num_entries_read", ps, depth, &(ctr->num_entries_read));
228 prs_uint32("ptr_share_info", ps, depth, &(ctr->ptr_share_info));
230 if (ctr->ptr_share_info != 0)
232 int i;
233 int num_entries = ctr->num_entries_read;
234 if (num_entries > MAX_SHARE_ENTRIES)
236 num_entries = MAX_SHARE_ENTRIES; /* report this! */
239 prs_uint32("num_entries_read2", ps, depth, &(ctr->num_entries_read2));
241 SMB_ASSERT_ARRAY(ctr->info_2, num_entries);
243 for (i = 0; i < num_entries; i++)
245 prs_grow(ps);
246 srv_io_share_info2("", &(ctr->info_2[i]), ps, depth);
249 for (i = 0; i < num_entries; i++)
251 prs_grow(ps);
252 srv_io_share_info2_str("", &(ctr->info_2_str[i]), ps, depth);
255 prs_align(ps);
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)
264 if (ctr == NULL) return;
266 prs_debug(ps, depth, desc, "srv_io_srv_share_ctr");
267 depth++;
269 prs_align(ps);
271 prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
272 prs_uint32("ptr_share_ctr", ps, depth, &(ctr->ptr_share_ctr));
274 if (ctr->ptr_share_ctr != 0)
276 switch (ctr->switch_value)
278 case 2:
280 srv_io_srv_share_info_2("", &(ctr->share.info2), ps, depth);
281 break;
283 case 1:
285 srv_io_srv_share_info_1("", &(ctr->share.info1), ps, depth);
286 break;
288 default:
290 DEBUG(5,("%s no share info at switch_value %d\n",
291 tab_depth(depth), ctr->switch_value));
292 break;
298 /*******************************************************************
299 reads or writes a structure.
300 ********************************************************************/
301 void make_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n,
302 char *srv_name,
303 uint32 share_level, SRV_SHARE_INFO_CTR *ctr,
304 uint32 preferred_len,
305 ENUM_HND *hnd)
307 if (q_n == NULL || ctr == NULL || hnd == NULL) return;
309 q_n->ctr = ctr;
311 DEBUG(5,("make_q_net_share_enum\n"));
313 make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name);
315 q_n->share_level = share_level;
316 q_n->preferred_len = preferred_len;
318 memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd));
321 /*******************************************************************
322 reads or writes a structure.
323 ********************************************************************/
324 void srv_io_q_net_share_enum(char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth)
326 if (q_n == NULL) return;
328 prs_debug(ps, depth, desc, "srv_io_q_net_share_enum");
329 depth++;
331 prs_align(ps);
333 prs_uint32("ptr_srv_name", ps, depth, &(q_n->ptr_srv_name));
334 smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth);
336 prs_align(ps);
338 prs_uint32("share_level", ps, depth, &(q_n->share_level ));
340 if (q_n->share_level != -1)
342 srv_io_srv_share_ctr("share_ctr", q_n->ctr, ps, depth);
345 prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
347 smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth);
350 /*******************************************************************
351 reads or writes a structure.
352 ********************************************************************/
353 void srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth)
355 if (r_n == NULL) return;
357 prs_debug(ps, depth, desc, "srv_io_r_net_share_enum");
358 depth++;
360 prs_align(ps);
362 prs_uint32("share_level", ps, depth, &(r_n->share_level));
364 if (r_n->share_level != 0)
366 srv_io_srv_share_ctr("share_ctr", r_n->ctr, ps, depth);
369 prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
370 smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth);
371 prs_uint32("status ", ps, depth, &(r_n->status));
374 /*******************************************************************
375 makes a SESS_INFO_0_STR structure
376 ********************************************************************/
377 void make_srv_sess_info0_str(SESS_INFO_0_STR *ss0, char *name)
379 if (ss0 == NULL) return;
381 DEBUG(5,("make_srv_sess_info0_str\n"));
383 make_unistr2(&(ss0->uni_name), name, strlen(name));
386 /*******************************************************************
387 reads or writes a structure.
388 ********************************************************************/
389 static void srv_io_sess_info0_str(char *desc, SESS_INFO_0_STR *ss0, prs_struct *ps, int depth)
391 if (ss0 == NULL) return;
393 prs_debug(ps, depth, desc, "srv_io_sess_info0_str");
394 depth++;
396 prs_align(ps);
398 smb_io_unistr2("", &(ss0->uni_name), True, ps, depth);
401 /*******************************************************************
402 makes a SESS_INFO_0 structure
403 ********************************************************************/
404 void make_srv_sess_info0(SESS_INFO_0 *ss0, char *name)
406 if (ss0 == NULL) return;
408 DEBUG(5,("make_srv_sess_info0: %s\n", name));
410 ss0->ptr_name = name != NULL ? 1 : 0;
413 /*******************************************************************
414 reads or writes a structure.
415 ********************************************************************/
416 static void srv_io_sess_info0(char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int depth)
418 if (ss0 == NULL) return;
420 prs_debug(ps, depth, desc, "srv_io_sess_info0");
421 depth++;
423 prs_align(ps);
425 prs_uint32("ptr_name", ps, depth, &(ss0->ptr_name));
428 /*******************************************************************
429 reads or writes a structure.
430 ********************************************************************/
431 static void srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth)
433 if (ss0 == NULL) return;
435 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_0");
436 depth++;
438 prs_align(ps);
440 prs_uint32("num_entries_read", ps, depth, &(ss0->num_entries_read));
441 prs_uint32("ptr_sess_info", ps, depth, &(ss0->ptr_sess_info));
443 if (ss0->ptr_sess_info != 0)
445 int i;
446 int num_entries = ss0->num_entries_read;
447 if (num_entries > MAX_SESS_ENTRIES)
449 num_entries = MAX_SESS_ENTRIES; /* report this! */
452 prs_uint32("num_entries_read2", ps, depth, &(ss0->num_entries_read2));
454 SMB_ASSERT_ARRAY(ss0->info_0, num_entries);
456 for (i = 0; i < num_entries; i++)
458 prs_grow(ps);
459 srv_io_sess_info0("", &(ss0->info_0[i]), ps, depth);
462 for (i = 0; i < num_entries; i++)
464 prs_grow(ps);
465 srv_io_sess_info0_str("", &(ss0->info_0_str[i]), ps, depth);
468 prs_align(ps);
472 /*******************************************************************
473 makes a SESS_INFO_1_STR structure
474 ********************************************************************/
475 void make_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user)
477 if (ss1 == NULL) return;
479 DEBUG(5,("make_srv_sess_info1_str\n"));
481 make_unistr2(&(ss1->uni_name), name, strlen(name));
482 make_unistr2(&(ss1->uni_user), name, strlen(user));
485 /*******************************************************************
486 reads or writes a structure.
487 ********************************************************************/
488 static void srv_io_sess_info1_str(char *desc, SESS_INFO_1_STR *ss1, prs_struct *ps, int depth)
490 if (ss1 == NULL) return;
492 prs_debug(ps, depth, desc, "srv_io_sess_info1_str");
493 depth++;
495 prs_align(ps);
497 smb_io_unistr2("", &(ss1->uni_name), True, ps, depth);
498 smb_io_unistr2("", &(ss1->uni_user), True, ps, depth);
501 /*******************************************************************
502 makes a SESS_INFO_1 structure
503 ********************************************************************/
504 void make_srv_sess_info1(SESS_INFO_1 *ss1,
505 char *name, char *user,
506 uint32 num_opens, uint32 open_time, uint32 idle_time,
507 uint32 user_flags)
509 if (ss1 == NULL) return;
511 DEBUG(5,("make_srv_sess_info1: %s\n", name));
513 ss1->ptr_name = name != NULL ? 1 : 0;
514 ss1->ptr_user = user != NULL ? 1 : 0;
516 ss1->num_opens = num_opens;
517 ss1->open_time = open_time;
518 ss1->idle_time = idle_time;
519 ss1->user_flags = user_flags;
522 /*******************************************************************
523 reads or writes a structure.
524 ********************************************************************/
525 static void srv_io_sess_info1(char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int depth)
527 if (ss1 == NULL) return;
529 prs_debug(ps, depth, desc, "srv_io_sess_info1");
530 depth++;
532 prs_align(ps);
534 prs_uint32("ptr_name ", ps, depth, &(ss1->ptr_name ));
535 prs_uint32("ptr_user ", ps, depth, &(ss1->ptr_user ));
537 prs_uint32("num_opens ", ps, depth, &(ss1->num_opens ));
538 prs_uint32("open_time ", ps, depth, &(ss1->open_time ));
539 prs_uint32("idle_time ", ps, depth, &(ss1->idle_time ));
540 prs_uint32("user_flags", ps, depth, &(ss1->user_flags));
543 /*******************************************************************
544 reads or writes a structure.
545 ********************************************************************/
546 static void srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth)
548 if (ss1 == NULL) return;
550 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_1");
551 depth++;
553 prs_align(ps);
555 prs_uint32("num_entries_read", ps, depth, &(ss1->num_entries_read));
556 prs_uint32("ptr_sess_info", ps, depth, &(ss1->ptr_sess_info));
558 if (ss1->ptr_sess_info != 0)
560 int i;
561 int num_entries = ss1->num_entries_read;
562 if (num_entries > MAX_SESS_ENTRIES)
564 num_entries = MAX_SESS_ENTRIES; /* report this! */
567 prs_uint32("num_entries_read2", ps, depth, &(ss1->num_entries_read2));
569 SMB_ASSERT_ARRAY(ss1->info_1, num_entries);
571 for (i = 0; i < num_entries; i++)
573 prs_grow(ps);
574 srv_io_sess_info1("", &(ss1->info_1[i]), ps, depth);
577 for (i = 0; i < num_entries; i++)
579 prs_grow(ps);
580 srv_io_sess_info1_str("", &(ss1->info_1_str[i]), ps, depth);
583 prs_align(ps);
587 /*******************************************************************
588 reads or writes a structure.
589 ********************************************************************/
590 static void srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR *ctr, prs_struct *ps, int depth)
592 if (ctr == NULL) return;
594 prs_debug(ps, depth, desc, "srv_io_srv_sess_ctr");
595 depth++;
597 prs_align(ps);
599 prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
600 prs_uint32("ptr_sess_ctr", ps, depth, &(ctr->ptr_sess_ctr));
602 if (ctr->ptr_sess_ctr != 0)
604 switch (ctr->switch_value)
606 case 0:
608 srv_io_srv_sess_info_0("", &(ctr->sess.info0), ps, depth);
609 break;
611 case 1:
613 srv_io_srv_sess_info_1("", &(ctr->sess.info1), ps, depth);
614 break;
616 default:
618 DEBUG(5,("%s no session info at switch_value %d\n",
619 tab_depth(depth), ctr->switch_value));
620 break;
626 /*******************************************************************
627 reads or writes a structure.
628 ********************************************************************/
629 void make_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n,
630 char *srv_name, char *qual_name,
631 uint32 sess_level, SRV_SESS_INFO_CTR *ctr,
632 uint32 preferred_len,
633 ENUM_HND *hnd)
635 if (q_n == NULL || ctr == NULL || hnd == NULL) return;
637 q_n->ctr = ctr;
639 DEBUG(5,("make_q_net_sess_enum\n"));
641 make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name);
642 make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name);
644 q_n->sess_level = sess_level;
645 q_n->preferred_len = preferred_len;
647 memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd));
650 /*******************************************************************
651 reads or writes a structure.
652 ********************************************************************/
653 void srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps, int depth)
655 if (q_n == NULL) return;
657 prs_debug(ps, depth, desc, "srv_io_q_net_sess_enum");
658 depth++;
660 prs_align(ps);
662 prs_uint32("ptr_srv_name", ps, depth, &(q_n->ptr_srv_name));
663 smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth);
665 prs_align(ps);
667 prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name));
668 smb_io_unistr2("", &(q_n->uni_qual_name), q_n->ptr_qual_name, ps, depth);
670 prs_align(ps);
672 prs_uint32("sess_level", ps, depth, &(q_n->sess_level ));
674 if (q_n->sess_level != -1)
676 srv_io_srv_sess_ctr("sess_ctr", q_n->ctr, ps, depth);
679 prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
681 smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth);
684 /*******************************************************************
685 reads or writes a structure.
686 ********************************************************************/
687 void srv_io_r_net_sess_enum(char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth)
689 if (r_n == NULL) return;
691 prs_debug(ps, depth, desc, "srv_io_r_net_sess_enum");
692 depth++;
694 prs_align(ps);
696 prs_uint32("sess_level", ps, depth, &(r_n->sess_level));
698 if (r_n->sess_level != -1)
700 srv_io_srv_sess_ctr("sess_ctr", r_n->ctr, ps, depth);
703 prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
704 smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth);
705 prs_uint32("status ", ps, depth, &(r_n->status));
708 /*******************************************************************
709 makes a CONN_INFO_0 structure
710 ********************************************************************/
711 void make_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id)
713 if (ss0 == NULL) return;
715 DEBUG(5,("make_srv_conn_info0\n"));
717 ss0->id = id;
720 /*******************************************************************
721 reads or writes a structure.
722 ********************************************************************/
723 static void srv_io_conn_info0(char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth)
725 if (ss0 == NULL) return;
727 prs_debug(ps, depth, desc, "srv_io_conn_info0");
728 depth++;
730 prs_align(ps);
732 prs_uint32("id", ps, depth, &(ss0->id));
735 /*******************************************************************
736 reads or writes a structure.
737 ********************************************************************/
738 static void srv_io_srv_conn_info_0(char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth)
740 if (ss0 == NULL) return;
742 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_0");
743 depth++;
745 prs_align(ps);
747 prs_uint32("num_entries_read", ps, depth, &(ss0->num_entries_read));
748 prs_uint32("ptr_conn_info", ps, depth, &(ss0->ptr_conn_info));
750 if (ss0->ptr_conn_info != 0)
752 int i;
753 int num_entries = ss0->num_entries_read;
754 if (num_entries > MAX_CONN_ENTRIES)
756 num_entries = MAX_CONN_ENTRIES; /* report this! */
759 prs_uint32("num_entries_read2", ps, depth, &(ss0->num_entries_read2));
761 for (i = 0; i < num_entries; i++)
763 prs_grow(ps);
764 srv_io_conn_info0("", &(ss0->info_0[i]), ps, depth);
767 prs_align(ps);
771 /*******************************************************************
772 makes a CONN_INFO_1_STR structure
773 ********************************************************************/
774 void make_srv_conn_info1_str(CONN_INFO_1_STR *ss1, char *usr_name, char *net_name)
776 if (ss1 == NULL) return;
778 DEBUG(5,("make_srv_conn_info1_str\n"));
780 make_unistr2(&(ss1->uni_usr_name), usr_name, strlen(usr_name));
781 make_unistr2(&(ss1->uni_net_name), net_name, strlen(net_name));
784 /*******************************************************************
785 reads or writes a structure.
786 ********************************************************************/
787 static void srv_io_conn_info1_str(char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth)
789 if (ss1 == NULL) return;
791 prs_debug(ps, depth, desc, "srv_io_conn_info1_str");
792 depth++;
794 prs_align(ps);
796 smb_io_unistr2("", &(ss1->uni_usr_name), True, ps, depth);
797 smb_io_unistr2("", &(ss1->uni_net_name), True, ps, depth);
800 /*******************************************************************
801 makes a CONN_INFO_1 structure
802 ********************************************************************/
803 void make_srv_conn_info1(CONN_INFO_1 *ss1,
804 uint32 id, uint32 type,
805 uint32 num_opens, uint32 num_users, uint32 open_time,
806 char *usr_name, char *net_name)
808 if (ss1 == NULL) return;
810 DEBUG(5,("make_srv_conn_info1: %s %s\n", usr_name, net_name));
812 ss1->id = id ;
813 ss1->type = type ;
814 ss1->num_opens = num_opens ;
815 ss1->num_users = num_users;
816 ss1->open_time = open_time;
818 ss1->ptr_usr_name = usr_name != NULL ? 1 : 0;
819 ss1->ptr_net_name = net_name != NULL ? 1 : 0;
822 /*******************************************************************
823 reads or writes a structure.
824 ********************************************************************/
825 static void srv_io_conn_info1(char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth)
827 if (ss1 == NULL) return;
829 prs_debug(ps, depth, desc, "srv_io_conn_info1");
830 depth++;
832 prs_align(ps);
834 prs_uint32("id ", ps, depth, &(ss1->id ));
835 prs_uint32("type ", ps, depth, &(ss1->type ));
836 prs_uint32("num_opens ", ps, depth, &(ss1->num_opens ));
837 prs_uint32("num_users ", ps, depth, &(ss1->num_users ));
838 prs_uint32("open_time ", ps, depth, &(ss1->open_time ));
840 prs_uint32("ptr_usr_name", ps, depth, &(ss1->ptr_usr_name));
841 prs_uint32("ptr_net_name", ps, depth, &(ss1->ptr_net_name));
844 /*******************************************************************
845 reads or writes a structure.
846 ********************************************************************/
847 static void srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth)
849 if (ss1 == NULL) return;
851 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_1");
852 depth++;
854 prs_align(ps);
856 prs_uint32("num_entries_read", ps, depth, &(ss1->num_entries_read));
857 prs_uint32("ptr_conn_info", ps, depth, &(ss1->ptr_conn_info));
859 if (ss1->ptr_conn_info != 0)
861 int i;
862 int num_entries = ss1->num_entries_read;
863 if (num_entries > MAX_CONN_ENTRIES)
865 num_entries = MAX_CONN_ENTRIES; /* report this! */
868 prs_uint32("num_entries_read2", ps, depth, &(ss1->num_entries_read2));
870 for (i = 0; i < num_entries; i++)
872 prs_grow(ps);
873 srv_io_conn_info1("", &(ss1->info_1[i]), ps, depth);
876 for (i = 0; i < num_entries; i++)
878 prs_grow(ps);
879 srv_io_conn_info1_str("", &(ss1->info_1_str[i]), ps, depth);
882 prs_align(ps);
886 /*******************************************************************
887 reads or writes a structure.
888 ********************************************************************/
889 static void srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR *ctr, prs_struct *ps, int depth)
891 if (ctr == NULL) return;
893 prs_debug(ps, depth, desc, "srv_io_srv_conn_ctr");
894 depth++;
896 prs_align(ps);
898 prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
899 prs_uint32("ptr_conn_ctr", ps, depth, &(ctr->ptr_conn_ctr));
901 if (ctr->ptr_conn_ctr != 0)
903 switch (ctr->switch_value)
905 case 0:
907 srv_io_srv_conn_info_0("", &(ctr->conn.info0), ps, depth);
908 break;
910 case 1:
912 srv_io_srv_conn_info_1("", &(ctr->conn.info1), ps, depth);
913 break;
915 default:
917 DEBUG(5,("%s no connection info at switch_value %d\n",
918 tab_depth(depth), ctr->switch_value));
919 break;
925 /*******************************************************************
926 reads or writes a structure.
927 ********************************************************************/
928 void make_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n,
929 char *srv_name, char *qual_name,
930 uint32 conn_level, SRV_CONN_INFO_CTR *ctr,
931 uint32 preferred_len,
932 ENUM_HND *hnd)
934 if (q_n == NULL || ctr == NULL || hnd == NULL) return;
936 q_n->ctr = ctr;
938 DEBUG(5,("make_q_net_conn_enum\n"));
940 make_buf_unistr2(&(q_n->uni_srv_name ), &(q_n->ptr_srv_name ), srv_name );
941 make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name);
943 q_n->conn_level = conn_level;
944 q_n->preferred_len = preferred_len;
946 memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd));
949 /*******************************************************************
950 reads or writes a structure.
951 ********************************************************************/
952 void srv_io_q_net_conn_enum(char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth)
954 if (q_n == NULL) return;
956 prs_debug(ps, depth, desc, "srv_io_q_net_conn_enum");
957 depth++;
959 prs_align(ps);
961 prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name));
962 smb_io_unistr2("", &(q_n->uni_srv_name), q_n->ptr_srv_name, ps, depth);
964 prs_align(ps);
966 prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name));
967 smb_io_unistr2("", &(q_n->uni_qual_name), q_n->ptr_qual_name, ps, depth);
969 prs_align(ps);
971 prs_uint32("conn_level", ps, depth, &(q_n->conn_level ));
973 if (q_n->conn_level != -1)
975 srv_io_srv_conn_ctr("conn_ctr", q_n->ctr, ps, depth);
978 prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
980 smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth);
983 /*******************************************************************
984 reads or writes a structure.
985 ********************************************************************/
986 void srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth)
988 if (r_n == NULL) return;
990 prs_debug(ps, depth, desc, "srv_io_r_net_conn_enum");
991 depth++;
993 prs_align(ps);
995 prs_uint32("conn_level", ps, depth, &(r_n->conn_level));
997 if (r_n->conn_level != -1)
999 srv_io_srv_conn_ctr("conn_ctr", r_n->ctr, ps, depth);
1002 prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
1003 smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth);
1004 prs_uint32("status ", ps, depth, &(r_n->status));
1007 /*******************************************************************
1008 makes a FILE_INFO_3_STR structure
1009 ********************************************************************/
1010 void make_srv_file_info3_str(FILE_INFO_3_STR *fi3, char *user_name, char *path_name)
1012 if (fi3 == NULL) return;
1014 DEBUG(5,("make_srv_file_info3_str\n"));
1016 make_unistr2(&(fi3->uni_path_name), path_name, strlen(path_name)+1);
1017 make_unistr2(&(fi3->uni_user_name), user_name, strlen(user_name)+1);
1020 /*******************************************************************
1021 reads or writes a structure.
1022 ********************************************************************/
1023 static void srv_io_file_info3_str(char *desc, FILE_INFO_3_STR *sh1, prs_struct *ps, int depth)
1025 if (sh1 == NULL) return;
1027 prs_debug(ps, depth, desc, "srv_io_file_info3_str");
1028 depth++;
1030 prs_align(ps);
1032 smb_io_unistr2("", &(sh1->uni_path_name), True, ps, depth);
1033 smb_io_unistr2("", &(sh1->uni_user_name), True, ps, depth);
1036 /*******************************************************************
1037 makes a FILE_INFO_3 structure
1038 ********************************************************************/
1039 void make_srv_file_info3(FILE_INFO_3 *fl3,
1040 uint32 id, uint32 perms, uint32 num_locks,
1041 char *path_name, char *user_name)
1043 if (fl3 == NULL) return;
1045 DEBUG(5,("make_srv_file_info3: %s %s\n", path_name, user_name));
1047 fl3->id = id;
1048 fl3->perms = perms;
1049 fl3->num_locks = num_locks;
1051 fl3->ptr_path_name = path_name != NULL ? 1 : 0;
1052 fl3->ptr_user_name = user_name != NULL ? 1 : 0;
1055 /*******************************************************************
1056 reads or writes a structure.
1057 ********************************************************************/
1058 static void srv_io_file_info3(char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth)
1060 if (fl3 == NULL) return;
1062 prs_debug(ps, depth, desc, "srv_io_file_info3");
1063 depth++;
1065 prs_align(ps);
1067 prs_uint32("id ", ps, depth, &(fl3->id ));
1068 prs_uint32("perms ", ps, depth, &(fl3->perms ));
1069 prs_uint32("num_locks ", ps, depth, &(fl3->num_locks ));
1070 prs_uint32("ptr_path_name", ps, depth, &(fl3->ptr_path_name));
1071 prs_uint32("ptr_user_name", ps, depth, &(fl3->ptr_user_name));
1074 /*******************************************************************
1075 reads or writes a structure.
1076 ********************************************************************/
1077 static void srv_io_srv_file_info_3(char *desc, SRV_FILE_INFO_3 *fl3, prs_struct *ps, int depth)
1079 if (fl3 == NULL) return;
1081 prs_debug(ps, depth, desc, "srv_io_file_3_fl3");
1082 depth++;
1084 prs_align(ps);
1086 prs_uint32("num_entries_read", ps, depth, &(fl3->num_entries_read));
1087 prs_uint32("ptr_file_fl3", ps, depth, &(fl3->ptr_file_info));
1088 if (fl3->ptr_file_info != 0)
1090 int i;
1091 int num_entries = fl3->num_entries_read;
1092 if (num_entries > MAX_FILE_ENTRIES)
1094 num_entries = MAX_FILE_ENTRIES; /* report this! */
1097 prs_uint32("num_entries_read2", ps, depth, &(fl3->num_entries_read2));
1099 for (i = 0; i < num_entries; i++)
1101 prs_grow(ps);
1102 srv_io_file_info3("", &(fl3->info_3[i]), ps, depth);
1105 for (i = 0; i < num_entries; i++)
1107 prs_grow(ps);
1108 srv_io_file_info3_str("", &(fl3->info_3_str[i]), ps, depth);
1111 prs_align(ps);
1115 /*******************************************************************
1116 reads or writes a structure.
1117 ********************************************************************/
1118 static void srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth)
1120 if (ctr == NULL) return;
1122 prs_debug(ps, depth, desc, "srv_io_srv_file_ctr");
1123 depth++;
1125 prs_align(ps);
1127 prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
1128 prs_uint32("ptr_file_ctr", ps, depth, &(ctr->ptr_file_ctr));
1130 if (ctr->ptr_file_ctr != 0)
1132 switch (ctr->switch_value)
1134 case 3:
1136 srv_io_srv_file_info_3("", &(ctr->file.info3), ps, depth);
1137 break;
1139 default:
1141 DEBUG(5,("%s no file info at switch_value %d\n",
1142 tab_depth(depth), ctr->switch_value));
1143 break;
1149 /*******************************************************************
1150 reads or writes a structure.
1151 ********************************************************************/
1152 void make_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n,
1153 char *srv_name, char *qual_name,
1154 uint32 file_level, SRV_FILE_INFO_CTR *ctr,
1155 uint32 preferred_len,
1156 ENUM_HND *hnd)
1158 if (q_n == NULL || ctr == NULL || hnd == NULL) return;
1160 q_n->ctr = ctr;
1162 DEBUG(5,("make_q_net_file_enum\n"));
1164 make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name);
1165 make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name);
1167 q_n->file_level = file_level;
1168 q_n->preferred_len = preferred_len;
1170 memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd));
1173 /*******************************************************************
1174 reads or writes a structure.
1175 ********************************************************************/
1176 void srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps, int depth)
1178 if (q_n == NULL) return;
1180 prs_debug(ps, depth, desc, "srv_io_q_net_file_enum");
1181 depth++;
1183 prs_align(ps);
1185 prs_uint32("ptr_srv_name", ps, depth, &(q_n->ptr_srv_name));
1186 smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth);
1188 prs_align(ps);
1190 prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name));
1191 smb_io_unistr2("", &(q_n->uni_qual_name), q_n->ptr_qual_name, ps, depth);
1193 prs_align(ps);
1195 prs_uint32("file_level", ps, depth, &(q_n->file_level ));
1197 if (q_n->file_level != -1)
1199 srv_io_srv_file_ctr("file_ctr", q_n->ctr, ps, depth);
1202 prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
1204 smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth);
1207 /*******************************************************************
1208 reads or writes a structure.
1209 ********************************************************************/
1210 void srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth)
1212 if (r_n == NULL) return;
1214 prs_debug(ps, depth, desc, "srv_io_r_net_file_enum");
1215 depth++;
1217 prs_align(ps);
1219 prs_uint32("file_level", ps, depth, &(r_n->file_level));
1221 if (r_n->file_level != 0)
1223 srv_io_srv_file_ctr("file_ctr", r_n->ctr, ps, depth);
1226 prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
1227 smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth);
1228 prs_uint32("status ", ps, depth, &(r_n->status));
1231 /*******************************************************************
1232 makes a SRV_INFO_101 structure.
1233 ********************************************************************/
1234 void make_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, char *name,
1235 uint32 ver_major, uint32 ver_minor,
1236 uint32 srv_type, char *comment)
1238 if (sv101 == NULL) return;
1240 DEBUG(5,("make_srv_info_101\n"));
1242 sv101->platform_id = platform_id;
1243 make_buf_unistr2(&(sv101->uni_name ), &(sv101->ptr_name ) , name );
1244 sv101->ver_major = ver_major;
1245 sv101->ver_minor = ver_minor;
1246 sv101->srv_type = srv_type;
1247 make_buf_unistr2(&(sv101->uni_comment ), &(sv101->ptr_comment) , comment );
1251 /*******************************************************************
1252 reads or writes a SRV_INFO_101 structure.
1253 ********************************************************************/
1254 static void srv_io_info_101(char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth)
1256 if (sv101 == NULL) return;
1258 prs_debug(ps, depth, desc, "srv_io_info_101");
1259 depth++;
1261 prs_align(ps);
1263 prs_uint32("platform_id ", ps, depth, &(sv101->platform_id ));
1264 prs_uint32("ptr_name ", ps, depth, &(sv101->ptr_name ));
1265 prs_uint32("ver_major ", ps, depth, &(sv101->ver_major ));
1266 prs_uint32("ver_minor ", ps, depth, &(sv101->ver_minor ));
1267 prs_uint32("srv_type ", ps, depth, &(sv101->srv_type ));
1268 prs_uint32("ptr_comment ", ps, depth, &(sv101->ptr_comment ));
1270 prs_align(ps);
1272 smb_io_unistr2("uni_name ", &(sv101->uni_name ), True, ps, depth);
1273 smb_io_unistr2("uni_comment ", &(sv101->uni_comment ), True, ps, depth);
1276 /*******************************************************************
1277 makes a SRV_INFO_102 structure.
1278 ********************************************************************/
1279 void make_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, char *name,
1280 char *comment, uint32 ver_major, uint32 ver_minor,
1281 uint32 srv_type, uint32 users, uint32 disc, uint32 hidden,
1282 uint32 announce, uint32 ann_delta, uint32 licenses,
1283 char *usr_path)
1285 if (sv102 == NULL) return;
1287 DEBUG(5,("make_srv_info_102\n"));
1289 sv102->platform_id = platform_id;
1290 make_buf_unistr2(&(sv102->uni_name ), &(sv102->ptr_name ), name );
1291 sv102->ver_major = ver_major;
1292 sv102->ver_minor = ver_minor;
1293 sv102->srv_type = srv_type;
1294 make_buf_unistr2(&(sv102->uni_comment ), &(sv102->ptr_comment ), comment );
1296 /* same as 101 up to here */
1298 sv102->users = users;
1299 sv102->disc = disc;
1300 sv102->hidden = hidden;
1301 sv102->announce = announce;
1302 sv102->ann_delta =ann_delta;
1303 sv102->licenses = licenses;
1304 make_buf_unistr2(&(sv102->uni_usr_path), &(sv102->ptr_usr_path), usr_path);
1308 /*******************************************************************
1309 reads or writes a SRV_INFO_102 structure.
1310 ********************************************************************/
1311 static void srv_io_info_102(char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth)
1313 if (sv102 == NULL) return;
1315 prs_debug(ps, depth, desc, "srv_io_info102");
1316 depth++;
1318 prs_align(ps);
1320 prs_uint32("platform_id ", ps, depth, &(sv102->platform_id ));
1321 prs_uint32("ptr_name ", ps, depth, &(sv102->ptr_name ));
1322 prs_uint32("ver_major ", ps, depth, &(sv102->ver_major ));
1323 prs_uint32("ver_minor ", ps, depth, &(sv102->ver_minor ));
1324 prs_uint32("srv_type ", ps, depth, &(sv102->srv_type ));
1325 prs_uint32("ptr_comment ", ps, depth, &(sv102->ptr_comment ));
1327 /* same as 101 up to here */
1329 prs_uint32("users ", ps, depth, &(sv102->users ));
1330 prs_uint32("disc ", ps, depth, &(sv102->disc ));
1331 prs_uint32("hidden ", ps, depth, &(sv102->hidden ));
1332 prs_uint32("announce ", ps, depth, &(sv102->announce ));
1333 prs_uint32("ann_delta ", ps, depth, &(sv102->ann_delta ));
1334 prs_uint32("licenses ", ps, depth, &(sv102->licenses ));
1335 prs_uint32("ptr_usr_path", ps, depth, &(sv102->ptr_usr_path));
1337 smb_io_unistr2("uni_name ", &(sv102->uni_name ), True, ps, depth);
1338 prs_align(ps);
1339 smb_io_unistr2("uni_comment ", &(sv102->uni_comment ), True, ps, depth);
1340 prs_align(ps);
1341 smb_io_unistr2("uni_usr_path", &(sv102->uni_usr_path), True, ps, depth);
1344 /*******************************************************************
1345 reads or writes a SRV_INFO_102 structure.
1346 ********************************************************************/
1347 static void srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth)
1349 if (ctr == NULL) return;
1351 prs_debug(ps, depth, desc, "srv_io_info_ctr");
1352 depth++;
1354 prs_align(ps);
1356 prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
1357 prs_uint32("ptr_srv_ctr ", ps, depth, &(ctr->ptr_srv_ctr ));
1359 if (ctr->ptr_srv_ctr != 0 && ctr->switch_value != 0 && ctr != NULL)
1361 switch (ctr->switch_value)
1363 case 101:
1365 srv_io_info_101("sv101", &(ctr->srv.sv101), ps, depth);
1366 break;
1368 case 102:
1370 srv_io_info_102("sv102", &(ctr->srv.sv102), ps, depth);
1371 break;
1373 default:
1375 DEBUG(5,("%s no server info at switch_value %d\n",
1376 tab_depth(depth), ctr->switch_value));
1377 break;
1383 /*******************************************************************
1384 makes a SRV_Q_NET_SRV_GET_INFO structure.
1385 ********************************************************************/
1386 void make_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv,
1387 char *server_name, uint32 switch_value)
1389 if (srv == NULL) return;
1391 DEBUG(5,("make_srv_q_net_srv_get_info\n"));
1393 make_buf_unistr2(&(srv->uni_srv_name), &(srv->ptr_srv_name), server_name);
1395 srv->switch_value = switch_value;
1398 /*******************************************************************
1399 reads or writes a structure.
1400 ********************************************************************/
1401 void srv_io_q_net_srv_get_info(char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth)
1403 if (q_n == NULL) return;
1405 prs_debug(ps, depth, desc, "srv_io_q_net_srv_get_info");
1406 depth++;
1408 prs_align(ps);
1410 prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name));
1411 smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth);
1413 prs_align(ps);
1415 prs_uint32("switch_value ", ps, depth, &(q_n->switch_value));
1418 /*******************************************************************
1419 makes a SRV_R_NET_SRV_GET_INFO structure.
1420 ********************************************************************/
1421 void make_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv,
1422 uint32 switch_value, SRV_INFO_CTR *ctr, uint32 status)
1424 if (srv == NULL) return;
1426 DEBUG(5,("make_srv_r_net_srv_get_info\n"));
1428 srv->ctr = ctr;
1430 if (status == 0x0)
1432 srv->ctr->switch_value = switch_value;
1433 srv->ctr->ptr_srv_ctr = 1;
1435 else
1437 srv->ctr->switch_value = 0;
1438 srv->ctr->ptr_srv_ctr = 0;
1441 srv->status = status;
1444 /*******************************************************************
1445 reads or writes a structure.
1446 ********************************************************************/
1447 void srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth)
1449 if (r_n == NULL) return;
1451 prs_debug(ps, depth, desc, "srv_io_r_net_srv_get_info");
1452 depth++;
1454 prs_align(ps);
1456 srv_io_info_ctr("ctr", r_n->ctr, ps, depth);
1458 prs_uint32("status ", ps, depth, &(r_n->status ));
1462 /*******************************************************************
1463 reads or writes a structure.
1464 ********************************************************************/
1465 void srv_io_q_net_remote_tod(char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth)
1467 if (q_n == NULL) return;
1469 prs_debug(ps, depth, desc, "srv_io_q_net_remote_tod");
1470 depth++;
1472 prs_align(ps);
1474 prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name));
1475 smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth);
1478 /*******************************************************************
1479 reads or writes a TIME_OF_DAY_INFO structure.
1480 ********************************************************************/
1481 static void srv_io_time_of_day_info(char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth)
1483 if (tod == NULL) return;
1485 prs_debug(ps, depth, desc, "srv_io_time_of_day_info");
1486 depth++;
1488 prs_align(ps);
1490 prs_uint32("elapsedt ", ps, depth, &(tod->elapsedt ));
1491 prs_uint32("msecs ", ps, depth, &(tod->msecs ));
1492 prs_uint32("hours ", ps, depth, &(tod->hours ));
1493 prs_uint32("mins ", ps, depth, &(tod->mins ));
1494 prs_uint32("secs ", ps, depth, &(tod->secs ));
1495 prs_uint32("hunds ", ps, depth, &(tod->hunds ));
1496 prs_uint32("timezone ", ps, depth, &(tod->zone ));
1497 prs_uint32("tintervals ", ps, depth, &(tod->tintervals));
1498 prs_uint32("day ", ps, depth, &(tod->day ));
1499 prs_uint32("month ", ps, depth, &(tod->month ));
1500 prs_uint32("year ", ps, depth, &(tod->year ));
1501 prs_uint32("weekday ", ps, depth, &(tod->weekday ));
1505 /*******************************************************************
1506 makes a TIME_OF_DAY_INFO structure.
1507 ********************************************************************/
1508 void make_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs,
1509 uint32 hours, uint32 mins, uint32 secs, uint32 hunds,
1510 uint32 zone, uint32 tintervals, uint32 day,
1511 uint32 month, uint32 year, uint32 weekday)
1513 if (tod == NULL) return;
1515 DEBUG(5,("make_time_of_day_info\n"));
1517 tod->elapsedt = elapsedt;
1518 tod->msecs = msecs;
1519 tod->hours = hours;
1520 tod->mins = mins;
1521 tod->secs = secs;
1522 tod->hunds = hunds;
1523 tod->zone = zone;
1524 tod->tintervals = tintervals;
1525 tod->day = day;
1526 tod->month = month;
1527 tod->year = year;
1528 tod->weekday = weekday;
1532 /*******************************************************************
1533 reads or writes a structure.
1534 ********************************************************************/
1535 void srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth)
1537 if (r_n == NULL) return;
1539 prs_debug(ps, depth, desc, "srv_io_r_net_remote_tod");
1540 depth++;
1542 prs_align(ps);
1544 prs_uint32("ptr_srv_tod ", ps, depth, &(r_n->ptr_srv_tod));
1546 srv_io_time_of_day_info("tod", r_n->tod, ps, depth);
1548 prs_uint32("status ", ps, depth, &(r_n->status));