3 * Unix SMB/Netbios implementation.
5 * RPC Pipe client / server routines
6 * Copyright (C) Andrew Tridgell 1992-1997,
7 * Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
8 * Copyright (C) Paul Ashton 1997.
9 * Copyright (C) Jeremy Allison 1999.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 extern int DEBUGLEVEL
;
31 /*******************************************************************
32 Inits a SH_INFO_1_STR structure
33 ********************************************************************/
35 void init_srv_share_info1_str(SH_INFO_1_STR
*sh1
, char *net_name
, char *remark
)
37 DEBUG(5,("init_srv_share_info1_str\n"));
39 init_unistr2(&sh1
->uni_netname
, net_name
, strlen(net_name
)+1);
40 init_unistr2(&sh1
->uni_remark
, remark
, strlen(remark
)+1);
43 /*******************************************************************
44 Reads or writes a structure.
45 ********************************************************************/
47 static BOOL
srv_io_share_info1_str(char *desc
, SH_INFO_1_STR
*sh1
, prs_struct
*ps
, int depth
)
52 prs_debug(ps
, depth
, desc
, "srv_io_share_info1_str");
58 if(!smb_io_unistr2("", &sh1
->uni_netname
, True
, ps
, depth
))
60 if(!smb_io_unistr2("", &sh1
->uni_remark
, True
, ps
, depth
))
66 /*******************************************************************
67 makes a SH_INFO_1 structure
68 ********************************************************************/
70 void init_srv_share_info1(SH_INFO_1
*sh1
, char *net_name
, uint32 type
, char *remark
)
72 DEBUG(5,("init_srv_share_info1: %s %8x %s\n", net_name
, type
, remark
));
74 sh1
->ptr_netname
= (net_name
!= NULL
) ? 1 : 0;
76 sh1
->ptr_remark
= (remark
!= NULL
) ? 1 : 0;
79 /*******************************************************************
80 Reads or writes a structure.
81 ********************************************************************/
83 static BOOL
srv_io_share_info1(char *desc
, SH_INFO_1
*sh1
, prs_struct
*ps
, int depth
)
88 prs_debug(ps
, depth
, desc
, "srv_io_share_info1");
94 if(!prs_uint32("ptr_netname", ps
, depth
, &sh1
->ptr_netname
))
96 if(!prs_uint32("type ", ps
, depth
, &sh1
->type
))
98 if(!prs_uint32("ptr_remark ", ps
, depth
, &sh1
->ptr_remark
))
104 /*******************************************************************
105 Inits a SH_INFO_2_STR structure
106 ********************************************************************/
108 void init_srv_share_info2_str(SH_INFO_2_STR
*sh2
,
109 char *net_name
, char *remark
,
110 char *path
, char *passwd
)
112 DEBUG(5,("init_srv_share_info2_str\n"));
114 init_unistr2(&sh2
->uni_netname
, net_name
, strlen(net_name
)+1);
115 init_unistr2(&sh2
->uni_remark
, remark
, strlen(remark
)+1);
116 init_unistr2(&sh2
->uni_path
, path
, strlen(path
)+1);
117 init_unistr2(&sh2
->uni_passwd
, passwd
, strlen(passwd
)+1);
120 /*******************************************************************
121 Reads or writes a structure.
122 ********************************************************************/
124 static BOOL
srv_io_share_info2_str(char *desc
, SH_INFO_2_STR
*sh2
, prs_struct
*ps
, int depth
)
129 prs_debug(ps
, depth
, desc
, "srv_io_share_info2_str");
135 if(!smb_io_unistr2("", &sh2
->uni_netname
, True
, ps
, depth
))
137 if(!smb_io_unistr2("", &sh2
->uni_remark
, True
, ps
, depth
))
139 if(!smb_io_unistr2("", &sh2
->uni_path
, True
, ps
, depth
))
141 if(!smb_io_unistr2("", &sh2
->uni_passwd
, True
, ps
, depth
))
147 /*******************************************************************
148 Inits a SH_INFO_2 structure
149 ********************************************************************/
151 void init_srv_share_info2(SH_INFO_2
*sh2
,
152 char *net_name
, uint32 type
, char *remark
,
153 uint32 perms
, uint32 max_uses
, uint32 num_uses
,
154 char *path
, char *passwd
)
156 DEBUG(5,("init_srv_share_info2: %s %8x %s\n", net_name
, type
, remark
));
158 sh2
->ptr_netname
= (net_name
!= NULL
) ? 1 : 0;
160 sh2
->ptr_remark
= (remark
!= NULL
) ? 1 : 0;
162 sh2
->max_uses
= max_uses
;
163 sh2
->num_uses
= num_uses
;
165 sh2
->ptr_path
= (path
!= NULL
) ? 1 : 0;
166 sh2
->ptr_passwd
= (passwd
!= NULL
) ? 1 : 0;
169 /*******************************************************************
170 Reads or writes a structure.
171 ********************************************************************/
173 static BOOL
srv_io_share_info2(char *desc
, SH_INFO_2
*sh2
, prs_struct
*ps
, int depth
)
178 prs_debug(ps
, depth
, desc
, "srv_io_share_info2");
184 if(!prs_uint32("ptr_netname", ps
, depth
, &sh2
->ptr_netname
))
186 if(!prs_uint32("type ", ps
, depth
, &sh2
->type
))
188 if(!prs_uint32("ptr_remark ", ps
, depth
, &sh2
->ptr_remark
))
190 if(!prs_uint32("perms ", ps
, depth
, &sh2
->perms
))
192 if(!prs_uint32("max_uses ", ps
, depth
, &sh2
->max_uses
))
194 if(!prs_uint32("num_uses ", ps
, depth
, &sh2
->num_uses
))
196 if(!prs_uint32("ptr_path ", ps
, depth
, &sh2
->ptr_path
))
198 if(!prs_uint32("ptr_passwd ", ps
, depth
, &sh2
->ptr_passwd
))
204 /*******************************************************************
205 Reads or writes a structure.
206 ********************************************************************/
208 static BOOL
srv_io_srv_share_ctr(char *desc
, SRV_SHARE_INFO_CTR
*ctr
, prs_struct
*ps
, int depth
)
213 prs_debug(ps
, depth
, desc
, "srv_io_srv_share_ctr");
216 if (UNMARSHALLING(ps
)) {
217 memset(ctr
, '\0', sizeof(SRV_SHARE_INFO_CTR
));
223 if(!prs_uint32("info_level", ps
, depth
, &ctr
->info_level
))
226 if (ctr
->info_level
== 0)
229 if(!prs_uint32("switch_value", ps
, depth
, &ctr
->switch_value
))
231 if(!prs_uint32("ptr_share_info", ps
, depth
, &ctr
->ptr_share_info
))
234 if (ctr
->ptr_share_info
== 0)
237 if(!prs_uint32("num_entries", ps
, depth
, &ctr
->num_entries
))
239 if(!prs_uint32("ptr_entries", ps
, depth
, &ctr
->ptr_entries
))
242 if (ctr
->ptr_entries
== 0) {
243 if (ctr
->num_entries
== 0)
249 if(!prs_uint32("num_entries2", ps
, depth
, &ctr
->num_entries2
))
252 if (ctr
->num_entries2
!= ctr
->num_entries
)
255 switch (ctr
->switch_value
) {
258 SRV_SHARE_INFO_1
*info1
= ctr
->share
.info1
;
259 int num_entries
= ctr
->num_entries
;
262 if (UNMARSHALLING(ps
)) {
263 if (!(info1
= malloc(num_entries
* sizeof(SRV_SHARE_INFO_1
))))
265 memset(info1
, '\0', num_entries
* sizeof(SRV_SHARE_INFO_1
));
266 ctr
->share
.info1
= info1
;
269 for (i
= 0; i
< num_entries
; i
++) {
270 if(!srv_io_share_info1("", &info1
[i
].info_1
, ps
, depth
))
274 for (i
= 0; i
< num_entries
; i
++) {
275 if(!srv_io_share_info1_str("", &info1
[i
].info_1_str
, ps
, depth
))
284 SRV_SHARE_INFO_2
*info2
= ctr
->share
.info2
;
285 int num_entries
= ctr
->num_entries
;
288 if (UNMARSHALLING(ps
)) {
289 if (!(info2
= malloc(num_entries
* sizeof(SRV_SHARE_INFO_2
))))
291 memset(info2
, '\0', num_entries
* sizeof(SRV_SHARE_INFO_2
));
292 ctr
->share
.info2
= info2
;
295 for (i
= 0; i
< num_entries
; i
++) {
296 if(!srv_io_share_info2("", &info2
[i
].info_2
, ps
, depth
))
300 for (i
= 0; i
< num_entries
; i
++) {
301 if(!srv_io_share_info2_str("", &info2
[i
].info_2_str
, ps
, depth
))
309 DEBUG(5,("%s no share info at switch_value %d\n",
310 tab_depth(depth
), ctr
->switch_value
));
317 /*******************************************************************
318 Frees a SRV_SHARE_INFO_CTR structure.
319 ********************************************************************/
321 void free_srv_share_info_ctr(SRV_SHARE_INFO_CTR
*ctr
)
326 free(ctr
->share
.info
);
327 memset(ctr
, '\0', sizeof(SRV_SHARE_INFO_CTR
));
330 /*******************************************************************
331 Frees a SRV_Q_NET_SHARE_ENUM structure.
332 ********************************************************************/
334 void free_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM
*q_n
)
338 free_srv_share_info_ctr(&q_n
->ctr
);
339 memset(q_n
, '\0', sizeof(SRV_Q_NET_SHARE_ENUM
));
342 /*******************************************************************
343 Frees a SRV_R_NET_SHARE_ENUM structure.
344 ********************************************************************/
346 void free_srv_r_net_share_enum(SRV_R_NET_SHARE_ENUM
*r_n
)
350 free_srv_share_info_ctr(&r_n
->ctr
);
351 memset(r_n
, '\0', sizeof(SRV_R_NET_SHARE_ENUM
));
354 /*******************************************************************
355 Inits a SRV_Q_NET_SHARE_ENUM structure.
356 ********************************************************************/
358 void init_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM
*q_n
,
359 char *srv_name
, uint32 info_level
,
360 uint32 preferred_len
, ENUM_HND
*hnd
)
363 DEBUG(5,("init_q_net_share_enum\n"));
365 init_buf_unistr2(&q_n
->uni_srv_name
, &q_n
->ptr_srv_name
, srv_name
);
367 q_n
->ctr
.info_level
= q_n
->ctr
.switch_value
= info_level
;
368 q_n
->ctr
.ptr_share_info
= 0;
369 q_n
->preferred_len
= preferred_len
;
371 memcpy(&q_n
->enum_hnd
, hnd
, sizeof(*hnd
));
374 /*******************************************************************
375 Reads or writes a structure.
376 ********************************************************************/
378 BOOL
srv_io_q_net_share_enum(char *desc
, SRV_Q_NET_SHARE_ENUM
*q_n
, prs_struct
*ps
, int depth
)
383 prs_debug(ps
, depth
, desc
, "srv_io_q_net_share_enum");
389 if(!prs_uint32("ptr_srv_name", ps
, depth
, &q_n
->ptr_srv_name
))
391 if(!smb_io_unistr2("", &q_n
->uni_srv_name
, True
, ps
, depth
))
394 if(!srv_io_srv_share_ctr("share_ctr", &q_n
->ctr
, ps
, depth
))
400 if(!prs_uint32("preferred_len", ps
, depth
, &q_n
->preferred_len
))
403 if(!smb_io_enum_hnd("enum_hnd", &q_n
->enum_hnd
, ps
, depth
))
409 /*******************************************************************
410 Reads or writes a structure.
411 ********************************************************************/
413 BOOL
srv_io_r_net_share_enum(char *desc
, SRV_R_NET_SHARE_ENUM
*r_n
, prs_struct
*ps
, int depth
)
418 prs_debug(ps
, depth
, desc
, "srv_io_r_net_share_enum");
421 if(!srv_io_srv_share_ctr("share_ctr", &r_n
->ctr
, ps
, depth
))
427 if(!prs_uint32("total_entries", ps
, depth
, &r_n
->total_entries
))
429 if(!smb_io_enum_hnd("enum_hnd", &r_n
->enum_hnd
, ps
, depth
))
431 if(!prs_uint32("status ", ps
, depth
, &r_n
->status
))
437 /*******************************************************************
438 Frees a SRV_Q_NET_SHARE_GET_INFO structure.
439 ********************************************************************/
441 void free_srv_q_net_share_get_info(SRV_Q_NET_SHARE_GET_INFO
*q_n
)
445 memset(q_n
, '\0', sizeof(SRV_Q_NET_SHARE_GET_INFO
));
448 /*******************************************************************
449 Frees a SRV_R_NET_SHARE_GET_INFO structure.
450 ********************************************************************/
452 void free_srv_r_net_share_get_info(SRV_R_NET_SHARE_GET_INFO
*r_n
)
456 memset(r_n
, '\0', sizeof(SRV_R_NET_SHARE_GET_INFO
));
459 /*******************************************************************
460 Reads or writes a structure.
461 ********************************************************************/
463 BOOL
srv_io_q_net_share_get_info(char *desc
, SRV_Q_NET_SHARE_GET_INFO
*q_n
, prs_struct
*ps
, int depth
)
468 prs_debug(ps
, depth
, desc
, "srv_io_q_net_share_get_info");
474 if(!prs_uint32("ptr_srv_name", ps
, depth
, &q_n
->ptr_srv_name
))
476 if(!smb_io_unistr2("", &q_n
->uni_srv_name
, True
, ps
, depth
))
479 if(!smb_io_unistr2("", &q_n
->uni_share_name
, True
, ps
, depth
))
485 if(!prs_uint32("info_level", ps
, depth
, &q_n
->info_level
))
491 /*******************************************************************
492 Reads or writes a structure.
493 ********************************************************************/
495 BOOL
srv_io_r_net_share_get_info(char *desc
, SRV_R_NET_SHARE_GET_INFO
*r_n
, prs_struct
*ps
, int depth
)
500 prs_debug(ps
, depth
, desc
, "srv_io_r_net_share_get_info");
506 if(!prs_uint32("switch_value ", ps
, depth
, &r_n
->switch_value
))
509 if(!prs_uint32("ptr_share_ctr", ps
, depth
, &r_n
->ptr_share_ctr
))
512 if (r_n
->ptr_share_ctr
!= 0) {
513 switch (r_n
->switch_value
) {
515 if(!srv_io_share_info1("", &r_n
->share
.info1
.info_1
, ps
, depth
))
518 if(!srv_io_share_info1_str("", &r_n
->share
.info1
.info_1_str
, ps
, depth
))
523 if(!srv_io_share_info2("", &r_n
->share
.info2
.info_2
, ps
, depth
))
526 if(!srv_io_share_info2_str("", &r_n
->share
.info2
.info_2_str
, ps
, depth
))
531 DEBUG(5,("%s no share info at switch_value %d\n",
532 tab_depth(depth
), r_n
->switch_value
));
540 if(!prs_uint32("status", ps
, depth
, &r_n
->status
))
546 /*******************************************************************
547 Inits a SESS_INFO_0_STR structure
548 ********************************************************************/
550 void init_srv_sess_info0_str(SESS_INFO_0_STR
*ss0
, char *name
)
552 DEBUG(5,("init_srv_sess_info0_str\n"));
554 init_unistr2(&ss0
->uni_name
, name
, strlen(name
)+1);
557 /*******************************************************************
558 Reads or writes a structure.
559 ********************************************************************/
561 static BOOL
srv_io_sess_info0_str(char *desc
, SESS_INFO_0_STR
*ss0
, prs_struct
*ps
, int depth
)
566 prs_debug(ps
, depth
, desc
, "srv_io_sess_info0_str");
572 if(!smb_io_unistr2("", &ss0
->uni_name
, True
, ps
, depth
))
578 /*******************************************************************
579 Inits a SESS_INFO_0 structure
580 ********************************************************************/
582 void init_srv_sess_info0(SESS_INFO_0
*ss0
, char *name
)
584 DEBUG(5,("init_srv_sess_info0: %s\n", name
));
586 ss0
->ptr_name
= (name
!= NULL
) ? 1 : 0;
589 /*******************************************************************
590 Reads or writes a structure.
591 ********************************************************************/
593 static BOOL
srv_io_sess_info0(char *desc
, SESS_INFO_0
*ss0
, prs_struct
*ps
, int depth
)
598 prs_debug(ps
, depth
, desc
, "srv_io_sess_info0");
604 if(!prs_uint32("ptr_name", ps
, depth
, &ss0
->ptr_name
))
610 /*******************************************************************
611 Reads or writes a structure.
612 ********************************************************************/
614 static BOOL
srv_io_srv_sess_info_0(char *desc
, SRV_SESS_INFO_0
*ss0
, prs_struct
*ps
, int depth
)
619 prs_debug(ps
, depth
, desc
, "srv_io_srv_sess_info_0");
625 if(!prs_uint32("num_entries_read", ps
, depth
, &ss0
->num_entries_read
))
627 if(!prs_uint32("ptr_sess_info", ps
, depth
, &ss0
->ptr_sess_info
))
630 if (ss0
->ptr_sess_info
!= 0) {
632 int num_entries
= ss0
->num_entries_read
;
634 if (num_entries
> MAX_SESS_ENTRIES
) {
635 num_entries
= MAX_SESS_ENTRIES
; /* report this! */
638 if(!prs_uint32("num_entries_read2", ps
, depth
, &ss0
->num_entries_read2
))
641 SMB_ASSERT_ARRAY(ss0
->info_0
, num_entries
);
643 for (i
= 0; i
< num_entries
; i
++) {
644 if(!srv_io_sess_info0("", &ss0
->info_0
[i
], ps
, depth
))
648 for (i
= 0; i
< num_entries
; i
++) {
649 if(!srv_io_sess_info0_str("", &ss0
->info_0_str
[i
], ps
, depth
))
660 /*******************************************************************
661 Inits a SESS_INFO_1_STR structure
662 ********************************************************************/
664 void init_srv_sess_info1_str(SESS_INFO_1_STR
*ss1
, char *name
, char *user
)
666 DEBUG(5,("init_srv_sess_info1_str\n"));
668 init_unistr2(&ss1
->uni_name
, name
, strlen(name
)+1);
669 init_unistr2(&ss1
->uni_user
, name
, strlen(user
)+1);
672 /*******************************************************************
673 Reads or writes a structure.
674 ********************************************************************/
676 static BOOL
srv_io_sess_info1_str(char *desc
, SESS_INFO_1_STR
*ss1
, prs_struct
*ps
, int depth
)
681 prs_debug(ps
, depth
, desc
, "srv_io_sess_info1_str");
687 if(!smb_io_unistr2("", &ss1
->uni_name
, True
, ps
, depth
))
689 if(!smb_io_unistr2("", &(ss1
->uni_user
), True
, ps
, depth
))
695 /*******************************************************************
696 Inits a SESS_INFO_1 structure
697 ********************************************************************/
699 void init_srv_sess_info1(SESS_INFO_1
*ss1
,
700 char *name
, char *user
,
701 uint32 num_opens
, uint32 open_time
, uint32 idle_time
,
704 DEBUG(5,("init_srv_sess_info1: %s\n", name
));
706 ss1
->ptr_name
= (name
!= NULL
) ? 1 : 0;
707 ss1
->ptr_user
= (user
!= NULL
) ? 1 : 0;
709 ss1
->num_opens
= num_opens
;
710 ss1
->open_time
= open_time
;
711 ss1
->idle_time
= idle_time
;
712 ss1
->user_flags
= user_flags
;
715 /*******************************************************************
716 reads or writes a structure.
717 ********************************************************************/
719 static BOOL
srv_io_sess_info1(char *desc
, SESS_INFO_1
*ss1
, prs_struct
*ps
, int depth
)
724 prs_debug(ps
, depth
, desc
, "srv_io_sess_info1");
730 if(!prs_uint32("ptr_name ", ps
, depth
, &ss1
->ptr_name
))
732 if(!prs_uint32("ptr_user ", ps
, depth
, &ss1
->ptr_user
))
735 if(!prs_uint32("num_opens ", ps
, depth
, &ss1
->num_opens
))
737 if(!prs_uint32("open_time ", ps
, depth
, &ss1
->open_time
))
739 if(!prs_uint32("idle_time ", ps
, depth
, &ss1
->idle_time
))
741 if(!prs_uint32("user_flags", ps
, depth
, &ss1
->user_flags
))
747 /*******************************************************************
748 Reads or writes a structure.
749 ********************************************************************/
751 static BOOL
srv_io_srv_sess_info_1(char *desc
, SRV_SESS_INFO_1
*ss1
, prs_struct
*ps
, int depth
)
756 prs_debug(ps
, depth
, desc
, "srv_io_srv_sess_info_1");
762 if(!prs_uint32("num_entries_read", ps
, depth
, &ss1
->num_entries_read
))
764 if(!prs_uint32("ptr_sess_info", ps
, depth
, &ss1
->ptr_sess_info
))
767 if (ss1
->ptr_sess_info
!= 0) {
769 int num_entries
= ss1
->num_entries_read
;
771 if (num_entries
> MAX_SESS_ENTRIES
) {
772 num_entries
= MAX_SESS_ENTRIES
; /* report this! */
775 if(!prs_uint32("num_entries_read2", ps
, depth
, &ss1
->num_entries_read2
))
778 SMB_ASSERT_ARRAY(ss1
->info_1
, num_entries
);
780 for (i
= 0; i
< num_entries
; i
++) {
781 if(!srv_io_sess_info1("", &ss1
->info_1
[i
], ps
, depth
))
785 for (i
= 0; i
< num_entries
; i
++) {
786 if(!srv_io_sess_info1_str("", &ss1
->info_1_str
[i
], ps
, depth
))
797 /*******************************************************************
798 Reads or writes a structure.
799 ********************************************************************/
801 static BOOL
srv_io_srv_sess_ctr(char *desc
, SRV_SESS_INFO_CTR
*ctr
, prs_struct
*ps
, int depth
)
806 prs_debug(ps
, depth
, desc
, "srv_io_srv_sess_ctr");
812 if(!prs_uint32("switch_value", ps
, depth
, &ctr
->switch_value
))
814 if(!prs_uint32("ptr_sess_ctr", ps
, depth
, &ctr
->ptr_sess_ctr
))
817 if (ctr
->ptr_sess_ctr
!= 0) {
818 switch (ctr
->switch_value
) {
820 if(!srv_io_srv_sess_info_0("", &ctr
->sess
.info0
, ps
, depth
))
824 if(!srv_io_srv_sess_info_1("", &ctr
->sess
.info1
, ps
, depth
))
828 DEBUG(5,("%s no session info at switch_value %d\n",
829 tab_depth(depth
), ctr
->switch_value
));
837 /*******************************************************************
838 Inits a SRV_Q_NET_SESS_ENUM structure.
839 ********************************************************************/
841 void init_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM
*q_n
,
842 char *srv_name
, char *qual_name
,
843 uint32 sess_level
, SRV_SESS_INFO_CTR
*ctr
,
844 uint32 preferred_len
,
849 DEBUG(5,("init_q_net_sess_enum\n"));
851 init_buf_unistr2(&q_n
->uni_srv_name
, &q_n
->ptr_srv_name
, srv_name
);
852 init_buf_unistr2(&q_n
->uni_qual_name
, &q_n
->ptr_qual_name
, qual_name
);
854 q_n
->sess_level
= sess_level
;
855 q_n
->preferred_len
= preferred_len
;
857 memcpy(&q_n
->enum_hnd
, hnd
, sizeof(*hnd
));
860 /*******************************************************************
861 Reads or writes a structure.
862 ********************************************************************/
864 BOOL
srv_io_q_net_sess_enum(char *desc
, SRV_Q_NET_SESS_ENUM
*q_n
, prs_struct
*ps
, int depth
)
869 prs_debug(ps
, depth
, desc
, "srv_io_q_net_sess_enum");
875 if(!prs_uint32("ptr_srv_name", ps
, depth
, &q_n
->ptr_srv_name
))
877 if(!smb_io_unistr2("", &q_n
->uni_srv_name
, True
, ps
, depth
))
883 if(!prs_uint32("ptr_qual_name", ps
, depth
, &q_n
->ptr_qual_name
))
885 if(!smb_io_unistr2("", &q_n
->uni_qual_name
, q_n
->ptr_qual_name
, ps
, depth
))
891 if(!prs_uint32("sess_level", ps
, depth
, &q_n
->sess_level
))
894 if (q_n
->sess_level
!= -1) {
895 if(!srv_io_srv_sess_ctr("sess_ctr", q_n
->ctr
, ps
, depth
))
899 if(!prs_uint32("preferred_len", ps
, depth
, &q_n
->preferred_len
))
902 if(!smb_io_enum_hnd("enum_hnd", &q_n
->enum_hnd
, ps
, depth
))
908 /*******************************************************************
909 Reads or writes a structure.
910 ********************************************************************/
912 BOOL
srv_io_r_net_sess_enum(char *desc
, SRV_R_NET_SESS_ENUM
*r_n
, prs_struct
*ps
, int depth
)
917 prs_debug(ps
, depth
, desc
, "srv_io_r_net_sess_enum");
923 if(!prs_uint32("sess_level", ps
, depth
, &r_n
->sess_level
))
926 if (r_n
->sess_level
!= -1) {
927 if(!srv_io_srv_sess_ctr("sess_ctr", r_n
->ctr
, ps
, depth
))
931 if(!prs_uint32("total_entries", ps
, depth
, &r_n
->total_entries
))
933 if(!smb_io_enum_hnd("enum_hnd", &r_n
->enum_hnd
, ps
, depth
))
935 if(!prs_uint32("status ", ps
, depth
, &r_n
->status
))
941 /*******************************************************************
942 Inits a CONN_INFO_0 structure
943 ********************************************************************/
945 void init_srv_conn_info0(CONN_INFO_0
*ss0
, uint32 id
)
947 DEBUG(5,("init_srv_conn_info0\n"));
952 /*******************************************************************
953 Reads or writes a structure.
954 ********************************************************************/
956 static BOOL
srv_io_conn_info0(char *desc
, CONN_INFO_0
*ss0
, prs_struct
*ps
, int depth
)
961 prs_debug(ps
, depth
, desc
, "srv_io_conn_info0");
967 if(!prs_uint32("id", ps
, depth
, &ss0
->id
))
973 /*******************************************************************
974 Reads or writes a structure.
975 ********************************************************************/
977 static BOOL
srv_io_srv_conn_info_0(char *desc
, SRV_CONN_INFO_0
*ss0
, prs_struct
*ps
, int depth
)
982 prs_debug(ps
, depth
, desc
, "srv_io_srv_conn_info_0");
988 if(!prs_uint32("num_entries_read", ps
, depth
, &ss0
->num_entries_read
))
990 if(!prs_uint32("ptr_conn_info", ps
, depth
, &ss0
->ptr_conn_info
))
993 if (ss0
->ptr_conn_info
!= 0) {
995 int num_entries
= ss0
->num_entries_read
;
997 if (num_entries
> MAX_CONN_ENTRIES
) {
998 num_entries
= MAX_CONN_ENTRIES
; /* report this! */
1001 if(!prs_uint32("num_entries_read2", ps
, depth
, &ss0
->num_entries_read2
))
1004 for (i
= 0; i
< num_entries
; i
++) {
1005 if(!srv_io_conn_info0("", &ss0
->info_0
[i
], ps
, depth
))
1016 /*******************************************************************
1017 Inits a CONN_INFO_1_STR structure
1018 ********************************************************************/
1020 void init_srv_conn_info1_str(CONN_INFO_1_STR
*ss1
, char *usr_name
, char *net_name
)
1022 DEBUG(5,("init_srv_conn_info1_str\n"));
1024 init_unistr2(&ss1
->uni_usr_name
, usr_name
, strlen(usr_name
)+1);
1025 init_unistr2(&ss1
->uni_net_name
, net_name
, strlen(net_name
)+1);
1028 /*******************************************************************
1029 Reads or writes a structure.
1030 ********************************************************************/
1032 static BOOL
srv_io_conn_info1_str(char *desc
, CONN_INFO_1_STR
*ss1
, prs_struct
*ps
, int depth
)
1037 prs_debug(ps
, depth
, desc
, "srv_io_conn_info1_str");
1043 if(!smb_io_unistr2("", &ss1
->uni_usr_name
, True
, ps
, depth
))
1045 if(!smb_io_unistr2("", &ss1
->uni_net_name
, True
, ps
, depth
))
1051 /*******************************************************************
1052 Inits a CONN_INFO_1 structure
1053 ********************************************************************/
1055 void init_srv_conn_info1(CONN_INFO_1
*ss1
,
1056 uint32 id
, uint32 type
,
1057 uint32 num_opens
, uint32 num_users
, uint32 open_time
,
1058 char *usr_name
, char *net_name
)
1060 DEBUG(5,("init_srv_conn_info1: %s %s\n", usr_name
, net_name
));
1064 ss1
->num_opens
= num_opens
;
1065 ss1
->num_users
= num_users
;
1066 ss1
->open_time
= open_time
;
1068 ss1
->ptr_usr_name
= (usr_name
!= NULL
) ? 1 : 0;
1069 ss1
->ptr_net_name
= (net_name
!= NULL
) ? 1 : 0;
1072 /*******************************************************************
1073 Reads or writes a structure.
1074 ********************************************************************/
1076 static BOOL
srv_io_conn_info1(char *desc
, CONN_INFO_1
*ss1
, prs_struct
*ps
, int depth
)
1081 prs_debug(ps
, depth
, desc
, "srv_io_conn_info1");
1087 if(!prs_uint32("id ", ps
, depth
, &ss1
->id
))
1089 if(!prs_uint32("type ", ps
, depth
, &ss1
->type
))
1091 if(!prs_uint32("num_opens ", ps
, depth
, &ss1
->num_opens
))
1093 if(!prs_uint32("num_users ", ps
, depth
, &ss1
->num_users
))
1095 if(!prs_uint32("open_time ", ps
, depth
, &ss1
->open_time
))
1098 if(!prs_uint32("ptr_usr_name", ps
, depth
, &ss1
->ptr_usr_name
))
1100 if(!prs_uint32("ptr_net_name", ps
, depth
, &ss1
->ptr_net_name
))
1106 /*******************************************************************
1107 Reads or writes a structure.
1108 ********************************************************************/
1110 static BOOL
srv_io_srv_conn_info_1(char *desc
, SRV_CONN_INFO_1
*ss1
, prs_struct
*ps
, int depth
)
1115 prs_debug(ps
, depth
, desc
, "srv_io_srv_conn_info_1");
1121 if(!prs_uint32("num_entries_read", ps
, depth
, &ss1
->num_entries_read
))
1123 if(!prs_uint32("ptr_conn_info", ps
, depth
, &ss1
->ptr_conn_info
))
1126 if (ss1
->ptr_conn_info
!= 0) {
1128 int num_entries
= ss1
->num_entries_read
;
1130 if (num_entries
> MAX_CONN_ENTRIES
) {
1131 num_entries
= MAX_CONN_ENTRIES
; /* report this! */
1134 if(!prs_uint32("num_entries_read2", ps
, depth
, &ss1
->num_entries_read2
))
1137 for (i
= 0; i
< num_entries
; i
++) {
1138 if(!srv_io_conn_info1("", &ss1
->info_1
[i
], ps
, depth
))
1142 for (i
= 0; i
< num_entries
; i
++) {
1143 if(!srv_io_conn_info1_str("", &ss1
->info_1_str
[i
], ps
, depth
))
1154 /*******************************************************************
1155 Reads or writes a structure.
1156 ********************************************************************/
1158 static BOOL
srv_io_srv_conn_ctr(char *desc
, SRV_CONN_INFO_CTR
*ctr
, prs_struct
*ps
, int depth
)
1163 prs_debug(ps
, depth
, desc
, "srv_io_srv_conn_ctr");
1169 if(!prs_uint32("switch_value", ps
, depth
, &ctr
->switch_value
))
1171 if(!prs_uint32("ptr_conn_ctr", ps
, depth
, &ctr
->ptr_conn_ctr
))
1174 if (ctr
->ptr_conn_ctr
!= 0) {
1175 switch (ctr
->switch_value
) {
1177 if(!srv_io_srv_conn_info_0("", &ctr
->conn
.info0
, ps
, depth
))
1181 if(!srv_io_srv_conn_info_1("", &ctr
->conn
.info1
, ps
, depth
))
1185 DEBUG(5,("%s no connection info at switch_value %d\n",
1186 tab_depth(depth
), ctr
->switch_value
));
1194 /*******************************************************************
1195 Reads or writes a structure.
1196 ********************************************************************/
1198 void init_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM
*q_n
,
1199 char *srv_name
, char *qual_name
,
1200 uint32 conn_level
, SRV_CONN_INFO_CTR
*ctr
,
1201 uint32 preferred_len
,
1204 DEBUG(5,("init_q_net_conn_enum\n"));
1208 init_buf_unistr2(&q_n
->uni_srv_name
, &q_n
->ptr_srv_name
, srv_name
);
1209 init_buf_unistr2(&q_n
->uni_qual_name
, &q_n
->ptr_qual_name
, qual_name
);
1211 q_n
->conn_level
= conn_level
;
1212 q_n
->preferred_len
= preferred_len
;
1214 memcpy(&q_n
->enum_hnd
, hnd
, sizeof(*hnd
));
1217 /*******************************************************************
1218 Reads or writes a structure.
1219 ********************************************************************/
1221 BOOL
srv_io_q_net_conn_enum(char *desc
, SRV_Q_NET_CONN_ENUM
*q_n
, prs_struct
*ps
, int depth
)
1226 prs_debug(ps
, depth
, desc
, "srv_io_q_net_conn_enum");
1232 if(!prs_uint32("ptr_srv_name ", ps
, depth
, &q_n
->ptr_srv_name
))
1234 if(!smb_io_unistr2("", &q_n
->uni_srv_name
, q_n
->ptr_srv_name
, ps
, depth
))
1240 if(!prs_uint32("ptr_qual_name", ps
, depth
, &q_n
->ptr_qual_name
))
1242 if(!smb_io_unistr2("", &q_n
->uni_qual_name
, q_n
->ptr_qual_name
, ps
, depth
))
1248 if(!prs_uint32("conn_level", ps
, depth
, &q_n
->conn_level
))
1251 if (q_n
->conn_level
!= -1) {
1252 if(!srv_io_srv_conn_ctr("conn_ctr", q_n
->ctr
, ps
, depth
))
1256 if(!prs_uint32("preferred_len", ps
, depth
, &q_n
->preferred_len
))
1259 if(!smb_io_enum_hnd("enum_hnd", &q_n
->enum_hnd
, ps
, depth
))
1265 /*******************************************************************
1266 Reads or writes a structure.
1267 ********************************************************************/
1269 BOOL
srv_io_r_net_conn_enum(char *desc
, SRV_R_NET_CONN_ENUM
*r_n
, prs_struct
*ps
, int depth
)
1274 prs_debug(ps
, depth
, desc
, "srv_io_r_net_conn_enum");
1280 if(!prs_uint32("conn_level", ps
, depth
, &r_n
->conn_level
))
1283 if (r_n
->conn_level
!= -1) {
1284 if(!srv_io_srv_conn_ctr("conn_ctr", r_n
->ctr
, ps
, depth
))
1288 if(!prs_uint32("total_entries", ps
, depth
, &r_n
->total_entries
))
1290 if(!smb_io_enum_hnd("enum_hnd", &r_n
->enum_hnd
, ps
, depth
))
1292 if(!prs_uint32("status ", ps
, depth
, &r_n
->status
))
1298 /*******************************************************************
1299 Inits a FILE_INFO_3_STR structure
1300 ********************************************************************/
1302 void init_srv_file_info3_str(FILE_INFO_3_STR
*fi3
, char *user_name
, char *path_name
)
1304 DEBUG(5,("init_srv_file_info3_str\n"));
1306 init_unistr2(&fi3
->uni_path_name
, path_name
, strlen(path_name
)+1);
1307 init_unistr2(&fi3
->uni_user_name
, user_name
, strlen(user_name
)+1);
1310 /*******************************************************************
1311 Reads or writes a structure.
1312 ********************************************************************/
1314 static BOOL
srv_io_file_info3_str(char *desc
, FILE_INFO_3_STR
*sh1
, prs_struct
*ps
, int depth
)
1319 prs_debug(ps
, depth
, desc
, "srv_io_file_info3_str");
1325 if(!smb_io_unistr2("", &sh1
->uni_path_name
, True
, ps
, depth
))
1327 if(!smb_io_unistr2("", &sh1
->uni_user_name
, True
, ps
, depth
))
1333 /*******************************************************************
1334 Inits a FILE_INFO_3 structure
1335 ********************************************************************/
1337 void init_srv_file_info3(FILE_INFO_3
*fl3
,
1338 uint32 id
, uint32 perms
, uint32 num_locks
,
1339 char *path_name
, char *user_name
)
1341 DEBUG(5,("init_srv_file_info3: %s %s\n", path_name
, user_name
));
1345 fl3
->num_locks
= num_locks
;
1347 fl3
->ptr_path_name
= (path_name
!= NULL
) ? 1 : 0;
1348 fl3
->ptr_user_name
= (user_name
!= NULL
) ? 1 : 0;
1351 /*******************************************************************
1352 Reads or writes a structure.
1353 ********************************************************************/
1355 static BOOL
srv_io_file_info3(char *desc
, FILE_INFO_3
*fl3
, prs_struct
*ps
, int depth
)
1360 prs_debug(ps
, depth
, desc
, "srv_io_file_info3");
1366 if(!prs_uint32("id ", ps
, depth
, &fl3
->id
))
1368 if(!prs_uint32("perms ", ps
, depth
, &fl3
->perms
))
1370 if(!prs_uint32("num_locks ", ps
, depth
, &fl3
->num_locks
))
1372 if(!prs_uint32("ptr_path_name", ps
, depth
, &fl3
->ptr_path_name
))
1374 if(!prs_uint32("ptr_user_name", ps
, depth
, &fl3
->ptr_user_name
))
1380 /*******************************************************************
1381 Reads or writes a structure.
1382 ********************************************************************/
1384 static BOOL
srv_io_srv_file_info_3(char *desc
, SRV_FILE_INFO_3
*fl3
, prs_struct
*ps
, int depth
)
1389 prs_debug(ps
, depth
, desc
, "srv_io_file_3_fl3");
1395 if(!prs_uint32("num_entries_read", ps
, depth
, &fl3
->num_entries_read
))
1397 if(!prs_uint32("ptr_file_fl3", ps
, depth
, &fl3
->ptr_file_info
))
1400 if (fl3
->ptr_file_info
!= 0) {
1402 int num_entries
= fl3
->num_entries_read
;
1404 if (num_entries
> MAX_FILE_ENTRIES
) {
1405 num_entries
= MAX_FILE_ENTRIES
; /* report this! */
1408 if(!prs_uint32("num_entries_read2", ps
, depth
, &fl3
->num_entries_read2
))
1411 for (i
= 0; i
< num_entries
; i
++) {
1412 if(!srv_io_file_info3("", &fl3
->info_3
[i
], ps
, depth
))
1416 for (i
= 0; i
< num_entries
; i
++) {
1417 if(!srv_io_file_info3_str("", &fl3
->info_3_str
[i
], ps
, depth
))
1428 /*******************************************************************
1429 Reads or writes a structure.
1430 ********************************************************************/
1432 static BOOL
srv_io_srv_file_ctr(char *desc
, SRV_FILE_INFO_CTR
*ctr
, prs_struct
*ps
, int depth
)
1437 prs_debug(ps
, depth
, desc
, "srv_io_srv_file_ctr");
1443 if(!prs_uint32("switch_value", ps
, depth
, &ctr
->switch_value
))
1445 if(!prs_uint32("ptr_file_ctr", ps
, depth
, &ctr
->ptr_file_ctr
))
1448 if (ctr
->ptr_file_ctr
!= 0) {
1449 switch (ctr
->switch_value
) {
1451 if(!srv_io_srv_file_info_3("", &ctr
->file
.info3
, ps
, depth
))
1455 DEBUG(5,("%s no file info at switch_value %d\n",
1456 tab_depth(depth
), ctr
->switch_value
));
1464 /*******************************************************************
1465 Inits a SRV_Q_NET_FILE_ENUM structure.
1466 ********************************************************************/
1468 void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM
*q_n
,
1469 char *srv_name
, char *qual_name
,
1470 uint32 file_level
, SRV_FILE_INFO_CTR
*ctr
,
1471 uint32 preferred_len
,
1474 DEBUG(5,("init_q_net_file_enum\n"));
1478 init_buf_unistr2(&q_n
->uni_srv_name
, &q_n
->ptr_srv_name
, srv_name
);
1479 init_buf_unistr2(&q_n
->uni_qual_name
, &q_n
->ptr_qual_name
, qual_name
);
1481 q_n
->file_level
= file_level
;
1482 q_n
->preferred_len
= preferred_len
;
1484 memcpy(&q_n
->enum_hnd
, hnd
, sizeof(*hnd
));
1487 /*******************************************************************
1488 Reads or writes a structure.
1489 ********************************************************************/
1491 BOOL
srv_io_q_net_file_enum(char *desc
, SRV_Q_NET_FILE_ENUM
*q_n
, prs_struct
*ps
, int depth
)
1496 prs_debug(ps
, depth
, desc
, "srv_io_q_net_file_enum");
1502 if(!prs_uint32("ptr_srv_name", ps
, depth
, &q_n
->ptr_srv_name
))
1504 if(!smb_io_unistr2("", &q_n
->uni_srv_name
, True
, ps
, depth
))
1510 if(!prs_uint32("ptr_qual_name", ps
, depth
, &q_n
->ptr_qual_name
))
1512 if(!smb_io_unistr2("", &q_n
->uni_qual_name
, q_n
->ptr_qual_name
, ps
, depth
))
1518 if(!prs_uint32("file_level", ps
, depth
, &q_n
->file_level
))
1521 if (q_n
->file_level
!= -1) {
1522 if(!srv_io_srv_file_ctr("file_ctr", q_n
->ctr
, ps
, depth
))
1526 if(!prs_uint32("preferred_len", ps
, depth
, &q_n
->preferred_len
))
1529 if(!smb_io_enum_hnd("enum_hnd", &q_n
->enum_hnd
, ps
, depth
))
1535 /*******************************************************************
1536 Reads or writes a structure.
1537 ********************************************************************/
1539 BOOL
srv_io_r_net_file_enum(char *desc
, SRV_R_NET_FILE_ENUM
*r_n
, prs_struct
*ps
, int depth
)
1544 prs_debug(ps
, depth
, desc
, "srv_io_r_net_file_enum");
1550 if(!prs_uint32("file_level", ps
, depth
, &r_n
->file_level
))
1553 if (r_n
->file_level
!= 0) {
1554 if(!srv_io_srv_file_ctr("file_ctr", r_n
->ctr
, ps
, depth
))
1558 if(!prs_uint32("total_entries", ps
, depth
, &r_n
->total_entries
))
1560 if(!smb_io_enum_hnd("enum_hnd", &r_n
->enum_hnd
, ps
, depth
))
1562 if(!prs_uint32("status ", ps
, depth
, &r_n
->status
))
1568 /*******************************************************************
1569 Inits a SRV_INFO_101 structure.
1570 ********************************************************************/
1572 void init_srv_info_101(SRV_INFO_101
*sv101
, uint32 platform_id
, char *name
,
1573 uint32 ver_major
, uint32 ver_minor
,
1574 uint32 srv_type
, char *comment
)
1576 DEBUG(5,("init_srv_info_101\n"));
1578 sv101
->platform_id
= platform_id
;
1579 init_buf_unistr2(&sv101
->uni_name
, &sv101
->ptr_name
, name
);
1580 sv101
->ver_major
= ver_major
;
1581 sv101
->ver_minor
= ver_minor
;
1582 sv101
->srv_type
= srv_type
;
1583 init_buf_unistr2(&sv101
->uni_comment
, &sv101
->ptr_comment
, comment
);
1586 /*******************************************************************
1587 Reads or writes a SRV_INFO_101 structure.
1588 ********************************************************************/
1590 static BOOL
srv_io_info_101(char *desc
, SRV_INFO_101
*sv101
, prs_struct
*ps
, int depth
)
1595 prs_debug(ps
, depth
, desc
, "srv_io_info_101");
1601 if(!prs_uint32("platform_id ", ps
, depth
, &sv101
->platform_id
))
1603 if(!prs_uint32("ptr_name ", ps
, depth
, &sv101
->ptr_name
))
1605 if(!prs_uint32("ver_major ", ps
, depth
, &sv101
->ver_major
))
1607 if(!prs_uint32("ver_minor ", ps
, depth
, &sv101
->ver_minor
))
1609 if(!prs_uint32("srv_type ", ps
, depth
, &sv101
->srv_type
))
1611 if(!prs_uint32("ptr_comment ", ps
, depth
, &sv101
->ptr_comment
))
1617 if(!smb_io_unistr2("uni_name ", &sv101
->uni_name
, True
, ps
, depth
))
1619 if(!smb_io_unistr2("uni_comment ", &sv101
->uni_comment
, True
, ps
, depth
))
1625 /*******************************************************************
1626 Inits a SRV_INFO_102 structure.
1627 ********************************************************************/
1629 void init_srv_info_102(SRV_INFO_102
*sv102
, uint32 platform_id
, char *name
,
1630 char *comment
, uint32 ver_major
, uint32 ver_minor
,
1631 uint32 srv_type
, uint32 users
, uint32 disc
, uint32 hidden
,
1632 uint32 announce
, uint32 ann_delta
, uint32 licenses
,
1635 DEBUG(5,("init_srv_info_102\n"));
1637 sv102
->platform_id
= platform_id
;
1638 init_buf_unistr2(&sv102
->uni_name
, &sv102
->ptr_name
, name
);
1639 sv102
->ver_major
= ver_major
;
1640 sv102
->ver_minor
= ver_minor
;
1641 sv102
->srv_type
= srv_type
;
1642 init_buf_unistr2(&sv102
->uni_comment
, &sv102
->ptr_comment
, comment
);
1644 /* same as 101 up to here */
1646 sv102
->users
= users
;
1648 sv102
->hidden
= hidden
;
1649 sv102
->announce
= announce
;
1650 sv102
->ann_delta
=ann_delta
;
1651 sv102
->licenses
= licenses
;
1652 init_buf_unistr2(&sv102
->uni_usr_path
, &sv102
->ptr_usr_path
, usr_path
);
1656 /*******************************************************************
1657 Reads or writes a SRV_INFO_102 structure.
1658 ********************************************************************/
1660 static BOOL
srv_io_info_102(char *desc
, SRV_INFO_102
*sv102
, prs_struct
*ps
, int depth
)
1665 prs_debug(ps
, depth
, desc
, "srv_io_info102");
1671 if(!prs_uint32("platform_id ", ps
, depth
, &sv102
->platform_id
))
1673 if(!prs_uint32("ptr_name ", ps
, depth
, &sv102
->ptr_name
))
1675 if(!prs_uint32("ver_major ", ps
, depth
, &sv102
->ver_major
))
1677 if(!prs_uint32("ver_minor ", ps
, depth
, &sv102
->ver_minor
))
1679 if(!prs_uint32("srv_type ", ps
, depth
, &sv102
->srv_type
))
1681 if(!prs_uint32("ptr_comment ", ps
, depth
, &sv102
->ptr_comment
))
1684 /* same as 101 up to here */
1686 if(!prs_uint32("users ", ps
, depth
, &sv102
->users
))
1688 if(!prs_uint32("disc ", ps
, depth
, &sv102
->disc
))
1690 if(!prs_uint32("hidden ", ps
, depth
, &sv102
->hidden
))
1692 if(!prs_uint32("announce ", ps
, depth
, &sv102
->announce
))
1694 if(!prs_uint32("ann_delta ", ps
, depth
, &sv102
->ann_delta
))
1696 if(!prs_uint32("licenses ", ps
, depth
, &sv102
->licenses
))
1698 if(!prs_uint32("ptr_usr_path", ps
, depth
, &sv102
->ptr_usr_path
))
1701 if(!smb_io_unistr2("uni_name ", &sv102
->uni_name
, True
, ps
, depth
))
1705 if(!smb_io_unistr2("uni_comment ", &sv102
->uni_comment
, True
, ps
, depth
))
1709 if(!smb_io_unistr2("uni_usr_path", &sv102
->uni_usr_path
, True
, ps
, depth
))
1715 /*******************************************************************
1716 Reads or writes a SRV_INFO_102 structure.
1717 ********************************************************************/
1719 static BOOL
srv_io_info_ctr(char *desc
, SRV_INFO_CTR
*ctr
, prs_struct
*ps
, int depth
)
1724 prs_debug(ps
, depth
, desc
, "srv_io_info_ctr");
1730 if(!prs_uint32("switch_value", ps
, depth
, &ctr
->switch_value
))
1732 if(!prs_uint32("ptr_srv_ctr ", ps
, depth
, &ctr
->ptr_srv_ctr
))
1735 if (ctr
->ptr_srv_ctr
!= 0 && ctr
->switch_value
!= 0 && ctr
!= NULL
) {
1736 switch (ctr
->switch_value
) {
1738 if(!srv_io_info_101("sv101", &ctr
->srv
.sv101
, ps
, depth
))
1742 if(!srv_io_info_102("sv102", &ctr
->srv
.sv102
, ps
, depth
))
1746 DEBUG(5,("%s no server info at switch_value %d\n",
1747 tab_depth(depth
), ctr
->switch_value
));
1757 /*******************************************************************
1758 Inits a SRV_Q_NET_SRV_GET_INFO structure.
1759 ********************************************************************/
1761 void init_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO
*srv
,
1762 char *server_name
, uint32 switch_value
)
1764 DEBUG(5,("init_srv_q_net_srv_get_info\n"));
1766 init_buf_unistr2(&srv
->uni_srv_name
, &srv
->ptr_srv_name
, server_name
);
1768 srv
->switch_value
= switch_value
;
1771 /*******************************************************************
1772 Reads or writes a structure.
1773 ********************************************************************/
1775 BOOL
srv_io_q_net_srv_get_info(char *desc
, SRV_Q_NET_SRV_GET_INFO
*q_n
, prs_struct
*ps
, int depth
)
1780 prs_debug(ps
, depth
, desc
, "srv_io_q_net_srv_get_info");
1786 if(!prs_uint32("ptr_srv_name ", ps
, depth
, &q_n
->ptr_srv_name
))
1788 if(!smb_io_unistr2("", &q_n
->uni_srv_name
, True
, ps
, depth
))
1794 if(!prs_uint32("switch_value ", ps
, depth
, &q_n
->switch_value
))
1800 /*******************************************************************
1801 Inits a SRV_R_NET_SRV_GET_INFO structure.
1802 ********************************************************************/
1804 void init_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO
*srv
,
1805 uint32 switch_value
, SRV_INFO_CTR
*ctr
, uint32 status
)
1807 DEBUG(5,("init_srv_r_net_srv_get_info\n"));
1811 if (status
== 0x0) {
1812 srv
->ctr
->switch_value
= switch_value
;
1813 srv
->ctr
->ptr_srv_ctr
= 1;
1815 srv
->ctr
->switch_value
= 0;
1816 srv
->ctr
->ptr_srv_ctr
= 0;
1819 srv
->status
= status
;
1822 /*******************************************************************
1823 Reads or writes a structure.
1824 ********************************************************************/
1826 BOOL
srv_io_r_net_srv_get_info(char *desc
, SRV_R_NET_SRV_GET_INFO
*r_n
, prs_struct
*ps
, int depth
)
1831 prs_debug(ps
, depth
, desc
, "srv_io_r_net_srv_get_info");
1837 if(!srv_io_info_ctr("ctr", r_n
->ctr
, ps
, depth
))
1840 if(!prs_uint32("status ", ps
, depth
, &r_n
->status
))
1847 /*******************************************************************
1848 Reads or writes a structure.
1849 ********************************************************************/
1851 BOOL
srv_io_q_net_remote_tod(char *desc
, SRV_Q_NET_REMOTE_TOD
*q_n
, prs_struct
*ps
, int depth
)
1856 prs_debug(ps
, depth
, desc
, "srv_io_q_net_remote_tod");
1862 if(!prs_uint32("ptr_srv_name ", ps
, depth
, &q_n
->ptr_srv_name
))
1864 if(!smb_io_unistr2("", &q_n
->uni_srv_name
, True
, ps
, depth
))
1870 /*******************************************************************
1871 Reads or writes a TIME_OF_DAY_INFO structure.
1872 ********************************************************************/
1874 static BOOL
srv_io_time_of_day_info(char *desc
, TIME_OF_DAY_INFO
*tod
, prs_struct
*ps
, int depth
)
1879 prs_debug(ps
, depth
, desc
, "srv_io_time_of_day_info");
1885 if(!prs_uint32("elapsedt ", ps
, depth
, &tod
->elapsedt
))
1887 if(!prs_uint32("msecs ", ps
, depth
, &tod
->msecs
))
1889 if(!prs_uint32("hours ", ps
, depth
, &tod
->hours
))
1891 if(!prs_uint32("mins ", ps
, depth
, &tod
->mins
))
1893 if(!prs_uint32("secs ", ps
, depth
, &tod
->secs
))
1895 if(!prs_uint32("hunds ", ps
, depth
, &tod
->hunds
))
1897 if(!prs_uint32("timezone ", ps
, depth
, &tod
->zone
))
1899 if(!prs_uint32("tintervals ", ps
, depth
, &tod
->tintervals
))
1901 if(!prs_uint32("day ", ps
, depth
, &tod
->day
))
1903 if(!prs_uint32("month ", ps
, depth
, &tod
->month
))
1905 if(!prs_uint32("year ", ps
, depth
, &tod
->year
))
1907 if(!prs_uint32("weekday ", ps
, depth
, &tod
->weekday
))
1913 /*******************************************************************
1914 Inits a TIME_OF_DAY_INFO structure.
1915 ********************************************************************/
1917 void init_time_of_day_info(TIME_OF_DAY_INFO
*tod
, uint32 elapsedt
, uint32 msecs
,
1918 uint32 hours
, uint32 mins
, uint32 secs
, uint32 hunds
,
1919 uint32 zone
, uint32 tintervals
, uint32 day
,
1920 uint32 month
, uint32 year
, uint32 weekday
)
1922 DEBUG(5,("init_time_of_day_info\n"));
1924 tod
->elapsedt
= elapsedt
;
1931 tod
->tintervals
= tintervals
;
1935 tod
->weekday
= weekday
;
1939 /*******************************************************************
1940 Reads or writes a structure.
1941 ********************************************************************/
1943 BOOL
srv_io_r_net_remote_tod(char *desc
, SRV_R_NET_REMOTE_TOD
*r_n
, prs_struct
*ps
, int depth
)
1948 prs_debug(ps
, depth
, desc
, "srv_io_r_net_remote_tod");
1954 if(!prs_uint32("ptr_srv_tod ", ps
, depth
, &r_n
->ptr_srv_tod
))
1957 if(!srv_io_time_of_day_info("tod", r_n
->tod
, ps
, depth
))
1960 if(!prs_uint32("status ", ps
, depth
, &r_n
->status
))