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++)
132 srv_io_share_info1("", &(ctr->info_1[i]), ps, depth);
135 for (i = 0; i < num_entries; i++)
137 srv_io_share_info1_str("", &(ctr->info_1_str[i]), ps, depth);
146 /*******************************************************************
147 makes a SH_INFO_2_STR structure
148 ********************************************************************/
149 BOOL make_srv_share_info2_str(SH_INFO_2_STR *sh2,
150 char *net_name, char *remark,
151 char *path, char *pass)
153 if (sh2 == NULL) return False;
155 DEBUG(5,("make_srv_share_info2_str\n"));
157 make_unistr2(&(sh2->uni_netname), net_name, strlen(net_name)+1);
158 make_unistr2(&(sh2->uni_remark ), remark , strlen(remark )+1);
159 make_unistr2(&(sh2->uni_path ), path , strlen(path )+1);
160 make_unistr2(&(sh2->uni_passwd ), pass , strlen(pass )+1);
165 /*******************************************************************
166 reads or writes a structure.
167 ********************************************************************/
168 static BOOL srv_io_share_info2_str(char *desc, SH_INFO_2_STR *ss2, SH_INFO_2 *sh2, prs_struct *ps, int depth)
170 if (ss2 == NULL) return False;
172 prs_debug(ps, depth, desc, "srv_io_share_info2_str");
177 smb_io_unistr2("", &(ss2->uni_netname), sh2->ptr_netname, ps, depth);
179 smb_io_unistr2("", &(ss2->uni_remark ), sh2->ptr_remark , ps, depth);
181 smb_io_unistr2("", &(ss2->uni_path ), sh2->ptr_path , ps, depth);
183 smb_io_unistr2("", &(ss2->uni_passwd ), sh2->ptr_passwd , ps, depth);
189 /*******************************************************************
190 makes a SH_INFO_2 structure
191 ********************************************************************/
192 BOOL make_srv_share_info2(SH_INFO_2 *sh2,
193 char *net_name, uint32 type, char *remark,
194 uint32 perms, uint32 max_uses, uint32 num_uses,
195 char *path, char *pass)
197 if (sh2 == NULL) return False;
199 DEBUG(5,("make_srv_share_info2: %s %8x %s\n", net_name, type, remark));
201 sh2->ptr_netname = net_name != NULL ? 1 : 0;
203 sh2->ptr_remark = remark != NULL ? 1 : 0;
205 sh2->max_uses = max_uses;
206 sh2->num_uses = num_uses;
208 sh2->ptr_path = path != NULL ? 1 : 0;
209 sh2->ptr_passwd = pass != NULL ? 1 : 0;
214 /*******************************************************************
215 reads or writes a structure.
216 ********************************************************************/
217 static BOOL srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth)
219 if (sh2 == NULL) return False;
221 prs_debug(ps, depth, desc, "srv_io_share_info2");
226 prs_uint32("ptr_netname", ps, depth, &(sh2->ptr_netname));
227 prs_uint32("type ", ps, depth, &(sh2->type ));
228 prs_uint32("ptr_remark ", ps, depth, &(sh2->ptr_remark ));
229 prs_uint32("perms ", ps, depth, &(sh2->perms ));
230 prs_uint32("max_uses ", ps, depth, &(sh2->max_uses ));
231 prs_uint32("num_uses ", ps, depth, &(sh2->num_uses ));
232 prs_uint32("ptr_path ", ps, depth, &(sh2->ptr_path ));
233 prs_uint32("ptr_passwd ", ps, depth, &(sh2->ptr_passwd ));
238 /*******************************************************************
239 reads or writes a structure.
240 ********************************************************************/
241 static BOOL srv_io_srv_share_info_2(char *desc, SRV_SHARE_INFO_2 *ctr, prs_struct *ps, int depth)
243 if (ctr == NULL) return False;
245 prs_debug(ps, depth, desc, "srv_io_share_2_ctr");
250 prs_uint32("num_entries_read", ps, depth, &(ctr->num_entries_read));
251 prs_uint32("ptr_share_info", ps, depth, &(ctr->ptr_share_info));
253 if (ctr->ptr_share_info != 0)
256 uint32 num_entries = ctr->num_entries_read;
257 if (num_entries > MAX_SHARE_ENTRIES)
259 num_entries = MAX_SHARE_ENTRIES; /* report this! */
262 prs_uint32("num_entries_read2", ps, depth, &(ctr->num_entries_read2));
264 SMB_ASSERT_ARRAY(ctr->info_2, num_entries);
266 for (i = 0; i < num_entries; i++)
268 if (!srv_io_share_info2("", &(ctr->info_2[i]), ps, depth)) return False;
271 for (i = 0; i < num_entries; i++)
273 if (!srv_io_share_info2_str("", &(ctr->info_2_str[i]), &(ctr->info_2[i]), ps, depth)) return False;
282 /*******************************************************************
283 reads or writes a structure.
284 ********************************************************************/
285 static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth)
287 if (ctr == NULL) return False;
289 prs_debug(ps, depth, desc, "srv_io_srv_share_ctr");
294 prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
295 prs_uint32("ptr_share_ctr", ps, depth, &(ctr->ptr_share_ctr));
297 if (ctr->ptr_share_ctr != 0)
299 switch (ctr->switch_value)
303 srv_io_srv_share_info_2("", &(ctr->share.info2), ps, depth);
308 srv_io_srv_share_info_1("", &(ctr->share.info1), ps, depth);
313 DEBUG(5,("%s no share info at switch_value %d\n",
314 tab_depth(depth), ctr->switch_value));
323 /*******************************************************************
324 reads or writes a structure.
325 ********************************************************************/
326 BOOL make_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n,
327 const char *srv_name,
328 uint32 share_level, SRV_SHARE_INFO_CTR *ctr,
329 uint32 preferred_len,
332 if (q_n == NULL || ctr == NULL || hnd == NULL) return False;
336 DEBUG(5,("make_q_net_share_enum\n"));
338 make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name);
340 q_n->share_level = share_level;
341 q_n->preferred_len = preferred_len;
343 memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd));
348 /*******************************************************************
349 reads or writes a structure.
350 ********************************************************************/
351 BOOL srv_io_q_net_share_enum(char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth)
353 if (q_n == NULL) return False;
355 prs_debug(ps, depth, desc, "srv_io_q_net_share_enum");
360 prs_uint32("ptr_srv_name", ps, depth, &(q_n->ptr_srv_name));
361 smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth);
365 prs_uint32("share_level", ps, depth, &(q_n->share_level ));
367 if (((int)q_n->share_level) != -1)
369 srv_io_srv_share_ctr("share_ctr", q_n->ctr, ps, depth);
372 prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
374 smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth);
379 /*******************************************************************
380 reads or writes a structure.
381 ********************************************************************/
382 BOOL srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth)
384 if (r_n == NULL) return False;
386 prs_debug(ps, depth, desc, "srv_io_r_net_share_enum");
391 prs_uint32("share_level", ps, depth, &(r_n->share_level));
393 if (r_n->share_level != 0)
395 srv_io_srv_share_ctr("share_ctr", r_n->ctr, ps, depth);
398 prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
399 smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth);
400 prs_uint32("status ", ps, depth, &(r_n->status));
405 /*******************************************************************
406 makes a SESS_INFO_0_STR structure
407 ********************************************************************/
408 BOOL make_srv_sess_info0_str(SESS_INFO_0_STR *ss0, char *name)
410 if (ss0 == NULL) return False;
412 DEBUG(5,("make_srv_sess_info0_str\n"));
414 make_unistr2(&(ss0->uni_name), name, strlen(name)+1);
419 /*******************************************************************
420 reads or writes a structure.
421 ********************************************************************/
422 static BOOL srv_io_sess_info0_str(char *desc, SESS_INFO_0_STR *ss0,
423 const SESS_INFO_0 *si0, prs_struct *ps, int depth)
425 if (ss0 == NULL) return False;
427 prs_debug(ps, depth, desc, "srv_io_sess_info0_str");
432 smb_io_unistr2("", &(ss0->uni_name), si0->ptr_name, ps, depth);
437 /*******************************************************************
438 makes a SESS_INFO_0 structure
439 ********************************************************************/
440 BOOL make_srv_sess_info0(SESS_INFO_0 *ss0, char *name)
442 if (ss0 == NULL) return False;
444 DEBUG(5,("make_srv_sess_info0: %s\n", name));
446 ss0->ptr_name = name != NULL ? 1 : 0;
451 /*******************************************************************
452 reads or writes a structure.
453 ********************************************************************/
454 static BOOL srv_io_sess_info0(char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int depth)
456 if (ss0 == NULL) return False;
458 prs_debug(ps, depth, desc, "srv_io_sess_info0");
463 prs_uint32("ptr_name", ps, depth, &(ss0->ptr_name));
468 /*******************************************************************
469 reads or writes a structure.
470 ********************************************************************/
471 static BOOL srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth)
473 if (ss0 == NULL) return False;
475 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_0");
480 prs_uint32("num_entries_read", ps, depth, &(ss0->num_entries_read));
481 prs_uint32("ptr_sess_info", ps, depth, &(ss0->ptr_sess_info));
483 if (ss0->ptr_sess_info != 0)
486 uint32 num_entries = ss0->num_entries_read;
487 if (num_entries > MAX_SESS_ENTRIES)
489 num_entries = MAX_SESS_ENTRIES; /* report this! */
492 prs_uint32("num_entries_read2", ps, depth, &(ss0->num_entries_read2));
494 SMB_ASSERT_ARRAY(ss0->info_0, num_entries);
496 for (i = 0; i < num_entries; i++)
498 srv_io_sess_info0("", &(ss0->info_0[i]), ps, depth);
501 for (i = 0; i < num_entries; i++)
503 srv_io_sess_info0_str("", &(ss0->info_0_str[i]),
514 /*******************************************************************
515 makes a SESS_INFO_1_STR structure
516 ********************************************************************/
517 BOOL make_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user)
519 if (ss1 == NULL) return False;
521 DEBUG(5,("make_srv_sess_info1_str\n"));
523 make_unistr2(&(ss1->uni_name), name, strlen(name)+1);
524 make_unistr2(&(ss1->uni_user), name, strlen(user)+1);
529 /*******************************************************************
530 reads or writes a structure.
531 ********************************************************************/
532 static BOOL srv_io_sess_info1_str(char *desc, SESS_INFO_1_STR *ss1,
534 prs_struct *ps, int depth)
536 if (ss1 == NULL) return False;
538 prs_debug(ps, depth, desc, "srv_io_sess_info1_str");
543 smb_io_unistr2("", &(ss1->uni_name), si1->ptr_name, ps, depth);
544 smb_io_unistr2("", &(ss1->uni_user), si1->ptr_user, ps, depth);
549 /*******************************************************************
550 makes a SESS_INFO_1 structure
551 ********************************************************************/
552 BOOL make_srv_sess_info1(SESS_INFO_1 *ss1,
553 char *name, char *user,
554 uint32 num_opens, uint32 open_time, uint32 idle_time,
557 if (ss1 == NULL) return False;
559 DEBUG(5,("make_srv_sess_info1: %s\n", name));
561 ss1->ptr_name = name != NULL ? 1 : 0;
562 ss1->ptr_user = user != NULL ? 1 : 0;
564 ss1->num_opens = num_opens;
565 ss1->open_time = open_time;
566 ss1->idle_time = idle_time;
567 ss1->user_flags = user_flags;
572 /*******************************************************************
573 reads or writes a structure.
574 ********************************************************************/
575 static BOOL srv_io_sess_info1(char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int depth)
577 if (ss1 == NULL) return False;
579 prs_debug(ps, depth, desc, "srv_io_sess_info1");
584 prs_uint32("ptr_name ", ps, depth, &(ss1->ptr_name ));
585 prs_uint32("ptr_user ", ps, depth, &(ss1->ptr_user ));
587 prs_uint32("num_opens ", ps, depth, &(ss1->num_opens ));
588 prs_uint32("open_time ", ps, depth, &(ss1->open_time ));
589 prs_uint32("idle_time ", ps, depth, &(ss1->idle_time ));
590 prs_uint32("user_flags", ps, depth, &(ss1->user_flags));
595 /*******************************************************************
596 reads or writes a structure.
597 ********************************************************************/
598 static BOOL srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth)
600 if (ss1 == NULL) return False;
602 prs_debug(ps, depth, desc, "srv_io_srv_sess_info_1");
607 prs_uint32("num_entries_read", ps, depth, &(ss1->num_entries_read));
608 prs_uint32("ptr_sess_info", ps, depth, &(ss1->ptr_sess_info));
610 if (ss1->ptr_sess_info != 0)
613 uint32 num_entries = ss1->num_entries_read;
614 if (num_entries > MAX_SESS_ENTRIES)
616 num_entries = MAX_SESS_ENTRIES; /* report this! */
619 prs_uint32("num_entries_read2", ps, depth, &(ss1->num_entries_read2));
621 SMB_ASSERT_ARRAY(ss1->info_1, num_entries);
623 for (i = 0; i < num_entries; i++)
625 srv_io_sess_info1("", &(ss1->info_1[i]), ps, depth);
628 for (i = 0; i < num_entries; i++)
630 srv_io_sess_info1_str("", &(ss1->info_1_str[i]),
641 /*******************************************************************
642 reads or writes a structure.
643 ********************************************************************/
644 static BOOL srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR *ctr, prs_struct *ps, int depth)
646 if (ctr == NULL) return False;
648 prs_debug(ps, depth, desc, "srv_io_srv_sess_ctr");
653 prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
654 prs_uint32("ptr_sess_ctr", ps, depth, &(ctr->ptr_sess_ctr));
656 if (ctr->ptr_sess_ctr != 0)
658 switch (ctr->switch_value)
662 srv_io_srv_sess_info_0("", &(ctr->sess.info0), ps, depth);
667 srv_io_srv_sess_info_1("", &(ctr->sess.info1), ps, depth);
672 DEBUG(5,("%s no session info at switch_value %d\n",
673 tab_depth(depth), ctr->switch_value));
682 /*******************************************************************
683 reads or writes a structure.
684 ********************************************************************/
685 BOOL make_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n,
686 const char *srv_name, const char *qual_name,
688 uint32 sess_level, SRV_SESS_INFO_CTR *ctr,
689 uint32 preferred_len,
692 if (q_n == NULL || ctr == NULL || hnd == NULL) return False;
696 DEBUG(5,("make_q_net_sess_enum\n"));
698 make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name);
699 make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name);
700 make_buf_unistr2(&(q_n->uni_user_name), &(q_n->ptr_user_name), user_name);
702 q_n->sess_level = sess_level;
703 q_n->preferred_len = preferred_len;
705 memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd));
710 /*******************************************************************
711 reads or writes a structure.
712 ********************************************************************/
713 BOOL srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps, int depth)
715 if (q_n == NULL) return False;
717 prs_debug(ps, depth, desc, "srv_io_q_net_sess_enum");
722 prs_uint32("ptr_srv_name", ps, depth, &(q_n->ptr_srv_name));
723 smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth);
727 prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name));
728 smb_io_unistr2("", &(q_n->uni_qual_name), q_n->ptr_qual_name, ps, depth);
731 prs_uint32("ptr_user_name", ps, depth, &(q_n->ptr_user_name));
732 smb_io_unistr2("", &(q_n->uni_user_name), q_n->ptr_user_name, ps, depth);
735 prs_uint32("sess_level", ps, depth, &(q_n->sess_level ));
737 if (((int)q_n->sess_level) != -1)
739 srv_io_srv_sess_ctr("sess_ctr", q_n->ctr, ps, depth);
742 prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
744 smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth);
749 /*******************************************************************
750 reads or writes a structure.
751 ********************************************************************/
752 BOOL srv_io_r_net_sess_enum(char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth)
754 if (r_n == NULL) return False;
756 prs_debug(ps, depth, desc, "srv_io_r_net_sess_enum");
761 prs_uint32("sess_level", ps, depth, &(r_n->sess_level));
763 if (((int)r_n->sess_level) != -1)
765 srv_io_srv_sess_ctr("sess_ctr", r_n->ctr, ps, depth);
768 prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
769 smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth);
770 prs_uint32("status ", ps, depth, &(r_n->status));
775 /*******************************************************************
776 makes a CONN_INFO_0 structure
777 ********************************************************************/
778 BOOL make_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id)
780 if (ss0 == NULL) return False;
782 DEBUG(5,("make_srv_conn_info0\n"));
789 /*******************************************************************
790 reads or writes a structure.
791 ********************************************************************/
792 static BOOL srv_io_conn_info0(char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth)
794 if (ss0 == NULL) return False;
796 prs_debug(ps, depth, desc, "srv_io_conn_info0");
801 prs_uint32("id", ps, depth, &(ss0->id));
806 /*******************************************************************
807 reads or writes a structure.
808 ********************************************************************/
809 static BOOL srv_io_srv_conn_info_0(char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth)
811 if (ss0 == NULL) return False;
813 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_0");
818 prs_uint32("num_entries_read", ps, depth, &(ss0->num_entries_read));
819 prs_uint32("ptr_conn_info", ps, depth, &(ss0->ptr_conn_info));
821 if (ss0->ptr_conn_info != 0)
824 uint32 num_entries = ss0->num_entries_read;
825 if (num_entries > MAX_CONN_ENTRIES)
827 num_entries = MAX_CONN_ENTRIES; /* report this! */
830 prs_uint32("num_entries_read2", ps, depth, &(ss0->num_entries_read2));
832 for (i = 0; i < num_entries; i++)
834 srv_io_conn_info0("", &(ss0->info_0[i]), ps, depth);
843 /*******************************************************************
844 makes a CONN_INFO_1_STR structure
845 ********************************************************************/
846 BOOL make_srv_conn_info1_str(CONN_INFO_1_STR *ss1, char *usr_name, char *net_name)
848 if (ss1 == NULL) return False;
850 DEBUG(5,("make_srv_conn_info1_str\n"));
852 make_unistr2(&(ss1->uni_usr_name), usr_name, strlen(usr_name)+1);
853 make_unistr2(&(ss1->uni_net_name), net_name, strlen(net_name)+1);
858 /*******************************************************************
859 reads or writes a structure.
860 ********************************************************************/
861 static BOOL srv_io_conn_info1_str(char *desc, CONN_INFO_1_STR *ss1,
862 CONN_INFO_1 *ci1, prs_struct *ps, int depth)
864 if (ss1 == NULL) return False;
866 prs_debug(ps, depth, desc, "srv_io_conn_info1_str");
871 smb_io_unistr2("", &(ss1->uni_usr_name), ci1->ptr_usr_name, ps, depth);
872 smb_io_unistr2("", &(ss1->uni_net_name), ci1->ptr_net_name, ps, depth);
877 /*******************************************************************
878 makes a CONN_INFO_1 structure
879 ********************************************************************/
880 BOOL make_srv_conn_info1(CONN_INFO_1 *ss1,
881 uint32 id, uint32 type,
882 uint32 num_opens, uint32 num_users, uint32 open_time,
883 char *usr_name, char *net_name)
885 if (ss1 == NULL) return False;
887 DEBUG(5,("make_srv_conn_info1: %s %s\n", usr_name, net_name));
891 ss1->num_opens = num_opens ;
892 ss1->num_users = num_users;
893 ss1->open_time = open_time;
895 ss1->ptr_usr_name = usr_name != NULL ? 1 : 0;
896 ss1->ptr_net_name = net_name != NULL ? 1 : 0;
901 /*******************************************************************
902 reads or writes a structure.
903 ********************************************************************/
904 static BOOL srv_io_conn_info1(char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth)
906 if (ss1 == NULL) return False;
908 prs_debug(ps, depth, desc, "srv_io_conn_info1");
913 prs_uint32("id ", ps, depth, &(ss1->id ));
914 prs_uint32("type ", ps, depth, &(ss1->type ));
915 prs_uint32("num_opens ", ps, depth, &(ss1->num_opens ));
916 prs_uint32("num_users ", ps, depth, &(ss1->num_users ));
917 prs_uint32("open_time ", ps, depth, &(ss1->open_time ));
919 prs_uint32("ptr_usr_name", ps, depth, &(ss1->ptr_usr_name));
920 prs_uint32("ptr_net_name", ps, depth, &(ss1->ptr_net_name));
925 /*******************************************************************
926 reads or writes a structure.
927 ********************************************************************/
928 static BOOL srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth)
930 if (ss1 == NULL) return False;
932 prs_debug(ps, depth, desc, "srv_io_srv_conn_info_1");
937 prs_uint32("num_entries_read", ps, depth, &(ss1->num_entries_read));
938 prs_uint32("ptr_conn_info", ps, depth, &(ss1->ptr_conn_info));
940 if (ss1->ptr_conn_info != 0)
943 uint32 num_entries = ss1->num_entries_read;
944 if (num_entries > MAX_CONN_ENTRIES)
946 num_entries = MAX_CONN_ENTRIES; /* report this! */
949 prs_uint32("num_entries_read2", ps, depth, &(ss1->num_entries_read2));
951 for (i = 0; i < num_entries; i++)
953 srv_io_conn_info1("", &(ss1->info_1[i]), ps, depth);
956 for (i = 0; i < num_entries; i++)
958 srv_io_conn_info1_str("", &(ss1->info_1_str[i]),
969 /*******************************************************************
970 reads or writes a structure.
971 ********************************************************************/
972 static BOOL srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR *ctr, prs_struct *ps, int depth)
974 if (ctr == NULL) return False;
976 prs_debug(ps, depth, desc, "srv_io_srv_conn_ctr");
981 prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
982 prs_uint32("ptr_conn_ctr", ps, depth, &(ctr->ptr_conn_ctr));
984 if (ctr->ptr_conn_ctr != 0)
986 switch (ctr->switch_value)
990 srv_io_srv_conn_info_0("", &(ctr->conn.info0), ps, depth);
995 srv_io_srv_conn_info_1("", &(ctr->conn.info1), ps, depth);
1000 DEBUG(5,("%s no connection info at switch_value %d\n",
1001 tab_depth(depth), ctr->switch_value));
1010 /*******************************************************************
1011 reads or writes a structure.
1012 ********************************************************************/
1013 BOOL make_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n,
1014 const char *srv_name, const char *qual_name,
1015 uint32 conn_level, SRV_CONN_INFO_CTR *ctr,
1016 uint32 preferred_len,
1019 if (q_n == NULL || ctr == NULL || hnd == NULL) return False;
1023 DEBUG(5,("make_q_net_conn_enum\n"));
1025 make_buf_unistr2(&(q_n->uni_srv_name ), &(q_n->ptr_srv_name ), srv_name );
1026 make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name);
1028 q_n->conn_level = conn_level;
1029 q_n->preferred_len = preferred_len;
1031 memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd));
1036 /*******************************************************************
1037 reads or writes a structure.
1038 ********************************************************************/
1039 BOOL srv_io_q_net_conn_enum(char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth)
1041 if (q_n == NULL) return False;
1043 prs_debug(ps, depth, desc, "srv_io_q_net_conn_enum");
1048 prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name));
1049 smb_io_unistr2("", &(q_n->uni_srv_name), q_n->ptr_srv_name, ps, depth);
1053 prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name));
1054 smb_io_unistr2("", &(q_n->uni_qual_name), q_n->ptr_qual_name, ps, depth);
1058 prs_uint32("conn_level", ps, depth, &(q_n->conn_level ));
1060 if (((int)q_n->conn_level) != -1)
1062 srv_io_srv_conn_ctr("conn_ctr", q_n->ctr, ps, depth);
1065 prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
1067 smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth);
1072 /*******************************************************************
1073 reads or writes a structure.
1074 ********************************************************************/
1075 BOOL srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth)
1077 if (r_n == NULL) return False;
1079 prs_debug(ps, depth, desc, "srv_io_r_net_conn_enum");
1084 prs_uint32("conn_level", ps, depth, &(r_n->conn_level));
1086 if (((int)r_n->conn_level) != -1)
1088 srv_io_srv_conn_ctr("conn_ctr", r_n->ctr, ps, depth);
1091 prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
1092 smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth);
1093 prs_uint32("status ", ps, depth, &(r_n->status));
1098 /*******************************************************************
1099 makes a TPRT_INFO_0_STR structure
1100 ********************************************************************/
1101 BOOL make_srv_tprt_info0_str(TPRT_INFO_0_STR *tp0,
1103 char *trans_addr, uint32 trans_addr_len,
1106 if (tp0 == NULL) return False;
1108 DEBUG(5,("make_srv_tprt_info0_str\n"));
1110 make_unistr2(&(tp0->uni_trans_name), trans_name, strlen(trans_name)+1);
1111 make_buffer4_str(&(tp0->buf_trans_addr), trans_addr, trans_addr_len);
1112 make_unistr2(&(tp0->uni_addr_name ), addr_name, strlen(addr_name)+1);
1117 /*******************************************************************
1118 reads or writes a structure.
1119 ********************************************************************/
1120 static BOOL srv_io_tprt_info0_str(char *desc, TPRT_INFO_0_STR *tp0,
1122 prs_struct *ps, int depth)
1124 if (tp0 == NULL) return False;
1126 prs_debug(ps, depth, desc, "srv_io_tprt_info0_str");
1131 smb_io_unistr2("", &(tp0->uni_trans_name), ti0->ptr_trans_name, ps, depth);
1132 smb_io_buffer4("", &(tp0->buf_trans_addr), ti0->ptr_trans_addr, ps, depth);
1133 smb_io_unistr2("", &(tp0->uni_addr_name ), ti0->ptr_addr_name, ps, depth);
1138 /*******************************************************************
1139 makes a TPRT_INFO_0 structure
1140 ********************************************************************/
1141 BOOL make_srv_tprt_info0(TPRT_INFO_0 *tp0,
1142 uint32 num_vcs, uint32 trans_addr_len,
1143 char *trans_name, char *trans_addr,
1146 if (tp0 == NULL) return False;
1148 DEBUG(5,("make_srv_tprt_info0: %s %s\n", trans_name, addr_name));
1150 tp0->num_vcs = num_vcs;
1151 tp0->ptr_trans_name = trans_name != NULL ? 1 : 0;
1152 tp0->ptr_trans_addr = trans_addr != NULL ? 1 : 0;
1153 tp0->trans_addr_len = trans_addr_len;
1154 tp0->ptr_addr_name = addr_name != NULL ? 1 : 0;
1159 /*******************************************************************
1160 reads or writes a structure.
1161 ********************************************************************/
1162 static BOOL srv_io_tprt_info0(char *desc, TPRT_INFO_0 *tp0, prs_struct *ps, int depth)
1164 if (tp0 == NULL) return False;
1166 prs_debug(ps, depth, desc, "srv_io_tprt_info0");
1171 prs_uint32("num_vcs ", ps, depth, &(tp0->num_vcs ));
1172 prs_uint32("ptr_trans_name", ps, depth, &(tp0->ptr_trans_name));
1173 prs_uint32("ptr_trans_addr", ps, depth, &(tp0->ptr_trans_addr));
1174 prs_uint32("trans_addr_len", ps, depth, &(tp0->trans_addr_len));
1175 prs_uint32("ptr_addr_name ", ps, depth, &(tp0->ptr_addr_name ));
1180 /*******************************************************************
1181 reads or writes a structure.
1182 ********************************************************************/
1183 static BOOL srv_io_srv_tprt_info_0(char *desc, SRV_TPRT_INFO_0 *tp0, prs_struct *ps, int depth)
1185 if (tp0 == NULL) return False;
1187 prs_debug(ps, depth, desc, "srv_io_srv_tprt_info_0");
1192 prs_uint32("num_entries_read", ps, depth, &(tp0->num_entries_read));
1193 prs_uint32("ptr_tprt_info", ps, depth, &(tp0->ptr_tprt_info));
1195 if (tp0->ptr_tprt_info != 0)
1198 uint32 num_entries = tp0->num_entries_read;
1200 prs_uint32("num_entries_read2", ps, depth, &(tp0->num_entries_read2));
1205 tp0->info_0 = (TPRT_INFO_0*)malloc(num_entries *
1206 sizeof(tp0->info_0[0]));
1208 tp0->info_0_str = (TPRT_INFO_0_STR*)malloc(num_entries *
1209 sizeof(tp0->info_0_str[0]));
1211 if (tp0->info_0 == NULL || tp0->info_0_str == NULL)
1213 free_srv_tprt_info_0(tp0);
1218 for (i = 0; i < num_entries; i++)
1220 srv_io_tprt_info0("", &(tp0->info_0[i]), ps, depth);
1223 for (i = 0; i < num_entries; i++)
1225 srv_io_tprt_info0_str("", &(tp0->info_0_str[i]),
1236 free_srv_tprt_info_0(tp0);
1242 /*******************************************************************
1244 ********************************************************************/
1245 void free_srv_tprt_info_0(SRV_TPRT_INFO_0 *tp0)
1247 if (tp0->info_0 != NULL)
1252 if (tp0->info_0_str != NULL)
1254 free(tp0->info_0_str);
1255 tp0->info_0_str = NULL;
1259 /*******************************************************************
1260 reads or writes a structure.
1261 ********************************************************************/
1262 static BOOL srv_io_srv_tprt_ctr(char *desc, SRV_TPRT_INFO_CTR *ctr, prs_struct *ps, int depth)
1264 if (ctr == NULL) return False;
1266 prs_debug(ps, depth, desc, "srv_io_srv_tprt_ctr");
1271 prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
1272 prs_uint32("ptr_tprt_ctr", ps, depth, &(ctr->ptr_tprt_ctr));
1274 if (ctr->ptr_tprt_ctr != 0)
1276 switch (ctr->switch_value)
1280 srv_io_srv_tprt_info_0("", &(ctr->tprt.info0), ps, depth);
1285 DEBUG(5,("%s no transport info at switch_value %d\n",
1286 tab_depth(depth), ctr->switch_value));
1295 /*******************************************************************
1296 reads or writes a structure.
1297 ********************************************************************/
1298 void free_srv_tprt_ctr(SRV_TPRT_INFO_CTR *ctr)
1300 switch (ctr->switch_value)
1304 free_srv_tprt_info_0(&(ctr->tprt.info0));
1309 DEBUG(5,("no transport info at switch_value %d\n",
1310 ctr->switch_value));
1316 /*******************************************************************
1317 reads or writes a structure.
1318 ********************************************************************/
1319 BOOL make_srv_q_net_tprt_enum(SRV_Q_NET_TPRT_ENUM *q_n,
1320 const char *srv_name,
1321 uint32 tprt_level, SRV_TPRT_INFO_CTR *ctr,
1322 uint32 preferred_len,
1325 if (q_n == NULL || ctr == NULL || hnd == NULL) return False;
1329 DEBUG(5,("make_q_net_tprt_enum\n"));
1331 make_buf_unistr2(&(q_n->uni_srv_name ), &(q_n->ptr_srv_name ), srv_name );
1333 q_n->tprt_level = tprt_level;
1334 q_n->preferred_len = preferred_len;
1336 memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd));
1341 /*******************************************************************
1342 reads or writes a structure.
1343 ********************************************************************/
1344 BOOL srv_io_q_net_tprt_enum(char *desc, SRV_Q_NET_TPRT_ENUM *q_n, prs_struct *ps, int depth)
1346 if (q_n == NULL) return False;
1348 prs_debug(ps, depth, desc, "srv_io_q_net_tprt_enum");
1353 prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name));
1354 smb_io_unistr2("", &(q_n->uni_srv_name), q_n->ptr_srv_name, ps, depth);
1358 prs_uint32("tprt_level", ps, depth, &(q_n->tprt_level ));
1360 if (((int)q_n->tprt_level) != -1)
1362 srv_io_srv_tprt_ctr("tprt_ctr", q_n->ctr, ps, depth);
1365 prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
1367 smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth);
1372 /*******************************************************************
1373 reads or writes a structure.
1374 ********************************************************************/
1375 BOOL srv_io_r_net_tprt_enum(char *desc, SRV_R_NET_TPRT_ENUM *r_n, prs_struct *ps, int depth)
1377 if (r_n == NULL) return False;
1379 prs_debug(ps, depth, desc, "srv_io_r_net_tprt_enum");
1384 prs_uint32("tprt_level", ps, depth, &(r_n->tprt_level));
1386 if (((int)r_n->tprt_level) != -1)
1388 srv_io_srv_tprt_ctr("tprt_ctr", r_n->ctr, ps, depth);
1391 prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
1392 smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth);
1393 prs_uint32("status ", ps, depth, &(r_n->status));
1398 /*******************************************************************
1399 makes a FILE_INFO_3_STR structure
1400 ********************************************************************/
1401 BOOL make_srv_file_info3_str(FILE_INFO_3_STR *fi3, char *user_name, char *path_name)
1403 if (fi3 == NULL) return False;
1405 DEBUG(5,("make_srv_file_info3_str\n"));
1407 make_unistr2(&(fi3->uni_path_name), path_name, strlen(path_name)+1);
1408 make_unistr2(&(fi3->uni_user_name), user_name, strlen(user_name)+1);
1413 /*******************************************************************
1414 reads or writes a structure.
1415 ********************************************************************/
1416 static BOOL srv_io_file_info3_str(char *desc, FILE_INFO_3_STR *sh1, prs_struct *ps, int depth)
1418 if (sh1 == NULL) return False;
1420 prs_debug(ps, depth, desc, "srv_io_file_info3_str");
1425 smb_io_unistr2("", &(sh1->uni_path_name), True, ps, depth);
1426 smb_io_unistr2("", &(sh1->uni_user_name), True, ps, depth);
1431 /*******************************************************************
1432 makes a FILE_INFO_3 structure
1433 ********************************************************************/
1434 BOOL make_srv_file_info3(FILE_INFO_3 *fl3,
1435 uint32 id, uint32 perms, uint32 num_locks,
1436 char *path_name, char *user_name)
1438 if (fl3 == NULL) return False;
1440 DEBUG(5,("make_srv_file_info3: %s %s\n", path_name, user_name));
1444 fl3->num_locks = num_locks;
1446 fl3->ptr_path_name = path_name != NULL ? 1 : 0;
1447 fl3->ptr_user_name = user_name != NULL ? 1 : 0;
1452 /*******************************************************************
1453 reads or writes a structure.
1454 ********************************************************************/
1455 static BOOL srv_io_file_info3(char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth)
1457 if (fl3 == NULL) return False;
1459 prs_debug(ps, depth, desc, "srv_io_file_info3");
1464 prs_uint32("id ", ps, depth, &(fl3->id ));
1465 prs_uint32("perms ", ps, depth, &(fl3->perms ));
1466 prs_uint32("num_locks ", ps, depth, &(fl3->num_locks ));
1467 prs_uint32("ptr_path_name", ps, depth, &(fl3->ptr_path_name));
1468 prs_uint32("ptr_user_name", ps, depth, &(fl3->ptr_user_name));
1473 /*******************************************************************
1474 reads or writes a structure.
1475 ********************************************************************/
1476 static BOOL srv_io_srv_file_info_3(char *desc, SRV_FILE_INFO_3 *fl3, prs_struct *ps, int depth)
1478 if (fl3 == NULL) return False;
1480 prs_debug(ps, depth, desc, "srv_io_file_3_fl3");
1485 prs_uint32("num_entries_read", ps, depth, &(fl3->num_entries_read));
1486 prs_uint32("ptr_file_fl3", ps, depth, &(fl3->ptr_file_info));
1487 if (fl3->ptr_file_info != 0)
1490 uint32 num_entries = fl3->num_entries_read;
1492 if (num_entries > MAX_FILE_ENTRIES)
1494 num_entries = MAX_FILE_ENTRIES; /* report this! */
1497 prs_uint32("num_entries_read2", ps, depth, &(fl3->num_entries_read2));
1499 for (i = 0; i < num_entries; i++)
1501 srv_io_file_info3("", &(fl3->info_3[i]), ps, depth);
1504 for (i = 0; i < num_entries; i++)
1506 srv_io_file_info3_str("", &(fl3->info_3_str[i]), ps, depth);
1515 /*******************************************************************
1516 reads or writes a structure.
1517 ********************************************************************/
1518 static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth)
1520 if (ctr == NULL) return False;
1522 prs_debug(ps, depth, desc, "srv_io_srv_file_ctr");
1527 prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
1528 prs_uint32("ptr_file_ctr", ps, depth, &(ctr->ptr_file_ctr));
1530 if (ctr->ptr_file_ctr != 0)
1532 switch (ctr->switch_value)
1536 srv_io_srv_file_info_3("", &(ctr->file.info3), ps, depth);
1541 DEBUG(5,("%s no file info at switch_value %d\n",
1542 tab_depth(depth), ctr->switch_value));
1551 /*******************************************************************
1552 reads or writes a structure.
1553 ********************************************************************/
1554 BOOL make_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n,
1555 const char *srv_name, const char *qual_name,
1557 uint32 file_level, SRV_FILE_INFO_CTR *ctr,
1558 uint32 preferred_len,
1561 if (q_n == NULL || ctr == NULL || hnd == NULL) return False;
1565 DEBUG(5,("make_q_net_file_enum\n"));
1567 make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name);
1568 make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name);
1570 q_n->file_id = file_id;
1571 q_n->file_level = file_level;
1572 q_n->preferred_len = preferred_len;
1574 memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd));
1579 /*******************************************************************
1580 reads or writes a structure.
1581 ********************************************************************/
1582 BOOL srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps, int depth)
1584 if (q_n == NULL) return False;
1586 prs_debug(ps, depth, desc, "srv_io_q_net_file_enum");
1591 prs_uint32("ptr_srv_name", ps, depth, &(q_n->ptr_srv_name));
1592 smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth);
1596 prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name));
1597 smb_io_unistr2("", &(q_n->uni_qual_name), q_n->ptr_qual_name, ps, depth);
1601 prs_uint32("file_id ", ps, depth, &(q_n->file_id ));
1602 prs_uint32("file_level", ps, depth, &(q_n->file_level));
1604 if (((int)q_n->file_level) != -1)
1606 srv_io_srv_file_ctr("file_ctr", q_n->ctr, ps, depth);
1609 prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len));
1611 smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth);
1616 /*******************************************************************
1617 reads or writes a structure.
1618 ********************************************************************/
1619 BOOL srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth)
1621 if (r_n == NULL) return False;
1623 prs_debug(ps, depth, desc, "srv_io_r_net_file_enum");
1628 prs_uint32("file_level", ps, depth, &(r_n->file_level));
1630 if (r_n->file_level != 0)
1632 srv_io_srv_file_ctr("file_ctr", r_n->ctr, ps, depth);
1635 prs_uint32("total_entries", ps, depth, &(r_n->total_entries));
1636 smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth);
1637 prs_uint32("status ", ps, depth, &(r_n->status));
1642 /*******************************************************************
1643 makes a SRV_INFO_101 structure.
1644 ********************************************************************/
1645 BOOL make_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, char *name,
1646 uint32 ver_major, uint32 ver_minor,
1647 uint32 srv_type, char *comment)
1649 if (sv101 == NULL) return False;
1651 DEBUG(5,("make_srv_info_101\n"));
1653 sv101->platform_id = platform_id;
1654 make_buf_unistr2(&(sv101->uni_name ), &(sv101->ptr_name ) , name );
1655 sv101->ver_major = ver_major;
1656 sv101->ver_minor = ver_minor;
1657 sv101->srv_type = srv_type;
1658 make_buf_unistr2(&(sv101->uni_comment ), &(sv101->ptr_comment) , comment );
1664 /*******************************************************************
1665 reads or writes a SRV_INFO_101 structure.
1666 ********************************************************************/
1667 static BOOL srv_io_info_101(char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth)
1669 if (sv101 == NULL) return False;
1671 prs_debug(ps, depth, desc, "srv_io_info_101");
1676 prs_uint32("platform_id ", ps, depth, &(sv101->platform_id ));
1677 prs_uint32("ptr_name ", ps, depth, &(sv101->ptr_name ));
1678 prs_uint32("ver_major ", ps, depth, &(sv101->ver_major ));
1679 prs_uint32("ver_minor ", ps, depth, &(sv101->ver_minor ));
1680 prs_uint32("srv_type ", ps, depth, &(sv101->srv_type ));
1681 prs_uint32("ptr_comment ", ps, depth, &(sv101->ptr_comment ));
1685 smb_io_unistr2("uni_name ", &(sv101->uni_name ), True, ps, depth);
1686 smb_io_unistr2("uni_comment ", &(sv101->uni_comment ), True, ps, depth);
1691 /*******************************************************************
1692 makes a SRV_INFO_102 structure.
1693 ********************************************************************/
1694 BOOL make_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, char *name,
1695 char *comment, uint32 ver_major, uint32 ver_minor,
1696 uint32 srv_type, uint32 users, uint32 disc, uint32 hidden,
1697 uint32 announce, uint32 ann_delta, uint32 licenses,
1700 if (sv102 == NULL) return False;
1702 DEBUG(5,("make_srv_info_102\n"));
1704 sv102->platform_id = platform_id;
1705 make_buf_unistr2(&(sv102->uni_name ), &(sv102->ptr_name ), name );
1706 sv102->ver_major = ver_major;
1707 sv102->ver_minor = ver_minor;
1708 sv102->srv_type = srv_type;
1709 make_buf_unistr2(&(sv102->uni_comment ), &(sv102->ptr_comment ), comment );
1711 /* same as 101 up to here */
1713 sv102->users = users;
1715 sv102->hidden = hidden;
1716 sv102->announce = announce;
1717 sv102->ann_delta =ann_delta;
1718 sv102->licenses = licenses;
1719 make_buf_unistr2(&(sv102->uni_usr_path), &(sv102->ptr_usr_path), usr_path);
1725 /*******************************************************************
1726 reads or writes a SRV_INFO_102 structure.
1727 ********************************************************************/
1728 static BOOL srv_io_info_102(char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth)
1730 if (sv102 == NULL) return False;
1732 prs_debug(ps, depth, desc, "srv_io_info102");
1737 prs_uint32("platform_id ", ps, depth, &(sv102->platform_id ));
1738 prs_uint32("ptr_name ", ps, depth, &(sv102->ptr_name ));
1739 prs_uint32("ver_major ", ps, depth, &(sv102->ver_major ));
1740 prs_uint32("ver_minor ", ps, depth, &(sv102->ver_minor ));
1741 prs_uint32("srv_type ", ps, depth, &(sv102->srv_type ));
1742 prs_uint32("ptr_comment ", ps, depth, &(sv102->ptr_comment ));
1744 /* same as 101 up to here */
1746 prs_uint32("users ", ps, depth, &(sv102->users ));
1747 prs_uint32("disc ", ps, depth, &(sv102->disc ));
1748 prs_uint32("hidden ", ps, depth, &(sv102->hidden ));
1749 prs_uint32("announce ", ps, depth, &(sv102->announce ));
1750 prs_uint32("ann_delta ", ps, depth, &(sv102->ann_delta ));
1751 prs_uint32("licenses ", ps, depth, &(sv102->licenses ));
1752 prs_uint32("ptr_usr_path", ps, depth, &(sv102->ptr_usr_path));
1754 smb_io_unistr2("uni_name ", &(sv102->uni_name ), True, ps, depth);
1756 smb_io_unistr2("uni_comment ", &(sv102->uni_comment ), True, ps, depth);
1758 smb_io_unistr2("uni_usr_path", &(sv102->uni_usr_path), True, ps, depth);
1763 /*******************************************************************
1764 reads or writes a SRV_INFO_102 structure.
1765 ********************************************************************/
1766 static BOOL srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth)
1768 if (ctr == NULL) return False;
1770 prs_debug(ps, depth, desc, "srv_io_info_ctr");
1775 prs_uint32("switch_value", ps, depth, &(ctr->switch_value));
1776 prs_uint32("ptr_srv_ctr ", ps, depth, &(ctr->ptr_srv_ctr ));
1778 if (ctr->ptr_srv_ctr != 0 && ctr->switch_value != 0 && ctr != NULL)
1780 switch (ctr->switch_value)
1784 srv_io_info_101("sv101", &(ctr->srv.sv101), ps, depth);
1789 srv_io_info_102("sv102", &(ctr->srv.sv102), ps, depth);
1794 DEBUG(5,("%s no server info at switch_value %d\n",
1795 tab_depth(depth), ctr->switch_value));
1805 /*******************************************************************
1806 makes a SRV_Q_NET_SRV_GET_INFO structure.
1807 ********************************************************************/
1808 BOOL make_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv,
1809 char *server_name, uint32 switch_value)
1811 if (srv == NULL) return False;
1813 DEBUG(5,("make_srv_q_net_srv_get_info\n"));
1815 make_buf_unistr2(&(srv->uni_srv_name), &(srv->ptr_srv_name), server_name);
1817 srv->switch_value = switch_value;
1822 /*******************************************************************
1823 reads or writes a structure.
1824 ********************************************************************/
1825 BOOL srv_io_q_net_srv_get_info(char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth)
1827 if (q_n == NULL) return False;
1829 prs_debug(ps, depth, desc, "srv_io_q_net_srv_get_info");
1834 prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name));
1835 smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth);
1839 prs_uint32("switch_value ", ps, depth, &(q_n->switch_value));
1844 /*******************************************************************
1845 makes a SRV_R_NET_SRV_GET_INFO structure.
1846 ********************************************************************/
1847 BOOL make_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv,
1848 uint32 switch_value, SRV_INFO_CTR *ctr, uint32 status)
1850 if (srv == NULL) return False;
1852 DEBUG(5,("make_srv_r_net_srv_get_info\n"));
1858 srv->ctr->switch_value = switch_value;
1859 srv->ctr->ptr_srv_ctr = 1;
1863 srv->ctr->switch_value = 0;
1864 srv->ctr->ptr_srv_ctr = 0;
1867 srv->status = status;
1872 /*******************************************************************
1873 reads or writes a structure.
1874 ********************************************************************/
1875 BOOL srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth)
1877 if (r_n == NULL) return False;
1879 prs_debug(ps, depth, desc, "srv_io_r_net_srv_get_info");
1884 srv_io_info_ctr("ctr", r_n->ctr, ps, depth);
1886 prs_uint32("status ", ps, depth, &(r_n->status ));
1891 /*******************************************************************
1892 makes a SRV_Q_NET_REMOTE_TOD structure.
1893 ********************************************************************/
1894 BOOL make_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_t, char *server_name)
1896 if (q_t == NULL) return False;
1898 DEBUG(5,("make_srv_q_net_remote_tod\n"));
1900 make_buf_unistr2(&(q_t->uni_srv_name), &(q_t->ptr_srv_name), server_name);
1905 /*******************************************************************
1906 reads or writes a structure.
1907 ********************************************************************/
1908 BOOL srv_io_q_net_remote_tod(char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth)
1910 if (q_n == NULL) return False;
1912 prs_debug(ps, depth, desc, "srv_io_q_net_remote_tod");
1917 prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name));
1918 smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth);
1923 /*******************************************************************
1924 reads or writes a TIME_OF_DAY_INFO structure.
1925 ********************************************************************/
1926 static BOOL srv_io_time_of_day_info(char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth)
1928 if (tod == NULL) return False;
1930 prs_debug(ps, depth, desc, "srv_io_time_of_day_info");
1935 prs_uint32("elapsedt ", ps, depth, &(tod->elapsedt ));
1936 prs_uint32("msecs ", ps, depth, &(tod->msecs ));
1937 prs_uint32("hours ", ps, depth, &(tod->hours ));
1938 prs_uint32("mins ", ps, depth, &(tod->mins ));
1939 prs_uint32("secs ", ps, depth, &(tod->secs ));
1940 prs_uint32("hunds ", ps, depth, &(tod->hunds ));
1941 prs_uint32("timezone ", ps, depth, &(tod->zone ));
1942 prs_uint32("tintervals ", ps, depth, &(tod->tintervals));
1943 prs_uint32("day ", ps, depth, &(tod->day ));
1944 prs_uint32("month ", ps, depth, &(tod->month ));
1945 prs_uint32("year ", ps, depth, &(tod->year ));
1946 prs_uint32("weekday ", ps, depth, &(tod->weekday ));
1952 /*******************************************************************
1953 makes a TIME_OF_DAY_INFO structure.
1954 ********************************************************************/
1955 BOOL make_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs,
1956 uint32 hours, uint32 mins, uint32 secs, uint32 hunds,
1957 uint32 zone, uint32 tintervals, uint32 day,
1958 uint32 month, uint32 year, uint32 weekday)
1960 if (tod == NULL) return False;
1962 DEBUG(5,("make_time_of_day_info\n"));
1964 tod->elapsedt = elapsedt;
1971 tod->tintervals = tintervals;
1975 tod->weekday = weekday;
1981 /*******************************************************************
1982 reads or writes a structure.
1983 ********************************************************************/
1984 BOOL srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth)
1986 if (r_n == NULL) return False;
1988 prs_debug(ps, depth, desc, "srv_io_r_net_remote_tod");
1993 prs_uint32("ptr_srv_tod ", ps, depth, &(r_n->ptr_srv_tod));
1995 srv_io_time_of_day_info("tod", r_n->tod, ps, depth);
1997 prs_uint32("status ", ps, depth, &(r_n->status));