module ioctls;

version(Linux){
  //
  // This constants have been taken from the file ioctls.h from the Linux Kernel Source
  //

  /* 0x54 is just a magic number to make these relatively unique ('T') */
  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 TIOCINQ		    =     FIONREAD;
  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 */
  /+
  // FIXME: CHECK THIS DECLARATIONS!
  const int TIOCGPTN	    _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
  const int TIOCSPTLCK	  _IOW('T',0x31, int)  /* Lock/unlock Pty */
  const int TIOCGDEV	    _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
  +/
  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;
  
  /* Used for packet mode */
  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 */
  
}


