Initial commit - from Precise source
[freerdp-ubuntu-pcb-backport.git] / include / freerdp / types.h
1 /**
2  * FreeRDP: A Remote Desktop Protocol Client
3  * Type Definitions
4  *
5  * Copyright 2009-2011 Jay Sorg
6  * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *     http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20
21 #ifndef __RDP_TYPES_H
22 #define __RDP_TYPES_H
23
24 #ifdef _WIN32
25 #include <windef.h>
26 #endif
27
28 /* Base Types */
29
30 #ifdef HAVE_LIMITS_H
31 #include <limits.h>
32 #endif
33
34 #ifdef HAVE_STDINT_H
35 #include <stdint.h>
36 #endif
37
38 #ifdef HAVE_INTTYPES_H
39
40 #include <inttypes.h>
41 typedef uint8_t uint8;
42 typedef int8_t sint8;
43 typedef uint16_t uint16;
44 typedef int16_t sint16;
45 typedef uint32_t uint32;
46 typedef int32_t sint32;
47 typedef uint64_t uint64;
48 typedef int64_t sint64;
49
50 #else
51
52 typedef unsigned char uint8;
53 typedef signed char sint8;
54 typedef unsigned short uint16;
55 typedef signed short sint16;
56 typedef unsigned int uint32;
57 typedef signed int sint32;
58 #ifdef _WIN32
59 typedef unsigned __int64 uint64;
60 typedef signed __int64 sint64;
61 #else
62 typedef unsigned long long uint64;
63 typedef signed long long sint64;
64 #endif
65
66 #endif /* HAVE_INTTYPES_H */
67
68 #ifdef HAVE_STDBOOL_H
69
70 #include <stdbool.h>
71
72 typedef int boolean;
73
74 #else
75
76 #ifndef __cplusplus
77
78 #ifndef __bool_true_false_are_defined
79 #define __bool_true_false_are_defined   1
80
81 #define true    1
82 #define false   0
83
84 #ifdef _WIN32
85 #define boolean BOOLEAN
86 #else
87 typedef int boolean;
88 #endif
89
90 #endif /* __bool_true_false_are_defined */
91
92 #else
93
94 #ifndef true
95 #define true    1
96 #endif
97
98 #ifndef false
99 #define false   0
100 #endif
101
102 typedef int boolean;
103
104 #endif /* __cplusplus */
105
106 #endif /* HAVE_STDBOOL_H */
107
108 #ifndef MIN
109 #define MIN(x,y)        (((x) < (y)) ? (x) : (y))
110 #endif
111
112 #ifndef MAX
113 #define MAX(x,y)        (((x) > (y)) ? (x) : (y))
114 #endif
115
116 #include <freerdp/settings.h>
117
118 struct _RDP_PLUGIN_DATA
119 {
120         uint16 size;
121         void* data[4];
122 };
123 typedef struct _RDP_PLUGIN_DATA RDP_PLUGIN_DATA;
124
125 struct _RDP_RECT
126 {
127         sint16 x;
128         sint16 y;
129         sint16 width;
130         sint16 height;
131 };
132 typedef struct _RDP_RECT RDP_RECT;
133
134 struct _RECTANGLE_16
135 {
136         uint16 left;
137         uint16 top;
138         uint16 right;
139         uint16 bottom;
140 };
141 typedef struct _RECTANGLE_16 RECTANGLE_16;
142
143 /* Plugin events */
144 typedef struct _RDP_EVENT RDP_EVENT;
145
146 typedef void (*RDP_EVENT_CALLBACK) (RDP_EVENT* event);
147
148 struct _RDP_EVENT
149 {
150         uint16 event_class;
151         uint16 event_type;
152         RDP_EVENT_CALLBACK on_event_free_callback;
153         void* user_data;
154 };
155
156 enum RDP_EVENT_CLASS
157 {
158         RDP_EVENT_CLASS_DEBUG = 0,
159         RDP_EVENT_CLASS_CLIPRDR,
160         RDP_EVENT_CLASS_TSMF,
161         RDP_EVENT_CLASS_RAIL
162 };
163
164 #endif /* __RDP_TYPES_H */