OpenAFS
OpenAFS distributed network file system
|
00001 /* 00002 * Copyright (c) 2008 Secure Endpoints, Inc. 00003 * Copyright (c) 2009-2011 Your File System, Inc. 00004 * All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions are met: 00008 * 00009 * - Redistributions of source code must retain the above copyright notice, 00010 * this list of conditions and the following disclaimer. 00011 * - Redistributions in binary form must reproduce the above copyright notice, 00012 * this list of conditions and the following disclaimer in the documentation 00013 * and/or other materials provided with the distribution. 00014 * - Neither the name of Secure Endpoints Inc. nor the names of its contributors 00015 * may be used to endorse or promote products derived from this software without 00016 * specific prior written permission from Secure Endpoints, Inc. and 00017 * Your File System, Inc. 00018 * 00019 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00020 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 00021 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 00022 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 00023 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00024 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00025 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00026 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00027 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00028 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00029 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 */ 00031 00032 extern void RDR_InitPipe(void); 00033 00034 extern void RDR_ShutdownPipe(void); 00035 00036 extern DWORD RDR_SetupPipe( ULONG index, cm_fid_t *parentFid, cm_fid_t *rootFid, 00037 WCHAR *Name, DWORD NameLength, 00038 cm_user_t *userp); 00039 00040 extern void RDR_CleanupPipe(ULONG index); 00041 00042 extern DWORD RDR_Pipe_Read(ULONG index, ULONG BufferLength, void *MappedBuffer, 00043 ULONG *pBytesProcessed, cm_req_t *reqp, cm_user_t *userp); 00044 00045 extern DWORD RDR_Pipe_Write(ULONG index, ULONG BufferLength, void *MappedBuffer, 00046 cm_req_t *reqp, cm_user_t *userp); 00047 00048 extern DWORD RDR_Pipe_QueryInfo( ULONG index, ULONG InfoClass, 00049 ULONG BufferLength, void *MappedBuffer, 00050 ULONG *pBytesProcessed, cm_req_t *reqp, cm_user_t *userp); 00051 00052 extern DWORD RDR_Pipe_SetInfo( ULONG index, ULONG InfoClass, 00053 ULONG BufferLength, void *MappedBuffer, 00054 cm_req_t *reqp, cm_user_t *userp); 00055 00056 #ifdef RDR_PIPE_PRIVATE 00057 typedef struct RDR_pipe { 00058 struct RDR_pipe *next, *prev; 00059 ULONG index; 00060 wchar_t name[MAX_PATH]; 00061 cm_fid_t parentFid; 00062 cm_fid_t rootFid; 00063 cm_scache_t *parentScp; 00064 afs_uint32 flags; 00065 afs_uint32 devstate; 00066 msrpc_conn rpc_conn; 00067 00068 /* input side */ 00069 char *inDatap; /* current position 00070 * in input parameter block */ 00071 char *inAllocp; /* allocated input parameter block */ 00072 afs_uint32 inCopied; /* # of input bytes copied in so far 00073 * by write calls */ 00074 /* output side */ 00075 char *outDatap; /* output results assembled so far */ 00076 char *outAllocp; /* output results assembled so far */ 00077 afs_uint32 outCopied; /* # of output bytes copied back so far */ 00078 } RDR_pipe_t; 00079 00080 /* flags for smb_ioctl_t */ 00081 #define RDR_PIPEFLAG_DATAIN 1 /* reading data from client to server */ 00082 #define RDR_PIPEFLAG_LOGON 2 /* got tokens from integrated logon */ 00083 #define RDR_PIPEFLAG_USEUTF8 4 /* this request is using UTF-8 strings */ 00084 #define RDR_PIPEFLAG_DATAOUT 8 /* sending data from server to client */ 00085 00086 #define RDR_PIPEFLAG_RPC 0x0010 00087 #define RDR_PIPEFLAG_MESSAGE_MODE 0x0020 00088 #define RDR_PIPEFLAG_BLOCKING 0x0040 00089 #define RDR_PIPEFLAG_INCALL 0x0080 00090 00091 /* Device state constants */ 00092 #define RDR_DEVICESTATE_READASBYTESTREAM 0x0000 00093 #define RDR_DEVICESTATE_READMSGFROMPIPE 0x0100 00094 #define RDR_DEVICESTATE_BYTESTREAMPIPE 0x0000 00095 #define RDR_DEVICESTATE_MESSAGEMODEPIPE 0x0400 00096 #define RDR_DEVICESTATE_PIPECLIENTEND 0x0000 00097 #define RDR_DEVICESTATE_PIPESERVEREND 0x4000 00098 #define RDR_DEVICESTATE_BLOCKING 0x8000 00099 00100 #define RDR_PIPE_MAXDATA 65536 00101 00102 /* procedure implementing an pipe */ 00103 typedef long (RDR_pipeProc_t)(RDR_pipe_t *, struct cm_user *userp); 00104 00105 extern RDR_pipe_t *RDR_FindPipe(ULONG index, int locked); 00106 00107 /* 00108 * DDK Data Structures 00109 * 00110 * This is a userland module and does not include DDK headers. 00111 * Replicate the DDK Data Structures required for pipe handling 00112 * based on [MS-FSC]: File System Control Codes 00113 * http://msdn.microsoft.com/en-us/library/cc231987%28v=PROT.13%29.aspx 00114 */ 00115 typedef enum _FILE_INFORMATION_CLASS { 00116 FileDirectoryInformation = 1, 00117 FileFullDirectoryInformation, // 2 00118 FileBothDirectoryInformation, // 3 00119 FileBasicInformation, // 4 00120 FileStandardInformation, // 5 00121 FileInternalInformation, // 6 00122 FileEaInformation, // 7 00123 FileAccessInformation, // 8 00124 FileNameInformation, // 9 00125 FileRenameInformation, // 10 00126 FileLinkInformation, // 11 00127 FileNamesInformation, // 12 00128 FileDispositionInformation, // 13 00129 FilePositionInformation, // 14 00130 FileFullEaInformation, // 15 00131 FileModeInformation, // 16 00132 FileAlignmentInformation, // 17 00133 FileAllInformation, // 18 00134 FileAllocationInformation, // 19 00135 FileEndOfFileInformation, // 20 00136 FileAlternateNameInformation, // 21 00137 FileStreamInformation, // 22 00138 FilePipeInformation, // 23 00139 FilePipeLocalInformation, // 24 00140 FilePipeRemoteInformation, // 25 00141 FileMailslotQueryInformation, // 26 00142 FileMailslotSetInformation, // 27 00143 FileCompressionInformation, // 28 00144 FileObjectIdInformation, // 29 00145 FileCompletionInformation, // 30 00146 FileMoveClusterInformation, // 31 00147 FileQuotaInformation, // 32 00148 FileReparsePointInformation, // 33 00149 FileNetworkOpenInformation, // 34 00150 FileAttributeTagInformation, // 35 00151 FileTrackingInformation, // 36 00152 FileIdBothDirectoryInformation, // 37 00153 FileIdFullDirectoryInformation, // 38 00154 FileValidDataLengthInformation, // 39 00155 FileShortNameInformation, // 40 00156 FileIoCompletionNotificationInformation, // 41 00157 FileIoStatusBlockRangeInformation, // 42 00158 FileIoPriorityHintInformation, // 43 00159 FileSfioReserveInformation, // 44 00160 FileSfioVolumeInformation, // 45 00161 FileHardLinkInformation, // 46 00162 FileProcessIdsUsingFileInformation, // 47 00163 FileNormalizedNameInformation, // 48 00164 FileNetworkPhysicalNameInformation, // 49 00165 FileIdGlobalTxDirectoryInformation, // 50 00166 FileIsRemoteDeviceInformation, // 51 00167 FileAttributeCacheInformation, // 52 00168 FileNumaNodeInformation, // 53 00169 FileStandardLinkInformation, // 54 00170 FileRemoteProtocolInformation, // 55 00171 FileMaximumInformation 00172 } FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS; 00173 00174 typedef struct _FILE_BASIC_INFORMATION { 00175 LARGE_INTEGER CreationTime; 00176 LARGE_INTEGER LastAccessTime; 00177 LARGE_INTEGER LastWriteTime; 00178 LARGE_INTEGER ChangeTime; 00179 ULONG FileAttributes; 00180 } FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION; 00181 00182 typedef struct _FILE_STANDARD_INFORMATION { 00183 LARGE_INTEGER AllocationSize; 00184 LARGE_INTEGER EndOfFile; 00185 ULONG NumberOfLinks; 00186 BOOLEAN DeletePending; 00187 BOOLEAN IsDirectory; 00188 } FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION; 00189 00190 typedef struct _FILE_NAME_INFORMATION { 00191 ULONG FileNameLength; 00192 WCHAR FileName[1]; 00193 } FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION; 00194 00195 typedef struct _FILE_PIPE_INFORMATION { 00196 ULONG ReadMode; 00197 ULONG CompletionMode; 00198 } FILE_PIPE_INFORMATION, *PFILE_PIPE_INFORMATION; 00199 00200 typedef struct _FILE_PIPE_LOCAL_INFORMATION { 00201 ULONG NamedPipeType; 00202 ULONG NamedPipeConfiguration; 00203 ULONG MaximumInstances; 00204 ULONG CurrentInstances; 00205 ULONG InboundQuota; 00206 ULONG ReadDataAvailable; 00207 ULONG OutboundQuota; 00208 ULONG WriteQuotaAvailable; 00209 ULONG NamedPipeState; 00210 ULONG NamedPipeEnd; 00211 } FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION; 00212 00213 typedef struct _FILE_PIPE_REMOTE_INFORMATION { 00214 LARGE_INTEGER CollectDataTime; 00215 ULONG MaximumCollectionCount; 00216 } FILE_PIPE_REMOTE_INFORMATION, *PFILE_PIPE_REMOTE_INFORMATION; 00217 00218 #define FILE_PIPE_BYTE_STREAM_TYPE 0x00000000 00219 #define FILE_PIPE_MESSAGE_TYPE 0x00000001 00220 00221 #define FILE_PIPE_ACCEPT_REMOTE_CLIENTS 0x00000000 00222 #define FILE_PIPE_REJECT_REMOTE_CLIENTS 0x00000002 00223 #define FILE_PIPE_TYPE_VALID_MASK 0x00000003 00224 00225 #define FILE_PIPE_QUEUE_OPERATION 0x00000000 00226 #define FILE_PIPE_COMPLETE_OPERATION 0x00000001 00227 00228 #define FILE_PIPE_BYTE_STREAM_MODE 0x00000000 00229 #define FILE_PIPE_MESSAGE_MODE 0x00000001 00230 00231 #define FILE_PIPE_INBOUND 0x00000000 00232 #define FILE_PIPE_OUTBOUND 0x00000001 00233 #define FILE_PIPE_FULL_DUPLEX 0x00000002 00234 00235 #define FILE_PIPE_DISCONNECTED_STATE 0x00000001 00236 #define FILE_PIPE_LISTENING_STATE 0x00000002 00237 #define FILE_PIPE_CONNECTED_STATE 0x00000003 00238 #define FILE_PIPE_CLOSING_STATE 0x00000004 00239 00240 #define FILE_PIPE_CLIENT_END 0x00000000 00241 #define FILE_PIPE_SERVER_END 0x00000001 00242 00243 #define FILE_PIPE_READ_DATA 0x00000000 00244 #define FILE_PIPE_WRITE_SPACE 0x00000001 00245 #endif 00246