2011-07-04 06:47:35 +04:00
|
|
|
/**
|
2012-10-09 07:02:04 +04:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2011-07-04 06:47:35 +04:00
|
|
|
* T.125 Multipoint Communication Service (MCS) Protocol
|
|
|
|
*
|
|
|
|
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MCS_H
|
|
|
|
#define __MCS_H
|
|
|
|
|
2013-11-15 08:05:29 +04:00
|
|
|
typedef struct rdp_mcs rdpMcs;
|
|
|
|
|
2011-07-07 23:35:09 +04:00
|
|
|
#include "transport.h"
|
2013-03-22 00:45:25 +04:00
|
|
|
|
2012-02-17 09:58:30 +04:00
|
|
|
#include <freerdp/crypto/ber.h>
|
2011-07-04 06:47:35 +04:00
|
|
|
|
2011-07-07 23:51:23 +04:00
|
|
|
#include <freerdp/types.h>
|
2013-03-22 00:45:25 +04:00
|
|
|
|
|
|
|
#include <winpr/stream.h>
|
2011-07-04 06:47:35 +04:00
|
|
|
|
2011-07-10 07:54:23 +04:00
|
|
|
#define MCS_BASE_CHANNEL_ID 1001
|
2011-07-10 20:10:24 +04:00
|
|
|
#define MCS_GLOBAL_CHANNEL_ID 1003
|
2011-07-10 07:54:23 +04:00
|
|
|
|
|
|
|
enum MCS_Result
|
|
|
|
{
|
|
|
|
MCS_Result_successful = 0,
|
|
|
|
MCS_Result_domain_merging = 1,
|
|
|
|
MCS_Result_domain_not_hierarchical = 2,
|
|
|
|
MCS_Result_no_such_channel = 3,
|
|
|
|
MCS_Result_no_such_domain = 4,
|
|
|
|
MCS_Result_no_such_user = 5,
|
|
|
|
MCS_Result_not_admitted = 6,
|
|
|
|
MCS_Result_other_user_id = 7,
|
|
|
|
MCS_Result_parameters_unacceptable = 8,
|
|
|
|
MCS_Result_token_not_available = 9,
|
|
|
|
MCS_Result_token_not_possessed = 10,
|
|
|
|
MCS_Result_too_many_channels = 11,
|
|
|
|
MCS_Result_too_many_tokens = 12,
|
|
|
|
MCS_Result_too_many_users = 13,
|
|
|
|
MCS_Result_unspecified_failure = 14,
|
|
|
|
MCS_Result_user_rejected = 15,
|
|
|
|
MCS_Result_enum_length = 16
|
|
|
|
};
|
|
|
|
|
2013-11-15 08:05:29 +04:00
|
|
|
enum MCS_Reason
|
|
|
|
{
|
|
|
|
MCS_Reason_domain_disconnected = 0,
|
|
|
|
MCS_Reason_provider_initiated = 1,
|
|
|
|
MCS_Reason_token_purged = 2,
|
|
|
|
MCS_Reason_user_requested = 3,
|
|
|
|
MCS_Reason_channel_purged = 4
|
|
|
|
};
|
|
|
|
|
2011-07-10 07:54:23 +04:00
|
|
|
enum DomainMCSPDU
|
|
|
|
{
|
|
|
|
DomainMCSPDU_PlumbDomainIndication = 0,
|
|
|
|
DomainMCSPDU_ErectDomainRequest = 1,
|
|
|
|
DomainMCSPDU_MergeChannelsRequest = 2,
|
|
|
|
DomainMCSPDU_MergeChannelsConfirm = 3,
|
|
|
|
DomainMCSPDU_PurgeChannelsIndication = 4,
|
|
|
|
DomainMCSPDU_MergeTokensRequest = 5,
|
|
|
|
DomainMCSPDU_MergeTokensConfirm = 6,
|
|
|
|
DomainMCSPDU_PurgeTokensIndication = 7,
|
|
|
|
DomainMCSPDU_DisconnectProviderUltimatum = 8,
|
|
|
|
DomainMCSPDU_RejectMCSPDUUltimatum = 9,
|
|
|
|
DomainMCSPDU_AttachUserRequest = 10,
|
|
|
|
DomainMCSPDU_AttachUserConfirm = 11,
|
|
|
|
DomainMCSPDU_DetachUserRequest = 12,
|
|
|
|
DomainMCSPDU_DetachUserIndication = 13,
|
|
|
|
DomainMCSPDU_ChannelJoinRequest = 14,
|
|
|
|
DomainMCSPDU_ChannelJoinConfirm = 15,
|
|
|
|
DomainMCSPDU_ChannelLeaveRequest = 16,
|
|
|
|
DomainMCSPDU_ChannelConveneRequest = 17,
|
|
|
|
DomainMCSPDU_ChannelConveneConfirm = 18,
|
|
|
|
DomainMCSPDU_ChannelDisbandRequest = 19,
|
|
|
|
DomainMCSPDU_ChannelDisbandIndication = 20,
|
|
|
|
DomainMCSPDU_ChannelAdmitRequest = 21,
|
|
|
|
DomainMCSPDU_ChannelAdmitIndication = 22,
|
|
|
|
DomainMCSPDU_ChannelExpelRequest = 23,
|
|
|
|
DomainMCSPDU_ChannelExpelIndication = 24,
|
|
|
|
DomainMCSPDU_SendDataRequest = 25,
|
|
|
|
DomainMCSPDU_SendDataIndication = 26,
|
|
|
|
DomainMCSPDU_UniformSendDataRequest = 27,
|
|
|
|
DomainMCSPDU_UniformSendDataIndication = 28,
|
|
|
|
DomainMCSPDU_TokenGrabRequest = 29,
|
|
|
|
DomainMCSPDU_TokenGrabConfirm = 30,
|
|
|
|
DomainMCSPDU_TokenInhibitRequest = 31,
|
|
|
|
DomainMCSPDU_TokenInhibitConfirm = 32,
|
|
|
|
DomainMCSPDU_TokenGiveRequest = 33,
|
|
|
|
DomainMCSPDU_TokenGiveIndication = 34,
|
|
|
|
DomainMCSPDU_TokenGiveResponse = 35,
|
|
|
|
DomainMCSPDU_TokenGiveConfirm = 36,
|
|
|
|
DomainMCSPDU_TokenPleaseRequest = 37,
|
|
|
|
DomainMCSPDU_TokenPleaseConfirm = 38,
|
|
|
|
DomainMCSPDU_TokenReleaseRequest = 39,
|
|
|
|
DomainMCSPDU_TokenReleaseConfirm = 40,
|
|
|
|
DomainMCSPDU_TokenTestRequest = 41,
|
|
|
|
DomainMCSPDU_TokenTestConfirm = 42,
|
|
|
|
DomainMCSPDU_enum_length = 43
|
|
|
|
};
|
|
|
|
|
2011-07-07 23:35:09 +04:00
|
|
|
typedef struct
|
|
|
|
{
|
2012-10-09 11:26:39 +04:00
|
|
|
UINT32 maxChannelIds;
|
|
|
|
UINT32 maxUserIds;
|
|
|
|
UINT32 maxTokenIds;
|
|
|
|
UINT32 numPriorities;
|
|
|
|
UINT32 minThroughput;
|
|
|
|
UINT32 maxHeight;
|
|
|
|
UINT32 maxMCSPDUsize;
|
|
|
|
UINT32 protocolVersion;
|
2011-07-10 07:54:23 +04:00
|
|
|
} DomainParameters;
|
2011-07-07 23:35:09 +04:00
|
|
|
|
2014-02-16 01:32:38 +04:00
|
|
|
struct rdp_mcs_channel
|
|
|
|
{
|
|
|
|
char Name[8];
|
|
|
|
UINT32 options;
|
|
|
|
int ChannelId;
|
|
|
|
BOOL joined;
|
|
|
|
void* handle;
|
|
|
|
};
|
|
|
|
typedef struct rdp_mcs_channel rdpMcsChannel;
|
|
|
|
|
2011-07-07 23:35:09 +04:00
|
|
|
struct rdp_mcs
|
|
|
|
{
|
2013-11-15 08:05:29 +04:00
|
|
|
rdpTransport* transport;
|
2014-02-14 02:50:38 +04:00
|
|
|
rdpSettings* settings;
|
2014-01-26 02:08:43 +04:00
|
|
|
|
2014-02-14 02:06:33 +04:00
|
|
|
UINT16 userId;
|
|
|
|
UINT16 messageChannelId;
|
2014-01-26 02:08:43 +04:00
|
|
|
|
2011-07-10 07:54:23 +04:00
|
|
|
DomainParameters domainParameters;
|
|
|
|
DomainParameters targetParameters;
|
|
|
|
DomainParameters minimumParameters;
|
|
|
|
DomainParameters maximumParameters;
|
2011-08-20 10:05:03 +04:00
|
|
|
|
2014-02-14 02:06:33 +04:00
|
|
|
BOOL userChannelJoined;
|
|
|
|
BOOL globalChannelJoined;
|
|
|
|
BOOL messageChannelJoined;
|
2014-02-16 01:32:38 +04:00
|
|
|
|
|
|
|
UINT32 channelCount;
|
|
|
|
UINT32 channelMaxCount;
|
|
|
|
rdpMcsChannel* channels;
|
2011-07-07 23:35:09 +04:00
|
|
|
};
|
|
|
|
|
2012-01-25 14:12:37 +04:00
|
|
|
#define MCS_SEND_DATA_HEADER_MAX_LENGTH 8
|
2011-07-12 02:46:36 +04:00
|
|
|
|
2011-07-07 23:35:09 +04:00
|
|
|
#define MCS_TYPE_CONNECT_INITIAL 0x65
|
|
|
|
#define MCS_TYPE_CONNECT_RESPONSE 0x66
|
|
|
|
|
2014-02-14 02:06:33 +04:00
|
|
|
BOOL mcs_merge_domain_parameters(DomainParameters* targetParameters, DomainParameters* minimumParameters,
|
|
|
|
DomainParameters* maximumParameters, DomainParameters* pOutParameters);
|
|
|
|
|
|
|
|
void mcs_write_connect_initial(wStream* s, rdpMcs* mcs, wStream* userData);
|
|
|
|
void mcs_write_connect_response(wStream* s, rdpMcs* mcs, wStream* userData);
|
2011-07-07 23:35:09 +04:00
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL mcs_recv_connect_initial(rdpMcs* mcs, wStream* s);
|
2012-10-09 10:38:39 +04:00
|
|
|
BOOL mcs_send_connect_initial(rdpMcs* mcs);
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL mcs_recv_connect_response(rdpMcs* mcs, wStream* s);
|
2012-10-09 10:38:39 +04:00
|
|
|
BOOL mcs_send_connect_response(rdpMcs* mcs);
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL mcs_recv_erect_domain_request(rdpMcs* mcs, wStream* s);
|
2012-10-09 10:38:39 +04:00
|
|
|
BOOL mcs_send_erect_domain_request(rdpMcs* mcs);
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL mcs_recv_attach_user_request(rdpMcs* mcs, wStream* s);
|
2012-10-09 10:38:39 +04:00
|
|
|
BOOL mcs_send_attach_user_request(rdpMcs* mcs);
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL mcs_recv_attach_user_confirm(rdpMcs* mcs, wStream* s);
|
2012-10-09 10:38:39 +04:00
|
|
|
BOOL mcs_send_attach_user_confirm(rdpMcs* mcs);
|
2014-02-14 02:06:33 +04:00
|
|
|
BOOL mcs_recv_channel_join_request(rdpMcs* mcs, wStream* s, UINT16* channelId);
|
|
|
|
BOOL mcs_send_channel_join_request(rdpMcs* mcs, UINT16 channelId);
|
|
|
|
BOOL mcs_recv_channel_join_confirm(rdpMcs* mcs, wStream* s, UINT16* channelId);
|
|
|
|
BOOL mcs_send_channel_join_confirm(rdpMcs* mcs, UINT16 channelId);
|
2013-11-15 08:05:29 +04:00
|
|
|
BOOL mcs_recv_disconnect_provider_ultimatum(rdpMcs* mcs, wStream* s, int* reason);
|
2012-10-09 10:38:39 +04:00
|
|
|
BOOL mcs_send_disconnect_provider_ultimatum(rdpMcs* mcs);
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL mcs_read_domain_mcspdu_header(wStream* s, enum DomainMCSPDU* domainMCSPDU, UINT16* length);
|
|
|
|
void mcs_write_domain_mcspdu_header(wStream* s, enum DomainMCSPDU domainMCSPDU, UINT16 length, BYTE options);
|
2011-07-08 23:32:06 +04:00
|
|
|
|
2011-07-07 23:35:09 +04:00
|
|
|
rdpMcs* mcs_new(rdpTransport* transport);
|
|
|
|
void mcs_free(rdpMcs* mcs);
|
2011-07-04 06:47:35 +04:00
|
|
|
|
|
|
|
#endif /* __MCS_H */
|