[NFS]
[reactos.git] / reactos / dll / np / nfs / options.h
1 /* NFSv4.1 client for Windows
2 * Copyright © 2012 The Regents of the University of Michigan
3 *
4 * Olga Kornievskaia <aglo@umich.edu>
5 * Casey Bodley <cbodley@umich.edu>
6 *
7 * This library is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation; either version 2.1 of the License, or (at
10 * your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful, but
13 * without any warranty; without even the implied warranty of merchantability
14 * or fitness for a particular purpose. See the GNU Lesser General Public
15 * License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 */
21
22 #ifndef __NFS41_NP_OPTIONS_H__
23 #define __NFS41_NP_OPTIONS_H__
24
25
26 #define MOUNT_OPTION_BUFFER_SECRET ('n4')
27
28 /* MOUNT_OPTION_BUFFER
29 * The mount options buffer received by NPAddConnection3
30 * via NETRESOURCE.lpComment. To avoid interpreting a normal
31 * comment string as mount options, a NULL and secret number
32 * are expected at the front. */
33 typedef struct _MOUNT_OPTION_BUFFER {
34 USHORT Zero; /* = 0 */
35 USHORT Secret; /* = 'n4' */
36 ULONG Length;
37 BYTE Buffer[1];
38 } MOUNT_OPTION_BUFFER, *PMOUNT_OPTION_BUFFER;
39
40 /* CONNECTION_BUFFER
41 * The connection information as sent to the driver via
42 * IOCTL_NFS41_ADDCONN. The buffer contains the connection name
43 * followed by any extended attributes for mount options. */
44 typedef struct _CONNECTION_BUFFER {
45 USHORT NameLength; /* length of connection filename */
46 USHORT EaPadding; /* 0-3 bytes of padding to put EaBuffer
47 * on a ULONG boundary */
48 ULONG EaLength; /* length of EaBuffer */
49 BYTE Buffer[1];
50 } CONNECTION_BUFFER, *PCONNECTION_BUFFER;
51
52 /* CONNECTION_INFO
53 * Used in NPAddConnection3 to encapsulate the formation of
54 * the connection buffer. */
55 typedef struct _CONNECTION_INFO {
56 PMOUNT_OPTION_BUFFER Options;
57 ULONG BufferSize;
58 PCONNECTION_BUFFER Buffer;
59 } CONNECTION_INFO, *PCONNECTION_INFO;
60
61 #define MAX_CONNECTION_BUFFER_SIZE(EaSize) ( \
62 sizeof(CONNECTION_BUFFER) + MAX_PATH + (EaSize) )
63
64
65 /* options.c */
66 DWORD InitializeConnectionInfo(
67 IN OUT PCONNECTION_INFO Connection,
68 IN PMOUNT_OPTION_BUFFER Options,
69 OUT LPWSTR *ConnectionName);
70
71 void FreeConnectionInfo(
72 IN OUT PCONNECTION_INFO Connection);
73
74 /* MarshallConnectionInfo
75 * Prepares the CONNECTION_BUFFER for transmission to the driver
76 * by copying the extended attributes into place and updating the
77 * lengths accordingly. */
78 void MarshalConnectionInfo(
79 IN OUT PCONNECTION_INFO Connection);
80
81
82 #endif /* !__NFS41_NP_OPTIONS_H__ */