1/*
2 * Copyright (c) 2000-2001 Boris Popov
3 * All rights reserved.
4 *
5 * Portions Copyright (C) 2001 - 2010 Apple Inc. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 *    must display the following acknowledgement:
17 *    This product includes software developed by Boris Popov.
18 * 4. Neither the name of the author nor the names of any co-contributors
19 *    may be used to endorse or promote products derived from this software
20 *    without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 */
35#ifndef _NETSMB_RQ_H_
36#define _NETSMB_RQ_H_
37
38#include <sys/types.h>
39
40struct smb_usr_rq;
41
42int smb_ntwrkpath_to_localpath(struct smb_ctx *,
43							   const char */*ntwrkstr*/, size_t /*ntwrk_len*/,
44							   char */*utf8str*/, size_t */*utf8_len*/,
45							   uint32_t /*flags*/);
46int smb_localpath_to_ntwrkpath(struct smb_ctx *,
47							   const char */*utf8str*/, size_t /*utf8_len*/,
48							   char */*ntwrkstr*/, size_t */*ntwrk_len*/,
49							   uint32_t /*flags*/);
50
51/*
52 * Calling smb_usr_rq_init_rcvsize with a request size causes it to allocate a
53 * receive buffer of that size.
54 */
55int  smb_usr_rq_init_rcvsize(struct smb_ctx *, u_char, uint16_t, size_t, struct smb_usr_rq **);
56/* The smb_usr_rq_init routtine will always allocate a receive buffer of page size. */
57int  smb_usr_rq_init(struct smb_ctx *, u_char, uint16_t, struct smb_usr_rq **);
58void smb_usr_rq_done(struct smb_usr_rq *);
59mbchain_t smb_usr_rq_getrequest(struct smb_usr_rq *);
60mdchain_t smb_usr_rq_getreply(struct smb_usr_rq *);
61uint32_t smb_usr_rq_get_error(struct smb_usr_rq *);
62uint32_t smb_usr_rq_flags2(struct smb_usr_rq *);
63uint32_t smb_usr_rq_nt_error(struct smb_usr_rq *rqp);
64void smb_usr_rq_setflags2(struct smb_usr_rq *, uint32_t );
65void smb_usr_rq_wstart(struct smb_usr_rq *);
66void smb_usr_rq_wend(struct smb_usr_rq *);
67void smb_usr_rq_bstart(struct smb_usr_rq *);
68void smb_usr_rq_bend(struct smb_usr_rq *);
69int smb_usr_rq_simple(struct smb_usr_rq *);
70int smb_usr_put_dmem(struct smb_ctx *, mbchain_t , const char *,
71            			size_t , int /*flags*/, size_t *);
72int smb_usr_rq_put_dstring(struct smb_ctx *, mbchain_t , const char *, size_t,
73							int /*flags*/, size_t *);
74
75int smb_usr_t2_request(struct smb_ctx *ctx, int setupcount, uint16_t *setup, const char *name,
76				   		uint16_t tparamcnt, const void *tparam,
77				   		uint16_t tdatacnt, const void *tdata,
78				   		uint16_t *rparamcnt, void *rparam,
79				   		uint16_t *rdatacnt, void *rdata,
80				   		uint32_t *buffer_oflow);
81#endif // _NETSMB_RQ_H_
82