22 #ifndef WINPR_COMM_IOCTL_H_
23 #define WINPR_COMM_IOCTL_H_
28 #include <winpr/tchar.h>
29 #include <winpr/wtypes.h>
47 #define STOP_BITS_1_5 1
54 #define SPACE_PARITY 4
80 ULONG ControlHandShake;
86 #define SERIAL_DTR_MASK ((ULONG)0x03)
87 #define SERIAL_DTR_CONTROL ((ULONG)0x01)
88 #define SERIAL_DTR_HANDSHAKE ((ULONG)0x02)
89 #define SERIAL_CTS_HANDSHAKE ((ULONG)0x08)
90 #define SERIAL_DSR_HANDSHAKE ((ULONG)0x10)
91 #define SERIAL_DCD_HANDSHAKE ((ULONG)0x20)
92 #define SERIAL_OUT_HANDSHAKEMASK ((ULONG)0x38)
93 #define SERIAL_DSR_SENSITIVITY ((ULONG)0x40)
94 #define SERIAL_ERROR_ABORT ((ULONG)0x80000000)
95 #define SERIAL_CONTROL_INVALID ((ULONG)0x7fffff84)
96 #define SERIAL_AUTO_TRANSMIT ((ULONG)0x01)
97 #define SERIAL_AUTO_RECEIVE ((ULONG)0x02)
98 #define SERIAL_ERROR_CHAR ((ULONG)0x04)
99 #define SERIAL_NULL_STRIPPING ((ULONG)0x08)
100 #define SERIAL_BREAK_CHAR ((ULONG)0x10)
101 #define SERIAL_RTS_MASK ((ULONG)0xc0)
102 #define SERIAL_RTS_CONTROL ((ULONG)0x40)
103 #define SERIAL_RTS_HANDSHAKE ((ULONG)0x80)
104 #define SERIAL_TRANSMIT_TOGGLE ((ULONG)0xc0)
105 #define SERIAL_XOFF_CONTINUE ((ULONG)0x80000000)
106 #define SERIAL_FLOW_INVALID ((ULONG)0x7fffff20)
108 #define SERIAL_SP_SERIALCOMM ((ULONG)0x00000001)
110 #define SERIAL_SP_UNSPECIFIED ((ULONG)0x00000000)
111 #define SERIAL_SP_RS232 ((ULONG)0x00000001)
112 #define SERIAL_SP_PARALLEL ((ULONG)0x00000002)
113 #define SERIAL_SP_RS422 ((ULONG)0x00000003)
114 #define SERIAL_SP_RS423 ((ULONG)0x00000004)
115 #define SERIAL_SP_RS449 ((ULONG)0x00000005)
116 #define SERIAL_SP_MODEM ((ULONG)0x00000006)
117 #define SERIAL_SP_FAX ((ULONG)0x00000021)
118 #define SERIAL_SP_SCANNER ((ULONG)0x00000022)
119 #define SERIAL_SP_BRIDGE ((ULONG)0x00000100)
120 #define SERIAL_SP_LAT ((ULONG)0x00000101)
121 #define SERIAL_SP_TELNET ((ULONG)0x00000102)
122 #define SERIAL_SP_X25 ((ULONG)0x00000103)
126 ULONG ReadIntervalTimeout;
127 ULONG ReadTotalTimeoutMultiplier;
128 ULONG ReadTotalTimeoutConstant;
129 ULONG WriteTotalTimeoutMultiplier;
130 ULONG WriteTotalTimeoutConstant;
133 #define SERIAL_MSR_DCTS 0x01
134 #define SERIAL_MSR_DDSR 0x02
135 #define SERIAL_MSR_TERI 0x04
136 #define SERIAL_MSR_DDCD 0x08
137 #define SERIAL_MSR_CTS 0x10
138 #define SERIAL_MSR_DSR 0x20
139 #define SERIAL_MSR_RI 0x40
140 #define SERIAL_MSR_DCD 0x80
148 #define SERIAL_PURGE_TXABORT 0x00000001
149 #define SERIAL_PURGE_RXABORT 0x00000002
150 #define SERIAL_PURGE_TXCLEAR 0x00000004
151 #define SERIAL_PURGE_RXCLEAR 0x00000008
157 ULONG AmountInInQueue;
158 ULONG AmountInOutQueue;
160 BOOLEAN WaitForImmediate;
163 #define SERIAL_TX_WAITING_FOR_CTS ((ULONG)0x00000001)
164 #define SERIAL_TX_WAITING_FOR_DSR ((ULONG)0x00000002)
165 #define SERIAL_TX_WAITING_FOR_DCD ((ULONG)0x00000004)
166 #define SERIAL_TX_WAITING_FOR_XON ((ULONG)0x00000008)
167 #define SERIAL_TX_WAITING_XOFF_SENT ((ULONG)0x00000010)
168 #define SERIAL_TX_WAITING_ON_BREAK ((ULONG)0x00000020)
169 #define SERIAL_RX_WAITING_FOR_DSR ((ULONG)0x00000040)
171 #define SERIAL_ERROR_BREAK ((ULONG)0x00000001)
172 #define SERIAL_ERROR_FRAMING ((ULONG)0x00000002)
173 #define SERIAL_ERROR_OVERRUN ((ULONG)0x00000004)
174 #define SERIAL_ERROR_QUEUEOVERRUN ((ULONG)0x00000008)
175 #define SERIAL_ERROR_PARITY ((ULONG)0x00000010)
177 #define SERIAL_DTR_STATE ((ULONG)0x00000001)
178 #define SERIAL_RTS_STATE ((ULONG)0x00000002)
179 #define SERIAL_CTS_STATE ((ULONG)0x00000010)
180 #define SERIAL_DSR_STATE ((ULONG)0x00000020)
181 #define SERIAL_RI_STATE ((ULONG)0x00000040)
182 #define SERIAL_DCD_STATE ((ULONG)0x00000080)
193 BOOL (*set_baud_rate)(WINPR_COMM* pComm,
const SERIAL_BAUD_RATE* pBaudRate);
195 BOOL (*get_properties)(WINPR_COMM* pComm,
COMMPROP* pProperties);
196 BOOL (*set_serial_chars)(WINPR_COMM* pComm,
const SERIAL_CHARS* pSerialChars);
197 BOOL (*get_serial_chars)(WINPR_COMM* pComm,
SERIAL_CHARS* pSerialChars);
200 BOOL (*set_handflow)(WINPR_COMM* pComm,
const SERIAL_HANDFLOW* pHandflow);
202 BOOL (*set_timeouts)(WINPR_COMM* pComm,
const SERIAL_TIMEOUTS* pTimeouts);
204 BOOL (*set_dtr)(WINPR_COMM* pComm);
205 BOOL (*clear_dtr)(WINPR_COMM* pComm);
206 BOOL (*set_rts)(WINPR_COMM* pComm);
207 BOOL (*clear_rts)(WINPR_COMM* pComm);
208 BOOL (*get_modemstatus)(WINPR_COMM* pComm, ULONG* pRegister);
209 BOOL (*set_wait_mask)(WINPR_COMM* pComm,
const ULONG* pWaitMask);
210 BOOL (*get_wait_mask)(WINPR_COMM* pComm, ULONG* pWaitMask);
211 BOOL (*wait_on_mask)(WINPR_COMM* pComm, ULONG* pOutputMask);
213 BOOL (*purge)(WINPR_COMM* pComm,
const ULONG* pPurgeMask);
214 BOOL (*get_commstatus)(WINPR_COMM* pComm,
SERIAL_STATUS* pCommstatus);
215 BOOL (*set_break_on)(WINPR_COMM* pComm);
216 BOOL (*set_break_off)(WINPR_COMM* pComm);
217 BOOL (*set_xoff)(WINPR_COMM* pComm);
218 BOOL (*set_xon)(WINPR_COMM* pComm);
219 BOOL (*get_dtrrts)(WINPR_COMM* pComm, ULONG* pMask);
220 BOOL (*config_size)(WINPR_COMM* pComm, ULONG* pSize);
221 BOOL (*immediate_char)(WINPR_COMM* pComm,
const UCHAR* pChar);
222 BOOL (*reset_device)(WINPR_COMM* pComm);
226 int _comm_ioctl_tcsetattr(
int fd,
int optional_actions,
const struct termios* termios_p);