www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - ioctl module for linux

Here is a module I wrote, that contains all the ioctl constants for 
linux;most of this is directly converted from the .h files.



//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;
}
const int NCC=8;
struct termio
{
ushort c_iflag, c_oflag;
ushort c_cflag, c_lflag;
char c_line;
char[NCC] c_cc;
}
//modem lines 
const int TIOCM_LE=0x001;
const int TIOCM_DTR=0x002;
const int TIOCM_RTS=0x004;
const int TIOCM_ST=0x008;
const int TIOCM_SR=0x010;
const int TIOCM_CTS=0x020;
const int TIOCM_CAR=0x040;
const int TIOCM_RNG=0x080;
const int TIOCM_DSR=0x100;
const int TIOCM_CD=TIOCM_CAR;
const int TIOCM_RI=TIOCM_RNG;
const int N_TTY=0;
const int N_SLIP=1;
const int N_MOUSE=2;
const int N_PPP=3;
const int N_STRIP=4; const int N_AX25=5;
const int N_X25=6; //X.25 async
const int N_6PACK=7;
const int N_MASC=8; //Mobitex module
const int N_R3964=9; //Simatic R3964 module
const int N_PROFIBUS_FDL=10;//Profibus
const int N_IRDA=11;//Linux IR
const int N_SMSBLOCK=12;//SMS block mode
const int N_HDLC=13;//synchronous HDLC
  const int N_SYNC_PPP=14;//synchronous PPP
const int N_HCI=15;//Bluetooth HCI UART
  const int SIOCADDRT=0x890B; //add routing table entry 
const int SIOCDELRT=0x890C; //delete routing table entry
const int SIOCRTMSG=0x890D; //call to routing system

const int SIOCGIFNAME =0x89100;//get iface name 
const int SIOCSIFLINK =0x8911;//set iface channel
const int SIOCGIFCONF =0x8912;//get iface list 
const int SIOCGIFFLAGS=0x8913;//get flags
const int SIOCSIFFLAGS=0x8914;//set flags
const int SIOCGIFADDR =0x8915;//get PA address 
const int SIOCSIFADDR =0x8916;//set PA address 
const int SIOCGIFDSTADDR=0x8917;//get remote PA address
const int SIOCSIFDSTADDR=0x8918;//set remote PA address
const int SIOCGIFBRDADDR=0x8919;//get broadcast PA address 
const int SIOCSIFBRDADDR=0x891a;//set broadcast PA address 
const int SIOCGIFNETMASK=0x891b;//get network PA mask
const int SIOCSIFNETMASK=0x891c;//set network PA mask
const int SIOCGIFMETRIC =0x891d;//get metric 
const int SIOCSIFMETRIC =0x891e;//set metric 
const int SIOCGIFMEM=0x891f;//get memory address (BSD) 
const int SIOCSIFMEM=0x8920;//set memory address (BSD) 
const int SIOCGIFMTU=0x8921;//get MTU size 
const int SIOCSIFMTU=0x8922;//set MTU size 
const int SIOCSIFNAME =0x8923;//set interface name 
const int SIOCSIFHWADDR =0x8924;//set hardware address 
const int SIOCGIFENCAP=0x8925;//get/set encapsulations 
const int SIOCSIFENCAP=0x8926;
const int SIOCGIFHWADDR =0x8927;//Get hardware address 
const int SIOCGIFSLAVE=0x8929;//Driver slaving support 
const int SIOCSIFSLAVE=0x8930;
const int SIOCADDMULTI=0x8931;//Multicast address lists
const int SIOCDELMULTI=0x8932;
const int SIOCGIFINDEX=0x8933;//name -> if_index mapping
const int SIOGIFINDEX=SIOCGIFINDEX;//misprint compatibility :-) 
const int SIOCSIFPFLAGS =0x8934;//set/get extended flags set 
const int SIOCGIFPFLAGS =0x8935;
const int SIOCDIFADDR =0x8936;//delete PA address
const int SIOCSIFHWBROADCAST=0x8937;//set hardware broadcast addr
const int SIOCGIFCOUNT=0x8938;//get number of devices 
const int SIOCGIFBR =0x8940;//Bridging support 
const int SIOCSIFBR =0x8941;//Set bridging options 
const int SIOCGIFTXQLEN =0x8942;//Get the tx queue length
const int SIOCSIFTXQLEN =0x8943;//Set the tx queue length
const int SIOCDARP =0x8953;//delete ARP table entry 
const int SIOCGARP =0x8954;//get ARP table entry 
const int SIOCSARP =0x8955;//set ARP table entry
  const int SIOCDRARP =0x8960;//delete RARP table entry
