preparing for release of alpha-2.6
[Samba/gbeck.git] / source / rpc_client / cli_brs.c
blob74b559d8a06fb1310c7459f18a24c589c7814171
1 /*
2 * Unix SMB/Netbios implementation.
3 * Version 1.9.
4 * RPC Pipe client / server routines
5 * Copyright (C) Andrew Tridgell 1992-1999,
6 * Copyright (C) Luke Kenneth Casson Leighton 1996-1999,
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include "includes.h"
24 #include "rpc_parse.h"
25 #include "rpc_client.h"
27 extern int DEBUGLEVEL;
29 /****************************************************************************
30 do a BRS Query
31 ****************************************************************************/
32 BOOL brs_query_info(const char *srv_name, uint32 switch_value, void *id)
34 prs_struct rbuf;
35 prs_struct buf;
36 BRS_Q_QUERY_INFO q_o;
37 BOOL valid_info = False;
39 struct cli_connection *con = NULL;
41 if (!cli_connection_init(srv_name, PIPE_BROWSER, &con))
43 return False;
46 if (id == NULL) return False;
48 prs_init(&buf , 0, 4, False);
49 prs_init(&rbuf, 0, 4, True );
51 /* create and send a MSRPC command with api BRS_QUERY_INFO */
53 DEBUG(4,("BRS Query Info\n"));
55 /* store the parameters */
56 make_brs_q_query_info(&q_o, srv_name, switch_value);
58 /* turn parameters into data stream */
59 if (brs_io_q_query_info("", &q_o, &buf, 0) &&
60 rpc_con_pipe_req(con, BRS_QUERY_INFO, &buf, &rbuf))
62 BRS_R_QUERY_INFO r_o;
63 BOOL p;
65 r_o.info.id = id;
67 brs_io_r_query_info("", &r_o, &rbuf, 0);
68 p = rbuf.offset != 0;
70 if (p && r_o.status != 0)
72 /* report error code */
73 DEBUG(0,("BRS_R_QUERY_INFO: %s\n", get_nt_error_msg(r_o.status)));
74 p = False;
77 if (p)
79 valid_info = True;
83 prs_free_data(&rbuf);
84 prs_free_data(&buf );
86 cli_connection_unlink(con);
88 return valid_info;