digitalmars.D - revised version of my ioctl interface module for linux
- Ameer Armaly (166/166) Aug 10 2005 //interface to ioctl (2) syscall
//interface to ioctl (2) syscall //written by Ameer Armaly //placed in the public domain module std.c.linux.ioctl; extern(C) int ioctl(short, uint, ...); //function declaration struct winsize { ushort ws_row, ws_col; ushort ws_xpixel, ws_ypixel; } //modem lines enum { TIOCM_LE=0x001, TIOCM_DTR=0x002, TIOCM_RTS=0x004, TIOCM_ST=0x008, TIOCM_SR=0x010, TIOCM_CTS=0x020, TIOCM_CAR=0x040, TIOCM_RNG=0x080, TIOCM_DSR=0x100, TIOCM_CD=TIOCM_CAR, TIOCM_RI=TIOCM_RNG, } enum { N_TTY=0, N_SLIP=1, N_MOUSE=2, N_PPP=3, N_STRIP=4, N_AX25=5, N_X25=6, //X.25 async N_6PACK=7, N_MASC=8, //Mobitex module N_R3964=9, //Simatic R3964 module N_PROFIBUS_FDL=10,//Profibus N_IRDA=11,//Linux IR N_SMSBLOCK=12,//SMS block mode N_HDLC=13,//synchronous HDLC N_SYNC_PPP=14,//synchronous PPP N_HCI=15,//Bluetooth HCI UART } enum { SIOCADDRT=0x890B, //add routing table entry SIOCDELRT=0x890C, //delete routing table entry SIOCRTMSG=0x890D, //call to routing system SIOCGIFNAME =0x89100,//get iface name SIOCSIFLINK =0x8911,//set iface channel SIOCGIFCONF =0x8912,//get iface list SIOCGIFFLAGS=0x8913,//get flags SIOCSIFFLAGS=0x8914,//set flags SIOCGIFADDR =0x8915,//get PA address SIOCSIFADDR =0x8916,//set PA address SIOCGIFDSTADDR=0x8917,//get remote PA address SIOCSIFDSTADDR=0x8918,//set remote PA address SIOCGIFBRDADDR=0x8919,//get broadcast PA address SIOCSIFBRDADDR=0x891a,//set broadcast PA address SIOCGIFNETMASK=0x891b,//get network PA mask SIOCSIFNETMASK=0x891c,//set network PA mask SIOCGIFMETRIC =0x891d,//get metric SIOCSIFMETRIC =0x891e,//set metric SIOCGIFMEM=0x891f,//get memory address (BSD) SIOCSIFMEM=0x8920,//set memory address (BSD) SIOCGIFMTU=0x8921,//get MTU size SIOCSIFMTU=0x8922,//set MTU size SIOCSIFNAME =0x8923,//set interface name SIOCSIFHWADDR =0x8924,//set hardware address SIOCGIFENCAP=0x8925,//get/set encapsulations SIOCSIFENCAP=0x8926, SIOCGIFHWADDR =0x8927,//Get hardware address SIOCGIFSLAVE=0x8929,//Driver slaving support SIOCSIFSLAVE=0x8930, SIOCADDMULTI=0x8931,//Multicast address lists SIOCDELMULTI=0x8932, SIOCGIFINDEX=0x8933,//name -> if_index mapping SIOGIFINDEX=SIOCGIFINDEX,//misprint compatibility :-) SIOCSIFPFLAGS =0x8934,//set/get extended flags set SIOCGIFPFLAGS =0x8935, SIOCDIFADDR =0x8936,//delete PA address SIOCSIFHWBROADCAST=0x8937,//set hardware broadcast addr SIOCGIFCOUNT=0x8938,//get number of devices SIOCGIFBR =0x8940,//Bridging support SIOCSIFBR =0x8941,//Set bridging options SIOCGIFTXQLEN =0x8942,//Get the tx queue length SIOCSIFTXQLEN =0x8943,//Set the tx queue length SIOCDARP =0x8953,//delete ARP table entry SIOCGARP =0x8954,//get ARP table entry SIOCSARP =0x8955,//set ARP table entry SIOCDRARP =0x8960,//delete RARP table entry SIOCGRARP =0x8961,//get RARP table entry SIOCSRARP =0x8962,//set RARP table entry SIOCGIFMAP=0x8970,//Get device parameters SIOCSIFMAP=0x8971,//Set device parameters SIOCADDDLCI =0x8980,//Create new DLCI device SIOCDELDLCI =0x8981,//Delete DLCI device } enum { TCGETS =0x5401, TCSETS =0x5402,// Clashes with SNDCTL_TMR_START sound ioctl TCSETSW=0x5403, TCSETSF=0x5404, TCGETA =0x5405, TCSETA =0x5406, TCSETAW=0x5407, TCSETAF=0x5408, TCSBRK =0x5409, TCXONC =0x540A, TCFLSH =0x540B, TIOCEXCL =0x540C, TIOCNXCL =0x540D, TIOCSCTTY =0x540E, TIOCGPGRP =0x540F, TIOCSPGRP =0x5410, TIOCOUTQ =0x5411, TIOCSTI=0x5412, TIOCGWINSZ=0x5413, TIOCSWINSZ=0x5414, TIOCMGET =0x5415, TIOCMBIS =0x5416, TIOCMBIC =0x5417, TIOCMSET =0x5418, TIOCGSOFTCAR =0x5419, TIOCSSOFTCAR =0x541A, FIONREAD =0x541B, TIOCLINUX =0x541C, TIOCCONS =0x541D, TIOCGSERIAL =0x541E, TIOCSSERIAL =0x541F, TIOCPKT=0x5420, FIONBIO=0x5421, TIOCNOTTY =0x5422, TIOCSETD =0x5423, TIOCGETD =0x5424, TCSBRKP=0x5425,// Needed for POSIX tcsendbreak() TIOCSBRK =0x5427,// BSD compatibility TIOCCBRK =0x5428,// BSD compatibility TIOCGSID =0x5429,// Return the session ID of FD FIONCLEX =0x5450, FIOCLEX=0x5451, FIOASYNC =0x5452, TIOCSERCONFIG=0x5453, TIOCSERGWILD =0x5454, TIOCSERSWILD =0x5455, TIOCGLCKTRMIOS =0x5456, TIOCSLCKTRMIOS =0x5457, TIOCSERGSTRUCT =0x5458,// For debugging only TIOCSERGETLSR=0x5459,// Get line status register TIOCSERGETMULTI =0x545A,// Get multiport config TIOCSERSETMULTI =0x545B,// Set multiport config TIOCMIWAIT=0x545C,// wait for a change on serial input line(s) TIOCGICOUNT =0x545D,// read serial port inline interrupt counts TIOCGHAYESESP=0x545E,// Get Hayes ESP configuration TIOCSHAYESESP=0x545F,// Set Hayes ESP configuration FIOQSIZE =0x5460, TIOCPKT_DATA=0, TIOCPKT_FLUSHREAD =1, TIOCPKT_FLUSHWRITE=2, TIOCPKT_STOP=4, TIOCPKT_START=8, TIOCPKT_NOSTOP=16, TIOCPKT_DOSTOP=32, TIOCSER_TEMT =0x01,// Transmitter physically empty }
Aug 10 2005