1 #ifndef _CYGWIN_SOCKET_H 2 #define _CYGWIN_SOCKET_H 3 4 #ifdef __cplusplus 5 extern "C" { 6 #endif /* __cplusplus */ 7 8 struct sockaddr { 9 unsigned short sa_family; /* address family, AF_xxx */ 10 char sa_data[14]; /* 14 bytes of protocol address */ 11 }; 12 13 #include <asm/socket.h> /* arch-dependent defines */ 14 #include <cygwin/sockios.h> /* the SIOCxxx I/O controls */ 15 #include <cygwin/uio.h> /* iovec support */ 16 #include <sys/types.h> 17 18 struct linger { 19 unsigned short l_onoff; /* Linger active */ 20 unsigned short l_linger; /* How long to linger for */ 21 }; 22 23 struct msghdr 24 { 25 void * msg_name; /* Socket name */ 26 int msg_namelen; /* Length of name */ 27 struct iovec * msg_iov; /* Data blocks */ 28 int msg_iovlen; /* Number of blocks */ 29 void * msg_accrights; /* Per protocol magic (eg BSD file descriptor passing) */ 30 int msg_accrightslen; /* Length of rights list */ 31 }; 32 33 /* Socket types. */ 34 #define SOCK_STREAM 1 /* stream (connection) socket */ 35 #define SOCK_DGRAM 2 /* datagram (conn.less) socket */ 36 #define SOCK_RAW 3 /* raw socket */ 37 #define SOCK_RDM 4 /* reliably-delivered message */ 38 #define SOCK_SEQPACKET 5 /* sequential packet socket */ 39 40 /* Supported address families. */ 41 /* 42 * Address families. 43 */ 44 #define AF_UNSPEC 0 /* unspecified */ 45 #define AF_UNIX 1 /* local to host (pipes, portals) */ 46 #define AF_LOCAL 1 /* POSIX name for AF_UNIX */ 47 #define AF_INET 2 /* internetwork: UDP, TCP, etc. */ 48 #define AF_IMPLINK 3 /* arpanet imp addresses */ 49 #define AF_PUP 4 /* pup protocols: e.g. BSP */ 50 #define AF_CHAOS 5 /* mit CHAOS protocols */ 51 #define AF_NS 6 /* XEROX NS protocols */ 52 #define AF_ISO 7 /* ISO protocols */ 53 #define AF_OSI AF_ISO /* OSI is ISO */ 54 #define AF_ECMA 8 /* european computer manufacturers */ 55 #define AF_DATAKIT 9 /* datakit protocols */ 56 #define AF_CCITT 10 /* CCITT protocols, X.25 etc */ 57 #define AF_SNA 11 /* IBM SNA */ 58 #define AF_DECnet 12 /* DECnet */ 59 #define AF_DLI 13 /* Direct data link interface */ 60 #define AF_LAT 14 /* LAT */ 61 #define AF_HYLINK 15 /* NSC Hyperchannel */ 62 #define AF_APPLETALK 16 /* AppleTalk */ 63 #define AF_NETBIOS 17 /* NetBios-style addresses */ 64 #define AF_INET6 23 /* IP version 6 */ 65 66 #define AF_MAX 32 67 /* 68 * Protocol families, same as address families for now. 69 */ 70 #define PF_UNSPEC AF_UNSPEC 71 #define PF_UNIX AF_UNIX 72 #define PF_LOCAL AF_LOCAL 73 #define PF_INET AF_INET 74 #define PF_IMPLINK AF_IMPLINK 75 #define PF_PUP AF_PUP 76 #define PF_CHAOS AF_CHAOS 77 #define PF_NS AF_NS 78 #define PF_ISO AF_ISO 79 #define PF_OSI AF_OSI 80 #define PF_ECMA AF_ECMA 81 #define PF_DATAKIT AF_DATAKIT 82 #define PF_CCITT AF_CCITT 83 #define PF_SNA AF_SNA 84 #define PF_DECnet AF_DECnet 85 #define PF_DLI AF_DLI 86 #define PF_LAT AF_LAT 87 #define PF_HYLINK AF_HYLINK 88 #define PF_APPLETALK AF_APPLETALK 89 #define PF_NETBIOS AF_NETBIOS 90 #define PF_INET6 AF_INET6 91 92 #define PF_MAX AF_MAX 93 94 /* Maximum queue length specificable by listen. */ 95 #define SOMAXCONN 5 96 97 /* Flags we can use with send/ and recv. */ 98 #define MSG_OOB 0x1 /* process out-of-band data */ 99 #define MSG_PEEK 0x2 /* peek at incoming message */ 100 #define MSG_DONTROUTE 0x4 /* send without using routing tables */ 101 102 /* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */ 103 #define SOL_IP 0 104 #define SOL_IPX 256 105 #define SOL_AX25 257 106 #define SOL_ATALK 258 107 #define SOL_NETROM 259 108 #define SOL_TCP 6 109 #define SOL_UDP 17 110 111 /* IP options */ 112 #define IPTOS_LOWDELAY 0x10 113 #define IPTOS_THROUGHPUT 0x08 114 #define IPTOS_RELIABILITY 0x04 115 116 /* These need to appear somewhere around here */ 117 #define IP_DEFAULT_MULTICAST_TTL 1 118 #define IP_DEFAULT_MULTICAST_LOOP 1 119 #define IP_MAX_MEMBERSHIPS 20 120 121 /* IP options for use with WinSock */ 122 123 #define IP_OPTIONS 1 124 #define IP_MULTICAST_IF 2 125 #define IP_MULTICAST_TTL 3 126 #define IP_MULTICAST_LOOP 4 127 #define IP_ADD_MEMBERSHIP 5 128 #define IP_DROP_MEMBERSHIP 6 129 #define IP_TTL 7 130 #define IP_TOS 8 131 #define IP_DONTFRAGMENT 9 132 133 /* IPX options */ 134 #define IPX_TYPE 1 135 136 /* TCP options - this way around because someone left a set in the c library includes */ 137 #define TCP_NODELAY 0x0001 138 #define TCP_MAXSEG 2 139 140 /* The various priorities. */ 141 #define SOPRI_INTERACTIVE 0 142 #define SOPRI_NORMAL 1 143 #define SOPRI_BACKGROUND 2 144 145 #ifdef __cplusplus 146 }; 147 #endif /* __cplusplus */ 148 149 #endif /* _CYGWIN_SOCKET_H */ |