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