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.
23 #include "libcli/raw/libcliraw.h"
26 /****************************************************************************
27 start a message sequence
28 ****************************************************************************/
29 BOOL smbcli_message_start(struct smbcli_tree *tree, char *host, char *username,
32 struct smbcli_request *req;
34 req = smbcli_request_setup(tree, SMBsendstrt, 0, 0);
35 smbcli_req_append_string(req, username, STR_TERMINATE);
36 smbcli_req_append_string(req, host, STR_TERMINATE);
37 if (!smbcli_request_send(req) ||
38 !smbcli_request_receive(req) ||
39 smbcli_is_error(tree)) {
40 smbcli_request_destroy(req);
44 *grp = SVAL(req->in.vwv, VWV(0));
45 smbcli_request_destroy(req);
51 /****************************************************************************
53 ****************************************************************************/
54 BOOL smbcli_message_text(struct smbcli_tree *tree, char *msg, int len, int grp)
56 struct smbcli_request *req;
58 req = smbcli_request_setup(tree, SMBsendtxt, 1, 0);
59 SSVAL(req->out.vwv, VWV(0), grp);
61 smbcli_req_append_bytes(req, (const uint8_t *)msg, len);
63 if (!smbcli_request_send(req) ||
64 !smbcli_request_receive(req) ||
65 smbcli_is_error(tree)) {
66 smbcli_request_destroy(req);
70 smbcli_request_destroy(req);
74 /****************************************************************************
76 ****************************************************************************/
77 BOOL smbcli_message_end(struct smbcli_tree *tree, int grp)
79 struct smbcli_request *req;
81 req = smbcli_request_setup(tree, SMBsendend, 1, 0);
82 SSVAL(req->out.vwv, VWV(0), grp);
84 if (!smbcli_request_send(req) ||
85 !smbcli_request_receive(req) ||
86 smbcli_is_error(tree)) {
87 smbcli_request_destroy(req);
91 smbcli_request_destroy(req);