xrdp/sesman/chansrv/drdynvc.h
Laxmikant Rashinkar 5b0eaa4a9b o added support for dynamic virtual channels
o added echo test routine in simple.c for testing DVC using Microsoft's ECHO protocol
2012-09-27 19:48:44 -07:00

88 lines
2.9 KiB
C

/**
* 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