t2ex/t2ex_source/include/t2ex/sys/ioctl.h | bare source | permlink (0.01 seconds) |
1: /* 2: *---------------------------------------------------------------------- 3: * T2EX Software Package 4: * 5: * Copyright 2012 by Ken Sakamura. 6: * This software is distributed under the latest version of T-License 2.x. 7: *---------------------------------------------------------------------- 8: * 9: * Released by T-Engine Forum(http://www.t-engine.org/) at 2012/12/12. 10: * Modified by TRON Forum(http://www.tron.org/) at 2015/06/04. 11: * 12: *---------------------------------------------------------------------- 13: */ 14: /* 15: * This software package is available for use, modification, 16: * and redistribution in accordance with the terms of the attached 17: * T-License 2.x. 18: * If you want to redistribute the source code, you need to attach 19: * the T-License 2.x document. 20: * There's no obligation to publish the content, and no obligation 21: * to disclose it to the TRON Forum if you have modified the 22: * software package. 23: * You can also distribute the modified source code. In this case, 24: * please register the modification to T-Kernel traceability service. 25: * People can know the history of modifications by the service, 26: * and can be sure that the version you have inherited some 27: * modification of a particular version or not. 28: * 29: * http://trace.tron.org/tk/?lang=en 30: * http://trace.tron.org/tk/?lang=ja 31: * 32: * As per the provisions of the T-License 2.x, TRON Forum ensures that 33: * the portion of the software that is copyrighted by Ken Sakamura or 34: * the TRON Forum does not infringe the copyrights of a third party. 35: * However, it does not make any warranty other than this. 36: * DISCLAIMER: TRON Forum and Ken Sakamura shall not be held 37: * responsible for any consequences or damages caused directly or 38: * indirectly by the use of this software package. 39: * 40: * The source codes in bsd_source.tar.gz in this software package are 41: * derived from NetBSD or OpenBSD and not covered under T-License 2.x. 42: * They need to be changed or redistributed according to the 43: * representation of each source header. 44: */ 45: 46: /* 47: * @(#)ioctl.h 48: * 49: */ 50: 51: #ifndef _SYS_IOCTL_H_ 52: #define _SYS_IOCTL_H_ 53: 54: #include <net/if.h> 55: 56: #ifdef __cplusplus 57: extern "C" { 58: #endif 59: 60: /* ioctl command structure: 61: bits 29-31 direction 62: bits 16-28 parameter length 63: bits 8-15 cmd group 64: bits 0-7 command 65: */ 66: #define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */ 67: #define IOCPARM_SHIFT 16 68: #define IOCGROUP_SHIFT 8 69: 70: /* no parameters */ 71: #define IOC_VOID (unsigned long)0x20000000 72: /* copy parameters out */ 73: #define IOC_OUT (unsigned long)0x40000000 74: /* copy parameters in */ 75: #define IOC_IN (unsigned long)0x80000000 76: /* copy parameters in and out */ 77: #define IOC_INOUT (IOC_IN|IOC_OUT) 78: /* mask for IN/OUT/VOID */ 79: #define IOC_DIRMASK (unsigned long)0xe0000000 80: 81: #define _IOC(inout,group,num,len) \ 82: (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num)) 83: #define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0) 84: #define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t)) 85: #define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t)) 86: /* this should be _IORW, but stdio got there first */ 87: #define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t)) 88: 89: /* 90: * command values 91: */ 92: #define FIONBIO _IOW('f', 126, int) /* set non-blocking I/O mode */ 93: #define FIONREAD _IOR('f', 127, int) /* get the number of bytes for reading */ 94: #define FIONWRITE _IOR('f', 121, int) /* get the number of bytes of send queue */ 95: #define FIONSPACE _IOR('f', 120, int) /* get the free space of send queue */ 96: 97: #define SIOCATMARK _IOR('s', 7, int) /* at oob mark? */ 98: #define SIOCSIFADDR _IOW('i', 12, struct ifreq) /* set ifnet address */ 99: #define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) /* set p-p address */ 100: #define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) /* set ifnet flags */ 101: #define SIOCGIFFLAGS _IOWR('i', 17, struct ifreq) /* get ifnet flags */ 102: #define SIOCSIFBRDADDR _IOW('i', 19, struct ifreq) /* set broadcast addr */ 103: #define SIOCSIFNETMASK _IOW('i', 22, struct ifreq) /* set net addr mask */ 104: #define SIOCDIFADDR _IOW('i', 25, struct ifreq) /* delete IF addr */ 105: #define SIOCAIFADDR _IOW('i', 26, struct ifaliasreq) /* add/chg IF alias */ 106: #define SIOCGIFADDR _IOWR('i', 33, struct ifreq) /* get ifnet address */ 107: #define SIOCGIFDSTADDR _IOWR('i', 34, struct ifreq) /* get p-p address */ 108: #define SIOCGIFBRDADDR _IOWR('i', 35, struct ifreq) /* get broadcast addr */ 109: #define SIOCGIFNETMASK _IOWR('i', 37, struct ifreq) /* get net addr mask */ 110: #define SIOCINQ FIONREAD 111: #define SIOCOUTQ FIONWRITE 112: 113: #define BIOCGETIF _IOR('B',107, struct ifreq) 114: #define BIOCSETIF _IOW('B',108, struct ifreq) 115: 116: #ifdef __cplusplus 117: } 118: #endif 119: #endif /* _SYS_IOCTL_H_ */ 120: