annotate gcc/ada/libgnat/g-sothco.ads @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT COMPILER COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- G N A T . S O C K E T S . T H I N _ C O M M O N --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
9 -- Copyright (C) 2008-2018, AdaCore --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
kono
parents:
diff changeset
17 -- --
kono
parents:
diff changeset
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
kono
parents:
diff changeset
19 -- additional permissions described in the GCC Runtime Library Exception, --
kono
parents:
diff changeset
20 -- version 3.1, as published by the Free Software Foundation. --
kono
parents:
diff changeset
21 -- --
kono
parents:
diff changeset
22 -- You should have received a copy of the GNU General Public License and --
kono
parents:
diff changeset
23 -- a copy of the GCC Runtime Library Exception along with this program; --
kono
parents:
diff changeset
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
kono
parents:
diff changeset
25 -- <http://www.gnu.org/licenses/>. --
kono
parents:
diff changeset
26 -- --
kono
parents:
diff changeset
27 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
29 -- --
kono
parents:
diff changeset
30 ------------------------------------------------------------------------------
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 -- This is the target-independent part of the thin sockets mapping.
kono
parents:
diff changeset
33 -- This package should not be directly with'ed by an applications program.
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 with Ada.Unchecked_Conversion;
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 with Interfaces.C;
kono
parents:
diff changeset
38 with Interfaces.C.Pointers;
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 package GNAT.Sockets.Thin_Common is
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 package C renames Interfaces.C;
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 Success : constant C.int := 0;
kono
parents:
diff changeset
45 Failure : constant C.int := -1;
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47 type time_t is
kono
parents:
diff changeset
48 range -2 ** (8 * SOSC.SIZEOF_tv_sec - 1)
kono
parents:
diff changeset
49 .. 2 ** (8 * SOSC.SIZEOF_tv_sec - 1) - 1;
kono
parents:
diff changeset
50 for time_t'Size use 8 * SOSC.SIZEOF_tv_sec;
kono
parents:
diff changeset
51 pragma Convention (C, time_t);
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 type suseconds_t is
kono
parents:
diff changeset
54 range -2 ** (8 * SOSC.SIZEOF_tv_usec - 1)
kono
parents:
diff changeset
55 .. 2 ** (8 * SOSC.SIZEOF_tv_usec - 1) - 1;
kono
parents:
diff changeset
56 for suseconds_t'Size use 8 * SOSC.SIZEOF_tv_usec;
kono
parents:
diff changeset
57 pragma Convention (C, suseconds_t);
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 type Timeval is record
kono
parents:
diff changeset
60 Tv_Sec : time_t;
kono
parents:
diff changeset
61 Tv_Usec : suseconds_t;
kono
parents:
diff changeset
62 end record;
kono
parents:
diff changeset
63 pragma Convention (C, Timeval);
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 type Timeval_Access is access all Timeval;
kono
parents:
diff changeset
66 pragma Convention (C, Timeval_Access);
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 Immediat : constant Timeval := (0, 0);
kono
parents:
diff changeset
69
kono
parents:
diff changeset
70 -------------------------------------------
kono
parents:
diff changeset
71 -- Mapping tables to low level constants --
kono
parents:
diff changeset
72 -------------------------------------------
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 Families : constant array (Family_Type) of C.int :=
kono
parents:
diff changeset
75 (Family_Inet => SOSC.AF_INET,
kono
parents:
diff changeset
76 Family_Inet6 => SOSC.AF_INET6);
kono
parents:
diff changeset
77
kono
parents:
diff changeset
78 Lengths : constant array (Family_Type) of C.unsigned_char :=
kono
parents:
diff changeset
79 (Family_Inet => SOSC.SIZEOF_sockaddr_in,
kono
parents:
diff changeset
80 Family_Inet6 => SOSC.SIZEOF_sockaddr_in6);
kono
parents:
diff changeset
81
kono
parents:
diff changeset
82 ----------------------------
kono
parents:
diff changeset
83 -- Generic socket address --
kono
parents:
diff changeset
84 ----------------------------
kono
parents:
diff changeset
85
kono
parents:
diff changeset
86 -- Common header
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 -- All socket address types (struct sockaddr, struct sockaddr_storage,
kono
parents:
diff changeset
89 -- and protocol specific address types) start with the same 2-byte header,
kono
parents:
diff changeset
90 -- which is either a length and a family (one byte each) or just a two-byte
kono
parents:
diff changeset
91 -- family. The following unchecked union describes the two possible layouts
kono
parents:
diff changeset
92 -- and is meant to be constrained with SOSC.Have_Sockaddr_Len.
kono
parents:
diff changeset
93
kono
parents:
diff changeset
94 type Sockaddr_Length_And_Family
kono
parents:
diff changeset
95 (Has_Sockaddr_Len : Boolean := False)
kono
parents:
diff changeset
96 is record
kono
parents:
diff changeset
97 case Has_Sockaddr_Len is
kono
parents:
diff changeset
98 when True =>
kono
parents:
diff changeset
99 Length : C.unsigned_char;
kono
parents:
diff changeset
100 Char_Family : C.unsigned_char;
kono
parents:
diff changeset
101
kono
parents:
diff changeset
102 when False =>
kono
parents:
diff changeset
103 Short_Family : C.unsigned_short;
kono
parents:
diff changeset
104 end case;
kono
parents:
diff changeset
105 end record;
kono
parents:
diff changeset
106 pragma Unchecked_Union (Sockaddr_Length_And_Family);
kono
parents:
diff changeset
107 pragma Convention (C, Sockaddr_Length_And_Family);
kono
parents:
diff changeset
108
kono
parents:
diff changeset
109 procedure Set_Family
kono
parents:
diff changeset
110 (Length_And_Family : out Sockaddr_Length_And_Family;
kono
parents:
diff changeset
111 Family : Family_Type);
kono
parents:
diff changeset
112 -- Set the family component to the appropriate value for Family, and also
kono
parents:
diff changeset
113 -- set Length accordingly if applicable on this platform.
kono
parents:
diff changeset
114
kono
parents:
diff changeset
115 type Sockaddr is record
kono
parents:
diff changeset
116 Sa_Family : Sockaddr_Length_And_Family;
kono
parents:
diff changeset
117 -- Address family (and address length on some platforms)
kono
parents:
diff changeset
118
kono
parents:
diff changeset
119 Sa_Data : C.char_array (1 .. 14) := (others => C.nul);
kono
parents:
diff changeset
120 -- Family-specific data
kono
parents:
diff changeset
121 -- Note that some platforms require that all unused (reserved) bytes
kono
parents:
diff changeset
122 -- in addresses be initialized to 0 (e.g. VxWorks).
kono
parents:
diff changeset
123 end record;
kono
parents:
diff changeset
124 pragma Convention (C, Sockaddr);
kono
parents:
diff changeset
125 -- Generic socket address
kono
parents:
diff changeset
126
kono
parents:
diff changeset
127 type Sockaddr_Access is access all Sockaddr;
kono
parents:
diff changeset
128 pragma Convention (C, Sockaddr_Access);
kono
parents:
diff changeset
129 -- Access to socket address
kono
parents:
diff changeset
130
kono
parents:
diff changeset
131 ----------------------------
kono
parents:
diff changeset
132 -- AF_INET socket address --
kono
parents:
diff changeset
133 ----------------------------
kono
parents:
diff changeset
134
kono
parents:
diff changeset
135 type In_Addr is record
kono
parents:
diff changeset
136 S_B1, S_B2, S_B3, S_B4 : C.unsigned_char;
kono
parents:
diff changeset
137 end record;
kono
parents:
diff changeset
138 for In_Addr'Alignment use C.int'Alignment;
kono
parents:
diff changeset
139 pragma Convention (C, In_Addr);
kono
parents:
diff changeset
140 -- IPv4 address, represented as a network-order C.int. Note that the
kono
parents:
diff changeset
141 -- underlying operating system may assume that values of this type have
kono
parents:
diff changeset
142 -- C.int alignment, so we need to provide a suitable alignment clause here.
kono
parents:
diff changeset
143
kono
parents:
diff changeset
144 function To_In_Addr is new Ada.Unchecked_Conversion (C.int, In_Addr);
kono
parents:
diff changeset
145 function To_Int is new Ada.Unchecked_Conversion (In_Addr, C.int);
kono
parents:
diff changeset
146
kono
parents:
diff changeset
147 type In_Addr_Access is access all In_Addr;
kono
parents:
diff changeset
148 pragma Convention (C, In_Addr_Access);
kono
parents:
diff changeset
149 -- Access to internet address
kono
parents:
diff changeset
150
kono
parents:
diff changeset
151 Inaddr_Any : aliased constant In_Addr := (others => 0);
kono
parents:
diff changeset
152 -- Any internet address (all the interfaces)
kono
parents:
diff changeset
153
kono
parents:
diff changeset
154 type In_Addr_Access_Array is array (C.size_t range <>)
kono
parents:
diff changeset
155 of aliased In_Addr_Access;
kono
parents:
diff changeset
156 pragma Convention (C, In_Addr_Access_Array);
kono
parents:
diff changeset
157
kono
parents:
diff changeset
158 package In_Addr_Access_Pointers is new C.Pointers
kono
parents:
diff changeset
159 (C.size_t, In_Addr_Access, In_Addr_Access_Array, null);
kono
parents:
diff changeset
160 -- Array of internet addresses
kono
parents:
diff changeset
161
kono
parents:
diff changeset
162 type Sockaddr_In is record
kono
parents:
diff changeset
163 Sin_Family : Sockaddr_Length_And_Family;
kono
parents:
diff changeset
164 -- Address family (and address length on some platforms)
kono
parents:
diff changeset
165
kono
parents:
diff changeset
166 Sin_Port : C.unsigned_short;
kono
parents:
diff changeset
167 -- Port in network byte order
kono
parents:
diff changeset
168
kono
parents:
diff changeset
169 Sin_Addr : In_Addr;
kono
parents:
diff changeset
170 -- IPv4 address
kono
parents:
diff changeset
171
kono
parents:
diff changeset
172 Sin_Zero : C.char_array (1 .. 8) := (others => C.nul);
kono
parents:
diff changeset
173 -- Padding
kono
parents:
diff changeset
174 --
kono
parents:
diff changeset
175 -- Note that some platforms require that all unused (reserved) bytes
kono
parents:
diff changeset
176 -- in addresses be initialized to 0 (e.g. VxWorks).
kono
parents:
diff changeset
177 end record;
kono
parents:
diff changeset
178 pragma Convention (C, Sockaddr_In);
kono
parents:
diff changeset
179 -- Internet socket address
kono
parents:
diff changeset
180
kono
parents:
diff changeset
181 type Sockaddr_In_Access is access all Sockaddr_In;
kono
parents:
diff changeset
182 pragma Convention (C, Sockaddr_In_Access);
kono
parents:
diff changeset
183 -- Access to internet socket address
kono
parents:
diff changeset
184
kono
parents:
diff changeset
185 procedure Set_Port
kono
parents:
diff changeset
186 (Sin : Sockaddr_In_Access;
kono
parents:
diff changeset
187 Port : C.unsigned_short);
kono
parents:
diff changeset
188 pragma Inline (Set_Port);
kono
parents:
diff changeset
189 -- Set Sin.Sin_Port to Port
kono
parents:
diff changeset
190
kono
parents:
diff changeset
191 procedure Set_Address
kono
parents:
diff changeset
192 (Sin : Sockaddr_In_Access;
kono
parents:
diff changeset
193 Address : In_Addr);
kono
parents:
diff changeset
194 pragma Inline (Set_Address);
kono
parents:
diff changeset
195 -- Set Sin.Sin_Addr to Address
kono
parents:
diff changeset
196
kono
parents:
diff changeset
197 ------------------
kono
parents:
diff changeset
198 -- Host entries --
kono
parents:
diff changeset
199 ------------------
kono
parents:
diff changeset
200
kono
parents:
diff changeset
201 type Hostent is new
kono
parents:
diff changeset
202 System.Storage_Elements.Storage_Array (1 .. SOSC.SIZEOF_struct_hostent);
kono
parents:
diff changeset
203 for Hostent'Alignment use 8;
kono
parents:
diff changeset
204 -- Host entry. This is an opaque type used only via the following
kono
parents:
diff changeset
205 -- accessor functions, because 'struct hostent' has different layouts on
kono
parents:
diff changeset
206 -- different platforms.
kono
parents:
diff changeset
207
kono
parents:
diff changeset
208 type Hostent_Access is access all Hostent;
kono
parents:
diff changeset
209 pragma Convention (C, Hostent_Access);
kono
parents:
diff changeset
210 -- Access to host entry
kono
parents:
diff changeset
211
kono
parents:
diff changeset
212 function Hostent_H_Name
kono
parents:
diff changeset
213 (E : Hostent_Access) return System.Address;
kono
parents:
diff changeset
214
kono
parents:
diff changeset
215 function Hostent_H_Alias
kono
parents:
diff changeset
216 (E : Hostent_Access; I : C.int) return System.Address;
kono
parents:
diff changeset
217
kono
parents:
diff changeset
218 function Hostent_H_Addrtype
kono
parents:
diff changeset
219 (E : Hostent_Access) return C.int;
kono
parents:
diff changeset
220
kono
parents:
diff changeset
221 function Hostent_H_Length
kono
parents:
diff changeset
222 (E : Hostent_Access) return C.int;
kono
parents:
diff changeset
223
kono
parents:
diff changeset
224 function Hostent_H_Addr
kono
parents:
diff changeset
225 (E : Hostent_Access; Index : C.int) return System.Address;
kono
parents:
diff changeset
226
kono
parents:
diff changeset
227 ---------------------
kono
parents:
diff changeset
228 -- Service entries --
kono
parents:
diff changeset
229 ---------------------
kono
parents:
diff changeset
230
kono
parents:
diff changeset
231 type Servent is new
kono
parents:
diff changeset
232 System.Storage_Elements.Storage_Array (1 .. SOSC.SIZEOF_struct_servent);
kono
parents:
diff changeset
233 for Servent'Alignment use 8;
kono
parents:
diff changeset
234 -- Service entry. This is an opaque type used only via the following
kono
parents:
diff changeset
235 -- accessor functions, because 'struct servent' has different layouts on
kono
parents:
diff changeset
236 -- different platforms.
kono
parents:
diff changeset
237
kono
parents:
diff changeset
238 type Servent_Access is access all Servent;
kono
parents:
diff changeset
239 pragma Convention (C, Servent_Access);
kono
parents:
diff changeset
240 -- Access to service entry
kono
parents:
diff changeset
241
kono
parents:
diff changeset
242 function Servent_S_Name
kono
parents:
diff changeset
243 (E : Servent_Access) return System.Address;
kono
parents:
diff changeset
244
kono
parents:
diff changeset
245 function Servent_S_Alias
kono
parents:
diff changeset
246 (E : Servent_Access; Index : C.int) return System.Address;
kono
parents:
diff changeset
247
kono
parents:
diff changeset
248 function Servent_S_Port
kono
parents:
diff changeset
249 (E : Servent_Access) return C.unsigned_short;
kono
parents:
diff changeset
250
kono
parents:
diff changeset
251 function Servent_S_Proto
kono
parents:
diff changeset
252 (E : Servent_Access) return System.Address;
kono
parents:
diff changeset
253
kono
parents:
diff changeset
254 ------------------
kono
parents:
diff changeset
255 -- NetDB access --
kono
parents:
diff changeset
256 ------------------
kono
parents:
diff changeset
257
kono
parents:
diff changeset
258 -- There are three possible situations for the following NetDB access
kono
parents:
diff changeset
259 -- functions:
kono
parents:
diff changeset
260 -- - inherently thread safe (case of data returned in a thread specific
kono
parents:
diff changeset
261 -- buffer);
kono
parents:
diff changeset
262 -- - thread safe using user-provided buffer;
kono
parents:
diff changeset
263 -- - thread unsafe.
kono
parents:
diff changeset
264 --
kono
parents:
diff changeset
265 -- In the first and third cases, the Buf and Buflen are ignored. In the
kono
parents:
diff changeset
266 -- second case, the caller must provide a buffer large enough to
kono
parents:
diff changeset
267 -- accommodate the returned data. In the third case, the caller must ensure
kono
parents:
diff changeset
268 -- that these functions are called within a critical section.
kono
parents:
diff changeset
269
kono
parents:
diff changeset
270 function C_Gethostbyname
kono
parents:
diff changeset
271 (Name : C.char_array;
kono
parents:
diff changeset
272 Ret : not null access Hostent;
kono
parents:
diff changeset
273 Buf : System.Address;
kono
parents:
diff changeset
274 Buflen : C.int;
kono
parents:
diff changeset
275 H_Errnop : not null access C.int) return C.int;
kono
parents:
diff changeset
276
kono
parents:
diff changeset
277 function C_Gethostbyaddr
kono
parents:
diff changeset
278 (Addr : System.Address;
kono
parents:
diff changeset
279 Addr_Len : C.int;
kono
parents:
diff changeset
280 Addr_Type : C.int;
kono
parents:
diff changeset
281 Ret : not null access Hostent;
kono
parents:
diff changeset
282 Buf : System.Address;
kono
parents:
diff changeset
283 Buflen : C.int;
kono
parents:
diff changeset
284 H_Errnop : not null access C.int) return C.int;
kono
parents:
diff changeset
285
kono
parents:
diff changeset
286 function C_Getservbyname
kono
parents:
diff changeset
287 (Name : C.char_array;
kono
parents:
diff changeset
288 Proto : C.char_array;
kono
parents:
diff changeset
289 Ret : not null access Servent;
kono
parents:
diff changeset
290 Buf : System.Address;
kono
parents:
diff changeset
291 Buflen : C.int) return C.int;
kono
parents:
diff changeset
292
kono
parents:
diff changeset
293 function C_Getservbyport
kono
parents:
diff changeset
294 (Port : C.int;
kono
parents:
diff changeset
295 Proto : C.char_array;
kono
parents:
diff changeset
296 Ret : not null access Servent;
kono
parents:
diff changeset
297 Buf : System.Address;
kono
parents:
diff changeset
298 Buflen : C.int) return C.int;
kono
parents:
diff changeset
299
kono
parents:
diff changeset
300 ------------------------------------
kono
parents:
diff changeset
301 -- Scatter/gather vector handling --
kono
parents:
diff changeset
302 ------------------------------------
kono
parents:
diff changeset
303
kono
parents:
diff changeset
304 type Msghdr is record
kono
parents:
diff changeset
305 Msg_Name : System.Address;
kono
parents:
diff changeset
306 Msg_Namelen : C.unsigned;
kono
parents:
diff changeset
307 Msg_Iov : System.Address;
kono
parents:
diff changeset
308 Msg_Iovlen : SOSC.Msg_Iovlen_T;
kono
parents:
diff changeset
309 Msg_Control : System.Address;
kono
parents:
diff changeset
310 Msg_Controllen : C.size_t;
kono
parents:
diff changeset
311 Msg_Flags : C.int;
kono
parents:
diff changeset
312 end record;
kono
parents:
diff changeset
313 pragma Convention (C, Msghdr);
kono
parents:
diff changeset
314
kono
parents:
diff changeset
315 ----------------------------
kono
parents:
diff changeset
316 -- Socket sets management --
kono
parents:
diff changeset
317 ----------------------------
kono
parents:
diff changeset
318
kono
parents:
diff changeset
319 procedure Get_Socket_From_Set
kono
parents:
diff changeset
320 (Set : access Fd_Set;
kono
parents:
diff changeset
321 Last : access C.int;
kono
parents:
diff changeset
322 Socket : access C.int);
kono
parents:
diff changeset
323 -- Get last socket in Socket and remove it from the socket set. The
kono
parents:
diff changeset
324 -- parameter Last is a maximum value of the largest socket. This hint is
kono
parents:
diff changeset
325 -- used to avoid scanning very large socket sets. After a call to
kono
parents:
diff changeset
326 -- Get_Socket_From_Set, Last is set back to the real largest socket in the
kono
parents:
diff changeset
327 -- socket set.
kono
parents:
diff changeset
328
kono
parents:
diff changeset
329 procedure Insert_Socket_In_Set
kono
parents:
diff changeset
330 (Set : access Fd_Set;
kono
parents:
diff changeset
331 Socket : C.int);
kono
parents:
diff changeset
332 -- Insert socket in the socket set
kono
parents:
diff changeset
333
kono
parents:
diff changeset
334 function Is_Socket_In_Set
kono
parents:
diff changeset
335 (Set : access constant Fd_Set;
kono
parents:
diff changeset
336 Socket : C.int) return C.int;
kono
parents:
diff changeset
337 -- Check whether Socket is in the socket set, return a non-zero
kono
parents:
diff changeset
338 -- value if it is, zero if it is not.
kono
parents:
diff changeset
339
kono
parents:
diff changeset
340 procedure Last_Socket_In_Set
kono
parents:
diff changeset
341 (Set : access Fd_Set;
kono
parents:
diff changeset
342 Last : access C.int);
kono
parents:
diff changeset
343 -- Find the largest socket in the socket set. This is needed for select().
kono
parents:
diff changeset
344 -- When Last_Socket_In_Set is called, parameter Last is a maximum value of
kono
parents:
diff changeset
345 -- the largest socket. This hint is used to avoid scanning very large
kono
parents:
diff changeset
346 -- socket sets. After the call, Last is set back to the real largest socket
kono
parents:
diff changeset
347 -- in the socket set.
kono
parents:
diff changeset
348
kono
parents:
diff changeset
349 procedure Remove_Socket_From_Set (Set : access Fd_Set; Socket : C.int);
kono
parents:
diff changeset
350 -- Remove socket from the socket set
kono
parents:
diff changeset
351
kono
parents:
diff changeset
352 procedure Reset_Socket_Set (Set : access Fd_Set);
kono
parents:
diff changeset
353 -- Make Set empty
kono
parents:
diff changeset
354
kono
parents:
diff changeset
355 ------------------------------------------
kono
parents:
diff changeset
356 -- Pairs of signalling file descriptors --
kono
parents:
diff changeset
357 ------------------------------------------
kono
parents:
diff changeset
358
kono
parents:
diff changeset
359 type Two_Ints is array (0 .. 1) of C.int;
kono
parents:
diff changeset
360 pragma Convention (C, Two_Ints);
kono
parents:
diff changeset
361 -- Container for two int values
kono
parents:
diff changeset
362
kono
parents:
diff changeset
363 subtype Fd_Pair is Two_Ints;
kono
parents:
diff changeset
364 -- Two_Ints as used for Create_Signalling_Fds: a pair of connected file
kono
parents:
diff changeset
365 -- descriptors, one of which (the "read end" of the connection) being used
kono
parents:
diff changeset
366 -- for reading, the other one (the "write end") being used for writing.
kono
parents:
diff changeset
367
kono
parents:
diff changeset
368 Read_End : constant := 0;
kono
parents:
diff changeset
369 Write_End : constant := 1;
kono
parents:
diff changeset
370 -- Indexes into an Fd_Pair value providing access to each of the connected
kono
parents:
diff changeset
371 -- file descriptors.
kono
parents:
diff changeset
372
kono
parents:
diff changeset
373 function Inet_Pton
kono
parents:
diff changeset
374 (Af : C.int;
kono
parents:
diff changeset
375 Cp : System.Address;
kono
parents:
diff changeset
376 Inp : System.Address) return C.int;
kono
parents:
diff changeset
377
kono
parents:
diff changeset
378 function C_Ioctl
kono
parents:
diff changeset
379 (Fd : C.int;
kono
parents:
diff changeset
380 Req : SOSC.IOCTL_Req_T;
kono
parents:
diff changeset
381 Arg : access C.int) return C.int;
kono
parents:
diff changeset
382
kono
parents:
diff changeset
383 private
kono
parents:
diff changeset
384 pragma Import (C, Get_Socket_From_Set, "__gnat_get_socket_from_set");
kono
parents:
diff changeset
385 pragma Import (C, Is_Socket_In_Set, "__gnat_is_socket_in_set");
kono
parents:
diff changeset
386 pragma Import (C, Last_Socket_In_Set, "__gnat_last_socket_in_set");
kono
parents:
diff changeset
387 pragma Import (C, Insert_Socket_In_Set, "__gnat_insert_socket_in_set");
kono
parents:
diff changeset
388 pragma Import (C, Remove_Socket_From_Set, "__gnat_remove_socket_from_set");
kono
parents:
diff changeset
389 pragma Import (C, Reset_Socket_Set, "__gnat_reset_socket_set");
kono
parents:
diff changeset
390 pragma Import (C, C_Ioctl, "__gnat_socket_ioctl");
kono
parents:
diff changeset
391 pragma Import (C, Inet_Pton, SOSC.Inet_Pton_Linkname);
kono
parents:
diff changeset
392
kono
parents:
diff changeset
393 pragma Import (C, C_Gethostbyname, "__gnat_gethostbyname");
kono
parents:
diff changeset
394 pragma Import (C, C_Gethostbyaddr, "__gnat_gethostbyaddr");
kono
parents:
diff changeset
395 pragma Import (C, C_Getservbyname, "__gnat_getservbyname");
kono
parents:
diff changeset
396 pragma Import (C, C_Getservbyport, "__gnat_getservbyport");
kono
parents:
diff changeset
397
kono
parents:
diff changeset
398 pragma Import (C, Servent_S_Name, "__gnat_servent_s_name");
kono
parents:
diff changeset
399 pragma Import (C, Servent_S_Alias, "__gnat_servent_s_alias");
kono
parents:
diff changeset
400 pragma Import (C, Servent_S_Port, "__gnat_servent_s_port");
kono
parents:
diff changeset
401 pragma Import (C, Servent_S_Proto, "__gnat_servent_s_proto");
kono
parents:
diff changeset
402
kono
parents:
diff changeset
403 pragma Import (C, Hostent_H_Name, "__gnat_hostent_h_name");
kono
parents:
diff changeset
404 pragma Import (C, Hostent_H_Alias, "__gnat_hostent_h_alias");
kono
parents:
diff changeset
405 pragma Import (C, Hostent_H_Addrtype, "__gnat_hostent_h_addrtype");
kono
parents:
diff changeset
406 pragma Import (C, Hostent_H_Length, "__gnat_hostent_h_length");
kono
parents:
diff changeset
407 pragma Import (C, Hostent_H_Addr, "__gnat_hostent_h_addr");
kono
parents:
diff changeset
408
kono
parents:
diff changeset
409 end GNAT.Sockets.Thin_Common;