2012-07-25 06:16:00 +04:00
|
|
|
/**
|
|
|
|
* xrdp: A Remote Desktop Protocol server.
|
|
|
|
*
|
2013-09-08 10:54:36 +04:00
|
|
|
* Copyright (C) Jay Sorg 2009-2013
|
|
|
|
* Copyright (C) Laxmikant Rashinkar 2009-2013
|
2012-07-25 06:16:00 +04:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2009-04-19 21:16:46 +04:00
|
|
|
|
|
|
|
#if !defined(CHANSRV_H)
|
|
|
|
#define CHANSRV_H
|
|
|
|
|
|
|
|
#include "arch.h"
|
|
|
|
#include "parse.h"
|
2012-08-20 06:45:31 +04:00
|
|
|
#include "log.h"
|
2009-04-19 21:16:46 +04:00
|
|
|
|
2012-09-28 06:48:44 +04:00
|
|
|
#define MAX_DVC_CHANNELS 32
|
|
|
|
|
2012-08-20 06:45:31 +04:00
|
|
|
struct chan_out_data
|
|
|
|
{
|
2012-09-28 06:48:44 +04:00
|
|
|
struct stream *s;
|
|
|
|
struct chan_out_data *next;
|
2012-08-20 06:45:31 +04:00
|
|
|
};
|
2012-07-23 10:20:38 +04:00
|
|
|
|
2009-04-19 21:16:46 +04:00
|
|
|
struct chan_item
|
|
|
|
{
|
2012-09-28 06:48:44 +04:00
|
|
|
int id;
|
|
|
|
int flags;
|
|
|
|
char name[16];
|
|
|
|
struct chan_out_data *head;
|
|
|
|
struct chan_out_data *tail;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* data in struct trans::callback_data */
|
|
|
|
struct xrdp_api_data
|
|
|
|
{
|
|
|
|
int chan_id;
|
|
|
|
char header[64];
|
|
|
|
int flags;
|
|
|
|
|
|
|
|
/* for dynamic virtual channels */
|
|
|
|
struct trans *transp;
|
2012-10-22 09:16:14 +04:00
|
|
|
int dvc_chan_id;
|
2012-09-28 06:48:44 +04:00
|
|
|
int is_connected;
|
2009-04-19 21:16:46 +04:00
|
|
|
};
|
|
|
|
|
2013-08-18 00:32:53 +04:00
|
|
|
int DEFAULT_CC
|
|
|
|
g_is_term(void);
|
|
|
|
|
2012-09-28 06:48:44 +04:00
|
|
|
int APP_CC send_channel_data(int chan_id, char *data, int size);
|
2013-06-30 23:36:01 +04:00
|
|
|
int APP_CC send_rail_drawing_orders(char* data, int size);
|
2012-09-28 06:48:44 +04:00
|
|
|
int APP_CC main_cleanup(void);
|
2013-09-08 10:54:36 +04:00
|
|
|
int APP_CC add_timeout(int msoffset, void (*callback)(void* data), void* data);
|
2016-12-23 20:52:22 +03:00
|
|
|
int APP_CC find_empty_slot_in_dvc_channels(void);
|
2013-07-24 07:57:38 +04:00
|
|
|
struct xrdp_api_data * APP_CC struct_from_dvc_chan_id(tui32 dvc_chan_id);
|
2012-10-05 21:13:53 +04:00
|
|
|
int remove_struct_with_chan_id(tui32 dvc_chan_id);
|
2009-04-19 21:16:46 +04:00
|
|
|
|
2009-09-02 06:52:30 +04:00
|
|
|
#define LOG_LEVEL 5
|
2009-08-27 06:15:49 +04:00
|
|
|
|
|
|
|
#define LOG(_a, _params) \
|
2012-09-28 06:48:44 +04:00
|
|
|
{ \
|
|
|
|
if (_a < LOG_LEVEL) \
|
|
|
|
{ \
|
|
|
|
g_write("xrdp-chansrv [%10.10u]: ", g_time3()); \
|
|
|
|
g_writeln _params ; \
|
|
|
|
} \
|
|
|
|
}
|
2009-08-27 06:15:49 +04:00
|
|
|
|
2012-07-23 10:20:38 +04:00
|
|
|
#define LOGM(_args) do { log_message _args ; } while (0)
|
|
|
|
|
2012-08-09 09:21:32 +04:00
|
|
|
#ifndef GSET_UINT8
|
|
|
|
#define GSET_UINT8(_ptr, _offset, _data) \
|
2012-09-28 06:48:44 +04:00
|
|
|
*((unsigned char*) (((unsigned char*)(_ptr)) + (_offset))) = (unsigned char)(_data)
|
2012-08-09 09:21:32 +04:00
|
|
|
#define GGET_UINT8(_ptr, _offset) \
|
2012-09-28 06:48:44 +04:00
|
|
|
(*((unsigned char*) (((unsigned char*)(_ptr)) + (_offset))))
|
2012-08-09 09:21:32 +04:00
|
|
|
#define GSET_UINT16(_ptr, _offset, _data) \
|
2012-09-28 06:48:44 +04:00
|
|
|
GSET_UINT8(_ptr, _offset, _data); \
|
|
|
|
GSET_UINT8(_ptr, (_offset) + 1, (_data) >> 8)
|
2012-08-09 09:21:32 +04:00
|
|
|
#define GGET_UINT16(_ptr, _offset) \
|
2012-09-28 06:48:44 +04:00
|
|
|
(GGET_UINT8(_ptr, _offset)) | \
|
|
|
|
((GGET_UINT8(_ptr, (_offset) + 1)) << 8)
|
2012-08-09 09:21:32 +04:00
|
|
|
#define GSET_UINT32(_ptr, _offset, _data) \
|
2012-09-28 06:48:44 +04:00
|
|
|
GSET_UINT16(_ptr, _offset, _data); \
|
|
|
|
GSET_UINT16(_ptr, (_offset) + 2, (_data) >> 16)
|
2012-08-09 09:21:32 +04:00
|
|
|
#define GGET_UINT32(_ptr, _offset) \
|
2012-09-28 06:48:44 +04:00
|
|
|
(GGET_UINT16(_ptr, _offset)) | \
|
|
|
|
((GGET_UINT16(_ptr, (_offset) + 2)) << 16)
|
2012-08-09 09:21:32 +04:00
|
|
|
#endif
|
|
|
|
|
2009-04-19 21:16:46 +04:00
|
|
|
#endif
|