/* termios.vala * * Copyright (c) 2008 Ed Schouten * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ [CCode (cheader_filename = "termios.h", lower_case_cprefix = "")] namespace Termios { [CCode (cname = "struct termios", cprefix = "tc")] public struct Termios { [CCode (cname = "c_iflag")] public IFlag iflag; [CCode (cname = "c_oflag")] public OFlag oflag; [CCode (cname = "c_cflag")] public CFlag cflag; [CCode (cname = "c_lflag")] public LFlag lflag; [CCode (cname = "c_cc")] public char[] cc; [CCode (cname = "cfgetispeed")] public Speed getispeed(); [CCode (cname = "cfgetospeed")] public Speed getospeed(); [CCode (cname = "cfsetispeed")] public int setispeed(Speed speed); [CCode (cname = "cfsetospeed")] public int setospeed(Speed speed); public static int drain(int fildes); public static int flow(int fildes, FlowType action); public static int flush(int fildes, FlushType queue_selector); [CCode (instance_pos=-1)] public int getattr(int fildes); public static int sendbreak(int fildes, int duration); [CCode (instance_pos=-1)] public int setattr(int fildes, AttrType optional_actions); } public const uint NCCS; public const uint VEOF; public const uint VEOL; public const uint VERASE; public const uint VINTR; public const uint VKILL; public const uint VMIN; public const uint VQUIT; public const uint VSTART; public const uint VSTOP; public const uint VSUSP; public const uint VTIME; [CCode (cname = "tcflag_t", cprefix = "")] public enum IFlag { BRKINT, ICRNL, IGNBRK, IGNCR, IGNPAR, INLCR, INPCK, ISTRIP, IXANY, IXOFF, IXON, PARMRK, } [CCode (cname = "tcflag_t", cprefix = "")] public enum OFlag { OPOST, ONLCR, OCRNL, ONOCR, ONLRET, OFILL, ONLDLY, NL0, NL1, CRDLY, CR0, CR1, CR2, CR3, TABDLY, TAB0, TAB1, TAB2, TAB3, BSDLY, BS0, BS1, VTDLY, VT0, VT1, FFDLY, FF0, FF1, } [CCode (cname = "speed_t", cprefix = "")] public enum Speed { B0, B50, B75, B110, B134, B150, B200, B300, B600, B1200, B1800, B2400, B4800, B9600, B19200, B38400, } [CCode (cname = "tcflag_t", cprefix = "")] public enum CFlag { CSIZE, CS5, CS6, CS7, CS8, CSTOPB, CREAD, PARENB, PARODD, HUPCL, CLOCAL, } [CCode (cname = "tcflag_t", cprefix = "")] public enum LFlag { ECHO, ECHOE, ECHOK, ECHONL, ICANON, IEXTEN, ISIG, NOFLSH, TOSTOP, } [CCode (cname = "int", cprefix = "TCSA")] public enum AttrType { NOW, DRAIN, FLUSH, } [CCode (cname = "int", cprefix = "TC")] public enum FlushType { IFLUSH, IOFLUSH, OFLUSH } [CCode (cname = "int", cprefix = "TC")] public enum FlowType { IOFF, ION, OOFF, OON } }