3 * Unix SMB/Netbios implementation.
5 * RPC Pipe client / server routines
6 * Copyright (C) Andrew Tridgell 1992-1999,
7 * Copyright (C) Luke Kenneth Casson Leighton 1996-1999,
8 * Copyright (C) Paul Ashton 1997-1999.
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.
28 extern int DEBUGLEVEL;
31 /*******************************************************************
32 makes a SH_INFO_1_STR structure
33 ********************************************************************/
34 BOOL make_srv_share_info1_str(SH_INFO_1_STR *sh1, char *net_name, char *remark)
36 if (sh1 == NULL) return False;
38 DEBUG(5,("make_srv_share_info1_str\n"));
40 make_unistr2(&(sh1->uni_netname), net_name, strlen(net_name)+1);
41 make_unistr2(&(sh1->uni_remark ), remark , strlen(remark )+1);
46 /*******************************************************************
47 reads or writes a structure.
48 ********************************************************************/
49 static BOOL srv_io_share_info1_str(char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth)
51 if (sh1 == NULL) return False;
53 prs_debug(ps, depth, desc, "srv_io_share_info1_str");
58 smb_io_unistr2("", &(sh1->uni_netname), True, ps, depth);
60 smb_io_unistr2("", &(sh1->uni_remark ), True, ps, depth);
67 /*******************************************************************
68 makes a SH_INFO_1 structure
69 ********************************************************************/
70 BOOL make_srv_share_info1(SH_INFO_1 *sh1, char *net_name, uint32 type, char *remark)
72 if (sh1 == NULL) return False;
74 DEBUG(5,("make_srv_share_info1: %s %8x %s\n", net_name, type, remark));
76 sh1->ptr_netname = net_name != NULL ? 1 : 0;
78 sh1->ptr_remark = remark != NULL ? 1 : 0;
83 /*******************************************************************
84 reads or writes a structure.
85 ********************************************************************/
86 static BOOL srv_io_share_info1(char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth)
88 if (sh1 == NULL) return False;
90 prs_debug(ps, depth, desc, "srv_io_share_info1");
95 prs_uint32("ptr_netname", ps, depth, &(sh1->ptr_netname));
96 prs_uint32("type ", ps, depth, &(sh1->type ));
97 prs_uint32("ptr_remark ", ps, depth, &(sh1->ptr_remark));
102 /*******************************************************************
103 reads or writes a structure.
104 ********************************************************************/
105 static BOOL srv_io_srv_share_info_1(char *desc, SRV_SHARE_INFO_1 *ctr, prs_struct *ps, int depth)
107 if (ctr == NULL) return False;
109 prs_debug(ps, depth, desc, "srv_io_share_1_ctr");
114 prs_uint32("num_entries_read", ps, depth, &(ctr->num_entries_read));
115 prs_uint32("ptr_share_info", ps, depth, &(ctr->ptr_share_info));
117 if (ctr->ptr_share_info != 0)
120 uint32 num_entries = ctr->num_entries_read;
121 if (num_entries > MAX_SHARE_ENTRIES)
123 num_entries = MAX_SHARE_ENTRIES; /* report this! */
126 prs_uint32("num_entries_read2", ps, depth, &(ctr->num_entries_read2));
128 SMB_ASSERT_ARRAY(ctr->info_1, num_entries);
130 for (i = 0; i < num_entries; i++)
133 srv_io_share_info1("", &(ctr->info_1[i]), ps, depth);
136 for (i = 0; i < num_entries; i++)
139 srv_io_share_info1_str("", &(ctr->info_1_str[i]), ps, depth);
148 /*******************************************************************
149 makes a SH_INFO_2_STR structure
150 ********************************************************************/
151 BOOL make_srv_share_info2_str(SH_INFO_2_STR *sh2,
152 char *net_name, char *remark,
153 char *path, char *pass)
155 if (sh2 == NULL) return False;
157 DEBUG(5,("make_srv_share_info2_str\n"));
159 make_unistr2(&(sh2->uni_netname), net_name, strlen(net_name)+1);
160 make_unistr2(&(sh2->uni_remark ), remark , strlen(remark )+1);
161 make_unistr2(&(sh2->uni_path ), path , strlen(path )+1);
162 make_unistr2(&(sh2->uni_passwd ), pass , strlen(pass )+1);
167 /*******************************************************************
168 reads or writes a structure.
169 ********************************************************************/
170 static BOOL srv_io_share_info2_str(char *desc, SH_INFO_2_STR *ss2, SH_INFO_2 *sh2, prs_struct *ps, int depth)
172 if (ss2 == NULL) return False;
174 prs_debug(ps, depth, desc, "srv_io_share_info2_str");
179 smb_io_unistr2("", &(ss2->uni_netname), sh2->ptr_netname, ps, depth);
181 smb_io_unistr2("", &(ss2->uni_remark ), sh2->ptr_remark , ps, depth);
183 smb_io_unistr2("", &(ss2->uni_path ), sh2->ptr_path , ps, depth);
185 smb_io_unistr2("", &(ss2->uni_passwd ), sh2->ptr_passwd , ps, depth);
191 /*******************************************************************
192 makes a SH_INFO_2 structure
193 ********************************************************************/
194 BOOL make_srv_share_info2(SH_INFO_2 *sh2,
195 char *net_name, uint32 type, char *remark,
196 uint32 perms, uint32 max_uses, uint32 num_uses,
197 char *path, char *pass)
199 if (sh2 == NULL) return False;
201 DEBUG(5,("make_srv_share_info2: %s %8x %s\n", net_name, type, remark));
203 sh2->ptr_netname = net_name != NULL ? 1 : 0;
205 sh2->ptr_remark = remark != NULL ? 1 : 0;
207 sh2->max_uses = max_uses;
208 sh2->num_uses = num_uses;
210 sh2->ptr_path = path != NULL ? 1 : 0;
211 sh2->ptr_passwd = pass != NULL ? 1 : 0;
216 /*******************************************************************
217 reads or writes a structure.
218 ********************************************************************/
219 static BOOL srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth)
221 if (sh2 == NULL) return False;
223 prs_debug(ps, depth, desc, "srv_io_share_info2");
228 prs_uint32("ptr_netname", ps, depth, &(sh2->ptr_netname));
229 prs_uint32("type ", ps, depth, &(sh2->type ));
230 prs_uint32("ptr_remark ", ps, depth, &(sh2->ptr_remark ));
231 prs_uint32("perms ", ps, depth, &(sh2->perms ));
232 prs_uint32("max_uses ", ps, depth, &(sh2->max_uses ));
233 prs_uint32("num_uses ", ps, depth, &(sh2->num_uses ));
234 prs_uint32("ptr_path ", ps, depth, &(sh2->ptr_path ));
235 prs_uint32("ptr_passwd ", ps, depth, &(sh2->ptr_passwd ));
240 /*******************************************************************
241 reads or writes a structure.
242 ********************************************************************/
243 static BOOL srv_io_srv_share_info_2(char *desc, SRV_SHARE_INFO_2 *ctr, prs_struct *ps, int depth)
245 if (ctr == NULL) return False;
247 prs_debug(ps, depth, desc, "srv_io_share_2_ctr");
252 prs_uint32("num_entries_read", ps, depth, &(ctr->num_entries_read));
253 prs_uint32("ptr_share_info", ps, depth, &(ctr->ptr_share_info));
255 if (ctr->ptr_share_info != 0)
258 uint32 num_entries = ctr->num_entries_read;
259 if (num_entries > MAX_SHARE_ENTRIES)
261 num_entries = MAX_SHARE_ENTRIES; /* report this! */
264 prs_uint32("num_entries_read2", ps, depth, &(ctr->num_entries_read2));
266 SMB_ASSERT_ARRAY(ctr->info_2, num_entries);
268 for (i = 0; i < num_entries; i++)
271 if (!srv_io_share_info2("", &(ctr->info_2[i]), ps, depth)) return False;
274 for (i = 0; i < num_entries; i++)
277 if (!srv_io_share_info2_str("", &(ctr->info_2_str[i]), &(ctr->info_2[i]), ps, depth)) return False;
286 /*******************************************************************
287 reads or writes a structure.
288 ********************************************************************/
289 static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth)
291 if (ctr == NULL) return False;
293 prs_debug(ps, depth, desc, "srv_io_srv_share_ctr");
298 prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
299 prs_uint32("ptr_share_ctr", ps, depth, &(ctr->ptr_share_ctr));
301 if (ctr->ptr_share_ctr != 0)
303 switch (ctr->switch_value)
307 srv_io_srv_share_info_2("", &(ctr->share.info2), ps, depth);
312 srv_io_srv_share_info_1("", &(ctr->share.info1), ps, depth);
317 DEBUG(5,("%s no share info at switch_value %d\n",
318 tab_depth(depth), ctr->switch_value));
327 /*******************************************************************
328 reads or writes a structure.
329 ********************************************************************/
330 BOOL make_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n,
332 uint32 share_level, SRV_SHARE_INFO_CTR *ctr,
333 uint32 preferred_len,
336 if (q_n == NULL || ctr == NULL || hnd == NULL) return False;
340 DEBUG(5,("make_q_net_share_enum\n"));
342 make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name);
344 q_n->share_level = share_level;
345 q_n->preferred_len = preferred_len;
347 memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd));
352 /*******************************************************************
353 reads or writes a structure.
354 ********************************************************************/
355 BOOL srv_io_q_net_share_enum(char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth)
357 if (q_n == NULL) return False;
359 prs_debug(ps, depth, desc, "srv_io_q_net_share_enum");
364 prs_uint32("ptr_srv_name", ps, depth, &(q_n->ptr_srv_name));
365 smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth);
369 prs_uint32("share_level", ps, depth, &(q_n->share_level ));
371 if (((int)q_n->share_level) != -1)
373 srv_io_srv_share_ctr("share_ctr", q_n->ctr, ps, depth);
376 prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
378 smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth);
383 /*******************************************************************
384 reads or writes a structure.
385 ********************************************************************/
386 BOOL srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth)
388 if (r_n == NULL) return False;
390 prs_debug(ps, depth, desc, "srv_io_r_net_share_enum");
395 prs_uint32("share_level", ps, depth, &(r_n->share_level));
397 if (r_n->share_level != 0)
399 srv_io_srv_share_ctr("share_ctr", r_n->ctr, ps, depth);
402 prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
403 smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth);
404 prs_uint32("status ", ps, depth, &(r_n->status));
409 /*******************************************************************
410 makes a SESS_INFO_0_STR structure
411 ********************************************************************/
412 BOOL make_srv_sess_info0_str(SESS_INFO_0_STR *ss0, char *name)
414 if (ss0 == NULL) return False;
416 DEBUG(5,("make_srv_sess_info0_str\n"));
418 make_unistr2(&(ss0->uni_name), name, strlen(name)+1);
423 /*******************************************************************
424 reads or writes a structure.
425 ********************************************************************/
426 static BOOL srv_io_sess_info0_str(char *desc, SESS_INFO_0_STR *ss0,
427 const SESS_INFO_0 *si0, prs_struct *ps, int depth)
429 if (ss0 == NULL) return False;
431 prs_debug(ps, depth, desc, "srv_io_sess_info0_str");
436 smb_io_unistr2("", &(ss0->uni_name), si0->ptr_name, ps, depth);
441 /*******************************************************************
442 makes a SESS_INFO_0 structure
443 ********************************************************************/
444 BOOL make_srv_sess_info0(SESS_INFO_0 *ss0, char *name)
446 if (ss0 == NULL) return False;
448 DEBUG(5,("make_srv_sess_info0: %s\n", name));
450 ss0->ptr_name = name != NULL ? 1 : 0;
455 /*******************************************************************
456 reads or writes a structure.
457 ********************************************************************/
458 static BOOL srv_io_sess_info0(char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int depth)
460 if (ss0 == NULL) return False;
462 prs_debug(ps, depth, desc, "srv_io_sess_info0");
467 prs_uint32("ptr_name", ps, depth, &(ss0->ptr_name));
472 /*******************************************************************
473 reads or writes a structure.
474 ********************************************************************/
475 static BOOL srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth)
477 if (ss0 == NULL) return False;
479 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_0");
484 prs_uint32("num_entries_read", ps, depth, &(ss0->num_entries_read));
485 prs_uint32("ptr_sess_info", ps, depth, &(ss0->ptr_sess_info));
487 if (ss0->ptr_sess_info != 0)
490 uint32 num_entries = ss0->num_entries_read;
491 if (num_entries > MAX_SESS_ENTRIES)
493 num_entries = MAX_SESS_ENTRIES; /* report this! */
496 prs_uint32("num_entries_read2", ps, depth, &(ss0->num_entries_read2));
498 SMB_ASSERT_ARRAY(ss0->info_0, num_entries);
500 for (i = 0; i < num_entries; i++)
503 srv_io_sess_info0("", &(ss0->info_0[i]), ps, depth);
506 for (i = 0; i < num_entries; i++)
509 srv_io_sess_info0_str("", &(ss0->info_0_str[i]),
520 /*******************************************************************
521 makes a SESS_INFO_1_STR structure
522 ********************************************************************/
523 BOOL make_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user)
525 if (ss1 == NULL) return False;
527 DEBUG(5,("make_srv_sess_info1_str\n"));
529 make_unistr2(&(ss1->uni_name), name, strlen(name)+1);
530 make_unistr2(&(ss1->uni_user), name, strlen(user)+1);
535 /*******************************************************************
536 reads or writes a structure.
537 ********************************************************************/
538 static BOOL srv_io_sess_info1_str(char *desc, SESS_INFO_1_STR *ss1,
540 prs_struct *ps, int depth)
542 if (ss1 == NULL) return False;
544 prs_debug(ps, depth, desc, "srv_io_sess_info1_str");
549 smb_io_unistr2("", &(ss1->uni_name), si1->ptr_name, ps, depth);
550 smb_io_unistr2("", &(ss1->uni_user), si1->ptr_user, ps, depth);
555 /*******************************************************************
556 makes a SESS_INFO_1 structure
557 ********************************************************************/
558 BOOL make_srv_sess_info1(SESS_INFO_1 *ss1,
559 char *name, char *user,
560 uint32 num_opens, uint32 open_time, uint32 idle_time,
563 if (ss1 == NULL) return False;
565 DEBUG(5,("make_srv_sess_info1: %s\n", name));
567 ss1->ptr_name = name != NULL ? 1 : 0;
568 ss1->ptr_user = user != NULL ? 1 : 0;
570 ss1->num_opens = num_opens;
571 ss1->open_time = open_time;
572 ss1->idle_time = idle_time;
573 ss1->user_flags = user_flags;
578 /*******************************************************************
579 reads or writes a structure.
580 ********************************************************************/
581 static BOOL srv_io_sess_info1(char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int depth)
583 if (ss1 == NULL) return False;
585 prs_debug(ps, depth, desc, "srv_io_sess_info1");
590 prs_uint32("ptr_name ", ps, depth, &(ss1->ptr_name ));
591 prs_uint32("ptr_user ", ps, depth, &(ss1->ptr_user ));
593 prs_uint32("num_opens ", ps, depth, &(ss1->num_opens ));
594 prs_uint32("open_time ", ps, depth, &(ss1->open_time ));
595 prs_uint32("idle_time ", ps, depth, &(ss1->idle_time ));
596 prs_uint32("user_flags", ps, depth, &(ss1->user_flags));
601 /*******************************************************************
602 reads or writes a structure.
603 ********************************************************************/
604 static BOOL srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth)
606 if (ss1 == NULL) return False;
608 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_1");
613 prs_uint32("num_entries_read", ps, depth, &(ss1->num_entries_read));
614 prs_uint32("ptr_sess_info", ps, depth, &(ss1->ptr_sess_info));
616 if (ss1->ptr_sess_info != 0)
619 uint32 num_entries = ss1->num_entries_read;
620 if (num_entries > MAX_SESS_ENTRIES)
622 num_entries = MAX_SESS_ENTRIES; /* report this! */
625 prs_uint32("num_entries_read2", ps, depth, &(ss1->num_entries_read2));
627 SMB_ASSERT_ARRAY(ss1->info_1, num_entries);
629 for (i = 0; i < num_entries; i++)
632 srv_io_sess_info1("", &(ss1->info_1[i]), ps, depth);
635 for (i = 0; i < num_entries; i++)
638 srv_io_sess_info1_str("", &(ss1->info_1_str[i]),
649 /*******************************************************************
650 reads or writes a structure.
651 ********************************************************************/
652 static BOOL srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR *ctr, prs_struct *ps, int depth)
654 if (ctr == NULL) return False;
656 prs_debug(ps, depth, desc, "srv_io_srv_sess_ctr");
661 prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
662 prs_uint32("ptr_sess_ctr", ps, depth, &(ctr->ptr_sess_ctr));
664 if (ctr->ptr_sess_ctr != 0)
666 switch (ctr->switch_value)
670 srv_io_srv_sess_info_0("", &(ctr->sess.info0), ps, depth);
675 srv_io_srv_sess_info_1("", &(ctr->sess.info1), ps, depth);
680 DEBUG(5,("%s no session info at switch_value %d\n",
681 tab_depth(depth), ctr->switch_value));
690 /*******************************************************************
691 reads or writes a structure.
692 ********************************************************************/
693 BOOL make_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n,
694 char *srv_name, char *qual_name,
696 uint32 sess_level, SRV_SESS_INFO_CTR *ctr,
697 uint32 preferred_len,
700 if (q_n == NULL || ctr == NULL || hnd == NULL) return False;
704 DEBUG(5,("make_q_net_sess_enum\n"));
706 make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name);
707 make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name);
708 make_buf_unistr2(&(q_n->uni_user_name), &(q_n->ptr_user_name), user_name);
710 q_n->sess_level = sess_level;
711 q_n->preferred_len = preferred_len;
713 memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd));
718 /*******************************************************************
719 reads or writes a structure.
720 ********************************************************************/
721 BOOL srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps, int depth)
723 if (q_n == NULL) return False;
725 prs_debug(ps, depth, desc, "srv_io_q_net_sess_enum");
730 prs_uint32("ptr_srv_name", ps, depth, &(q_n->ptr_srv_name));
731 smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth);
735 prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name));
736 smb_io_unistr2("", &(q_n->uni_qual_name), q_n->ptr_qual_name, ps, depth);
739 prs_uint32("ptr_user_name", ps, depth, &(q_n->ptr_user_name));
740 smb_io_unistr2("", &(q_n->uni_user_name), q_n->ptr_user_name, ps, depth);
743 prs_uint32("sess_level", ps, depth, &(q_n->sess_level ));
745 if (((int)q_n->sess_level) != -1)
747 srv_io_srv_sess_ctr("sess_ctr", q_n->ctr, ps, depth);
750 prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
752 smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth);
757 /*******************************************************************
758 reads or writes a structure.
759 ********************************************************************/
760 BOOL srv_io_r_net_sess_enum(char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth)
762 if (r_n == NULL) return False;
764 prs_debug(ps, depth, desc, "srv_io_r_net_sess_enum");
769 prs_uint32("sess_level", ps, depth, &(r_n->sess_level));
771 if (((int)r_n->sess_level) != -1)
773 srv_io_srv_sess_ctr("sess_ctr", r_n->ctr, ps, depth);
776 prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
777 smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth);
778 prs_uint32("status ", ps, depth, &(r_n->status));
783 /*******************************************************************
784 makes a CONN_INFO_0 structure
785 ********************************************************************/
786 BOOL make_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id)
788 if (ss0 == NULL) return False;
790 DEBUG(5,("make_srv_conn_info0\n"));
797 /*******************************************************************
798 reads or writes a structure.
799 ********************************************************************/
800 static BOOL srv_io_conn_info0(char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth)
802 if (ss0 == NULL) return False;
804 prs_debug(ps, depth, desc, "srv_io_conn_info0");
809 prs_uint32("id", ps, depth, &(ss0->id));
814 /*******************************************************************
815 reads or writes a structure.
816 ********************************************************************/
817 static BOOL srv_io_srv_conn_info_0(char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth)
819 if (ss0 == NULL) return False;
821 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_0");
826 prs_uint32("num_entries_read", ps, depth, &(ss0->num_entries_read));
827 prs_uint32("ptr_conn_info", ps, depth, &(ss0->ptr_conn_info));
829 if (ss0->ptr_conn_info != 0)
832 uint32 num_entries = ss0->num_entries_read;
833 if (num_entries > MAX_CONN_ENTRIES)
835 num_entries = MAX_CONN_ENTRIES; /* report this! */
838 prs_uint32("num_entries_read2", ps, depth, &(ss0->num_entries_read2));
840 for (i = 0; i < num_entries; i++)
843 srv_io_conn_info0("", &(ss0->info_0[i]), ps, depth);
852 /*******************************************************************
853 makes a CONN_INFO_1_STR structure
854 ********************************************************************/
855 BOOL make_srv_conn_info1_str(CONN_INFO_1_STR *ss1, char *usr_name, char *net_name)
857 if (ss1 == NULL) return False;
859 DEBUG(5,("make_srv_conn_info1_str\n"));
861 make_unistr2(&(ss1->uni_usr_name), usr_name, strlen(usr_name)+1);
862 make_unistr2(&(ss1->uni_net_name), net_name, strlen(net_name)+1);
867 /*******************************************************************
868 reads or writes a structure.
869 ********************************************************************/
870 static BOOL srv_io_conn_info1_str(char *desc, CONN_INFO_1_STR *ss1,
871 CONN_INFO_1 *ci1, prs_struct *ps, int depth)
873 if (ss1 == NULL) return False;
875 prs_debug(ps, depth, desc, "srv_io_conn_info1_str");
880 smb_io_unistr2("", &(ss1->uni_usr_name), ci1->ptr_usr_name, ps, depth);
881 smb_io_unistr2("", &(ss1->uni_net_name), ci1->ptr_net_name, ps, depth);
886 /*******************************************************************
887 makes a CONN_INFO_1 structure
888 ********************************************************************/
889 BOOL make_srv_conn_info1(CONN_INFO_1 *ss1,
890 uint32 id, uint32 type,
891 uint32 num_opens, uint32 num_users, uint32 open_time,
892 char *usr_name, char *net_name)
894 if (ss1 == NULL) return False;
896 DEBUG(5,("make_srv_conn_info1: %s %s\n", usr_name, net_name));
900 ss1->num_opens = num_opens ;
901 ss1->num_users = num_users;
902 ss1->open_time = open_time;
904 ss1->ptr_usr_name = usr_name != NULL ? 1 : 0;
905 ss1->ptr_net_name = net_name != NULL ? 1 : 0;
910 /*******************************************************************
911 reads or writes a structure.
912 ********************************************************************/
913 static BOOL srv_io_conn_info1(char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth)
915 if (ss1 == NULL) return False;
917 prs_debug(ps, depth, desc, "srv_io_conn_info1");
922 prs_uint32("id ", ps, depth, &(ss1->id ));
923 prs_uint32("type ", ps, depth, &(ss1->type ));
924 prs_uint32("num_opens ", ps, depth, &(ss1->num_opens ));
925 prs_uint32("num_users ", ps, depth, &(ss1->num_users ));
926 prs_uint32("open_time ", ps, depth, &(ss1->open_time ));
928 prs_uint32("ptr_usr_name", ps, depth, &(ss1->ptr_usr_name));
929 prs_uint32("ptr_net_name", ps, depth, &(ss1->ptr_net_name));
934 /*******************************************************************
935 reads or writes a structure.
936 ********************************************************************/
937 static BOOL srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth)
939 if (ss1 == NULL) return False;
941 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_1");
946 prs_uint32("num_entries_read", ps, depth, &(ss1->num_entries_read));
947 prs_uint32("ptr_conn_info", ps, depth, &(ss1->ptr_conn_info));
949 if (ss1->ptr_conn_info != 0)
952 uint32 num_entries = ss1->num_entries_read;
953 if (num_entries > MAX_CONN_ENTRIES)
955 num_entries = MAX_CONN_ENTRIES; /* report this! */
958 prs_uint32("num_entries_read2", ps, depth, &(ss1->num_entries_read2));
960 for (i = 0; i < num_entries; i++)
963 srv_io_conn_info1("", &(ss1->info_1[i]), ps, depth);
966 for (i = 0; i < num_entries; i++)
969 srv_io_conn_info1_str("", &(ss1->info_1_str[i]),
980 /*******************************************************************
981 reads or writes a structure.
982 ********************************************************************/
983 static BOOL srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR *ctr, prs_struct *ps, int depth)
985 if (ctr == NULL) return False;
987 prs_debug(ps, depth, desc, "srv_io_srv_conn_ctr");
992 prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
993 prs_uint32("ptr_conn_ctr", ps, depth, &(ctr->ptr_conn_ctr));
995 if (ctr->ptr_conn_ctr != 0)
997 switch (ctr->switch_value)
1001 srv_io_srv_conn_info_0("", &(ctr->conn.info0), ps, depth);
1006 srv_io_srv_conn_info_1("", &(ctr->conn.info1), ps, depth);
1011 DEBUG(5,("%s no connection info at switch_value %d\n",
1012 tab_depth(depth), ctr->switch_value));
1021 /*******************************************************************
1022 reads or writes a structure.
1023 ********************************************************************/
1024 BOOL make_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n,
1025 char *srv_name, char *qual_name,
1026 uint32 conn_level, SRV_CONN_INFO_CTR *ctr,
1027 uint32 preferred_len,
1030 if (q_n == NULL || ctr == NULL || hnd == NULL) return False;
1034 DEBUG(5,("make_q_net_conn_enum\n"));
1036 make_buf_unistr2(&(q_n->uni_srv_name ), &(q_n->ptr_srv_name ), srv_name );
1037 make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name);
1039 q_n->conn_level = conn_level;
1040 q_n->preferred_len = preferred_len;
1042 memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd));
1047 /*******************************************************************
1048 reads or writes a structure.
1049 ********************************************************************/
1050 BOOL srv_io_q_net_conn_enum(char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth)
1052 if (q_n == NULL) return False;
1054 prs_debug(ps, depth, desc, "srv_io_q_net_conn_enum");
1059 prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name));
1060 smb_io_unistr2("", &(q_n->uni_srv_name), q_n->ptr_srv_name, ps, depth);
1064 prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name));
1065 smb_io_unistr2("", &(q_n->uni_qual_name), q_n->ptr_qual_name, ps, depth);
1069 prs_uint32("conn_level", ps, depth, &(q_n->conn_level ));
1071 if (((int)q_n->conn_level) != -1)
1073 srv_io_srv_conn_ctr("conn_ctr", q_n->ctr, ps, depth);
1076 prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
1078 smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth);
1083 /*******************************************************************
1084 reads or writes a structure.
1085 ********************************************************************/
1086 BOOL srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth)
1088 if (r_n == NULL) return False;
1090 prs_debug(ps, depth, desc, "srv_io_r_net_conn_enum");
1095 prs_uint32("conn_level", ps, depth, &(r_n->conn_level));
1097 if (((int)r_n->conn_level) != -1)
1099 srv_io_srv_conn_ctr("conn_ctr", r_n->ctr, ps, depth);
1102 prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
1103 smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth);
1104 prs_uint32("status ", ps, depth, &(r_n->status));
1109 /*******************************************************************
1110 makes a TPRT_INFO_0_STR structure
1111 ********************************************************************/
1112 BOOL make_srv_tprt_info0_str(TPRT_INFO_0_STR *tp0,
1114 char *trans_addr, uint32 trans_addr_len,
1117 if (tp0 == NULL) return False;
1119 DEBUG(5,("make_srv_tprt_info0_str\n"));
1121 make_unistr2(&(tp0->uni_trans_name), trans_name, strlen(trans_name)+1);
1122 make_buffer4_str(&(tp0->buf_trans_addr), trans_addr, trans_addr_len);
1123 make_unistr2(&(tp0->uni_addr_name ), addr_name, strlen(addr_name)+1);
1128 /*******************************************************************
1129 reads or writes a structure.
1130 ********************************************************************/
1131 static BOOL srv_io_tprt_info0_str(char *desc, TPRT_INFO_0_STR *tp0,
1133 prs_struct *ps, int depth)
1135 if (tp0 == NULL) return False;
1137 prs_debug(ps, depth, desc, "srv_io_tprt_info0_str");
1142 smb_io_unistr2("", &(tp0->uni_trans_name), ti0->ptr_trans_name, ps, depth);
1143 smb_io_buffer4("", &(tp0->buf_trans_addr), ti0->ptr_trans_addr, ps, depth);
1144 smb_io_unistr2("", &(tp0->uni_addr_name ), ti0->ptr_addr_name, ps, depth);
1149 /*******************************************************************
1150 makes a TPRT_INFO_0 structure
1151 ********************************************************************/
1152 BOOL make_srv_tprt_info0(TPRT_INFO_0 *tp0,
1153 uint32 num_vcs, uint32 trans_addr_len,
1154 char *trans_name, char *trans_addr,
1157 if (tp0 == NULL) return False;
1159 DEBUG(5,("make_srv_tprt_info0: %s %s\n", trans_name, addr_name));
1161 tp0->num_vcs = num_vcs;
1162 tp0->ptr_trans_name = trans_name != NULL ? 1 : 0;
1163 tp0->ptr_trans_addr = trans_addr != NULL ? 1 : 0;
1164 tp0->trans_addr_len = trans_addr_len;
1165 tp0->ptr_addr_name = addr_name != NULL ? 1 : 0;
1170 /*******************************************************************
1171 reads or writes a structure.
1172 ********************************************************************/
1173 static BOOL srv_io_tprt_info0(char *desc, TPRT_INFO_0 *tp0, prs_struct *ps, int depth)
1175 if (tp0 == NULL) return False;
1177 prs_debug(ps, depth, desc, "srv_io_tprt_info0");
1182 prs_uint32("num_vcs ", ps, depth, &(tp0->num_vcs ));
1183 prs_uint32("ptr_trans_name", ps, depth, &(tp0->ptr_trans_name));
1184 prs_uint32("ptr_trans_addr", ps, depth, &(tp0->ptr_trans_addr));
1185 prs_uint32("trans_addr_len", ps, depth, &(tp0->trans_addr_len));
1186 prs_uint32("ptr_addr_name ", ps, depth, &(tp0->ptr_addr_name ));
1191 /*******************************************************************
1192 reads or writes a structure.
1193 ********************************************************************/
1194 static BOOL srv_io_srv_tprt_info_0(char *desc, SRV_TPRT_INFO_0 *tp0, prs_struct *ps, int depth)
1196 if (tp0 == NULL) return False;
1198 prs_debug(ps, depth, desc, "srv_io_srv_tprt_info_0");
1203 prs_uint32("num_entries_read", ps, depth, &(tp0->num_entries_read));
1204 prs_uint32("ptr_tprt_info", ps, depth, &(tp0->ptr_tprt_info));
1206 if (tp0->ptr_tprt_info != 0)
1209 uint32 num_entries = tp0->num_entries_read;
1211 prs_uint32("num_entries_read2", ps, depth, &(tp0->num_entries_read2));
1216 tp0->info_0 = (TPRT_INFO_0*)malloc(num_entries *
1217 sizeof(tp0->info_0[0]));
1219 tp0->info_0_str = (TPRT_INFO_0_STR*)malloc(num_entries *
1220 sizeof(tp0->info_0_str[0]));
1222 if (tp0->info_0 == NULL || tp0->info_0_str == NULL)
1224 free_srv_tprt_info_0(tp0);
1229 for (i = 0; i < num_entries; i++)
1232 srv_io_tprt_info0("", &(tp0->info_0[i]), ps, depth);
1235 for (i = 0; i < num_entries; i++)
1238 srv_io_tprt_info0_str("", &(tp0->info_0_str[i]),
1249 free_srv_tprt_info_0(tp0);
1255 /*******************************************************************
1257 ********************************************************************/
1258 void free_srv_tprt_info_0(SRV_TPRT_INFO_0 *tp0)
1260 if (tp0->info_0 != NULL)
1265 if (tp0->info_0_str != NULL)
1267 free(tp0->info_0_str);
1268 tp0->info_0_str = NULL;
1272 /*******************************************************************
1273 reads or writes a structure.
1274 ********************************************************************/
1275 static BOOL srv_io_srv_tprt_ctr(char *desc, SRV_TPRT_INFO_CTR *ctr, prs_struct *ps, int depth)
1277 if (ctr == NULL) return False;
1279 prs_debug(ps, depth, desc, "srv_io_srv_tprt_ctr");
1284 prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
1285 prs_uint32("ptr_tprt_ctr", ps, depth, &(ctr->ptr_tprt_ctr));
1287 if (ctr->ptr_tprt_ctr != 0)
1289 switch (ctr->switch_value)
1293 srv_io_srv_tprt_info_0("", &(ctr->tprt.info0), ps, depth);
1298 DEBUG(5,("%s no transport info at switch_value %d\n",
1299 tab_depth(depth), ctr->switch_value));
1308 /*******************************************************************
1309 reads or writes a structure.
1310 ********************************************************************/
1311 void free_srv_tprt_ctr(SRV_TPRT_INFO_CTR *ctr)
1313 switch (ctr->switch_value)
1317 free_srv_tprt_info_0(&(ctr->tprt.info0));
1322 DEBUG(5,("no transport info at switch_value %d\n",
1323 ctr->switch_value));
1329 /*******************************************************************
1330 reads or writes a structure.
1331 ********************************************************************/
1332 BOOL make_srv_q_net_tprt_enum(SRV_Q_NET_TPRT_ENUM *q_n,
1334 uint32 tprt_level, SRV_TPRT_INFO_CTR *ctr,
1335 uint32 preferred_len,
1338 if (q_n == NULL || ctr == NULL || hnd == NULL) return False;
1342 DEBUG(5,("make_q_net_tprt_enum\n"));
1344 make_buf_unistr2(&(q_n->uni_srv_name ), &(q_n->ptr_srv_name ), srv_name );
1346 q_n->tprt_level = tprt_level;
1347 q_n->preferred_len = preferred_len;
1349 memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd));
1354 /*******************************************************************
1355 reads or writes a structure.
1356 ********************************************************************/
1357 BOOL srv_io_q_net_tprt_enum(char *desc, SRV_Q_NET_TPRT_ENUM *q_n, prs_struct *ps, int depth)
1359 if (q_n == NULL) return False;
1361 prs_debug(ps, depth, desc, "srv_io_q_net_tprt_enum");
1366 prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name));
1367 smb_io_unistr2("", &(q_n->uni_srv_name), q_n->ptr_srv_name, ps, depth);
1371 prs_uint32("tprt_level", ps, depth, &(q_n->tprt_level ));
1373 if (((int)q_n->tprt_level) != -1)
1375 srv_io_srv_tprt_ctr("tprt_ctr", q_n->ctr, ps, depth);
1378 prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
1380 smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth);
1385 /*******************************************************************
1386 reads or writes a structure.
1387 ********************************************************************/
1388 BOOL srv_io_r_net_tprt_enum(char *desc, SRV_R_NET_TPRT_ENUM *r_n, prs_struct *ps, int depth)
1390 if (r_n == NULL) return False;
1392 prs_debug(ps, depth, desc, "srv_io_r_net_tprt_enum");
1397 prs_uint32("tprt_level", ps, depth, &(r_n->tprt_level));
1399 if (((int)r_n->tprt_level) != -1)
1401 srv_io_srv_tprt_ctr("tprt_ctr", r_n->ctr, ps, depth);
1404 prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
1405 smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth);
1406 prs_uint32("status ", ps, depth, &(r_n->status));
1411 /*******************************************************************
1412 makes a FILE_INFO_3_STR structure
1413 ********************************************************************/
1414 BOOL make_srv_file_info3_str(FILE_INFO_3_STR *fi3, char *user_name, char *path_name)
1416 if (fi3 == NULL) return False;
1418 DEBUG(5,("make_srv_file_info3_str\n"));
1420 make_unistr2(&(fi3->uni_path_name), path_name, strlen(path_name)+1);
1421 make_unistr2(&(fi3->uni_user_name), user_name, strlen(user_name)+1);
1426 /*******************************************************************
1427 reads or writes a structure.
1428 ********************************************************************/
1429 static BOOL srv_io_file_info3_str(char *desc, FILE_INFO_3_STR *sh1, prs_struct *ps, int depth)
1431 if (sh1 == NULL) return False;
1433 prs_debug(ps, depth, desc, "srv_io_file_info3_str");
1438 smb_io_unistr2("", &(sh1->uni_path_name), True, ps, depth);
1439 smb_io_unistr2("", &(sh1->uni_user_name), True, ps, depth);
1444 /*******************************************************************
1445 makes a FILE_INFO_3 structure
1446 ********************************************************************/
1447 BOOL make_srv_file_info3(FILE_INFO_3 *fl3,
1448 uint32 id, uint32 perms, uint32 num_locks,
1449 char *path_name, char *user_name)
1451 if (fl3 == NULL) return False;
1453 DEBUG(5,("make_srv_file_info3: %s %s\n", path_name, user_name));
1457 fl3->num_locks = num_locks;
1459 fl3->ptr_path_name = path_name != NULL ? 1 : 0;
1460 fl3->ptr_user_name = user_name != NULL ? 1 : 0;
1465 /*******************************************************************
1466 reads or writes a structure.
1467 ********************************************************************/
1468 static BOOL srv_io_file_info3(char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth)
1470 if (fl3 == NULL) return False;
1472 prs_debug(ps, depth, desc, "srv_io_file_info3");
1477 prs_uint32("id ", ps, depth, &(fl3->id ));
1478 prs_uint32("perms ", ps, depth, &(fl3->perms ));
1479 prs_uint32("num_locks ", ps, depth, &(fl3->num_locks ));
1480 prs_uint32("ptr_path_name", ps, depth, &(fl3->ptr_path_name));
1481 prs_uint32("ptr_user_name", ps, depth, &(fl3->ptr_user_name));
1486 /*******************************************************************
1487 reads or writes a structure.
1488 ********************************************************************/
1489 static BOOL srv_io_srv_file_info_3(char *desc, SRV_FILE_INFO_3 *fl3, prs_struct *ps, int depth)
1491 if (fl3 == NULL) return False;
1493 prs_debug(ps, depth, desc, "srv_io_file_3_fl3");
1498 prs_uint32("num_entries_read", ps, depth, &(fl3->num_entries_read));
1499 prs_uint32("ptr_file_fl3", ps, depth, &(fl3->ptr_file_info));
1500 if (fl3->ptr_file_info != 0)
1503 uint32 num_entries = fl3->num_entries_read;
1505 if (num_entries > MAX_FILE_ENTRIES)
1507 num_entries = MAX_FILE_ENTRIES; /* report this! */
1510 prs_uint32("num_entries_read2", ps, depth, &(fl3->num_entries_read2));
1512 for (i = 0; i < num_entries; i++)
1515 srv_io_file_info3("", &(fl3->info_3[i]), ps, depth);
1518 for (i = 0; i < num_entries; i++)
1521 srv_io_file_info3_str("", &(fl3->info_3_str[i]), ps, depth);
1530 /*******************************************************************
1531 reads or writes a structure.
1532 ********************************************************************/
1533 static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth)
1535 if (ctr == NULL) return False;
1537 prs_debug(ps, depth, desc, "srv_io_srv_file_ctr");
1542 prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
1543 prs_uint32("ptr_file_ctr", ps, depth, &(ctr->ptr_file_ctr));
1545 if (ctr->ptr_file_ctr != 0)
1547 switch (ctr->switch_value)
1551 srv_io_srv_file_info_3("", &(ctr->file.info3), ps, depth);
1556 DEBUG(5,("%s no file info at switch_value %d\n",
1557 tab_depth(depth), ctr->switch_value));
1566 /*******************************************************************
1567 reads or writes a structure.
1568 ********************************************************************/
1569 BOOL make_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n,
1570 char *srv_name, char *qual_name, uint32 file_id,
1571 uint32 file_level, SRV_FILE_INFO_CTR *ctr,
1572 uint32 preferred_len,
1575 if (q_n == NULL || ctr == NULL || hnd == NULL) return False;
1579 DEBUG(5,("make_q_net_file_enum\n"));
1581 make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name);
1582 make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name);
1584 q_n->file_id = file_id;
1585 q_n->file_level = file_level;
1586 q_n->preferred_len = preferred_len;
1588 memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd));
1593 /*******************************************************************
1594 reads or writes a structure.
1595 ********************************************************************/
1596 BOOL srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps, int depth)
1598 if (q_n == NULL) return False;
1600 prs_debug(ps, depth, desc, "srv_io_q_net_file_enum");
1605 prs_uint32("ptr_srv_name", ps, depth, &(q_n->ptr_srv_name));
1606 smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth);
1610 prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name));
1611 smb_io_unistr2("", &(q_n->uni_qual_name), q_n->ptr_qual_name, ps, depth);
1615 prs_uint32("file_id ", ps, depth, &(q_n->file_id ));
1616 prs_uint32("file_level", ps, depth, &(q_n->file_level));
1618 if (((int)q_n->file_level) != -1)
1620 srv_io_srv_file_ctr("file_ctr", q_n->ctr, ps, depth);
1623 prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
1625 smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth);
1630 /*******************************************************************
1631 reads or writes a structure.
1632 ********************************************************************/
1633 BOOL srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth)
1635 if (r_n == NULL) return False;
1637 prs_debug(ps, depth, desc, "srv_io_r_net_file_enum");
1642 prs_uint32("file_level", ps, depth, &(r_n->file_level));
1644 if (r_n->file_level != 0)
1646 srv_io_srv_file_ctr("file_ctr", r_n->ctr, ps, depth);
1649 prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
1650 smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth);
1651 prs_uint32("status ", ps, depth, &(r_n->status));
1656 /*******************************************************************
1657 makes a SRV_INFO_101 structure.
1658 ********************************************************************/
1659 BOOL make_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, char *name,
1660 uint32 ver_major, uint32 ver_minor,
1661 uint32 srv_type, char *comment)
1663 if (sv101 == NULL) return False;
1665 DEBUG(5,("make_srv_info_101\n"));
1667 sv101->platform_id = platform_id;
1668 make_buf_unistr2(&(sv101->uni_name ), &(sv101->ptr_name ) , name );
1669 sv101->ver_major = ver_major;
1670 sv101->ver_minor = ver_minor;
1671 sv101->srv_type = srv_type;
1672 make_buf_unistr2(&(sv101->uni_comment ), &(sv101->ptr_comment) , comment );
1678 /*******************************************************************
1679 reads or writes a SRV_INFO_101 structure.
1680 ********************************************************************/
1681 static BOOL srv_io_info_101(char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth)
1683 if (sv101 == NULL) return False;
1685 prs_debug(ps, depth, desc, "srv_io_info_101");
1690 prs_uint32("platform_id ", ps, depth, &(sv101->platform_id ));
1691 prs_uint32("ptr_name ", ps, depth, &(sv101->ptr_name ));
1692 prs_uint32("ver_major ", ps, depth, &(sv101->ver_major ));
1693 prs_uint32("ver_minor ", ps, depth, &(sv101->ver_minor ));
1694 prs_uint32("srv_type ", ps, depth, &(sv101->srv_type ));
1695 prs_uint32("ptr_comment ", ps, depth, &(sv101->ptr_comment ));
1699 smb_io_unistr2("uni_name ", &(sv101->uni_name ), True, ps, depth);
1700 smb_io_unistr2("uni_comment ", &(sv101->uni_comment ), True, ps, depth);
1705 /*******************************************************************
1706 makes a SRV_INFO_102 structure.
1707 ********************************************************************/
1708 BOOL make_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, char *name,
1709 char *comment, uint32 ver_major, uint32 ver_minor,
1710 uint32 srv_type, uint32 users, uint32 disc, uint32 hidden,
1711 uint32 announce, uint32 ann_delta, uint32 licenses,
1714 if (sv102 == NULL) return False;
1716 DEBUG(5,("make_srv_info_102\n"));
1718 sv102->platform_id = platform_id;
1719 make_buf_unistr2(&(sv102->uni_name ), &(sv102->ptr_name ), name );
1720 sv102->ver_major = ver_major;
1721 sv102->ver_minor = ver_minor;
1722 sv102->srv_type = srv_type;
1723 make_buf_unistr2(&(sv102->uni_comment ), &(sv102->ptr_comment ), comment );
1725 /* same as 101 up to here */
1727 sv102->users = users;
1729 sv102->hidden = hidden;
1730 sv102->announce = announce;
1731 sv102->ann_delta =ann_delta;
1732 sv102->licenses = licenses;
1733 make_buf_unistr2(&(sv102->uni_usr_path), &(sv102->ptr_usr_path), usr_path);
1739 /*******************************************************************
1740 reads or writes a SRV_INFO_102 structure.
1741 ********************************************************************/
1742 static BOOL srv_io_info_102(char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth)
1744 if (sv102 == NULL) return False;
1746 prs_debug(ps, depth, desc, "srv_io_info102");
1751 prs_uint32("platform_id ", ps, depth, &(sv102->platform_id ));
1752 prs_uint32("ptr_name ", ps, depth, &(sv102->ptr_name ));
1753 prs_uint32("ver_major ", ps, depth, &(sv102->ver_major ));
1754 prs_uint32("ver_minor ", ps, depth, &(sv102->ver_minor ));
1755 prs_uint32("srv_type ", ps, depth, &(sv102->srv_type ));
1756 prs_uint32("ptr_comment ", ps, depth, &(sv102->ptr_comment ));
1758 /* same as 101 up to here */
1760 prs_uint32("users ", ps, depth, &(sv102->users ));
1761 prs_uint32("disc ", ps, depth, &(sv102->disc ));
1762 prs_uint32("hidden ", ps, depth, &(sv102->hidden ));
1763 prs_uint32("announce ", ps, depth, &(sv102->announce ));
1764 prs_uint32("ann_delta ", ps, depth, &(sv102->ann_delta ));
1765 prs_uint32("licenses ", ps, depth, &(sv102->licenses ));
1766 prs_uint32("ptr_usr_path", ps, depth, &(sv102->ptr_usr_path));
1768 smb_io_unistr2("uni_name ", &(sv102->uni_name ), True, ps, depth);
1770 smb_io_unistr2("uni_comment ", &(sv102->uni_comment ), True, ps, depth);
1772 smb_io_unistr2("uni_usr_path", &(sv102->uni_usr_path), True, ps, depth);
1777 /*******************************************************************
1778 reads or writes a SRV_INFO_102 structure.
1779 ********************************************************************/
1780 static BOOL srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth)
1782 if (ctr == NULL) return False;
1784 prs_debug(ps, depth, desc, "srv_io_info_ctr");
1789 prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
1790 prs_uint32("ptr_srv_ctr ", ps, depth, &(ctr->ptr_srv_ctr ));
1792 if (ctr->ptr_srv_ctr != 0 && ctr->switch_value != 0 && ctr != NULL)
1794 switch (ctr->switch_value)
1798 srv_io_info_101("sv101", &(ctr->srv.sv101), ps, depth);
1803 srv_io_info_102("sv102", &(ctr->srv.sv102), ps, depth);
1808 DEBUG(5,("%s no server info at switch_value %d\n",
1809 tab_depth(depth), ctr->switch_value));
1819 /*******************************************************************
1820 makes a SRV_Q_NET_SRV_GET_INFO structure.
1821 ********************************************************************/
1822 BOOL make_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv,
1823 char *server_name, uint32 switch_value)
1825 if (srv == NULL) return False;
1827 DEBUG(5,("make_srv_q_net_srv_get_info\n"));
1829 make_buf_unistr2(&(srv->uni_srv_name), &(srv->ptr_srv_name), server_name);
1831 srv->switch_value = switch_value;
1836 /*******************************************************************
1837 reads or writes a structure.
1838 ********************************************************************/
1839 BOOL srv_io_q_net_srv_get_info(char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth)
1841 if (q_n == NULL) return False;
1843 prs_debug(ps, depth, desc, "srv_io_q_net_srv_get_info");
1848 prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name));
1849 smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth);
1853 prs_uint32("switch_value ", ps, depth, &(q_n->switch_value));
1858 /*******************************************************************
1859 makes a SRV_R_NET_SRV_GET_INFO structure.
1860 ********************************************************************/
1861 BOOL make_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv,
1862 uint32 switch_value, SRV_INFO_CTR *ctr, uint32 status)
1864 if (srv == NULL) return False;
1866 DEBUG(5,("make_srv_r_net_srv_get_info\n"));
1872 srv->ctr->switch_value = switch_value;
1873 srv->ctr->ptr_srv_ctr = 1;
1877 srv->ctr->switch_value = 0;
1878 srv->ctr->ptr_srv_ctr = 0;
1881 srv->status = status;
1886 /*******************************************************************
1887 reads or writes a structure.
1888 ********************************************************************/
1889 BOOL srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth)
1891 if (r_n == NULL) return False;
1893 prs_debug(ps, depth, desc, "srv_io_r_net_srv_get_info");
1898 srv_io_info_ctr("ctr", r_n->ctr, ps, depth);
1900 prs_uint32("status ", ps, depth, &(r_n->status ));
1905 /*******************************************************************
1906 makes a SRV_Q_NET_REMOTE_TOD structure.
1907 ********************************************************************/
1908 BOOL make_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_t, char *server_name)
1910 if (q_t == NULL) return False;
1912 DEBUG(5,("make_srv_q_net_remote_tod\n"));
1914 make_buf_unistr2(&(q_t->uni_srv_name), &(q_t->ptr_srv_name), server_name);
1919 /*******************************************************************
1920 reads or writes a structure.
1921 ********************************************************************/
1922 BOOL srv_io_q_net_remote_tod(char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth)
1924 if (q_n == NULL) return False;
1926 prs_debug(ps, depth, desc, "srv_io_q_net_remote_tod");
1931 prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name));
1932 smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth);
1937 /*******************************************************************
1938 reads or writes a TIME_OF_DAY_INFO structure.
1939 ********************************************************************/
1940 static BOOL srv_io_time_of_day_info(char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth)
1942 if (tod == NULL) return False;
1944 prs_debug(ps, depth, desc, "srv_io_time_of_day_info");
1949 prs_uint32("elapsedt ", ps, depth, &(tod->elapsedt ));
1950 prs_uint32("msecs ", ps, depth, &(tod->msecs ));
1951 prs_uint32("hours ", ps, depth, &(tod->hours ));
1952 prs_uint32("mins ", ps, depth, &(tod->mins ));
1953 prs_uint32("secs ", ps, depth, &(tod->secs ));
1954 prs_uint32("hunds ", ps, depth, &(tod->hunds ));
1955 prs_uint32("timezone ", ps, depth, &(tod->zone ));
1956 prs_uint32("tintervals ", ps, depth, &(tod->tintervals));
1957 prs_uint32("day ", ps, depth, &(tod->day ));
1958 prs_uint32("month ", ps, depth, &(tod->month ));
1959 prs_uint32("year ", ps, depth, &(tod->year ));
1960 prs_uint32("weekday ", ps, depth, &(tod->weekday ));
1966 /*******************************************************************
1967 makes a TIME_OF_DAY_INFO structure.
1968 ********************************************************************/
1969 BOOL make_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs,
1970 uint32 hours, uint32 mins, uint32 secs, uint32 hunds,
1971 uint32 zone, uint32 tintervals, uint32 day,
1972 uint32 month, uint32 year, uint32 weekday)
1974 if (tod == NULL) return False;
1976 DEBUG(5,("make_time_of_day_info\n"));
1978 tod->elapsedt = elapsedt;
1985 tod->tintervals = tintervals;
1989 tod->weekday = weekday;
1995 /*******************************************************************
1996 reads or writes a structure.
1997 ********************************************************************/
1998 BOOL srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth)
2000 if (r_n == NULL) return False;
2002 prs_debug(ps, depth, desc, "srv_io_r_net_remote_tod");
2007 prs_uint32("ptr_srv_tod ", ps, depth, &(r_n->ptr_srv_tod));
2009 srv_io_time_of_day_info("tod", r_n->tod, ps, depth);
2011 prs_uint32("status ", ps, depth, &(r_n->status));