home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / utilities / utilss / sockets / include / sys / h / ioctl < prev    next >
Encoding:
Text File  |  1995-11-06  |  13.9 KB  |  355 lines

  1. /*
  2.  * $Header: /ax/networking:include/sys/ioctl.h:networking  1.5  $
  3.  * $Source: /ax/networking:include/sys/ioctl.h: $
  4.  *
  5.  * Copyright (c) 1988 Acorn Computers Ltd., Cambridge, England
  6.  *
  7.  * $Log:    ioctl.h,v $
  8.  * Revision 1.5  95/09/21  15:21:48  pwain
  9.  * Added SIOCGIFMTU and SIOCSIFMTU for PPP driver.
  10.  *
  11.  * Revision 1.4  95/06/13  14:39:58  kwelton
  12.  * Added structure and definitions for new SIOCGPCBHEADS ioctl().
  13.  *
  14.  * Revision 1.3  95/06/05  14:33:30  kwelton
  15.  * Added four new ioctl()'s: SIOC[GS]TCP{IDLE,CNT}.  These are new commands
  16.  * for the Internet module, implemented at the request of Online.
  17.  *
  18.  * Revision 1.2  95/01/24  16:30:21  kwelton
  19.  * Added a new ioctl, SIOCSWHOTHEYARE.
  20.  *
  21.  * Revision 1.1  95/01/11  10:19:17  kwelton
  22.  * Initial revision
  23.  *
  24.  * Revision 1.3     88/06/17  20:19:23  beta
  25.  * Acorn Unix initial beta version
  26.  *
  27.  */
  28. /* @(#)ioctl.h    1.2 87/05/15 3.2/4.3NFSSRC */
  29. /*
  30.  * Copyright (c) 1982, 1986 Regents of the University of California.
  31.  * All rights reserved.     The Berkeley software License Agreement
  32.  * specifies the terms and conditions for redistribution.
  33.  *
  34.  *    @(#)ioctl.h    7.1 (Berkeley) 6/4/86
  35.  */
  36.  
  37. /*
  38.  * Ioctl definitions
  39.  */
  40. #ifndef _IOCTL_
  41. #define _IOCTL_
  42. #ifdef KERNEL
  43. #include "ttychars.h"
  44. #include "ttydev.h"
  45. #else
  46. #include "sys/ttychars.h"
  47. #include "sys/ttydev.h"
  48. #endif
  49.  
  50. struct tchars {
  51.     char    t_intrc;    /* interrupt */
  52.     char    t_quitc;    /* quit */
  53.     char    t_startc;    /* start output */
  54.     char    t_stopc;    /* stop output */
  55.     char    t_eofc;        /* end-of-file */
  56.     char    t_brkc;        /* input delimiter (like nl) */
  57. };
  58. #ifdef    arm
  59. #define SZ_TCHARS    6
  60. #endif  /* arm */
  61.  
  62. struct ltchars {
  63.     char    t_suspc;    /* stop process signal */
  64.     char    t_dsuspc;    /* delayed stop process signal */
  65.     char    t_rprntc;    /* reprint line */
  66.     char    t_flushc;    /* flush output (toggles) */
  67.     char    t_werasc;    /* word erase */
  68.     char    t_lnextc;    /* literal next character */
  69. };
  70. #ifdef    arm
  71. #define SZ_LTCHARS    6
  72. #endif  /* arm */
  73.  
  74. /*
  75.  * Structure for TIOCGETP and TIOCSETP ioctls.
  76.  */
  77.  
  78. #ifndef _SGTTYB_
  79. #define _SGTTYB_
  80. struct sgttyb {
  81.     char    sg_ispeed;        /* input speed */
  82.     char    sg_ospeed;        /* output speed */
  83.     char    sg_erase;        /* erase character */
  84.     char    sg_kill;        /* kill character */
  85.     short    sg_flags;        /* mode flags */
  86. };
  87. #endif
  88.  
  89. /*
  90.  * Window/terminal size structure.
  91.  * This information is stored by the kernel
  92.  * in order to provide a consistent interface,
  93.  * but is not used by the kernel.
  94.  *
  95.  * Type must be "unsigned short" so that types.h not required.
  96.  */
  97. struct winsize {
  98.     unsigned short    ws_row;            /* rows, in characters */
  99.     unsigned short    ws_col;            /* columns, in characters */
  100.     unsigned short    ws_xpixel;        /* horizontal size, pixels */
  101.     unsigned short    ws_ypixel;        /* vertical size, pixels */
  102. };
  103.  
  104. /*
  105.  * Pun for SUN.
  106.  */
  107. struct ttysize {
  108.     unsigned short    ts_lines;
  109.     unsigned short    ts_cols;
  110.     unsigned short    ts_xxx;
  111.     unsigned short    ts_yyy;
  112. };
  113. #define TIOCGSIZE    TIOCGWINSZ
  114. #define TIOCSSIZE    TIOCSWINSZ
  115.  
  116. #ifndef _IO
  117. /*
  118.  * Ioctl's have the command encoded in the lower word,
  119.  * and the size of any in or out parameters in the upper
  120.  * word.  The high 2 bits of the upper word are used
  121.  * to encode the in/out status of the parameter; for now
  122.  * we restrict parameters to at most 128 bytes.
  123.  */
  124. #define IOCPARM_MASK    0x7f        /* parameters must be < 128 bytes */
  125. #define IOC_VOID    0x20000000    /* no parameters */
  126. #define IOC_OUT        0x40000000    /* copy out parameters */
  127. #define IOC_IN        0x80000000    /* copy in parameters */
  128. #define IOC_INOUT    (IOC_IN|IOC_OUT)
  129. /* the 0x20000000 is so we can distinguish new ioctl's from old */
  130. #define _IO(x,y)    (IOC_VOID|(x<<8)|y)
  131. #define _IOR(x,y,t)    (IOC_OUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
  132. #define _IOW(x,y,t)    (IOC_IN|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
  133. /* this should be _IORW, but stdio got there first */
  134. #define _IOWR(x,y,t)    (IOC_INOUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
  135. #endif
  136.  
  137. /*
  138.  * tty ioctl commands
  139.  */
  140. #define TIOCGETD    _IOR('t', 0, int)      /* get line discipline */
  141. #define TIOCSETD    _IOW('t', 1, int)      /* set line discipline */
  142. #define TIOCHPCL    _IO('t', 2)          /* hang up on last close */
  143. #define TIOCMODG    _IOR('t', 3, int)      /* get modem control state */
  144. #define TIOCMODS    _IOW('t', 4, int)      /* set modem control state */
  145. #define        TIOCM_LE    0001        /* line enable */
  146. #define        TIOCM_DTR    0002        /* data terminal ready */
  147. #define        TIOCM_RTS    0004        /* request to send */
  148. #define        TIOCM_ST    0010        /* secondary transmit */
  149. #define        TIOCM_SR    0020        /* secondary receive */
  150. #define        TIOCM_CTS    0040        /* clear to send */
  151. #define        TIOCM_CAR    0100        /* carrier detect */
  152. #define        TIOCM_CD    TIOCM_CAR
  153. #define        TIOCM_RNG    0200        /* ring */
  154. #define        TIOCM_RI    TIOCM_RNG
  155. #define        TIOCM_DSR    0400        /* data set ready */
  156. #define TIOCGETP    _IOR('t', 8,struct sgttyb)/* get parameters -- gtty */
  157. #define TIOCSETP    _IOW('t', 9,struct sgttyb)/* set parameters -- stty */
  158. #define TIOCSETN    _IOW('t',10,struct sgttyb)/* as above, but no flushtty */
  159. #define TIOCEXCL    _IO('t', 13)          /* set exclusive use of tty */
  160. #define TIOCNXCL    _IO('t', 14)          /* reset exclusive use of tty */
  161. #define TIOCFLUSH    _IOW('t', 16, int)      /* flush buffers */
  162. #define TIOCSETC    _IOW('t',17,struct tchars)/* set special characters */
  163. #define TIOCGETC    _IOR('t',18,struct tchars)/* get special characters */
  164. #define        TANDEM        0x00000001    /* send stopc on out q full */
  165. #define        CBREAK        0x00000002    /* half-cooked mode */
  166. #define        LCASE        0x00000004    /* simulate lower case */
  167. #define        ECHO        0x00000008    /* echo input */
  168. #define        CRMOD        0x00000010    /* map \r to \r\n on output */
  169. #define        RAW        0x00000020    /* no i/o processing */
  170. #define        ODDP        0x00000040    /* get/send odd parity */
  171. #define        EVENP        0x00000080    /* get/send even parity */
  172. #define        ANYP        0x000000c0    /* get any parity/send none */
  173. #define        NLDELAY        0x00000300    /* \n delay */
  174. #define            NL0    0x00000000
  175. #define            NL1    0x00000100    /* tty 37 */
  176. #define            NL2    0x00000200    /* vt05 */
  177. #define            NL3    0x00000300
  178. #define        TBDELAY        0x00000c00    /* horizontal tab delay */
  179. #define            TAB0    0x00000000
  180. #define            TAB1    0x00000400    /* tty 37 */
  181. #define            TAB2    0x00000800
  182. #define        XTABS        0x00000c00    /* expand tabs on output */
  183. #define        CRDELAY        0x00003000    /* \r delay */
  184. #define            CR0    0x00000000
  185. #define            CR1    0x00001000    /* tn 300 */
  186. #define            CR2    0x00002000    /* tty 37 */
  187. #define            CR3    0x00003000    /* concept 100 */
  188. #define        VTDELAY        0x00004000    /* vertical tab delay */
  189. #define            FF0    0x00000000
  190. #define            FF1    0x00004000    /* tty 37 */
  191. #define        BSDELAY        0x00008000    /* \b delay */
  192. #define            BS0    0x00000000
  193. #define            BS1    0x00008000
  194. #define        ALLDELAY    (NLDELAY|TBDELAY|CRDELAY|VTDELAY|BSDELAY)
  195. #define        CRTBS        0x00010000    /* do backspacing for crt */
  196. #define        PRTERA        0x00020000    /* \ ... / erase */
  197. #define        CRTERA        0x00040000    /* " \b " to wipe out char */
  198. #define        TILDE        0x00080000    /* hazeltine tilde kludge */
  199. #define        MDMBUF        0x00100000    /* start/stop output on carrier intr */
  200. #define        LITOUT        0x00200000    /* literal output */
  201. #define        TOSTOP        0x00400000    /* SIGSTOP on background output */
  202. #define        FLUSHO        0x00800000    /* flush output to terminal */
  203. #define        NOHANG        0x01000000    /* no SIGHUP on carrier drop */
  204. #define        L001000        0x02000000
  205. #define        CRTKIL        0x04000000    /* kill line with " \b " */
  206. #define        PASS8        0x08000000
  207. #define        CTLECH        0x10000000    /* echo control chars as ^X */
  208. #define        PENDIN        0x20000000    /* tp->t_rawq needs reread */
  209. #define        DECCTQ        0x40000000    /* only ^Q starts after ^S */
  210. #define        NOFLSH        0x80000000    /* no output flush on signal */
  211. /* locals, from 127 down */
  212. #define TIOCLBIS    _IOW('t', 127, int)      /* bis local mode bits */
  213. #define TIOCLBIC    _IOW('t', 126, int)      /* bic local mode bits */
  214. #define TIOCLSET    _IOW('t', 125, int)      /* set entire local mode word */
  215. #define TIOCLGET    _IOR('t', 124, int)      /* get local modes */
  216. #define        LCRTBS        (CRTBS>>16)
  217. #define        LPRTERA        (PRTERA>>16)
  218. #define        LCRTERA        (CRTERA>>16)
  219. #define        LTILDE        (TILDE>>16)
  220. #define        LMDMBUF        (MDMBUF>>16)
  221. #define        LLITOUT        (LITOUT>>16)
  222. #define        LTOSTOP        (TOSTOP>>16)
  223. #define        LFLUSHO        (FLUSHO>>16)
  224. #define        LNOHANG        (NOHANG>>16)
  225. #define        LCRTKIL        (CRTKIL>>16)
  226. #define        LPASS8        (PASS8>>16)
  227. #define        LCTLECH        (CTLECH>>16)
  228. #define        LPENDIN        (PENDIN>>16)
  229. #define        LDECCTQ        (DECCTQ>>16)
  230. #define        LNOFLSH        (NOFLSH>>16)
  231. #define TIOCSBRK    _IO('t', 123)          /* set break bit */
  232. #define TIOCCBRK    _IO('t', 122)          /* clear break bit */
  233. #define TIOCSDTR    _IO('t', 121)          /* set data terminal ready */
  234. #define TIOCCDTR    _IO('t', 120)          /* clear data terminal ready */
  235. #define TIOCGPGRP    _IOR('t', 119, int)      /* get pgrp of tty */
  236. #define TIOCSPGRP    _IOW('t', 118, int)      /* set pgrp of tty */
  237. #define TIOCSLTC    _IOW('t',117,struct ltchars)/* set local special chars */
  238. #define TIOCGLTC    _IOR('t',116,struct ltchars)/* get local special chars */
  239. #define TIOCOUTQ    _IOR('t', 115, int)      /* output queue size */
  240. #define TIOCSTI        _IOW('t', 114, char)      /* simulate terminal input */
  241. #define TIOCNOTTY    _IO('t', 113)          /* void tty association */
  242. #define TIOCPKT        _IOW('t', 112, int)      /* pty: set/clear packet mode */
  243. #define        TIOCPKT_DATA        0x00    /* data packet */
  244. #define        TIOCPKT_FLUSHREAD    0x01    /* flush packet */
  245. #define        TIOCPKT_FLUSHWRITE    0x02    /* flush packet */
  246. #define        TIOCPKT_STOP        0x04    /* stop output */
  247. #define        TIOCPKT_START        0x08    /* start output */
  248. #define        TIOCPKT_NOSTOP        0x10    /* no more ^S, ^Q */
  249. #define        TIOCPKT_DOSTOP        0x20    /* now do ^S ^Q */
  250. #define TIOCSTOP    _IO('t', 111)          /* stop output, like ^S */
  251. #define TIOCSTART    _IO('t', 110)          /* start output, like ^Q */
  252. #define TIOCMSET    _IOW('t', 109, int)      /* set all modem bits */
  253. #define TIOCMBIS    _IOW('t', 108, int)      /* bis modem bits */
  254. #define TIOCMBIC    _IOW('t', 107, int)      /* bic modem bits */
  255. #define TIOCMGET    _IOR('t', 106, int)      /* get all modem bits */
  256. #define TIOCREMOTE    _IOW('t', 105, int)      /* remote input editing */
  257. #define TIOCGWINSZ    _IOR('t', 104, struct winsize)      /* get window size */
  258. #define TIOCSWINSZ    _IOW('t', 103, struct winsize)      /* set window size */
  259. #define TIOCUCNTL    _IOW('t', 102, int)      /* pty: set/clr usr cntl mode */
  260. #define        UIOCCMD(n)    _IO('u', n)          /* usr cntl op "n" */
  261.  
  262. #define OTTYDISC    0        /* old, v7 std tty driver */
  263. #define NETLDISC    1        /* line discip for berk net */
  264. #define NTTYDISC    2        /* new tty discipline */
  265. #define TABLDISC    3        /* tablet discipline */
  266. #define SLIPDISC    4        /* serial IP discipline */
  267. #define MKIDISC        5        /* mouse/keyboard discipline */
  268.  
  269. #define FIOCLEX        _IO('f', 1)          /* set exclusive use on fd */
  270. #define FIONCLEX    _IO('f', 2)          /* remove exclusive use */
  271. /* another local */
  272. #define FIONREAD    _IOR('f', 127, int)      /* get # bytes to read */
  273. #define FIONBIO        _IOW('f', 126, int)      /* set/clear non-blocking i/o */
  274. #define FIOASYNC    _IOW('f', 125, int)      /* set/clear async i/o */
  275. #define FIOSETOWN    _IOW('f', 124, int)      /* set owner */
  276. #define FIOGETOWN    _IOR('f', 123, int)      /* get owner */
  277. #define FIORXDIR    _IOW('f', 122, int)      /* set/clear direct rx */
  278.  
  279. /* socket i/o controls */
  280. #define SIOCSHIWAT    _IOW('s',  0, int)          /* set high watermark */
  281. #define SIOCGHIWAT    _IOR('s',  1, int)          /* get high watermark */
  282. #define SIOCSLOWAT    _IOW('s',  2, int)          /* set low watermark */
  283. #define SIOCGLOWAT    _IOR('s',  3, int)          /* get low watermark */
  284. #define SIOCATMARK    _IOR('s',  7, int)          /* at oob mark? */
  285. #define SIOCSPGRP    _IOW('s',  8, int)          /* set process group */
  286. #define SIOCGPGRP    _IOR('s',  9, int)          /* get process group */
  287.  
  288. #define SIOCADDRT    _IOW('r', 10, struct rtentry)      /* add route */
  289. #define SIOCDELRT    _IOW('r', 11, struct rtentry)      /* delete route */
  290. #ifdef __riscos
  291. #define SIOCGETRT    _IOR('r', 6, struct rttinfo)      /* get route table */
  292. #endif
  293.  
  294. #define SIOCSIFADDR    _IOW('i', 12, struct ifreq)      /* set ifnet address */
  295. #define SIOCGIFADDR    _IOWR('i',13, struct ifreq)      /* get ifnet address */
  296. #define SIOCSIFDSTADDR    _IOW('i', 14, struct ifreq)      /* set p-p address */
  297. #define SIOCGIFDSTADDR    _IOWR('i',15, struct ifreq)      /* get p-p address */
  298. #define SIOCSIFFLAGS    _IOW('i', 16, struct ifreq)      /* set ifnet flags */
  299. #define SIOCGIFFLAGS    _IOWR('i',17, struct ifreq)      /* get ifnet flags */
  300. #define SIOCGIFBRDADDR    _IOWR('i',18, struct ifreq)      /* get broadcast addr */
  301. #define SIOCSIFBRDADDR    _IOW('i',19, struct ifreq)      /* set broadcast addr */
  302. #define SIOCGIFCONF    _IOWR('i',20, struct ifconf)      /* get ifnet list */
  303. #define SIOCGIFNETMASK    _IOWR('i',21, struct ifreq)      /* get net addr mask */
  304. #define SIOCSIFNETMASK    _IOW('i',22, struct ifreq)      /* set net addr mask */
  305. #define SIOCGIFMETRIC    _IOWR('i',23, struct ifreq)      /* get IF metric */
  306. #define SIOCSIFMETRIC    _IOW('i',24, struct ifreq)      /* set IF metric */
  307. #ifdef __riscos
  308. #define SIOCGWHOIAMR    _IOWR('i',25, struct ifreq)      /* get IP adr via REVARP */
  309. #define SIOCGWHOIAMB    _IOWR('i',26, struct ifreq)      /* get IP adr via BOOTP */
  310. #define SIOCGWHOIAMRB    _IOWR('i',27, struct ifreq)      /* get IP adr via REVARP or BOOTP */
  311. #define SIOCGWHOIAMM    _IOWR('i',28, struct ifreq)      /* get net addr mask via ICMP */
  312. #define SIOCGWHOIAMMNS    _IOWR('i',29, struct ifreq)      /* get net addr via MNS Rarp */
  313. #endif
  314.  
  315. #define SIOCSARP    _IOW('i', 30, struct arpreq)      /* set arp entry */
  316. #define SIOCGARP    _IOWR('i',31, struct arpreq)      /* get arp entry */
  317. #define SIOCDARP    _IOW('i', 32, struct arpreq)      /* delete arp entry */
  318. #ifdef __riscos
  319. #define SIOCTARP    _IOR('i', 33, struct arptinfo)      /* read arp table */
  320. #define SIOCSWHOTHEYARE    _IOW('i', 34, struct ifreq)       /* broadcast REVARP
  321.                                * replies (used
  322.                                * by NetG module) */
  323.  
  324. /*
  325.  * the following ioctl's were implemented for use by OM - they are
  326.  * not for use by the faint-hearted, nor by the idly curious
  327.  */
  328. #define SIOCGTCPIDLE    _IOR('i', 35, int)        /* get tcp_keepidle */
  329. #define SIOCSTCPIDLE    _IOW('i', 36, int)        /* set tcp_keepidle */
  330. #define SIOCGTCPCNT    _IOR('i', 37, int)        /* get tcp_keepcnt */
  331. #define SIOCSTCPCNT    _IOW('i', 38, int)        /* set tcp_keepcnt */
  332.  
  333. /* 210995 PWain
  334.  * The IOCTLs to set and get the MTU of a unit.
  335.  */
  336. #define SIOCGIFMTU    _IOWR('i', 39, struct ifreq)    /* get if_mtu */
  337. #define SIOCSIFMTU    _IOW('i', 40, struct ifreq)     /* set if_mtu */
  338.  
  339. /*
  340.  * this ioctl supplies the head of the UDP and TCP pcb linked lists. it
  341.  * is for use by the RISC OS equivalent of the UNIX netstat command
  342.  */
  343. struct pcbheads
  344. {
  345.     struct inpcb *pcb_udb;
  346.     struct inpcb *pcb_tcb;
  347. };
  348. #define SIOCGPCBHEADS    _IOR('i', 39, struct pcbheads)
  349.  
  350. #endif /* defined(__riscos) */
  351.  
  352. #endif
  353.  
  354. /* EOF ioctl.h */
  355.