1 /**
2  * FreeRDP: A Remote Desktop Protocol Implementation
3  * .rdp file
4  *
5  * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 #ifndef FREERDP_CLIENT_RDP_FILE_H
21 #define FREERDP_CLIENT_RDP_FILE_H
22 
23 #include <freerdp/api.h>
24 #include <freerdp/freerdp.h>
25 
26 /* Ignore invalid integer values */
27 #define RDP_FILE_FLAG_PARSE_INT_RELAXED 1
28 
29 typedef struct rdp_file rdpFile;
30 typedef BOOL (*rdp_file_fkt_parse)(void* context, const char* key, char type, const char* value);
31 
32 #ifdef __cplusplus
33 extern "C"
34 {
35 #endif
36 
37 	/* When using freerdp_client_parse_rdp_file_ex or freerdp_client_parse_rdp_file_buffer_ex
38 	 * set the context for the callback with this function. */
39 	FREERDP_API void freerdp_client_rdp_file_set_callback_context(rdpFile* file, void* context);
40 
41 	FREERDP_API BOOL freerdp_client_parse_rdp_file(rdpFile* file, const char* name);
42 	FREERDP_API BOOL freerdp_client_parse_rdp_file_ex(rdpFile* file, const char* name,
43 	                                                  rdp_file_fkt_parse parse);
44 	FREERDP_API BOOL freerdp_client_parse_rdp_file_buffer(rdpFile* file, const BYTE* buffer,
45 	                                                      size_t size);
46 	FREERDP_API BOOL freerdp_client_parse_rdp_file_buffer_ex(rdpFile* file, const BYTE* buffer,
47 	                                                         size_t size, rdp_file_fkt_parse parse);
48 	FREERDP_API BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file,
49 	                                                                rdpSettings* settings);
50 
51 	FREERDP_API BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file,
52 	                                                                const rdpSettings* settings);
53 	FREERDP_API BOOL freerdp_client_write_rdp_file(const rdpFile* file, const char* name,
54 	                                               BOOL unicode);
55 	FREERDP_API size_t freerdp_client_write_rdp_file_buffer(const rdpFile* file, char* buffer,
56 	                                                        size_t size);
57 
58 	FREERDP_API int freerdp_client_rdp_file_set_string_option(rdpFile* file, const char* name,
59 	                                                          const char* value);
60 	FREERDP_API const char* freerdp_client_rdp_file_get_string_option(rdpFile* file,
61 	                                                                  const char* name);
62 
63 	FREERDP_API int freerdp_client_rdp_file_set_integer_option(rdpFile* file, const char* name,
64 	                                                           int value);
65 	FREERDP_API int freerdp_client_rdp_file_get_integer_option(rdpFile* file, const char* name);
66 
67 	FREERDP_API rdpFile* freerdp_client_rdp_file_new(void);
68 	FREERDP_API rdpFile* freerdp_client_rdp_file_new_ex(DWORD flags);
69 	FREERDP_API void freerdp_client_rdp_file_free(rdpFile* file);
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif /* FREERDP_CLIENT_RDP_FILE_H */
76