const int SIOCGRARP =0x8961;//get RARP table entry
const int SIOCSRARP =0x8962;//set RARP table entry
  const int SIOCGIFMAP=0x8970;//Get device parameters 
const int SIOCSIFMAP=0x8971;//Set device parameters

const int SIOCADDDLCI =0x8980;//Create new DLCI device 
const int SIOCDELDLCI =0x8981;//Delete DLCI device

const int TCGETS =0x5401;
const int TCSETS =0x5402;// Clashes with SNDCTL_TMR_START sound ioctl 
const int TCSETSW=0x5403;
const int TCSETSF=0x5404;
const int TCGETA =0x5405;
const int TCSETA =0x5406;
const int TCSETAW=0x5407;
const int TCSETAF=0x5408;
const int TCSBRK =0x5409;
const int TCXONC =0x540A;
const int TCFLSH =0x540B;
const int TIOCEXCL =0x540C;
const int TIOCNXCL =0x540D;
const int TIOCSCTTY =0x540E;
const int TIOCGPGRP =0x540F;
const int TIOCSPGRP =0x5410;
const int TIOCOUTQ =0x5411;
const int TIOCSTI=0x5412;
const int TIOCGWINSZ=0x5413;
const int TIOCSWINSZ=0x5414;
const int TIOCMGET =0x5415;
const int TIOCMBIS =0x5416;
const int TIOCMBIC =0x5417;
const int TIOCMSET =0x5418;
const int TIOCGSOFTCAR =0x5419;
const int TIOCSSOFTCAR =0x541A;
const int FIONREAD =0x541B;
const int TIOCINQFIONREAD;
const int TIOCLINUX =0x541C;
const int TIOCCONS =0x541D;
const int TIOCGSERIAL =0x541E;
const int TIOCSSERIAL =0x541F;
const int TIOCPKT=0x5420;
const int FIONBIO=0x5421;
const int TIOCNOTTY =0x5422;
const int TIOCSETD =0x5423;
const int TIOCGETD =0x5424;
const int TCSBRKP=0x5425;// Needed for POSIX tcsendbreak() 
;// const int TIOCTTYGSTRUCT =0x5426 - Former debugging-only ioctl 
const int TIOCSBRK =0x5427;// BSD compatibility 
const int TIOCCBRK =0x5428;// BSD compatibility 
const int TIOCGSID =0x5429;// Return the session ID of FD
const int FIONCLEX =0x5450;
const int FIOCLEX=0x5451;
const int FIOASYNC =0x5452;
const int TIOCSERCONFIG=0x5453;
const int TIOCSERGWILD =0x5454;
const int TIOCSERSWILD =0x5455;
const int TIOCGLCKTRMIOS =0x5456;
const int TIOCSLCKTRMIOS =0x5457;
const int TIOCSERGSTRUCT =0x5458;// For debugging only 
const int TIOCSERGETLSR=0x5459;// Get line status register 
const int TIOCSERGETMULTI =0x545A;// Get multiport config 
const int TIOCSERSETMULTI =0x545B;// Set multiport config

const int TIOCMIWAIT=0x545C;// wait for a change on serial input line(s) 
const int TIOCGICOUNT =0x545D;// read serial port inline interrupt counts 
const int TIOCGHAYESESP=0x545E;// Get Hayes ESP configuration 
const int TIOCSHAYESESP=0x545F;// Set Hayes ESP configuration 
const int FIOQSIZE =0x5460;
const int TIOCPKT_DATA=0;
const int TIOCPKT_FLUSHREAD =1;
const int TIOCPKT_FLUSHWRITE=2;
const int TIOCPKT_STOP=4;
const int TIOCPKT_START=8;
const int TIOCPKT_NOSTOP=16;
const int TIOCPKT_DOSTOP=32;
const int TIOCSER_TEMT  =0x01;// Transmitter physically empty
Jul 21 2005