r10656: BIG merge from trunk. Features not copied over
[tprouty/samba.git] / source / rpc_client / cli_wkssvc.c
1 /* 
2    Unix SMB/CIFS implementation.
3    NT Domain Authentication SMB / MSRPC client
4    Copyright (C) Andrew Tridgell 1994-2000
5    Copyright (C) Tim Potter 2001
6    Copyright (C) Rafal Szczesniak 2002
7    Copyright (C) Jeremy Allison 2005.
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.
13    
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.
18    
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.
22 */
23
24 #include "includes.h"
25
26 /**
27  * WksQueryInfo rpc call (like query for server's capabilities)
28  *
29  * @param initialised client structure with \PIPE\wkssvc opened
30  * @param mem_ctx memory context assigned to this rpc binding
31  * @param wks100 WksQueryInfo structure
32  *
33  * @return NTSTATUS of rpc call
34  */
35  
36 NTSTATUS rpccli_wks_query_info(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
37                             WKS_INFO_100 *wks100)
38 {
39         prs_struct qbuf;
40         prs_struct rbuf;
41         WKS_Q_QUERY_INFO q;
42         WKS_R_QUERY_INFO r;
43
44         if (cli == NULL || wks100 == NULL)
45                 return NT_STATUS_UNSUCCESSFUL;
46
47         DEBUG(4, ("WksQueryInfo\n"));
48         
49         /* init query structure with rpc call arguments */
50         init_wks_q_query_info(&q, cli->cli->desthost, 100);
51         r.wks100 = wks100;
52
53         CLI_DO_RPC(cli, mem_ctx, PI_WKSSVC, WKS_QUERY_INFO,
54                 q, r,
55                 qbuf, rbuf,
56                 wks_io_q_query_info,
57                 wks_io_r_query_info,
58                 NT_STATUS_UNSUCCESSFUL);
59                 
60         /* check returnet status code */
61         if (NT_STATUS_IS_ERR(r.status)) {
62                 /* report the error */
63                 DEBUG(0,("WKS_R_QUERY_INFO: %s\n", nt_errstr(r.status)));
64                 return r.status;
65         }
66         
67         return NT_STATUS_OK;
68 }