1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
/**
* xrdp: A Remote Desktop Protocol server.
*
* Copyright (C) Laxmikant Rashinkar 2012 LK.Rashinkar@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 _DRDYNVC_H_
#define _DRDYNVC_H_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "arch.h"
#include "chansrv.h"
#include "xcommon.h"
#include "log.h"
#include "os_calls.h"
#include "trans.h"
/* move this to tsmf.c */
#define TSMF_CHAN_ID 0x1000
/* get number of bytes in stream before s->p */
#define stream_length_before_p(s) (int) ((s)->p - (s)->data)
/* get number of bytes in stream after s->p */
#define stream_length_after_p(s) (int) ((s)->end - (s)->p)
#define rewind_stream(s) do \
{ \
(s)->p = (s)->data; \
(s)->end = (s)->data; \
} while (0)
/* max number of bytes we can send in one pkt */
#define MAX_PDU_SIZE 1600
/* commands used to manage dynamic virtual channels */
#define CMD_DVC_OPEN_CHANNEL 0x10
#define CMD_DVC_DATA_FIRST 0x20
#define CMD_DVC_DATA 0x30
#define CMD_DVC_CLOSE_CHANNEL 0x40
#define CMD_DVC_CAPABILITY 0x50
int APP_CC drdynvc_init(void);
static int APP_CC drdynvc_send_capability_request(uint16_t version);
static int APP_CC drdynvc_process_capability_response(struct stream* s,
unsigned char cmd);
int APP_CC drdynvc_send_open_channel_request(int chan_pri, unsigned int chan_id,
char *chan_name);
static int APP_CC drdynvc_process_open_channel_response(struct stream *s,
unsigned char cmd);
int APP_CC drdynvc_send_close_channel_request(unsigned int chan_id);
static int APP_CC drdynvc_process_close_channel_response(struct stream *s,
unsigned char cmd);
int APP_CC drdynvc_write_data(uint32_t chan_id, char *data, int data_size);
int APP_CC drdynvc_data_in(struct stream* s, int chan_id, int chan_flags,
int length, int total_length);
static int APP_CC drdynvc_process_data_first(struct stream* s, unsigned char cmd);
static int APP_CC drdynvc_process_data(struct stream* s, unsigned char cmd);
static int APP_CC drdynvc_insert_uint_124(struct stream *s, uint32_t val);
static int APP_CC drdynvc_get_chan_id(struct stream *s, char cmd, uint32_t *chan_id_p);
#endif
|