FreeRDP/channels/serial/client/serial_tty.h

80 lines
2.0 KiB
C
Raw Normal View History

2011-10-04 22:15:15 +04:00
/**
2012-10-09 07:02:04 +04:00
* FreeRDP: A Remote Desktop Protocol Implementation
2011-10-04 22:15:15 +04:00
* Serial Port Device Service Virtual Channel
*
* Copyright 2011 O.S. Systems Software Ltda.
* Copyright 2011 Eduardo Fiss Beloni <beloni@ossystems.com.br>
*
* 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 __SERIAL_TTY_H
#define __SERIAL_TTY_H
#include <sys/types.h>
#include <sys/stat.h>
#ifndef _WIN32
2011-10-04 22:15:15 +04:00
#include <dirent.h>
#endif
2011-10-04 22:15:15 +04:00
2012-10-09 05:00:07 +04:00
#include <freerdp/types.h>
#include <winpr/stream.h>
2012-10-09 05:00:07 +04:00
2011-10-04 22:15:15 +04:00
typedef struct _SERIAL_TTY SERIAL_TTY;
2012-10-09 05:00:07 +04:00
2011-10-04 22:15:15 +04:00
struct _SERIAL_TTY
{
2012-10-09 11:26:39 +04:00
UINT32 id;
2011-10-04 22:15:15 +04:00
int fd;
int dtr;
int rts;
2012-10-09 11:26:39 +04:00
UINT32 control;
UINT32 xonoff;
UINT32 onlimit;
UINT32 offlimit;
UINT32 baud_rate;
UINT32 queue_in_size;
UINT32 queue_out_size;
UINT32 wait_mask;
UINT32 read_interval_timeout;
UINT32 read_total_timeout_multiplier;
UINT32 read_total_timeout_constant;
UINT32 write_total_timeout_multiplier;
UINT32 write_total_timeout_constant;
BYTE stop_bits;
BYTE parity;
BYTE word_length;
BYTE chars[6];
2011-10-04 22:15:15 +04:00
struct termios* ptermios;
struct termios* pold_termios;
int event_txempty;
int event_cts;
int event_dsr;
int event_rlsd;
int event_pending;
};
2012-10-09 11:26:39 +04:00
SERIAL_TTY* serial_tty_new(const char* path, UINT32 id);
2011-10-04 22:15:15 +04:00
void serial_tty_free(SERIAL_TTY* tty);
2012-10-09 11:26:39 +04:00
BOOL serial_tty_read(SERIAL_TTY* tty, BYTE* buffer, UINT32* Length);
BOOL serial_tty_write(SERIAL_TTY* tty, BYTE* buffer, UINT32 Length);
UINT32 serial_tty_control(SERIAL_TTY* tty, UINT32 IoControlCode, wStream* input, wStream* output, UINT32* abort_io);
2011-10-04 22:15:15 +04:00
2012-10-09 11:26:39 +04:00
BOOL serial_tty_get_event(SERIAL_TTY* tty, UINT32* result);
2011-10-04 22:15:15 +04:00
#endif /* __SERIAL_TTY_H */