add WITH_SENDFILE profiling data (from Pierre Belanger)
[Samba.git] / source / rpc_parse / parse_wks.c
blobecd4a201ae4d74e5d590a00ddb58206c765e144b
1 /*
2 * Unix SMB/Netbios implementation.
3 * Version 1.9.
4 * RPC Pipe client / server routines
5 * Copyright (C) Andrew Tridgell 1992-1997,
6 * Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
7 * Copyright (C) Paul Ashton 1997.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include "includes.h"
26 /*******************************************************************
27 Init
28 ********************************************************************/
30 void init_wks_q_query_info(WKS_Q_QUERY_INFO *q_u,
31 char *server, uint16 switch_value)
33 DEBUG(5,("init_wks_q_query_info\n"));
35 init_buf_unistr2(&q_u->uni_srv_name, &q_u->ptr_srv_name, server);
36 q_u->switch_value = switch_value;
39 /*******************************************************************
40 Reads or writes a WKS_Q_QUERY_INFO structure.
41 ********************************************************************/
43 BOOL wks_io_q_query_info(char *desc, WKS_Q_QUERY_INFO *q_u, prs_struct *ps, int depth)
45 if (q_u == NULL)
46 return False;
48 prs_debug(ps, depth, desc, "wks_io_q_query_info");
49 depth++;
51 if(!prs_align(ps))
52 return False;
54 if(!prs_uint32("ptr_srv_name", ps, depth, &q_u->ptr_srv_name))
55 return False;
56 if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->ptr_srv_name, ps, depth))
57 return False;
58 if(!prs_align(ps))
59 return False;
61 if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
62 return False;
63 if(!prs_align(ps))
64 return False;
66 return True;
69 /*******************************************************************
70 wks_info_100
71 ********************************************************************/
73 void init_wks_info_100(WKS_INFO_100 *inf,
74 uint32 platform_id, uint32 ver_major, uint32 ver_minor,
75 char *my_name, char *domain_name)
77 DEBUG(5,("Init WKS_INFO_100: %d\n", __LINE__));
79 inf->platform_id = platform_id; /* 0x0000 01f4 - unknown */
80 inf->ver_major = ver_major; /* os major version */
81 inf->ver_minor = ver_minor; /* os minor version */
83 init_buf_unistr2(&inf->uni_compname, &inf->ptr_compname, my_name );
84 init_buf_unistr2(&inf->uni_lan_grp, &inf->ptr_lan_grp, domain_name);
87 /*******************************************************************
88 Reads or writes a WKS_INFO_100 structure.
89 ********************************************************************/
91 static BOOL wks_io_wks_info_100(char *desc, WKS_INFO_100 *inf, prs_struct *ps, int depth)
93 if (inf == NULL)
94 return False;
96 prs_debug(ps, depth, desc, "wks_io_wks_info_100");
97 depth++;
99 if(!prs_align(ps))
100 return False;
102 if(!prs_uint32("platform_id ", ps, depth, &inf->platform_id)) /* 0x0000 01f4 - unknown */
103 return False;
104 if(!prs_uint32("ptr_compname", ps, depth, &inf->ptr_compname)) /* pointer to computer name */
105 return False;
106 if(!prs_uint32("ptr_lan_grp ", ps, depth, &inf->ptr_lan_grp)) /* pointer to LAN group name */
107 return False;
108 if(!prs_uint32("ver_major ", ps, depth, &inf->ver_major)) /* 4 - major os version */
109 return False;
110 if(!prs_uint32("ver_minor ", ps, depth, &inf->ver_minor)) /* 0 - minor os version */
111 return False;
113 if(!smb_io_unistr2("", &inf->uni_compname, inf->ptr_compname, ps, depth))
114 return False;
115 if(!prs_align(ps))
116 return False;
118 if(!smb_io_unistr2("", &inf->uni_lan_grp, inf->ptr_lan_grp , ps, depth))
119 return False;
120 if(!prs_align(ps))
121 return False;
123 return True;
126 /*******************************************************************
127 Inits WKS_R_QUERY_INFO.
129 only supports info level 100 at the moment.
131 ********************************************************************/
133 void init_wks_r_query_info(WKS_R_QUERY_INFO *r_u,
134 uint32 switch_value, WKS_INFO_100 *wks100,
135 NTSTATUS status)
137 DEBUG(5,("init_wks_r_unknown_0: %d\n", __LINE__));
139 r_u->switch_value = switch_value; /* same as in request */
141 r_u->ptr_1 = 1; /* pointer 1 */
142 r_u->wks100 = wks100;
144 r_u->status = status;
147 /*******************************************************************
148 Reads or writes a structure.
149 ********************************************************************/
151 BOOL wks_io_r_query_info(char *desc, WKS_R_QUERY_INFO *r_u, prs_struct *ps, int depth)
153 if (r_u == NULL)
154 return False;
156 prs_debug(ps, depth, desc, "wks_io_r_query_info");
157 depth++;
159 if(!prs_align(ps))
160 return False;
162 if(!prs_uint16("switch_value", ps, depth, &r_u->switch_value)) /* level 100 (0x64) */
163 return False;
164 if(!prs_align(ps))
165 return False;
167 if(!prs_uint32("ptr_1 ", ps, depth, &r_u->ptr_1)) /* pointer 1 */
168 return False;
169 if(!wks_io_wks_info_100("inf", r_u->wks100, ps, depth))
170 return False;
172 if(!prs_ntstatus("status ", ps, depth, &r_u->status))
173 return False;
175 return True;