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 3 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, see <http://www.gnu.org/licenses/>.
22 #include "libcli/raw/libcliraw.h"
23 #include "libcli/raw/raw_proto.h"
24 #include "libcli/libcli.h"
27 /****************************************************************************
28 start a message sequence
29 ****************************************************************************/
30 bool smbcli_message_start(struct smbcli_tree
*tree
, const char *host
, const char *username
,
33 struct smbcli_request
*req
;
35 req
= smbcli_request_setup(tree
, SMBsendstrt
, 0, 0);
39 smbcli_req_append_string(req
, username
, STR_TERMINATE
);
40 smbcli_req_append_string(req
, host
, STR_TERMINATE
);
41 if (!smbcli_request_send(req
) ||
42 !smbcli_request_receive(req
) ||
43 smbcli_is_error(tree
)) {
44 smbcli_request_destroy(req
);
48 *grp
= SVAL(req
->in
.vwv
, VWV(0));
49 smbcli_request_destroy(req
);
55 /****************************************************************************
57 ****************************************************************************/
58 bool smbcli_message_text(struct smbcli_tree
*tree
, char *msg
, int len
, int grp
)
60 struct smbcli_request
*req
;
62 req
= smbcli_request_setup(tree
, SMBsendtxt
, 1, 0);
66 SSVAL(req
->out
.vwv
, VWV(0), grp
);
68 smbcli_req_append_bytes(req
, (const uint8_t *)msg
, len
);
70 if (!smbcli_request_send(req
) ||
71 !smbcli_request_receive(req
) ||
72 smbcli_is_error(tree
)) {
73 smbcli_request_destroy(req
);
77 smbcli_request_destroy(req
);
81 /****************************************************************************
83 ****************************************************************************/
84 bool smbcli_message_end(struct smbcli_tree
*tree
, int grp
)
86 struct smbcli_request
*req
;
88 req
= smbcli_request_setup(tree
, SMBsendend
, 1, 0);
92 SSVAL(req
->out
.vwv
, VWV(0), grp
);
94 if (!smbcli_request_send(req
) ||
95 !smbcli_request_receive(req
) ||
96 smbcli_is_error(tree
)) {
97 smbcli_request_destroy(req
);
101 smbcli_request_destroy(req
);