diff options
Diffstat (limited to 'gcc/ada/g-socket.adb')
-rw-r--r-- | gcc/ada/g-socket.adb | 119 |
1 files changed, 64 insertions, 55 deletions
diff --git a/gcc/ada/g-socket.adb b/gcc/ada/g-socket.adb index 29ede34..a8b718a 100644 --- a/gcc/ada/g-socket.adb +++ b/gcc/ada/g-socket.adb @@ -1169,28 +1169,30 @@ package body GNAT.Sockets is end if; case Name is - when Multicast_Loop | - Multicast_TTL | - Receive_Packet_Info => + when Multicast_Loop + | Multicast_TTL + | Receive_Packet_Info + => Len := V1'Size / 8; Add := V1'Address; - when Generic_Option | - Keep_Alive | - Reuse_Address | - Broadcast | - No_Delay | - Send_Buffer | - Receive_Buffer | - Multicast_If | - Error | - Busy_Polling => + when Broadcast + | Busy_Polling + | Error + | Generic_Option + | Keep_Alive + | Multicast_If + | No_Delay + | Receive_Buffer + | Reuse_Address + | Send_Buffer + => Len := V4'Size / 8; Add := V4'Address; - when Send_Timeout | - Receive_Timeout => - + when Receive_Timeout + | Send_Timeout + => -- The standard argument for SO_RCVTIMEO and SO_SNDTIMEO is a -- struct timeval, but on Windows it is a milliseconds count in -- a DWORD. @@ -1204,12 +1206,12 @@ package body GNAT.Sockets is Add := VT'Address; end if; - when Linger | - Add_Membership | - Drop_Membership => + when Add_Membership + | Drop_Membership + | Linger + => Len := V8'Size / 8; Add := V8'Address; - end case; Res := @@ -1228,44 +1230,48 @@ package body GNAT.Sockets is Opt.Optname := Onm; Opt.Optval := V4; - when Keep_Alive | - Reuse_Address | - Broadcast | - No_Delay => + when Broadcast + | Keep_Alive + | No_Delay + | Reuse_Address + => Opt.Enabled := (V4 /= 0); when Busy_Polling => Opt.Microseconds := Natural (V4); - when Linger => + when Linger => Opt.Enabled := (V8 (V8'First) /= 0); Opt.Seconds := Natural (V8 (V8'Last)); - when Send_Buffer | - Receive_Buffer => + when Receive_Buffer + | Send_Buffer + => Opt.Size := Natural (V4); - when Error => + when Error => Opt.Error := Resolve_Error (Integer (V4)); - when Add_Membership | - Drop_Membership => + when Add_Membership + | Drop_Membership + => To_Inet_Addr (To_In_Addr (V8 (V8'First)), Opt.Multicast_Address); To_Inet_Addr (To_In_Addr (V8 (V8'Last)), Opt.Local_Interface); - when Multicast_If => + when Multicast_If => To_Inet_Addr (To_In_Addr (V4), Opt.Outgoing_If); - when Multicast_TTL => + when Multicast_TTL => Opt.Time_To_Live := Integer (V1); - when Multicast_Loop | - Receive_Packet_Info => + when Multicast_Loop + | Receive_Packet_Info + => Opt.Enabled := (V1 /= 0); - when Send_Timeout | - Receive_Timeout => - + when Receive_Timeout + | Send_Timeout + => if Target_OS = Windows then -- Timeout is in milliseconds, actual value is 500 ms + @@ -2296,10 +2302,11 @@ package body GNAT.Sockets is Len := V4'Size / 8; Add := V4'Address; - when Keep_Alive | - Reuse_Address | - Broadcast | - No_Delay => + when Broadcast + | Keep_Alive + | No_Delay + | Reuse_Address + => V4 := C.int (Boolean'Pos (Option.Enabled)); Len := V4'Size / 8; Add := V4'Address; @@ -2309,49 +2316,52 @@ package body GNAT.Sockets is Len := V4'Size / 8; Add := V4'Address; - when Linger => + when Linger => V8 (V8'First) := C.int (Boolean'Pos (Option.Enabled)); V8 (V8'Last) := C.int (Option.Seconds); Len := V8'Size / 8; Add := V8'Address; - when Send_Buffer | - Receive_Buffer => + when Receive_Buffer + | Send_Buffer + => V4 := C.int (Option.Size); Len := V4'Size / 8; Add := V4'Address; - when Error => + when Error => V4 := C.int (Boolean'Pos (True)); Len := V4'Size / 8; Add := V4'Address; - when Add_Membership | - Drop_Membership => + when Add_Membership + | Drop_Membership + => V8 (V8'First) := To_Int (To_In_Addr (Option.Multicast_Address)); V8 (V8'Last) := To_Int (To_In_Addr (Option.Local_Interface)); Len := V8'Size / 8; Add := V8'Address; - when Multicast_If => + when Multicast_If => V4 := To_Int (To_In_Addr (Option.Outgoing_If)); Len := V4'Size / 8; Add := V4'Address; - when Multicast_TTL => + when Multicast_TTL => V1 := C.unsigned_char (Option.Time_To_Live); Len := V1'Size / 8; Add := V1'Address; - when Multicast_Loop | - Receive_Packet_Info => + when Multicast_Loop + | Receive_Packet_Info + => V1 := C.unsigned_char (Boolean'Pos (Option.Enabled)); Len := V1'Size / 8; Add := V1'Address; - when Send_Timeout | - Receive_Timeout => - + when Receive_Timeout + | Send_Timeout + => if Target_OS = Windows then -- On Windows, the timeout is a DWORD in milliseconds, and @@ -2375,7 +2385,6 @@ package body GNAT.Sockets is Len := VT'Size / 8; Add := VT'Address; end if; - end case; if Option.Name in Specific_Option_Name then |