newlib/winsup/cygwin/include/asm/socket.h

77 lines
3.7 KiB
C
Raw Normal View History

/* asm/socket.h
Copyright 1996, 1997, 1998, 2001, 2005, 2007 Red Hat, Inc.
This file is part of Cygwin.
This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
2000-02-17 20:38:33 +01:00
#ifndef _ASM_SOCKET_H
#define _ASM_SOCKET_H
#include <cygwin/if.h>
#define IOCPARM_MASK 0x7f /* parameters must be < 128 bytes */
#define IOC_VOID 0x20000000 /* no parameters */
#define IOC_OUT 0x40000000 /* copy out parameters */
#define IOC_IN 0x80000000 /* copy in parameters */
#define _IO(x,y) (IOC_VOID|(x<<8)|y)
#define _IOR(x,y,t) (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
#define _IOW(x,y,t) (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
#define SIOCATMARK _IOR('s', 7, u_long) /* at oob mark? */
#define FIONREAD _IOR('f', 127, u_long) /* get # bytes to read */
#define FIONBIO 0x8004667e /* To be compatible with termiost version */
#define REAL_FIONBIO _IOW('f', 126, u_long) /* set/clear non-blocking i/o */
#define FIOASYNC _IOW('f', 125, u_long) /* set/clear async i/o */
#define SIOCSHIWAT _IOW('s', 0, u_long) /* set high watermark */
#define SIOCGHIWAT _IOR('s', 1, u_long) /* get high watermark */
#define SIOCSLOWAT _IOW('s', 2, u_long) /* set low watermark */
#define SIOCGLOWAT _IOR('s', 3, u_long) /* get low watermark */
/* Needed for if queries */
#define SIOCGIFCONF _IOW('s', 100, struct ifconf) /* get if list */
#define SIOCGIFFLAGS _IOW('s', 101, struct ifreq) /* Get if flags */
#define SIOCGIFADDR _IOW('s', 102, struct ifreq) /* Get if addr */
2000-02-17 20:38:33 +01:00
#define SIOCGIFBRDADDR _IOW('s', 103, struct ifreq) /* Get if broadcastaddr */
#define SIOCGIFNETMASK _IOW('s', 104, struct ifreq) /* Get if netmask */
#define SIOCGIFHWADDR _IOW('s', 105, struct ifreq) /* Get hw addr */
#define SIOCGIFMETRIC _IOW('s', 106, struct ifreq) /* get metric */
#define SIOCGIFMTU _IOW('s', 107, struct ifreq) /* get MTU size */
#define SIOCGIFINDEX _IOW('s', 108, struct ifreq) /* get if index */
#define SIOGIFINDEX SIOCGIFINDEX /* backward compatibility w/ Linux typo. */
* autoload.cc (WSAIoctl): Define. (SendARP): Define. * cygwin.din: Export if_freenameindex, if_indextoname, if_nameindex and if_nametoindex. * fhandler_procnet.cc: Drop including wchar.h. Drop definitions of GAA_FLAG_INCLUDE_ALL_INTERFACES, IP_ADAPTER_UNICAST_ADDRESS_VISTA. (fhandler_procnet::exists): Check for has_gaa_prefixes. Call get_adapters_addresses here. (fhandler_procnet::readdir): Ditto. (prefix): Move to net.cc. (fhandler_procnet::fill_filebuf): Call get_adapters_addresses here. Simplify allocation. Use AdapterName rather than FriendlyName as interface name. Use IfIndex if available, Ipv6IfIndex otherwise. (in6_are_prefix_equal): Move to net.cc. * fhandler_socket.cc: Define old SIOCGxxx values. (CONV_OLD_TO_NEW_SIO): Convert old SIOCGxxx value to new one. (struct __old_ifreq): Define old struct ifreq. (fhandler_socket::ioctl): Handle old SIOCGxxx values. Handle new SIOCGIFFRNDLYNAM command. Simplify copying ifreq data to user space. Call get_ifconf with additional SOCKET parameter. * net.cc (IP_ADAPTER_UNICAST_ADDRESS_LH): Define. (IP_ADAPTER_ADDRESSES_LH): Define. (SIO_GET_INTERFACE_LIST): Define. (sockaddr_in6_old): Define. (sockaddr_gen): Define. (INTERFACE_INFO): Define. (IN_LOOPBACK): Define. (in_are_prefix_equal): New static function. (ip_addr_prefix): New function, replaces prefix function, add AF_INET handling. (GAA_FLAG_INCLUDE_ALL_INTERFACES): Define. (get_adapters_addresses): New function. (WS_IFF_xxx): Define Winsock interface flag values. (convert_ifr_flags): New function to convert Winsock interface flag values to Cygwin interface flag values. (get_xp_ifconf): New get_ifconf implementation for XP SP1 and above. (get_2k_ifconf): Fix interface index. Fix formatting. (get_nt_ifconf): Fix formatting. (get_95_ifconf): Ditto. (get_ifconf): Take additional SOCKET parameter. Call get_xp_ifconf on XP SP1 and above. (if_nametoindex): New function. (if_indextoname): New function. (if_nameindex): New function. (if_freenameindex): New function. (in6_are_prefix_equal): Moved here from fhandler_procnet.cc. * wincap.cc (wincap_xp): Define has_gaa_prefixes as true by default. (wincapc::init): Assume has_osversioninfoex by default. Call GetVersionEx with OSVERSIONINFOEX first. Call with OSVERSIONINFO only if that fails. Simplify NT4 case and try to avoid strcmp. Check XP Service Pack using version.wServicePackMajor to avoid strcmp. * include/asm/socket.h (SIOCGIFFRNDLYNAM): Define. * include/cygwin/if.h: Fix formatting. (IFF_POINTTOPOINT): Define. (IFF_NOARP): Define. (IFF_LOWER_UP): Define. (IFF_DORMANT): Define. (struct if_nameindex): Define. (IFRF_FRIENDLYNAMESIZ): Define. (struct ifreq_frndlyname): Define. (IFNAMSIZ): Redefine as 44. (IF_NAMESIZE): Define. (struct ifreq): Redefine ifru_flags as int. Define ifru_data. Pad size to sizeof sockaddr_in6 for further extensions. (ifr_data): Define. (ifr_frndlyname): Define. (if_nametoindex): Declare. (if_indextoname): Declare. (if_nameindex): Declare. (if_freenameindex): Declare. * include/cygwin/version.h: Bump API minor number. (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ): Define check for old vs. new ifreq structure.
2007-01-21 23:54:05 +01:00
#define SIOCGIFFRNDLYNAM _IOW('s', 109, struct ifreq) /* get friendly if name */
#define SIOCGIFDSTADDR _IOW('s', 110, struct ifreq) /* Get if dstaddr */
2000-02-17 20:38:33 +01:00
#define SOL_SOCKET 0xffff /* options for socket level */
#define SO_DEBUG 0x0001 /* turn on debugging info recording */
#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */
#define SO_REUSEADDR 0x0004 /* allow local address reuse */
#define SO_KEEPALIVE 0x0008 /* keep connections alive */
#define SO_DONTROUTE 0x0010 /* just use interface addresses */
#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */
#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */
#define SO_LINGER 0x0080 /* linger on close if data present */
#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */
#define SO_DONTLINGER (u_int)(~SO_LINGER)
#define SO_PEERCRED 0x0200 /* same as getpeereid */
2000-02-17 20:38:33 +01:00
/*
* Additional options.
*/
#define SO_SNDBUF 0x1001 /* send buffer size */
#define SO_RCVBUF 0x1002 /* receive buffer size */
#define SO_SNDLOWAT 0x1003 /* send low-water mark */
#define SO_RCVLOWAT 0x1004 /* receive low-water mark */
#define SO_SNDTIMEO 0x1005 /* send timeout */
#define SO_RCVTIMEO 0x1006 /* receive timeout */
#define SO_ERROR 0x1007 /* get error status and clear */
#define SO_TYPE 0x1008 /* get socket type */
2000-02-17 20:38:33 +01:00
#endif /* _ASM_SOCKET_H */