22 #ifndef FREERDP_LIB_CORE_MCS_H
23 #define FREERDP_LIB_CORE_MCS_H
27 #include "transport.h"
29 #include <freerdp/crypto/ber.h>
30 #include <freerdp/api.h>
31 #include <freerdp/types.h>
33 #include <winpr/stream.h>
34 #include <winpr/wtsapi.h>
38 MCS_Result_successful = 0,
39 MCS_Result_domain_merging = 1,
40 MCS_Result_domain_not_hierarchical = 2,
41 MCS_Result_no_such_channel = 3,
42 MCS_Result_no_such_domain = 4,
43 MCS_Result_no_such_user = 5,
44 MCS_Result_not_admitted = 6,
45 MCS_Result_other_user_id = 7,
46 MCS_Result_parameters_unacceptable = 8,
47 MCS_Result_token_not_available = 9,
48 MCS_Result_token_not_possessed = 10,
49 MCS_Result_too_many_channels = 11,
50 MCS_Result_too_many_tokens = 12,
51 MCS_Result_too_many_users = 13,
52 MCS_Result_unspecified_failure = 14,
53 MCS_Result_user_rejected = 15,
54 MCS_Result_enum_length = 16
59 DomainMCSPDU_invalid = -1,
60 DomainMCSPDU_PlumbDomainIndication = 0,
61 DomainMCSPDU_ErectDomainRequest = 1,
62 DomainMCSPDU_MergeChannelsRequest = 2,
63 DomainMCSPDU_MergeChannelsConfirm = 3,
64 DomainMCSPDU_PurgeChannelsIndication = 4,
65 DomainMCSPDU_MergeTokensRequest = 5,
66 DomainMCSPDU_MergeTokensConfirm = 6,
67 DomainMCSPDU_PurgeTokensIndication = 7,
68 DomainMCSPDU_DisconnectProviderUltimatum = 8,
69 DomainMCSPDU_RejectMCSPDUUltimatum = 9,
70 DomainMCSPDU_AttachUserRequest = 10,
71 DomainMCSPDU_AttachUserConfirm = 11,
72 DomainMCSPDU_DetachUserRequest = 12,
73 DomainMCSPDU_DetachUserIndication = 13,
74 DomainMCSPDU_ChannelJoinRequest = 14,
75 DomainMCSPDU_ChannelJoinConfirm = 15,
76 DomainMCSPDU_ChannelLeaveRequest = 16,
77 DomainMCSPDU_ChannelConveneRequest = 17,
78 DomainMCSPDU_ChannelConveneConfirm = 18,
79 DomainMCSPDU_ChannelDisbandRequest = 19,
80 DomainMCSPDU_ChannelDisbandIndication = 20,
81 DomainMCSPDU_ChannelAdmitRequest = 21,
82 DomainMCSPDU_ChannelAdmitIndication = 22,
83 DomainMCSPDU_ChannelExpelRequest = 23,
84 DomainMCSPDU_ChannelExpelIndication = 24,
85 DomainMCSPDU_SendDataRequest = 25,
86 DomainMCSPDU_SendDataIndication = 26,
87 DomainMCSPDU_UniformSendDataRequest = 27,
88 DomainMCSPDU_UniformSendDataIndication = 28,
89 DomainMCSPDU_TokenGrabRequest = 29,
90 DomainMCSPDU_TokenGrabConfirm = 30,
91 DomainMCSPDU_TokenInhibitRequest = 31,
92 DomainMCSPDU_TokenInhibitConfirm = 32,
93 DomainMCSPDU_TokenGiveRequest = 33,
94 DomainMCSPDU_TokenGiveIndication = 34,
95 DomainMCSPDU_TokenGiveResponse = 35,
96 DomainMCSPDU_TokenGiveConfirm = 36,
97 DomainMCSPDU_TokenPleaseRequest = 37,
98 DomainMCSPDU_TokenPleaseConfirm = 38,
99 DomainMCSPDU_TokenReleaseRequest = 39,
100 DomainMCSPDU_TokenReleaseConfirm = 40,
101 DomainMCSPDU_TokenTestRequest = 41,
102 DomainMCSPDU_TokenTestConfirm = 42,
103 DomainMCSPDU_enum_length = 43
108 UINT32 maxChannelIds;
111 UINT32 numPriorities;
112 UINT32 minThroughput;
114 UINT32 maxMCSPDUsize;
115 UINT32 protocolVersion;
120 char Name[CHANNEL_NAME_LEN + 1];
130 rdpTransport* transport;
133 UINT16 baseChannelId;
134 UINT16 messageChannelId;
143 BOOL userChannelJoined;
144 BOOL globalChannelJoined;
145 BOOL messageChannelJoined;
148 UINT32 channelMaxCount;
149 rdpMcsChannel* channels;
152 #define MCS_SEND_DATA_HEADER_MAX_LENGTH 8
154 #define MCS_TYPE_CONNECT_INITIAL 0x65
155 #define MCS_TYPE_CONNECT_RESPONSE 0x66
157 const char* mcs_domain_pdu_string(DomainMCSPDU pdu);
158 BOOL mcs_server_apply_to_settings(
const rdpMcs* mcs, rdpSettings* settings);
160 FREERDP_LOCAL BOOL mcs_recv_connect_initial(rdpMcs* mcs,
wStream* s);
161 FREERDP_LOCAL BOOL mcs_recv_connect_response(rdpMcs* mcs,
wStream* s);
162 FREERDP_LOCAL BOOL mcs_send_connect_response(rdpMcs* mcs);
163 FREERDP_LOCAL BOOL mcs_recv_erect_domain_request(rdpMcs* mcs,
wStream* s);
164 FREERDP_LOCAL BOOL mcs_send_erect_domain_request(rdpMcs* mcs);
165 FREERDP_LOCAL BOOL mcs_recv_attach_user_request(rdpMcs* mcs,
wStream* s);
166 FREERDP_LOCAL BOOL mcs_send_attach_user_request(rdpMcs* mcs);
167 FREERDP_LOCAL BOOL mcs_recv_attach_user_confirm(rdpMcs* mcs,
wStream* s);
168 FREERDP_LOCAL BOOL mcs_send_attach_user_confirm(rdpMcs* mcs);
169 FREERDP_LOCAL BOOL mcs_recv_channel_join_request(rdpMcs* mcs,
const rdpSettings* settings,
170 wStream* s, UINT16* channelId);
171 FREERDP_LOCAL BOOL mcs_send_channel_join_request(rdpMcs* mcs, UINT16 channelId);
172 FREERDP_LOCAL BOOL mcs_recv_channel_join_confirm(rdpMcs* mcs,
wStream* s, UINT16* channelId);
173 FREERDP_LOCAL BOOL mcs_send_channel_join_confirm(rdpMcs* mcs, UINT16 channelId);
174 FREERDP_LOCAL BOOL mcs_recv_disconnect_provider_ultimatum(rdpMcs* mcs,
wStream* s,
int* reason);
175 FREERDP_LOCAL BOOL mcs_send_disconnect_provider_ultimatum(rdpMcs* mcs);
177 FREERDP_LOCAL BOOL mcs_write_domain_mcspdu_header(
wStream* s, DomainMCSPDU domainMCSPDU,
178 UINT16 length, BYTE options);
180 FREERDP_LOCAL BOOL mcs_client_begin(rdpMcs* mcs);
182 FREERDP_LOCAL
void mcs_free(rdpMcs* mcs);
184 WINPR_ATTR_MALLOC(mcs_free, 1)
185 FREERDP_LOCAL rdpMcs* mcs_new(rdpTransport* transport);