1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements.  See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership.  The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License.  You may obtain a copy of the License at
9  *
10  *   http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied.  See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
20 #ifndef GUAC_RDP_CHANNELS_RDPDR_FS_MESSAGES_FILE_INFO_H
21 #define GUAC_RDP_CHANNELS_RDPDR_FS_MESSAGES_FILE_INFO_H
22 
23 /**
24  * Handlers for file queries received over the RDPDR channel via the
25  * IRP_MJ_QUERY_INFORMATION major function.
26  *
27  * @file rdpdr-fs-messages-file-info.h
28  */
29 
30 #include "channels/common-svc.h"
31 #include "channels/rdpdr/rdpdr.h"
32 
33 #include <winpr/stream.h>
34 
35 /**
36  * Handler for Device I/O Requests which set/update file information.
37  *
38  * @param svc
39  *     The guac_rdp_common_svc representing the static virtual channel being
40  *     used for RDPDR.
41  *
42  * @param device
43  *     The guac_rdpdr_device of the relevant device, as dictated by the
44  *     deviceId field of the common RDPDR header within the received PDU.
45  *     Within the guac_rdpdr_iorequest structure, the deviceId field is stored
46  *     within device_id.
47  *
48  * @param iorequest
49  *     The contents of the common RDPDR Device I/O Request header shared by all
50  *     RDPDR devices.
51  *
52  * @param length
53  *     The length of the SetBuffer field of the I/O request, in bytes. Whether
54  *     the SetBuffer field is applicable to a particular request, as well as
55  *     the specific contents of that field, depend on the type of request.
56  *
57  * @param input_stream
58  *     The remaining data within the received PDU, following the common RDPDR
59  *     Device I/O Request header and length field. If the SetBuffer field is
60  *     used for this request, the first byte of SetBuffer will be the first
61  *     byte read from this stream.
62  */
63 typedef void guac_rdpdr_set_information_request_handler(guac_rdp_common_svc* svc,
64         guac_rdpdr_device* device, guac_rdpdr_iorequest* iorequest,
65         int length, wStream* input_stream);
66 
67 /**
68  * Processes a query for FileBasicInformation. From the documentation, this is
69  * "used to query a file for the times of creation, last access, last write,
70  * and change, in addition to file attribute information."
71  */
72 guac_rdpdr_device_iorequest_handler guac_rdpdr_fs_process_query_basic_info;
73 
74 /**
75  * Processes a query for FileStandardInformation. From the documentation, this
76  * is "used to query for file information such as allocation size, end-of-file
77  * position, and number of links."
78  */
79 guac_rdpdr_device_iorequest_handler guac_rdpdr_fs_process_query_standard_info;
80 
81 /**
82  * Processes a query for FileAttributeTagInformation. From the documentation
83  * this is "used to query for file attribute and reparse tag information."
84  */
85 guac_rdpdr_device_iorequest_handler guac_rdpdr_fs_process_query_attribute_tag_info;
86 
87 /**
88  * Process a set operation for FileRenameInformation. From the documentation,
89  * this operation is used to rename a file.
90  */
91 guac_rdpdr_set_information_request_handler guac_rdpdr_fs_process_set_rename_info;
92 
93 /**
94  * Process a set operation for FileAllocationInformation. From the
95  * documentation, this operation is used to set a file's allocation size.
96  */
97 guac_rdpdr_set_information_request_handler guac_rdpdr_fs_process_set_allocation_info;
98 
99 /**
100  * Process a set operation for FileDispositionInformation. From the
101  * documentation, this operation is used to mark a file for deletion.
102  */
103 guac_rdpdr_set_information_request_handler guac_rdpdr_fs_process_set_disposition_info;
104 
105 /**
106  * Process a set operation for FileEndOfFileInformation. From the
107  * documentation, this operation is used "to set end-of-file information for
108  * a file."
109  */
110 guac_rdpdr_set_information_request_handler guac_rdpdr_fs_process_set_end_of_file_info;
111 
112 /**
113  * Process a set operation for FileBasicInformation. From the documentation,
114  * this is "used to set file information such as the times of creation, last
115  * access, last write, and change, in addition to file attributes."
116  */
117 guac_rdpdr_set_information_request_handler guac_rdpdr_fs_process_set_basic_info;
118 
119 #endif
120