1/*
2 * Copyright (c) 2000-2001, Boris Popov
3 * All rights reserved.
4 *
5 * Portions Copyright (C) 2004 - 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 * $Id: rap.h,v 1.2 2004/12/13 00:25:23 lindak Exp $
35 */
36#ifndef _RAP_H_
37#define _RAP_H_
38
39/*
40 * RAP error codes
41 */
42#define	SMB_ERROR_ACCESS_DENIED			5
43#define	SMB_ERROR_NETWORK_ACCESS_DENIED	65
44#define SMB_ERROR_MORE_DATA				234
45
46#define get16(buf,ofs)		(*((uint16_t*)(&((uint8_t*)(buf))[ofs])))
47#define get32(buf,ofs)		(*((uint32_t*)(&((uint8_t*)(buf))[ofs])))
48
49#define getwle(buf,ofs)	OSSwapHostToLittleInt16(get16(buf,ofs)
50#define getwbe(buf,ofs)	OSSwapHostToBigInt16(get16(buf,ofs)
51#define getdle(buf,ofs)	OSSwapHostToLittleInt32(get32(buf,ofs)
52#define getdbe(buf,ofs) OSSwapHostToBigInt32(get32(buf,ofs)
53
54#define setwle(buf,ofs,val)	get16(buf,ofs)=OSSwapHostToLittleInt16(val)
55#define setwbe(buf,ofs,val) get16(buf,ofs)=OSSwapHostToBigInt16(val)
56#define setdle(buf,ofs,val) get32(buf,ofs)=OSSwapHostToLittleInt32(val)
57#define setdbe(buf,ofs,val) get32(buf,ofs)=OSSwapHostToBigInt32(val)
58
59struct smb_rap {
60	char *		r_sparam;
61	char *		r_nparam;
62	char *		r_sdata;
63	char *		r_ndata;
64	char *		r_pbuf;		/* rq parameters */
65	int		r_plen;		/* rq param len */
66	char *		r_npbuf;
67	char *		r_dbuf;		/* rq data */
68	int		r_dlen;		/* rq data len */
69	char *		r_ndbuf;
70	uint32_t	r_result;
71	char *		r_rcvbuf;
72	int		r_rcvbuflen;
73	int		r_entries;
74};
75
76struct smb_share_info_1 {
77	char		shi1_netname[13];
78	char		shi1_pad;
79	uint16_t	shi1_type;
80	uint32_t	shi1_remark;		/* char * */
81};
82
83__BEGIN_DECLS
84
85int
86RapNetShareEnum(SMBHANDLE inConnection, int sLevel, void **rBuffer, uint32_t *rBufferSize,
87				uint32_t *entriesRead, uint32_t *totalEntriesRead);
88void RapNetApiBufferFree(void * bufptr);
89
90__END_DECLS
91
92#endif /* _RAP_H_ */
93