1{ 2 This file is part of the Free Pascal run time library. 3 (c) 2000-2003 by Marco van de Voort 4 member of the Free Pascal development team. 5 (c) 2010 by Olivier Coursière. 6 7 See the file COPYING.FPC, included in this distribution, 8 for details about the copyright. 9 10 OS dependant part of the header. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY;without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15} 16 17Const 18{* 19 * Address families. 20 *} 21 AF_UNSPEC = 0; { unspecified } 22 AF_INET = 1; { internetwork: UDP, TCP, etc. } 23 AF_APPLETALK = 2; { Apple Talk } 24 AF_ROUTE = 3; { Internal Routing Protocol } 25 AF_LINK = 4; { Link layer interface } 26 AF_INET6 = 5; { IPv6 } 27 AF_DLI = 6; { DEC Direct data link interface } 28 AF_IPX = 7; { Novell Internet Protocol } 29 AF_NOTIFY = 8; { ??? } 30 AF_LOCAL = 9; { local to host (pipes, portals) } 31 AF_UNIX = AF_LOCAL; { standardized name for AF_LOCAL } 32 AF_BLUETOOTH = 10; { Bluetooth sockets } 33 AF_MAX = 11; 34 35(* Values not yet defined under Haiku (see sys/socket.h) 36 AF_IMPLINK = 3; { arpanet imp addresses } 37 AF_PUP = 4; { pup protocols: e.g. BSP } 38 AF_CHAOS = 5; { mit CHAOS protocols } 39 AF_NETBIOS = 6; { SMB protocols } 40 AF_ISO = 7; { ISO protocols } 41 AF_OSI = AF_ISO; 42 AF_ECMA = 8; { European computer manufacturers } 43 AF_DATAKIT = 9; { datakit protocols } 44 AF_CCITT = 10; { CCITT protocols, X.25 etc } 45 AF_SNA = 11; { IBM SNA } 46 AF_DECnet = 12; { DECnet } 47 AF_LAT = 14; { LAT } 48 AF_HYLINK = 15; { NSC Hyperchannel } 49 pseudo_AF_XTP = 19; { eXpress Transfer Protocol (no AF) } 50 AF_COIP = 20; { connection-oriented IP, aka ST II } 51 AF_CNT = 21; { Computer Network Technology } 52 pseudo_AF_RTIP = 22; { Help Identify RTIP packets } 53 AF_SIP = 24; { Simple Internet Protocol } 54 pseudo_AF_PIP = 25; { Help Identify PIP packets } 55 AF_ISDN = 26; { Integrated Services Digital Network} 56 AF_E164 = AF_ISDN; { CCITT E.164 recommendation } 57 pseudo_AF_KEY = 27; { Internal key-management function } 58 AF_NATM = 29; { native ATM access } 59 AF_ATM = 30; { ATM } 60 pseudo_AF_HDRCMPLT = 31; { Used by BPF to not rewrite headers 61 * in interface output routine 62 } 63 AF_NETGRAPH = 32; { Netgraph sockets } 64 AF_SLOW = 33; { 802.3ad slow protocol } 65 AF_SCLUSTER = 34; { Sitara cluster protocol } 66 AF_ARP = 35; 67 AF_IEEE80211 = 37; { IEEE 802.11 protocol } 68*) 69 70 { 71 * Protocol families, same as address families for now. 72 } 73 74 const 75 PF_UNSPEC = AF_UNSPEC; 76 PF_INET = AF_INET; 77 PF_ROUTE = AF_ROUTE; 78 PF_LINK = AF_LINK; 79 PF_INET6 = AF_INET6; 80 PF_LOCAL = AF_LOCAL; 81 { backward compatibility } 82 PF_UNIX = PF_LOCAL; 83 PF_BLUETOOTH = AF_BLUETOOTH; 84 PF_MAX = AF_MAX; 85 86(* Values not yet defined under Haiku (see sys/socket.h) 87 PF_IMPLINK = AF_IMPLINK; 88 PF_PUP = AF_PUP; 89 PF_CHAOS = AF_CHAOS; 90 PF_NETBIOS = AF_NETBIOS; 91 PF_ISO = AF_ISO; 92 PF_OSI = AF_ISO; 93 PF_ECMA = AF_ECMA; 94 PF_DATAKIT = AF_DATAKIT; 95 PF_CCITT = AF_CCITT; 96 PF_SNA = AF_SNA; 97 PF_DECnet = AF_DECnet; 98 PF_DLI = AF_DLI; 99 PF_LAT = AF_LAT; 100 PF_HYLINK = AF_HYLINK; 101 PF_APPLETALK = AF_APPLETALK; 102 { really just proto family, no AF } 103 PF_XTP = pseudo_AF_XTP; 104 PF_COIP = AF_COIP; 105 PF_CNT = AF_CNT; 106 PF_SIP = AF_SIP; 107 PF_IPX = AF_IPX; 108 { same format as AF_INET } 109 PF_RTIP = pseudo_AF_RTIP; 110 PF_PIP = pseudo_AF_PIP; 111 PF_ISDN = AF_ISDN; 112 PF_KEY = pseudo_AF_KEY; 113 PF_NATM = AF_NATM; 114 PF_ATM = AF_ATM; 115 PF_NETGRAPH = AF_NETGRAPH; 116 PF_SLOW = AF_SLOW; 117 PF_SCLUSTER = AF_SCLUSTER; 118 PF_ARP = AF_ARP; 119*) 120 121 SOCK_PACKET = 10; 122 123 124{ Maximum queue length specifiable by listen. } 125 SOMAXCONN = 32; 126 127 SOL_SOCKET = -1; 128 129 SO_ACCEPTCONN = $00000001; { socket has had listen() } 130 SO_BROADCAST = $00000002; { permit sending of broadcast msgs } 131 SO_DEBUG = $00000004; { turn on debugging info recording } 132 SO_DONTROUTE = $00000008; { just use interface addresses } 133 SO_KEEPALIVE = $00000010; { keep connections alive } 134 SO_OOBINLINE = $00000020; { leave received OOB data in line } 135 SO_REUSEADDR = $00000040; { allow local address reuse } 136 SO_REUSEPORT = $00000080; { allow local address & port reuse } 137 SO_USELOOPBACK = $00000100; { bypass hardware when possible } 138 SO_LINGER = $00000200; { linger on close if data present } 139 140(* Values not yet defined under Haiku (see sys/socket.h) 141 SO_TIMESTAMP = $0400; { timestamp received dgram traffic } 142*) 143 144{ 145 * Additional options, not kept in so_options. 146 } 147 SO_SNDBUF = $40000001; { send buffer size } 148 SO_SNDLOWAT = $40000003; { send low-water mark } 149 SO_SNDTIMEO = $40000005; { send timeout } 150 SO_RCVBUF = $40000002; { receive buffer size } 151 SO_RCVLOWAT = $40000004; { receive low-water mark } 152 SO_RCVTIMEO = $40000006; { receive timeout } 153 SO_ERROR = $40000007; { get error status and clear } 154 SO_TYPE = $40000008; { get socket type } 155 SO_NONBLOCK = $40000009; 156 SO_BINDTODEVICE = $4000000a; { binds the socket to a specific device index } 157 SO_PEERCRED = $4000000b; { get peer credentials, param: ucred } 158 159 160 SHUT_RD =0; { shut down the reading side } 161 SHUT_WR =1; { shut down the writing side } 162 SHUT_RDWR =2; { shut down both sides } 163 164 IPPROTO_IP = 0; { dummy for IP } 165 IPPROTO_ICMP = 1; { control message protocol } 166 IPPROTO_TCP = 6; { tcp } 167 IPPROTO_UDP = 17; { user datagram protocol } 168 169 170 IPPROTO_HOPOPTS = 0 ; { IP6 hop-by-hop options } 171 IPPROTO_IGMP = 2 ; { group mgmt protocol } 172 IPPROTO_GGP = 3 ; { gateway^2 (deprecated) } 173 IPPROTO_IPV4 = 4 ; { IPv4 encapsulation } 174 IPPROTO_IPIP = IPPROTO_IPV4; { for compatibility } 175 IPPROTO_ST = 7 ; { Stream protocol II } 176 IPPROTO_EGP = 8 ; { exterior gateway protocol } 177 IPPROTO_PIGP = 9 ; { private interior gateway } 178 IPPROTO_RCCMON = 10; { BBN RCC Monitoring } 179 IPPROTO_NVPII = 11; { network voice protocol} 180 IPPROTO_PUP = 12; { pup } 181 IPPROTO_ARGUS = 13; { Argus } 182 IPPROTO_EMCON = 14; { EMCON } 183 IPPROTO_XNET = 15; { Cross Net Debugger } 184 IPPROTO_CHAOS = 16; { Chaos} 185 IPPROTO_MUX = 18; { Multiplexing } 186 IPPROTO_MEAS = 19; { DCN Measurement Subsystems } 187 IPPROTO_HMP = 20; { Host Monitoring } 188 IPPROTO_PRM = 21; { Packet Radio Measurement } 189 IPPROTO_IDP = 22; { xns idp } 190 IPPROTO_TRUNK1 = 23; { Trunk-1 } 191 IPPROTO_TRUNK2 = 24; { Trunk-2 } 192 IPPROTO_LEAF1 = 25; { Leaf-1 } 193 IPPROTO_LEAF2 = 26; { Leaf-2 } 194 IPPROTO_RDP = 27; { Reliable Data } 195 IPPROTO_IRTP = 28; { Reliable Transaction } 196 IPPROTO_TP = 29; { tp-4 w/ class negotiation } 197 IPPROTO_BLT = 30; { Bulk Data Transfer } 198 IPPROTO_NSP = 31; { Network Services } 199 IPPROTO_INP = 32; { Merit Internodal } 200 IPPROTO_SEP = 33; { Sequential Exchange } 201 IPPROTO_3PC = 34; { Third Party Connect } 202 IPPROTO_IDPR = 35; { InterDomain Policy Routing } 203 IPPROTO_XTP = 36; { XTP } 204 IPPROTO_DDP = 37; { Datagram Delivery } 205 IPPROTO_CMTP = 38; { Control Message Transport } 206 IPPROTO_TPXX = 39; { TP++ Transport } 207 IPPROTO_IL = 40; { IL transport protocol } 208 IPPROTO_IPV6 = 41; { IP6 header } 209 IPPROTO_SDRP = 42; { Source Demand Routing } 210 IPPROTO_ROUTING = 43; { IP6 routing header } 211 IPPROTO_FRAGMENT = 44; { IP6 fragmentation header } 212 IPPROTO_IDRP = 45; { InterDomain Routing} 213 IPPROTO_RSVP = 46; { resource reservation } 214 IPPROTO_GRE = 47; { General Routing Encap. } 215 IPPROTO_MHRP = 48; { Mobile Host Routing } 216 IPPROTO_BHA = 49; { BHA } 217 IPPROTO_ESP = 50; { IP6 Encap Sec. Payload } 218 IPPROTO_AH = 51; { IP6 Auth Header } 219 IPPROTO_INLSP = 52; { Integ. Net Layer Security } 220 IPPROTO_SWIPE = 53; { IP with encryption } 221 IPPROTO_NHRP = 54; { Next Hop Resolution } 222 IPPROTO_MOBILE = 55; { IP Mobility } 223 IPPROTO_TLSP = 56; { Transport Layer Security } 224 IPPROTO_SKIP = 57; { SKIP } 225 IPPROTO_ICMPV6 = 58; { ICMP6 } 226 IPPROTO_NONE = 59; { IP6 no next header } 227 IPPROTO_DSTOPTS = 60; { IP6 destination option } 228 IPPROTO_AHIP = 61; { any host internal protocol } 229 IPPROTO_CFTP = 62; { CFTP } 230 IPPROTO_HELLO = 63; { "hello" routing protocol } 231 IPPROTO_SATEXPAK = 64; { SATNET/Backroom EXPAK } 232 IPPROTO_KRYPTOLAN = 65; { Kryptolan } 233 IPPROTO_RVD = 66; { Remote Virtual Disk } 234 IPPROTO_IPPC = 67; { Pluribus Packet Core } 235 IPPROTO_ADFS = 68; { Any distributed FS } 236 IPPROTO_SATMON = 69; { Satnet Monitoring } 237 IPPROTO_VISA = 70; { VISA Protocol } 238 IPPROTO_IPCV = 71; { Packet Core Utility } 239 IPPROTO_CPNX = 72; { Comp. Prot. Net. Executive } 240 IPPROTO_CPHB = 73; { Comp. Prot. HeartBeat } 241 IPPROTO_WSN = 74; { Wang Span Network } 242 IPPROTO_PVP = 75; { Packet Video Protocol } 243 IPPROTO_BRSATMON = 76; { BackRoom SATNET Monitoring } 244 IPPROTO_ND = 77; { Sun net disk proto (temp.) } 245 IPPROTO_WBMON = 78; { WIDEBAND Monitoring } 246 IPPROTO_WBEXPAK = 79; { WIDEBAND EXPAK } 247 IPPROTO_EON = 80; { ISO cnlp } 248 IPPROTO_VMTP = 81; { VMTP } 249 IPPROTO_SVMTP = 82; { Secure VMTP } 250 IPPROTO_VINES = 83; { Banyon VINES } 251 IPPROTO_TTP = 84; { TTP } 252 IPPROTO_IGP = 85; { NSFNET-IGP } 253 IPPROTO_DGP = 86; { dissimilar gateway prot. } 254 IPPROTO_TCF = 87; { TCF } 255 IPPROTO_IGRP = 88; { Cisco/GXS IGRP } 256 IPPROTO_OSPFIGP = 89; { OSPFIGP } 257 IPPROTO_SRPC = 90; { Strite RPC protocol } 258 IPPROTO_LARP = 91; { Locus Address Resoloution } 259 IPPROTO_MTP = 92; { Multicast Transport } 260 IPPROTO_AX25 = 93; { AX.25 Frames } 261 IPPROTO_IPEIP = 94; { IP encapsulated in IP } 262 IPPROTO_MICP = 95; { Mobile Int.ing control } 263 IPPROTO_SCCSP = 96; { Semaphore Comm. security } 264 IPPROTO_ETHERIP = 97; { Ethernet IP encapsulation } 265 IPPROTO_ENCAP = 98; { encapsulation header } 266 IPPROTO_APES = 99; { any private encr. scheme } 267 IPPROTO_GMTP = 100; { GMTP} 268 IPPROTO_IPCOMP = 108; { payload compression (IPComp) } 269{ 101-254: Partly Unassigned } 270 IPPROTO_PIM = 103; { Protocol Independent Mcast } 271 IPPROTO_CARP = 112; { CARP } 272 IPPROTO_PGM = 113; { PGM } 273 IPPROTO_PFSYNC = 240; { PFSYNC } 274 275{ last return value of *_input(), meaning "all job for this pkt is done". } 276 IPPROTO_RAW = 255; 277 IPPROTO_MAX = 256; 278 IPPROTO_DONE = 257; 279 280{ 281 * Options for use with [gs]etsockopt at the IP level. 282 * First word of comment is data type; bool is stored in int. 283 } 284 IP_OPTIONS = 1 ; { buf/ip_opts; set/get IP options } 285 IP_HDRINCL = 2 ; { int; header is included with data } 286 IP_TOS = 3 ; { int; IP type of service and preced. } 287 IP_TTL = 4 ; { int; IP time to live } 288 IP_RECVOPTS = 5 ; { bool; receive all IP opts w/dgram } 289 IP_RECVRETOPTS = 6 ; { bool; receive IP opts for response } 290 IP_RECVDSTADDR = 7 ; { bool; receive IP dst addr w/dgram } 291 IP_SENDSRCADDR = IP_RECVDSTADDR; { cmsg_type to set src addr } 292 IP_RETOPTS = 8 ; { ip_opts; set/get IP options } 293 IP_MULTICAST_IF = 9 ; { u_char; set/get IP multicast i/f } 294 IP_MULTICAST_TTL = 10; { u_char; set/get IP multicast ttl } 295 IP_MULTICAST_LOOP = 11; { u_char; set/get IP multicast loopback } 296 IP_ADD_MEMBERSHIP = 12; { ip_mreq; add an IP group membership } 297 IP_DROP_MEMBERSHIP = 13; { ip_mreq; drop an IP group membership } 298 299 IP_BLOCK_SOURCE = 14; { ip_mreq_source } 300 IP_UNBLOCK_SOURCE = 15; { ip_mreq_source } 301 IP_ADD_SOURCE_MEMBERSHIP = 16; { ip_mreq_source } 302 IP_DROP_SOURCE_MEMBERSHIP = 17; { ip_mreq_source } 303 MCAST_JOIN_GROUP = 18; { group_req } 304 MCAST_BLOCK_SOURCE = 19; { group_source_req } 305 MCAST_UNBLOCK_SOURCE = 20; { group_source_req } 306 MCAST_LEAVE_GROUP = 21; { group_req } 307 MCAST_JOIN_SOURCE_GROUP = 22; { group_source_req } 308 MCAST_LEAVE_SOURCE_GROUP = 23; { group_source_req } 309 310(* Values not yet defined under Haiku (see netinet/in.h) 311 IP_MULTICAST_VIF = 14; { set/get IP mcast virt. iface } 312 IP_RSVP_ON = 15; { enable RSVP in kernel } 313 IP_RSVP_OFF = 16; { disable RSVP in kernel } 314 IP_RSVP_VIF_ON = 17; { set RSVP per-vif socket } 315 IP_RSVP_VIF_OFF = 18; { unset RSVP per-vif socket } 316 IP_PORTRANGE = 19; { int; range to choose for unspec port } 317 IP_RECVIF = 20; { bool; receive reception if w/dgram } 318 319{ for IPSEC } 320 IP_IPSEC_POLICY = 21; { int; set/get security policy } 321 IP_FAITH = 22; { bool; accept FAITH'ed connections } 322 323 IP_ONESBCAST = 23; { bool: send all-ones broadcast } 324 325 IP_FW_TABLE_ADD = 40; { add entry } 326 IP_FW_TABLE_DEL = 41; { delete entry } 327 IP_FW_TABLE_FLUSH = 42; { flush table } 328 IP_FW_TABLE_GETSIZE = 43; { get table size } 329 IP_FW_TABLE_LIST = 44; { list table contents } 330 331 IP_FW_ADD = 50; { add a firewall rule to chain } 332 IP_FW_DEL = 51; { delete a firewall rule from chain } 333 IP_FW_FLUSH = 52; { flush firewall rule chain } 334 IP_FW_ZERO = 53; { clear single/all firewall counter(s) } 335 IP_FW_GET = 54; { get entire firewall rule chain } 336 IP_FW_RESETLOG = 55; { reset logging counters } 337 338 IP_DUMMYNET_CONFIGURE = 60; { add/configure a dummynet pipe } 339 IP_DUMMYNET_DEL = 61; { delete a dummynet pipe from chain } 340 IP_DUMMYNET_FLUSH = 62; { flush dummynet } 341 IP_DUMMYNET_GET = 64; { get entire dummynet pipes } 342 343 IP_RECVTTL = 65; { bool; receive IP TTL w/dgram } 344 345 IPV6_SOCKOPT_RESERVED1 = 3 ; { reserved for future use } 346 IPV6_UNICAST_HOPS = 4 ; { int; IP6 hops } 347*) 348 349 IPV6_MULTICAST_IF = 24; { u_int; setget IP6 multicast if } 350 IPV6_MULTICAST_HOPS = 25; { int; setget IP6 multicast hops } 351 IPV6_MULTICAST_LOOP = 26; { u_int; setget IP6 multicast loopback } 352 353(* Values not yet defined under Haiku (see netinet/in.h) 354 IPV6_JOIN_GROUP = 12; { ip6_mreq; join a group membership } 355 IPV6_LEAVE_GROUP = 13; { ip6_mreq; leave a group membership } 356 IPV6_PORTRANGE = 14; { int; range to choose for unspec port } 357 358 IPV6_PKTINFO = 46; { in6_pktinfo; send if, src addr } 359 IPV6_HOPLIMIT = 47; { int; send hop limit } 360 IPV6_NEXTHOP = 48; { sockaddr; next hop addr } 361 IPV6_HOPOPTS = 49; { ip6_hbh; send hop-by-hop option } 362 IPV6_DSTOPTS = 50; { ip6_dest; send dst option befor rthdr } 363 IPV6_RTHDR = 51; { ip6_rthdr; send routing header } 364 IPV6_PKTOPTIONS = 52; { buf/cmsghdr; set/get IPv6 options } 365*) 366 367 { Flags for send, recv etc. } 368 MSG_OOB = $0001; { process out-of-band data} 369 MSG_PEEK = $0002; { peek at incoming messages } 370 MSG_DONTROUTE = $0004; { send without using routing tables } 371 MSG_EOR = $0008; { data completes record } 372 MSG_TRUNC = $0010; { data discarded before delivery } 373 MSG_CTRUNC = $0020; { control data lost before delivery } 374 MSG_WAITALL = $0040; { wait for full request or error } 375 MSG_DONTWAIT = $0080; { this message should be nonblocking } 376 MSG_BCAST = $0100; { this message rec'd as broadcast } 377 MSG_MCAST = $0200; { this message rec'd as multicast } 378 MSG_EOF = $0400; { data completes connection } 379 380(* Values not yet defined under Haiku (see sys/socket.h) 381 MSG_NBIO = $4000; 382 MSG_COMPAT = $8000; 383 MSG_SOCALLBCK = $10000; 384 MSG_NOSIGNAL = $20000; { Do not generate SIGPIPE } 385*) 386 387 { SOL_SOCKET control message types } 388 SCM_RIGHTS = $01; 389 390 INVALID_SOCKET = -1; 391 SOCKET_ERROR = -1; 392 393 TCP_NODELAY = $01; 394 { don't delay sending smaller packets } 395 TCP_MAXSEG = $02; 396 { set maximum segment size } 397 TCP_NOPUSH = $04; 398 { don't use TH_PUSH } 399 TCP_NOOPT = $08; 400 { don't use any TCP options } 401