2 Unix SMB/Netbios implementation.
4 client message handling routines
5 Copyright (C) Andrew Tridgell 1994-1998
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.
27 /****************************************************************************
28 start a message sequence
29 ****************************************************************************/
30 BOOL cli_message_start(struct cli_state *cli, char *host, char *username,
35 /* send a SMBsendstrt command */
36 memset(cli->outbuf,'\0',smb_size);
37 set_message(cli->outbuf,0,0,True);
38 CVAL(cli->outbuf,smb_com) = SMBsendstrt;
39 SSVAL(cli->outbuf,smb_tid,cli->cnum);
40 cli_setup_packet(cli);
42 p = smb_buf(cli->outbuf);
52 cli_setup_bcc(cli, p);
56 if (!cli_receive_smb(cli)) {
60 if (cli_error(cli, NULL, NULL, NULL)) return False;
62 *grp = SVAL(cli->inbuf,smb_vwv0);
68 /****************************************************************************
70 ****************************************************************************/
71 BOOL cli_message_text(struct cli_state *cli, char *msg, int len, int grp)
75 memset(cli->outbuf,'\0',smb_size);
76 set_message(cli->outbuf,1,len+3,True);
77 CVAL(cli->outbuf,smb_com) = SMBsendtxt;
78 SSVAL(cli->outbuf,smb_tid,cli->cnum);
79 cli_setup_packet(cli);
81 SSVAL(cli->outbuf,smb_vwv0,grp);
83 p = smb_buf(cli->outbuf);
89 if (!cli_receive_smb(cli)) {
93 if (cli_error(cli, NULL, NULL, NULL)) return False;
98 /****************************************************************************
100 ****************************************************************************/
101 BOOL cli_message_end(struct cli_state *cli, int grp)
103 memset(cli->outbuf,'\0',smb_size);
104 set_message(cli->outbuf,1,0,True);
105 CVAL(cli->outbuf,smb_com) = SMBsendend;
106 SSVAL(cli->outbuf,smb_tid,cli->cnum);
108 SSVAL(cli->outbuf,smb_vwv0,grp);
110 cli_setup_packet(cli);
114 if (!cli_receive_smb(cli)) {
118 if (cli_error(cli, NULL, NULL, NULL)) return False;