cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

comm.h (18736B)


      1/**
      2 * WinPR: Windows Portable Runtime
      3 * Serial Communication API
      4 *
      5 * Copyright 2011 O.S. Systems Software Ltda.
      6 * Copyright 2011 Eduardo Fiss Beloni <beloni@ossystems.com.br>
      7 * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
      8 * Copyright 2014 Hewlett-Packard Development Company, L.P.
      9 *
     10 * Licensed under the Apache License, Version 2.0 (the "License");
     11 * you may not use this file except in compliance with the License.
     12 * You may obtain a copy of the License at
     13 *
     14 *     http://www.apache.org/licenses/LICENSE-2.0
     15 *
     16 * Unless required by applicable law or agreed to in writing, software
     17 * distributed under the License is distributed on an "AS IS" BASIS,
     18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     19 * See the License for the specific language governing permissions and
     20 * limitations under the License.
     21 */
     22
     23#ifndef WINPR_COMM_H
     24#define WINPR_COMM_H
     25
     26#include <winpr/collections.h>
     27#include <winpr/file.h>
     28#include <winpr/winpr.h>
     29#include <winpr/wtypes.h>
     30
     31#if defined __linux__ && !defined ANDROID
     32
     33#define NOPARITY 0
     34#define ODDPARITY 1
     35#define EVENPARITY 2
     36#define MARKPARITY 3
     37#define SPACEPARITY 4
     38
     39#define ONESTOPBIT 0
     40#define ONE5STOPBITS 1
     41#define TWOSTOPBITS 2
     42
     43#ifndef IGNORE
     44#define IGNORE 0
     45#endif
     46
     47#define CBR_110 110
     48#define CBR_300 300
     49#define CBR_600 600
     50#define CBR_1200 1200
     51#define CBR_2400 2400
     52#define CBR_4800 4800
     53#define CBR_9600 9600
     54#define CBR_14400 14400
     55#define CBR_19200 19200
     56#define CBR_38400 38400
     57#define CBR_56000 56000
     58#define CBR_57600 57600
     59#define CBR_115200 115200
     60#define CBR_128000 128000
     61#define CBR_256000 256000
     62
     63#define CE_RXOVER 0x0001
     64#define CE_OVERRUN 0x0002
     65#define CE_RXPARITY 0x0004
     66#define CE_FRAME 0x0008
     67#define CE_BREAK 0x0010
     68#define CE_TXFULL 0x0100
     69#define CE_PTO 0x0200
     70#define CE_IOE 0x0400
     71#define CE_DNS 0x0800
     72#define CE_OOP 0x1000
     73#define CE_MODE 0x8000
     74
     75#define IE_BADID (-1)
     76#define IE_OPEN (-2)
     77#define IE_NOPEN (-3)
     78#define IE_MEMORY (-4)
     79#define IE_DEFAULT (-5)
     80#define IE_HARDWARE (-10)
     81#define IE_BYTESIZE (-11)
     82#define IE_BAUDRATE (-12)
     83
     84#define EV_RXCHAR 0x0001
     85#define EV_RXFLAG 0x0002
     86#define EV_TXEMPTY 0x0004
     87#define EV_CTS 0x0008
     88#define EV_DSR 0x0010
     89#define EV_RLSD 0x0020
     90#define EV_BREAK 0x0040
     91#define EV_ERR 0x0080
     92#define EV_RING 0x0100
     93#define EV_PERR 0x0200
     94#define EV_RX80FULL 0x0400
     95#define EV_EVENT1 0x0800
     96#define EV_EVENT2 0x1000
     97
     98#define SETXOFF 1
     99#define SETXON 2
    100#define SETRTS 3
    101#define CLRRTS 4
    102#define SETDTR 5
    103#define CLRDTR 6
    104#define RESETDEV 7
    105#define SETBREAK 8
    106#define CLRBREAK 9
    107
    108#define PURGE_TXABORT 0x0001
    109#define PURGE_RXABORT 0x0002
    110#define PURGE_TXCLEAR 0x0004
    111#define PURGE_RXCLEAR 0x0008
    112
    113#define LPTx 0x80
    114
    115#define MS_CTS_ON ((DWORD)0x0010)
    116#define MS_DSR_ON ((DWORD)0x0020)
    117#define MS_RING_ON ((DWORD)0x0040)
    118#define MS_RLSD_ON ((DWORD)0x0080)
    119
    120#define SP_SERIALCOMM ((DWORD)0x00000001)
    121
    122#define PST_UNSPECIFIED ((DWORD)0x00000000)
    123#define PST_RS232 ((DWORD)0x00000001)
    124#define PST_PARALLELPORT ((DWORD)0x00000002)
    125#define PST_RS422 ((DWORD)0x00000003)
    126#define PST_RS423 ((DWORD)0x00000004)
    127#define PST_RS449 ((DWORD)0x00000005)
    128#define PST_MODEM ((DWORD)0x00000006)
    129#define PST_FAX ((DWORD)0x00000021)
    130#define PST_SCANNER ((DWORD)0x00000022)
    131#define PST_NETWORK_BRIDGE ((DWORD)0x00000100)
    132#define PST_LAT ((DWORD)0x00000101)
    133#define PST_TCPIP_TELNET ((DWORD)0x00000102)
    134#define PST_X25 ((DWORD)0x00000103)
    135
    136#define PCF_DTRDSR ((DWORD)0x0001)
    137#define PCF_RTSCTS ((DWORD)0x0002)
    138#define PCF_RLSD ((DWORD)0x0004)
    139#define PCF_PARITY_CHECK ((DWORD)0x0008)
    140#define PCF_XONXOFF ((DWORD)0x0010)
    141#define PCF_SETXCHAR ((DWORD)0x0020)
    142#define PCF_TOTALTIMEOUTS ((DWORD)0x0040)
    143#define PCF_INTTIMEOUTS ((DWORD)0x0080)
    144#define PCF_SPECIALCHARS ((DWORD)0x0100)
    145#define PCF_16BITMODE ((DWORD)0x0200)
    146
    147#define SP_PARITY ((DWORD)0x0001)
    148#define SP_BAUD ((DWORD)0x0002)
    149#define SP_DATABITS ((DWORD)0x0004)
    150#define SP_STOPBITS ((DWORD)0x0008)
    151#define SP_HANDSHAKING ((DWORD)0x0010)
    152#define SP_PARITY_CHECK ((DWORD)0x0020)
    153#define SP_RLSD ((DWORD)0x0040)
    154
    155#define BAUD_075 ((DWORD)0x00000001)
    156#define BAUD_110 ((DWORD)0x00000002)
    157#define BAUD_134_5 ((DWORD)0x00000004)
    158#define BAUD_150 ((DWORD)0x00000008)
    159#define BAUD_300 ((DWORD)0x00000010)
    160#define BAUD_600 ((DWORD)0x00000020)
    161#define BAUD_1200 ((DWORD)0x00000040)
    162#define BAUD_1800 ((DWORD)0x00000080)
    163#define BAUD_2400 ((DWORD)0x00000100)
    164#define BAUD_4800 ((DWORD)0x00000200)
    165#define BAUD_7200 ((DWORD)0x00000400)
    166#define BAUD_9600 ((DWORD)0x00000800)
    167#define BAUD_14400 ((DWORD)0x00001000)
    168#define BAUD_19200 ((DWORD)0x00002000)
    169#define BAUD_38400 ((DWORD)0x00004000)
    170#define BAUD_56K ((DWORD)0x00008000)
    171#define BAUD_128K ((DWORD)0x00010000)
    172#define BAUD_115200 ((DWORD)0x00020000)
    173#define BAUD_57600 ((DWORD)0x00040000)
    174#define BAUD_USER ((DWORD)0x10000000)
    175
    176#define DATABITS_5 ((WORD)0x0001)
    177#define DATABITS_6 ((WORD)0x0002)
    178#define DATABITS_7 ((WORD)0x0004)
    179#define DATABITS_8 ((WORD)0x0008)
    180#define DATABITS_16 ((WORD)0x0010)
    181#define DATABITS_16X ((WORD)0x0020)
    182
    183#define STOPBITS_10 ((WORD)0x0001)
    184#define STOPBITS_15 ((WORD)0x0002)
    185#define STOPBITS_20 ((WORD)0x0004)
    186
    187#define PARITY_NONE ((WORD)0x0100)
    188#define PARITY_ODD ((WORD)0x0200)
    189#define PARITY_EVEN ((WORD)0x0400)
    190#define PARITY_MARK ((WORD)0x0800)
    191#define PARITY_SPACE ((WORD)0x1000)
    192
    193#define COMMPROP_INITIALIZED ((DWORD)0xE73CF52E)
    194
    195#define DTR_CONTROL_DISABLE 0x00
    196#define DTR_CONTROL_ENABLE 0x01
    197#define DTR_CONTROL_HANDSHAKE 0x02
    198
    199#define RTS_CONTROL_DISABLE 0x00
    200#define RTS_CONTROL_ENABLE 0x01
    201#define RTS_CONTROL_HANDSHAKE 0x02
    202#define RTS_CONTROL_TOGGLE 0x03
    203
    204// http://msdn.microsoft.com/en-us/library/windows/desktop/aa363214%28v=vs.85%29.aspx
    205typedef struct _DCB
    206{
    207	DWORD DCBlength;
    208	DWORD BaudRate;
    209	DWORD fBinary : 1;
    210	DWORD fParity : 1;
    211	DWORD fOutxCtsFlow : 1;
    212	DWORD fOutxDsrFlow : 1;
    213	DWORD fDtrControl : 2;
    214	DWORD fDsrSensitivity : 1;
    215	DWORD fTXContinueOnXoff : 1;
    216	DWORD fOutX : 1;
    217	DWORD fInX : 1;
    218	DWORD fErrorChar : 1;
    219	DWORD fNull : 1;
    220	DWORD fRtsControl : 2;
    221	DWORD fAbortOnError : 1;
    222	DWORD fDummy2 : 17;
    223	WORD wReserved;
    224	WORD XonLim;
    225	WORD XoffLim;
    226	BYTE ByteSize;
    227	BYTE Parity;
    228	BYTE StopBits;
    229	char XonChar;
    230	char XoffChar;
    231	char ErrorChar;
    232	char EofChar;
    233	char EvtChar;
    234	WORD wReserved1;
    235} DCB, *LPDCB;
    236
    237typedef struct _COMM_CONFIG
    238{
    239	DWORD dwSize;
    240	WORD wVersion;
    241	WORD wReserved;
    242	DCB dcb;
    243	DWORD dwProviderSubType;
    244	DWORD dwProviderOffset;
    245	DWORD dwProviderSize;
    246	WCHAR wcProviderData[1];
    247} COMMCONFIG, *LPCOMMCONFIG;
    248
    249typedef struct _COMMPROP
    250{
    251	WORD wPacketLength;
    252	WORD wPacketVersion;
    253	DWORD dwServiceMask;
    254	DWORD dwReserved1;
    255	DWORD dwMaxTxQueue;
    256	DWORD dwMaxRxQueue;
    257	DWORD dwMaxBaud;
    258	DWORD dwProvSubType;
    259	DWORD dwProvCapabilities;
    260	DWORD dwSettableParams;
    261	DWORD dwSettableBaud;
    262	WORD wSettableData;
    263	WORD wSettableStopParity;
    264	DWORD dwCurrentTxQueue;
    265	DWORD dwCurrentRxQueue;
    266	DWORD dwProvSpec1;
    267	DWORD dwProvSpec2;
    268	WCHAR wcProvChar[1];
    269} COMMPROP, *LPCOMMPROP;
    270
    271typedef struct _COMMTIMEOUTS
    272{
    273	DWORD ReadIntervalTimeout;
    274	DWORD ReadTotalTimeoutMultiplier;
    275	DWORD ReadTotalTimeoutConstant;
    276	DWORD WriteTotalTimeoutMultiplier;
    277	DWORD WriteTotalTimeoutConstant;
    278} COMMTIMEOUTS, *LPCOMMTIMEOUTS;
    279
    280typedef struct _COMSTAT
    281{
    282	DWORD fCtsHold : 1;
    283	DWORD fDsrHold : 1;
    284	DWORD fRlsdHold : 1;
    285	DWORD fXoffHold : 1;
    286	DWORD fXoffSent : 1;
    287	DWORD fEof : 1;
    288	DWORD fTxim : 1;
    289	DWORD fReserved : 25;
    290	DWORD cbInQue;
    291	DWORD cbOutQue;
    292} COMSTAT, *LPCOMSTAT;
    293
    294#ifdef __cplusplus
    295extern "C"
    296{
    297#endif
    298
    299	WINPR_API BOOL BuildCommDCBA(LPCSTR lpDef, LPDCB lpDCB);
    300	WINPR_API BOOL BuildCommDCBW(LPCWSTR lpDef, LPDCB lpDCB);
    301
    302	WINPR_API BOOL BuildCommDCBAndTimeoutsA(LPCSTR lpDef, LPDCB lpDCB,
    303	                                        LPCOMMTIMEOUTS lpCommTimeouts);
    304	WINPR_API BOOL BuildCommDCBAndTimeoutsW(LPCWSTR lpDef, LPDCB lpDCB,
    305	                                        LPCOMMTIMEOUTS lpCommTimeouts);
    306
    307	WINPR_API BOOL CommConfigDialogA(LPCSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC);
    308	WINPR_API BOOL CommConfigDialogW(LPCWSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC);
    309
    310	WINPR_API BOOL GetCommConfig(HANDLE hCommDev, LPCOMMCONFIG lpCC, LPDWORD lpdwSize);
    311	WINPR_API BOOL SetCommConfig(HANDLE hCommDev, LPCOMMCONFIG lpCC, DWORD dwSize);
    312
    313	WINPR_API BOOL GetCommMask(HANDLE hFile, PDWORD lpEvtMask);
    314	WINPR_API BOOL SetCommMask(HANDLE hFile, DWORD dwEvtMask);
    315
    316	WINPR_API BOOL GetCommModemStatus(HANDLE hFile, PDWORD lpModemStat);
    317	WINPR_API BOOL GetCommProperties(HANDLE hFile, LPCOMMPROP lpCommProp);
    318
    319	WINPR_API BOOL GetCommState(HANDLE hFile, LPDCB lpDCB);
    320	WINPR_API BOOL SetCommState(HANDLE hFile, LPDCB lpDCB);
    321
    322	WINPR_API BOOL GetCommTimeouts(HANDLE hFile, LPCOMMTIMEOUTS lpCommTimeouts);
    323	WINPR_API BOOL SetCommTimeouts(HANDLE hFile, LPCOMMTIMEOUTS lpCommTimeouts);
    324
    325	WINPR_API BOOL GetDefaultCommConfigA(LPCSTR lpszName, LPCOMMCONFIG lpCC, LPDWORD lpdwSize);
    326	WINPR_API BOOL GetDefaultCommConfigW(LPCWSTR lpszName, LPCOMMCONFIG lpCC, LPDWORD lpdwSize);
    327
    328	WINPR_API BOOL SetDefaultCommConfigA(LPCSTR lpszName, LPCOMMCONFIG lpCC, DWORD dwSize);
    329	WINPR_API BOOL SetDefaultCommConfigW(LPCWSTR lpszName, LPCOMMCONFIG lpCC, DWORD dwSize);
    330
    331	WINPR_API BOOL SetCommBreak(HANDLE hFile);
    332	WINPR_API BOOL ClearCommBreak(HANDLE hFile);
    333	WINPR_API BOOL ClearCommError(HANDLE hFile, PDWORD lpErrors, LPCOMSTAT lpStat);
    334
    335	WINPR_API BOOL PurgeComm(HANDLE hFile, DWORD dwFlags);
    336	WINPR_API BOOL SetupComm(HANDLE hFile, DWORD dwInQueue, DWORD dwOutQueue);
    337
    338	WINPR_API BOOL EscapeCommFunction(HANDLE hFile, DWORD dwFunc);
    339
    340	WINPR_API BOOL TransmitCommChar(HANDLE hFile, char cChar);
    341
    342	WINPR_API BOOL WaitCommEvent(HANDLE hFile, PDWORD lpEvtMask, LPOVERLAPPED lpOverlapped);
    343
    344#ifdef UNICODE
    345#define BuildCommDCB BuildCommDCBW
    346#define BuildCommDCBAndTimeouts BuildCommDCBAndTimeoutsW
    347#define CommConfigDialog CommConfigDialogW
    348#define GetDefaultCommConfig GetDefaultCommConfigW
    349#define SetDefaultCommConfig SetDefaultCommConfigW
    350#else
    351#define BuildCommDCB BuildCommDCBA
    352#define BuildCommDCBAndTimeouts BuildCommDCBAndTimeoutsA
    353#define CommConfigDialog CommConfigDialogA
    354#define GetDefaultCommConfig GetDefaultCommConfigA
    355#define SetDefaultCommConfig SetDefaultCommConfigA
    356#endif
    357
    358/* Extended API */
    359
    360/* FIXME: MAXULONG should be defined arround winpr/limits.h */
    361#ifndef MAXULONG
    362#define MAXULONG (4294967295UL)
    363#endif
    364
    365	/**
    366	 * IOCTLs table according the server's serial driver:
    367	 * http://msdn.microsoft.com/en-us/library/windows/hardware/dn265347%28v=vs.85%29.aspx
    368	 */
    369	typedef enum _SERIAL_DRIVER_ID
    370	{
    371		SerialDriverUnknown = 0,
    372		SerialDriverSerialSys,
    373		SerialDriverSerCxSys,
    374		SerialDriverSerCx2Sys /* default fallback, see also CommDeviceIoControl() */
    375	} SERIAL_DRIVER_ID;
    376
    377	/*
    378	 * About DefineCommDevice() / QueryDosDevice()
    379	 *
    380	 * Did something close to QueryDosDevice() and DefineDosDevice() but with
    381	 * folowing constraints:
    382	 *   - mappings are stored in a static array.
    383	 *   - QueryCommDevice returns only the mappings that have been defined through
    384	 * DefineCommDevice()
    385	 */
    386	WINPR_API BOOL DefineCommDevice(/* DWORD dwFlags,*/ LPCTSTR lpDeviceName, LPCTSTR lpTargetPath);
    387	WINPR_API DWORD QueryCommDevice(LPCTSTR lpDeviceName, LPTSTR lpTargetPath, DWORD ucchMax);
    388	WINPR_API BOOL IsCommDevice(LPCTSTR lpDeviceName);
    389
    390	/**
    391	 * A handle can only be created on defined devices with DefineCommDevice(). This
    392	 * also ensures that CommCreateFileA() has been registered through
    393	 * RegisterHandleCreator().
    394	 */
    395	WINPR_API HANDLE CommCreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
    396	                                 LPSECURITY_ATTRIBUTES lpSecurityAttributes,
    397	                                 DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes,
    398	                                 HANDLE hTemplateFile);
    399
    400#define IOCTL_SERIAL_SET_BAUD_RATE 0x001B0004
    401#define IOCTL_SERIAL_GET_BAUD_RATE 0x001B0050
    402#define IOCTL_SERIAL_SET_LINE_CONTROL 0x001B000C
    403#define IOCTL_SERIAL_GET_LINE_CONTROL 0x001B0054
    404#define IOCTL_SERIAL_SET_TIMEOUTS 0x001B001C
    405#define IOCTL_SERIAL_GET_TIMEOUTS 0x001B0020
    406/* GET_CHARS and SET_CHARS are swapped in the RDP docs [MS-RDPESP] */
    407#define IOCTL_SERIAL_GET_CHARS 0x001B0058
    408#define IOCTL_SERIAL_SET_CHARS 0x001B005C
    409
    410#define IOCTL_SERIAL_SET_DTR 0x001B0024
    411#define IOCTL_SERIAL_CLR_DTR 0x001B0028
    412#define IOCTL_SERIAL_RESET_DEVICE 0x001B002C
    413#define IOCTL_SERIAL_SET_RTS 0x001B0030
    414#define IOCTL_SERIAL_CLR_RTS 0x001B0034
    415#define IOCTL_SERIAL_SET_XOFF 0x001B0038
    416#define IOCTL_SERIAL_SET_XON 0x001B003C
    417#define IOCTL_SERIAL_SET_BREAK_ON 0x001B0010
    418#define IOCTL_SERIAL_SET_BREAK_OFF 0x001B0014
    419#define IOCTL_SERIAL_SET_QUEUE_SIZE 0x001B0008
    420#define IOCTL_SERIAL_GET_WAIT_MASK 0x001B0040
    421#define IOCTL_SERIAL_SET_WAIT_MASK 0x001B0044
    422#define IOCTL_SERIAL_WAIT_ON_MASK 0x001B0048
    423#define IOCTL_SERIAL_IMMEDIATE_CHAR 0x001B0018
    424#define IOCTL_SERIAL_PURGE 0x001B004C
    425#define IOCTL_SERIAL_GET_HANDFLOW 0x001B0060
    426#define IOCTL_SERIAL_SET_HANDFLOW 0x001B0064
    427#define IOCTL_SERIAL_GET_MODEMSTATUS 0x001B0068
    428#define IOCTL_SERIAL_GET_DTRRTS 0x001B0078
    429
    430/* according to [MS-RDPESP] it should be 0x001B0084, but servers send 0x001B006C */
    431#define IOCTL_SERIAL_GET_COMMSTATUS 0x001B006C
    432
    433#define IOCTL_SERIAL_GET_PROPERTIES 0x001B0074
    434/* IOCTL_SERIAL_XOFF_COUNTER 0x001B0070 */
    435/* IOCTL_SERIAL_LSRMST_INSERT 0x001B007C */
    436#define IOCTL_SERIAL_CONFIG_SIZE 0x001B0080
    437/* IOCTL_SERIAL_GET_STATS 0x001B008C */
    438/* IOCTL_SERIAL_CLEAR_STATS 0x001B0090 */
    439/* IOCTL_SERIAL_GET_MODEM_CONTROL 0x001B0094 */
    440/* IOCTL_SERIAL_SET_MODEM_CONTROL 0x001B0098 */
    441/* IOCTL_SERIAL_SET_FIFO_CONTROL 0x001B009C */
    442
    443/* IOCTL_PAR_QUERY_INFORMATION 0x00160004 */
    444/* IOCTL_PAR_SET_INFORMATION 0x00160008 */
    445/* IOCTL_PAR_QUERY_DEVICE_ID 0x0016000C */
    446/* IOCTL_PAR_QUERY_DEVICE_ID_SIZE 0x00160010 */
    447/* IOCTL_IEEE1284_GET_MODE 0x00160014 */
    448/* IOCTL_IEEE1284_NEGOTIATE 0x00160018 */
    449/* IOCTL_PAR_SET_WRITE_ADDRESS 0x0016001C */
    450/* IOCTL_PAR_SET_READ_ADDRESS 0x00160020 */
    451/* IOCTL_PAR_GET_DEVICE_CAPS 0x00160024 */
    452/* IOCTL_PAR_GET_DEFAULT_MODES 0x00160028 */
    453/* IOCTL_PAR_QUERY_RAW_DEVICE_ID 0x00160030 */
    454/* IOCTL_PAR_IS_PORT_FREE 0x00160054 */
    455
    456/* http://msdn.microsoft.com/en-us/library/windows/hardware/ff551803(v=vs.85).aspx */
    457#define IOCTL_USBPRINT_GET_1284_ID 0x220034
    458
    459	typedef struct __SERIAL_IOCTL_NAME
    460	{
    461		ULONG number;
    462		const char* name;
    463	} _SERIAL_IOCTL_NAME;
    464
    465	static const _SERIAL_IOCTL_NAME _SERIAL_IOCTL_NAMES[] = {
    466		{ IOCTL_SERIAL_SET_BAUD_RATE, "IOCTL_SERIAL_SET_BAUD_RATE" },
    467		{ IOCTL_SERIAL_GET_BAUD_RATE, "IOCTL_SERIAL_GET_BAUD_RATE" },
    468		{ IOCTL_SERIAL_SET_LINE_CONTROL, "IOCTL_SERIAL_SET_LINE_CONTROL" },
    469		{ IOCTL_SERIAL_GET_LINE_CONTROL, "IOCTL_SERIAL_GET_LINE_CONTROL" },
    470		{ IOCTL_SERIAL_SET_TIMEOUTS, "IOCTL_SERIAL_SET_TIMEOUTS" },
    471		{ IOCTL_SERIAL_GET_TIMEOUTS, "IOCTL_SERIAL_GET_TIMEOUTS" },
    472		{ IOCTL_SERIAL_GET_CHARS, "IOCTL_SERIAL_GET_CHARS" },
    473		{ IOCTL_SERIAL_SET_CHARS, "IOCTL_SERIAL_SET_CHARS" },
    474		{ IOCTL_SERIAL_SET_DTR, "IOCTL_SERIAL_SET_DTR" },
    475		{ IOCTL_SERIAL_CLR_DTR, "IOCTL_SERIAL_CLR_DTR" },
    476		{ IOCTL_SERIAL_RESET_DEVICE, "IOCTL_SERIAL_RESET_DEVICE" },
    477		{ IOCTL_SERIAL_SET_RTS, "IOCTL_SERIAL_SET_RTS" },
    478		{ IOCTL_SERIAL_CLR_RTS, "IOCTL_SERIAL_CLR_RTS" },
    479		{ IOCTL_SERIAL_SET_XOFF, "IOCTL_SERIAL_SET_XOFF" },
    480		{ IOCTL_SERIAL_SET_XON, "IOCTL_SERIAL_SET_XON" },
    481		{ IOCTL_SERIAL_SET_BREAK_ON, "IOCTL_SERIAL_SET_BREAK_ON" },
    482		{ IOCTL_SERIAL_SET_BREAK_OFF, "IOCTL_SERIAL_SET_BREAK_OFF" },
    483		{ IOCTL_SERIAL_SET_QUEUE_SIZE, "IOCTL_SERIAL_SET_QUEUE_SIZE" },
    484		{ IOCTL_SERIAL_GET_WAIT_MASK, "IOCTL_SERIAL_GET_WAIT_MASK" },
    485		{ IOCTL_SERIAL_SET_WAIT_MASK, "IOCTL_SERIAL_SET_WAIT_MASK" },
    486		{ IOCTL_SERIAL_WAIT_ON_MASK, "IOCTL_SERIAL_WAIT_ON_MASK" },
    487		{ IOCTL_SERIAL_IMMEDIATE_CHAR, "IOCTL_SERIAL_IMMEDIATE_CHAR" },
    488		{ IOCTL_SERIAL_PURGE, "IOCTL_SERIAL_PURGE" },
    489		{ IOCTL_SERIAL_GET_HANDFLOW, "IOCTL_SERIAL_GET_HANDFLOW" },
    490		{ IOCTL_SERIAL_SET_HANDFLOW, "IOCTL_SERIAL_SET_HANDFLOW" },
    491		{ IOCTL_SERIAL_GET_MODEMSTATUS, "IOCTL_SERIAL_GET_MODEMSTATUS" },
    492		{ IOCTL_SERIAL_GET_DTRRTS, "IOCTL_SERIAL_GET_DTRRTS" },
    493		{ IOCTL_SERIAL_GET_COMMSTATUS, "IOCTL_SERIAL_GET_COMMSTATUS" },
    494		{ IOCTL_SERIAL_GET_PROPERTIES, "IOCTL_SERIAL_GET_PROPERTIES" },
    495		// {IOCTL_SERIAL_XOFF_COUNTER,	"IOCTL_SERIAL_XOFF_COUNTER"},
    496		// {IOCTL_SERIAL_LSRMST_INSERT,	"IOCTL_SERIAL_LSRMST_INSERT"},
    497		{ IOCTL_SERIAL_CONFIG_SIZE, "IOCTL_SERIAL_CONFIG_SIZE" },
    498		// {IOCTL_SERIAL_GET_STATS,	"IOCTL_SERIAL_GET_STATS"},
    499		// {IOCTL_SERIAL_CLEAR_STATS,	"IOCTL_SERIAL_CLEAR_STATS"},
    500		// {IOCTL_SERIAL_GET_MODEM_CONTROL,"IOCTL_SERIAL_GET_MODEM_CONTROL"},
    501		// {IOCTL_SERIAL_SET_MODEM_CONTROL,"IOCTL_SERIAL_SET_MODEM_CONTROL"},
    502		// {IOCTL_SERIAL_SET_FIFO_CONTROL,	"IOCTL_SERIAL_SET_FIFO_CONTROL"},
    503
    504		// {IOCTL_PAR_QUERY_INFORMATION,	"IOCTL_PAR_QUERY_INFORMATION"},
    505		// {IOCTL_PAR_SET_INFORMATION,	"IOCTL_PAR_SET_INFORMATION"},
    506		// {IOCTL_PAR_QUERY_DEVICE_ID,	"IOCTL_PAR_QUERY_DEVICE_ID"},
    507		// {IOCTL_PAR_QUERY_DEVICE_ID_SIZE,"IOCTL_PAR_QUERY_DEVICE_ID_SIZE"},
    508		// {IOCTL_IEEE1284_GET_MODE,	"IOCTL_IEEE1284_GET_MODE"},
    509		// {IOCTL_IEEE1284_NEGOTIATE,	"IOCTL_IEEE1284_NEGOTIATE"},
    510		// {IOCTL_PAR_SET_WRITE_ADDRESS,	"IOCTL_PAR_SET_WRITE_ADDRESS"},
    511		// {IOCTL_PAR_SET_READ_ADDRESS,	"IOCTL_PAR_SET_READ_ADDRESS"},
    512		// {IOCTL_PAR_GET_DEVICE_CAPS,	"IOCTL_PAR_GET_DEVICE_CAPS"},
    513		// {IOCTL_PAR_GET_DEFAULT_MODES,	"IOCTL_PAR_GET_DEFAULT_MODES"},
    514		// {IOCTL_PAR_QUERY_RAW_DEVICE_ID, "IOCTL_PAR_QUERY_RAW_DEVICE_ID"},
    515		// {IOCTL_PAR_IS_PORT_FREE,	"IOCTL_PAR_IS_PORT_FREE"},
    516
    517		{ IOCTL_USBPRINT_GET_1284_ID, "IOCTL_USBPRINT_GET_1284_ID" },
    518
    519		{ 0, NULL }
    520	};
    521
    522	/**
    523	 * FIXME: got a proper function name and place
    524	 */
    525	WINPR_API const char* _comm_serial_ioctl_name(ULONG number);
    526
    527	/**
    528	 * FIXME: got a proper function name and place
    529	 */
    530	WINPR_API void _comm_setServerSerialDriver(HANDLE hComm, SERIAL_DRIVER_ID);
    531
    532	/**
    533	 * FIXME: got a proper function name and place
    534	 *
    535	 * permissive mode is disabled by default.
    536	 */
    537	WINPR_API BOOL _comm_set_permissive(HANDLE hDevice, BOOL permissive);
    538
    539	/**
    540	 * FIXME: to be moved in comm_ioctl.h
    541	 */
    542	WINPR_API BOOL CommDeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer,
    543	                                   DWORD nInBufferSize, LPVOID lpOutBuffer,
    544	                                   DWORD nOutBufferSize, LPDWORD lpBytesReturned,
    545	                                   LPOVERLAPPED lpOverlapped);
    546
    547	/**
    548	 * FIXME: to be moved in comm_io.h
    549	 */
    550	WINPR_API BOOL CommReadFile(HANDLE hDevice, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
    551	                            LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped);
    552
    553	/**
    554	 * FIXME: to be moved in comm_io.h
    555	 */
    556	WINPR_API BOOL CommWriteFile(HANDLE hDevice, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
    557	                             LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped);
    558
    559#ifdef __cplusplus
    560}
    561#endif
    562
    563#endif /* __linux__ */
    564
    565#endif /* WINPR_COMM_H */