1 module tango.sys.solaris.consts.socket;
2 import tango.sys.solaris.consts.fcntl: F_GETFL, F_SETFL,O_NONBLOCK;
3 
4     enum {SOCKET_ERROR = -1}
5     enum
6     {
7         SO_DEBUG = 0x0001 , /* turn on debugging info recording */
8         SO_BROADCAST = 0x0020 , /* permit sending of broadcast msgs */
9         SO_REUSEADDR = 0x0004 , /* allow local address reuse */
10         SO_LINGER = 0x0080 , /* linger on close if data present */
11         SO_DONTLINGER = ~(SO_LINGER),
12         SO_OOBINLINE = 0x0100 , /* leave received OOB data in line */
13         SO_ACCEPTCONN = 0x0002, /* socket has had listen() */
14         SO_KEEPALIVE = 0x0008 , /* keep connections alive */
15         SO_DONTROUTE = 0x0010, /* just use interface addresses */
16         SO_TYPE = 0x1008 , /* get socket type */
17         /*
18          * Additional options, not kept in so_options.
19          */
20         SO_SNDBUF = 0x1001, /* send buffer size */
21         SO_RCVBUF = 0x1002, /* receive buffer size */
22         SO_ERROR = 0x1007 , /* get error status and clear */
23         // OptionLevel.IP settings
24         IP_MULTICAST_TTL = 0x11 ,
25         IP_MULTICAST_LOOP = 0x12 ,
26         IP_ADD_MEMBERSHIP = 0x13 ,
27         IP_DROP_MEMBERSHIP = 0x14,
28         // OptionLevel.TCP settings
29         TCP_NODELAY = 0x01 ,
30     }
31     
32     enum
33     {
34         SOL_SOCKET = 0xffff,
35     }
36     enum
37     {
38         SOCK_STREAM = 2 , /++ sequential, reliable +/
39         SOCK_DGRAM = 1, /++ connectionless unreliable, max length +/
40         SOCK_SEQPACKET = 6, /++ sequential, reliable, max length +/
41         SOCK_RAW = 4,
42     }
43 
44     /* Standard well-defined IP protocols.  */
45     enum
46       {
47         IPPROTO_IP = 0, /* Dummy protocol for TCP.  */
48         IPPROTO_IPV4 = 0,
49         IPPROTO_IPV6 = 41, /* IPv6 header.  */
50         IPPROTO_ICMP = 1, /* Internet Control Message Protocol.  */
51         IPPROTO_IGMP = 2, /* Internet Group Management Protocol. */
52         IPPROTO_TCP = 6, /* Transmission Control Protocol.  */
53         IPPROTO_PUP = 12, /* PUP protocol.  */
54         IPPROTO_UDP = 17, /* User Datagram Protocol.  */
55         IPPROTO_IDP = 22, /* XNS IDP protocol.  */
56         /+
57         // undefined for cross platform reasons, if you need them ask
58         IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94).  */
59         IPPROTO_HOPOPTS = 0, /* IPv6 Hop-by-Hop options.  */
60         IPPROTO_EGP = 8, /* Exterior Gateway Protocol.  */
61         IPPROTO_TP = 29, /* SO Transport Protocol Class 4.  */
62         IPPROTO_ROUTING = 43, /* IPv6 routing header.  */
63         IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header.  */
64         IPPROTO_RSVP = 46, /* Reservation Protocol.  */
65         IPPROTO_GRE = 47, /* General Routing Encapsulation.  */
66         IPPROTO_ESP = 50, /* encapsulating security payload.  */
67         IPPROTO_AH = 51, /* authentication header.  */
68         IPPROTO_ICMPV6 = 58, /* ICMPv6.  */
69         IPPROTO_NONE = 59, /* IPv6 no next header.  */
70         IPPROTO_DSTOPTS = 60, /* IPv6 destination options.  */
71         IPPROTO_MTP = 92, /* Multicast Transport Protocol.  */
72         IPPROTO_ENCAP = 98, /* Encapsulation Header.  */
73         IPPROTO_PIM = 103, /* Protocol Independent Multicast.  */
74         IPPROTO_COMP = 108, /* Compression Header Protocol.  */
75         IPPROTO_SCTP = 132, /* Stream Control Transmission Protocol.  */
76         IPPROTO_RAW = 255, /* Raw IP packets.  */
77         IPPROTO_MAX
78         +/
79       }
80     enum
81     {
82         AF_UNSPEC = 0 ,
83         AF_UNIX = 1 ,
84         AF_INET = 2 ,
85         AF_IPX = 23,
86         AF_APPLETALK = 16,
87         AF_INET6 = 26 ,
88     }
89     enum : uint
90     {
91         SCM_RIGHTS = 0x1010
92     }
93     enum
94     {
95         SOMAXCONN       = 128,
96     }
97     
98     enum : uint
99     {
100         MSG_CTRUNC      = 0x10,
101         MSG_DONTROUTE   = 0x4,
102         MSG_EOR         = 0x8,
103         MSG_OOB         = 0x1,
104         MSG_PEEK        = 0x2,
105         MSG_TRUNC       = 0x20,
106         MSG_WAITALL     = 0x40
107     }
108 
109     enum
110     {
111         SHUT_RD = 0,
112         SHUT_WR = 1,
113         SHUT_RDWR = 2
114     }
115         
116 enum: int
117 {
118          AI_PASSIVE = 0x0008,   /// intended for bind() + listen()
119          AI_CANONNAME = 0x0010, /// return canonical version of host
120          AI_NUMERICHOST = 0x0020,       /// use numeric node address string
121          AI_NUMERICSERV = 0x0040,       /// servname is assumed numeric
122          AI_V4MAPPED = 0x0001,  /// IPv4 mapped addresses if no IPv6
123          AI_ALL = 0x0002,       /// IPv6 and IPv4 mapped addresses
124          AI_ADDRCONFIG = 0x0004,        /// AAAA or A records only if IPv6/IPv4 cnfg'd
125          AI_MASK = (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | AI_ADDRCONFIG),
126          AI_DEFAULT = (AI_V4MAPPED | AI_ADDRCONFIG),
127 }
128 
129 enum
130 {
131         EAI_BADFLAGS = 3,       /// Invalid value for `ai_flags' field.
132         EAI_NONAME = 8, /// NAME or SERVICE is unknown.
133         EAI_AGAIN = 2,  /// Temporary failure in name resolution.
134         EAI_FAIL = 4,   /// Non-recoverable failure in name res.
135         EAI_NODATA = 7, /// No address associated with NAME.
136         EAI_FAMILY = 5, /// `ai_family' not supported.
137         EAI_SOCKTYPE = 10,      /// `ai_socktype' not supported.
138         EAI_SERVICE = 9,        /// SERVICE not supported for `ai_socktype'.
139         EAI_MEMORY = 6, /// Memory allocation failure.
140 }       
141 
142 enum
143 {
144         NI_MAXHOST = 1025,
145         NI_MAXSERV = 32,
146         NI_NUMERICHOST = 0x0002,        /// Don't try to look up hostname.
147         NI_NUMERICSERV = 0x0008,        /// Don't convert port number to name.
148         NI_NOFQDN = 0x0001,     /// Only return nodename portion.
149         NI_NAMEREQD = 0x0004,   /// Don't return numeric addresses.
150         NI_DGRAM = 0x0010,      /// Look up UDP service rather than TCP.
151 }       
152