libfreerdp-core: construction and sending of MCS Connect-Initial

This commit is contained in:
Marc-André Moreau 2011-07-07 19:32:51 -04:00
parent 7b71f3cdbd
commit 9160411803
5 changed files with 58 additions and 28 deletions

View File

@ -22,11 +22,13 @@
#include "tpkt.h"
#include "nego.h"
#include "mcs.h"
#include "transport.h"
#include <freerdp/settings.h>
#include <freerdp/utils/memory.h>
rdpMcs* mcs;
rdpNego* nego;
rdpSettings* settings;
rdpTransport* transport;
@ -75,5 +77,8 @@ int main(int argc, char* argv[])
transport_connect_nla(transport);
mcs = mcs_new(transport);
mcs_send_connect_initial(mcs);
return 0;
}

View File

@ -105,8 +105,7 @@ uint8 t124_02_98_oid[6] = { 0, 0, 20, 124, 0, 1 };
* @param user_data client data blocks
*/
void
gcc_write_create_conference_request(STREAM* s, STREAM* user_data)
void gcc_write_create_conference_request(STREAM* s, STREAM* user_data)
{
/* ConnectData */
per_write_choice(s, 0); /* From Key select object (0) of type OBJECT_IDENTIFIER */
@ -142,8 +141,7 @@ gcc_write_create_conference_request(STREAM* s, STREAM* user_data)
* @param length data block length
*/
void
gcc_write_user_data_header(STREAM* s, uint16 type, uint16 length)
void gcc_write_user_data_header(STREAM* s, uint16 type, uint16 length)
{
stream_write_uint16(s, type); /* type */
stream_write_uint16(s, length); /* length */
@ -156,8 +154,7 @@ gcc_write_user_data_header(STREAM* s, uint16 type, uint16 length)
* @param settings rdp settings
*/
void
gcc_write_client_core_data(STREAM* s, rdpSettings *settings)
void gcc_write_client_core_data(STREAM* s, rdpSettings *settings)
{
uint32 version;
uint16 highColorDepth;
@ -223,8 +220,7 @@ gcc_write_client_core_data(STREAM* s, rdpSettings *settings)
* @param settings rdp settings
*/
void
gcc_write_client_security_data(STREAM* s, rdpSettings *settings)
void gcc_write_client_security_data(STREAM* s, rdpSettings *settings)
{
uint16 encryptionMethods;
@ -252,8 +248,7 @@ gcc_write_client_security_data(STREAM* s, rdpSettings *settings)
* @param settings rdp settings
*/
void
gcc_write_client_network_data(STREAM* s, rdpSettings *settings)
void gcc_write_client_network_data(STREAM* s, rdpSettings *settings)
{
int i;
uint16 length;
@ -282,8 +277,7 @@ gcc_write_client_network_data(STREAM* s, rdpSettings *settings)
* @param settings rdp settings
*/
void
gcc_write_client_cluster_data(STREAM* s, rdpSettings *settings)
void gcc_write_client_cluster_data(STREAM* s, rdpSettings *settings)
{
uint32 flags;
uint32 redirectedSessionID;
@ -306,8 +300,7 @@ gcc_write_client_cluster_data(STREAM* s, rdpSettings *settings)
* @param settings rdp settings
*/
void
gcc_write_client_monitor_data(STREAM* s, rdpSettings *settings)
void gcc_write_client_monitor_data(STREAM* s, rdpSettings *settings)
{
int i;
uint16 length;

View File

@ -105,20 +105,13 @@
/* Monitor Flags */
#define MONITOR_PRIMARY 0x00000001
void
gcc_write_create_conference_request(STREAM* s, STREAM* user_data);
void gcc_write_create_conference_request(STREAM* s, STREAM* user_data);
void
gcc_write_user_data_header(STREAM* s, uint16 type, uint16 length);
void
gcc_write_client_core_data(STREAM* s, rdpSettings *settings);
void
gcc_write_client_security_data(STREAM* s, rdpSettings *settings);
void
gcc_write_client_network_data(STREAM* s, rdpSettings *settings);
void
gcc_write_client_cluster_data(STREAM* s, rdpSettings *settings);
void
gcc_write_client_monitor_data(STREAM* s, rdpSettings *settings);
void gcc_write_user_data_header(STREAM* s, uint16 type, uint16 length);
void gcc_write_client_core_data(STREAM* s, rdpSettings *settings);
void gcc_write_client_security_data(STREAM* s, rdpSettings *settings);
void gcc_write_client_network_data(STREAM* s, rdpSettings *settings);
void gcc_write_client_cluster_data(STREAM* s, rdpSettings *settings);
void gcc_write_client_monitor_data(STREAM* s, rdpSettings *settings);
#endif /* __GCC_H */

View File

@ -17,6 +17,8 @@
* limitations under the License.
*/
#include "gcc.h"
#include "mcs.h"
/**
@ -148,6 +150,41 @@ void mcs_write_connect_initial(STREAM* s, rdpMcs* mcs, STREAM* user_data)
ber_write_octet_string(s, user_data->data, gcc_CCrq_length);
}
void mcs_send_connect_initial(rdpMcs* mcs)
{
STREAM* s;
int length;
uint8 *bm, *em;
STREAM* gcc_CCrq;
STREAM* client_data;
client_data = stream_new(512);
gcc_write_client_core_data(client_data, mcs->transport->settings);
gcc_write_client_security_data(client_data, mcs->transport->settings);
gcc_write_client_network_data(client_data, mcs->transport->settings);
gcc_write_client_cluster_data(client_data, mcs->transport->settings);
gcc_write_client_monitor_data(client_data, mcs->transport->settings);
gcc_CCrq = stream_new(512);
gcc_write_create_conference_request(gcc_CCrq, client_data);
length = stream_get_length(gcc_CCrq) + 7;
s = stream_new(512);
stream_get_mark(s, bm);
stream_seek(s, 7);
mcs_write_connect_initial(s, mcs, gcc_CCrq);
stream_get_mark(s, em);
length = (em - bm) + 7;
stream_set_mark(s, bm);
tpkt_write_header(s, length);
tpdu_write_connection_request(s, length - 5);
stream_set_mark(s, em);
tls_write(mcs->transport->tls, s->data, stream_get_length(s));
}
/**
* Instantiate new MCS module.
* @param transport transport

View File

@ -52,6 +52,8 @@ typedef struct rdp_mcs rdpMcs;
void mcs_write_connect_initial(STREAM* s, rdpMcs* mcs, STREAM* user_data);
void mcs_send_connect_initial(rdpMcs* mcs);
rdpMcs* mcs_new(rdpTransport* transport);
void mcs_free(rdpMcs* mcs);