Initial commit - from Precise source
[freerdp-ubuntu-pcb-backport.git] / include / freerdp / svc.h
1 /**
2  * FreeRDP: A Remote Desktop Protocol client.
3  * Static Virtual Channel Interface
4  *
5  * Copyright 2009-2011 Jay Sorg
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 /**
21  * MS compatible SVC plugin interface
22  * reference:
23  * http://msdn.microsoft.com/en-us/library/aa383580.aspx
24  */
25
26 #ifndef __FREERDP_SVC_H
27 #define __FREERDP_SVC_H
28
29 #include <freerdp/api.h>
30 #include <freerdp/types.h>
31
32 #define CHANNEL_EXPORT_FUNC_NAME "VirtualChannelEntry"
33
34 #define CHANNEL_NAME_LEN 7
35
36 struct _CHANNEL_DEF
37 {
38         char name[CHANNEL_NAME_LEN + 1];
39         uint32 options;
40 };
41 typedef struct _CHANNEL_DEF CHANNEL_DEF;
42 typedef CHANNEL_DEF* PCHANNEL_DEF;
43 typedef CHANNEL_DEF** PPCHANNEL_DEF;
44
45 typedef void (FREERDP_CC * PCHANNEL_INIT_EVENT_FN)(void* pInitHandle,
46         uint32 event, void* pData, uint32 dataLength);
47
48
49 typedef void (FREERDP_CC * PCHANNEL_OPEN_EVENT_FN)(uint32 openHandle,
50         uint32 event, void* pData, uint32 dataLength,
51         uint32 totalLength, uint32 dataFlags);
52
53 #define CHANNEL_RC_OK                             0
54 #define CHANNEL_RC_ALREADY_INITIALIZED            1
55 #define CHANNEL_RC_NOT_INITIALIZED                2
56 #define CHANNEL_RC_ALREADY_CONNECTED              3
57 #define CHANNEL_RC_NOT_CONNECTED                  4
58 #define CHANNEL_RC_TOO_MANY_CHANNELS              5
59 #define CHANNEL_RC_BAD_CHANNEL                    6
60 #define CHANNEL_RC_BAD_CHANNEL_HANDLE             7
61 #define CHANNEL_RC_NO_BUFFER                      8
62 #define CHANNEL_RC_BAD_INIT_HANDLE                9
63 #define CHANNEL_RC_NOT_OPEN                      10
64 #define CHANNEL_RC_BAD_PROC                      11
65 #define CHANNEL_RC_NO_MEMORY                     12
66 #define CHANNEL_RC_UNKNOWN_CHANNEL_NAME          13
67 #define CHANNEL_RC_ALREADY_OPEN                  14
68 #define CHANNEL_RC_NOT_IN_VIRTUALCHANNELENTRY    15
69 #define CHANNEL_RC_NULL_DATA                     16
70 #define CHANNEL_RC_ZERO_LENGTH                   17
71
72 #define VIRTUAL_CHANNEL_VERSION_WIN2000         1
73
74 typedef uint32 (FREERDP_CC * PVIRTUALCHANNELINIT)(void** ppInitHandle,
75         PCHANNEL_DEF pChannel, int channelCount, uint32 versionRequested,
76         PCHANNEL_INIT_EVENT_FN pChannelInitEventProc);
77 typedef uint32 (FREERDP_CC * PVIRTUALCHANNELOPEN)(void* pInitHandle,
78         uint32* pOpenHandle, char* pChannelName,
79         PCHANNEL_OPEN_EVENT_FN pChannelOpenEventProc);
80 typedef uint32 (FREERDP_CC * PVIRTUALCHANNELCLOSE)(uint32 openHandle);
81
82 typedef uint32 (FREERDP_CC * PVIRTUALCHANNELWRITE)(uint32 openHandle,
83         void* pData, uint32 dataLength, void* pUserData);
84
85 typedef uint32 (FREERDP_CC * PVIRTUALCHANNELEVENTPUSH)(uint32 openHandle,
86         RDP_EVENT* event);
87
88 struct _CHANNEL_ENTRY_POINTS
89 {
90         uint32 cbSize;
91         uint32 protocolVersion;
92         PVIRTUALCHANNELINIT  pVirtualChannelInit;
93         PVIRTUALCHANNELOPEN  pVirtualChannelOpen;
94         PVIRTUALCHANNELCLOSE pVirtualChannelClose;
95         PVIRTUALCHANNELWRITE pVirtualChannelWrite;
96 };
97 typedef struct _CHANNEL_ENTRY_POINTS CHANNEL_ENTRY_POINTS;
98 typedef CHANNEL_ENTRY_POINTS* PCHANNEL_ENTRY_POINTS;
99
100 typedef int (FREERDP_CC * PVIRTUALCHANNELENTRY)(PCHANNEL_ENTRY_POINTS pEntryPoints);
101
102 struct _CHANNEL_ENTRY_POINTS_EX
103 {
104         uint32 cbSize;
105         uint32 protocolVersion;
106         PVIRTUALCHANNELINIT  pVirtualChannelInit;
107         PVIRTUALCHANNELOPEN  pVirtualChannelOpen;
108         PVIRTUALCHANNELCLOSE pVirtualChannelClose;
109         PVIRTUALCHANNELWRITE pVirtualChannelWrite;
110         void* pExtendedData; /* extended data field to pass initial parameters */
111         PVIRTUALCHANNELEVENTPUSH pVirtualChannelEventPush;
112 };
113 typedef struct _CHANNEL_ENTRY_POINTS_EX CHANNEL_ENTRY_POINTS_EX;
114 typedef CHANNEL_ENTRY_POINTS_EX* PCHANNEL_ENTRY_POINTS_EX;
115
116 #endif