#pragma once #include #ifdef __GNUC__ #include #else #include #endif #include #include #include #include "hook/iobuf.h" #include "hook/iohook.h" struct uart { HANDLE fd; unsigned int port_no; SERIAL_BAUD_RATE baud; SERIAL_STATUS status; SERIAL_CHARS chars; SERIAL_HANDFLOW handflow; SERIAL_LINE_CONTROL line; SERIAL_TIMEOUTS timeouts; DWORD mask; bool cts_on; bool dsr_on; bool ring_on; bool rlsd_on; bool dtr_on; bool rts_on; ULONG modem_control; struct iobuf written; struct iobuf readable; }; void uart_init(struct uart *uart, unsigned int port_no); void uart_fini(struct uart *uart); bool uart_match_irp(const struct uart *uart, const struct irp *irp); HRESULT uart_handle_irp(struct uart *uart, struct irp *irp);