2 Unix SMB/CIFS implementation.
3 client message handling routines
4 Copyright (C) Andrew Tridgell 1994-1998
5 Copyright (C) James J Myers 2003 <myersjj@samba.org>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 /****************************************************************************
26 start a message sequence
27 ****************************************************************************/
28 BOOL smbcli_message_start(struct smbcli_tree *tree, char *host, char *username,
31 struct smbcli_request *req;
33 req = smbcli_request_setup(tree, SMBsendstrt, 0, 0);
34 smbcli_req_append_string(req, username, STR_TERMINATE);
35 smbcli_req_append_string(req, host, STR_TERMINATE);
36 if (!smbcli_request_send(req) ||
37 !smbcli_request_receive(req) ||
38 smbcli_is_error(tree)) {
39 smbcli_request_destroy(req);
43 *grp = SVAL(req->in.vwv, VWV(0));
44 smbcli_request_destroy(req);
50 /****************************************************************************
52 ****************************************************************************/
53 BOOL smbcli_message_text(struct smbcli_tree *tree, char *msg, int len, int grp)
55 struct smbcli_request *req;
57 req = smbcli_request_setup(tree, SMBsendtxt, 1, 0);
58 SSVAL(req->out.vwv, VWV(0), grp);
60 smbcli_req_append_bytes(req, msg, len);
62 if (!smbcli_request_send(req) ||
63 !smbcli_request_receive(req) ||
64 smbcli_is_error(tree)) {
65 smbcli_request_destroy(req);
69 smbcli_request_destroy(req);
73 /****************************************************************************
75 ****************************************************************************/
76 BOOL smbcli_message_end(struct smbcli_tree *tree, int grp)
78 struct smbcli_request *req;
80 req = smbcli_request_setup(tree, SMBsendend, 1, 0);
81 SSVAL(req->out.vwv, VWV(0), grp);
83 if (!smbcli_request_send(req) ||
84 !smbcli_request_receive(req) ||
85 smbcli_is_error(tree)) {
86 smbcli_request_destroy(req);
90 smbcli_request_destroy(req);