IPv6_Only => SOSC.IPV6_V6ONLY,
Send_Timeout => SOSC.SO_SNDTIMEO,
Receive_Timeout => SOSC.SO_RCVTIMEO,
- Busy_Polling => SOSC.SO_BUSY_POLL];
+ Busy_Polling => SOSC.SO_BUSY_POLL,
+ Bind_To_Device => SOSC.SO_BINDTODEVICE];
-- ??? Note: for OpenSolaris, Receive_Packet_Info should be IP_RECVPKTINFO,
-- but for Linux compatibility this constant is the same as IP_PKTINFO.
use type C.unsigned;
use type C.unsigned_char;
+ -- SOSC.IF_NAMESIZE may be not defined, ensure that we have at least
+ -- a valid range for VS declared below.
+ NS : constant Interfaces.C.size_t :=
+ (if SOSC.IF_NAMESIZE = -1 then 256 else SOSC.IF_NAMESIZE);
V8 : aliased Two_Ints;
V4 : aliased C.int;
U4 : aliased C.unsigned;
V1 : aliased C.unsigned_char;
+ VS : aliased C.char_array (1 .. NS); -- for devices name
VT : aliased Timeval;
Len : aliased C.int;
Add : System.Address;
Res : C.int;
Opt : Option_Type (Name);
Onm : Interfaces.C.int;
-
begin
if Name in Specific_Option_Name then
Onm := Options (Name);
=>
Len := V8'Size / 8;
Add := V8'Address;
+
+ when Bind_To_Device
+ =>
+ Len := VS'Length;
+ Add := VS'Address;
end case;
Res :=
else
Opt.Timeout := To_Duration (VT);
end if;
+
+ when Bind_To_Device =>
+ Opt.Device := ASU.To_Unbounded_String (C.To_Ada (VS));
end case;
return Opt;
V4 : aliased C.int;
U4 : aliased C.unsigned;
V1 : aliased C.unsigned_char;
+ VS : aliased C.char_array
+ (1 .. (if Option.Name = Bind_To_Device
+ then C.size_t (ASU.Length (Option.Device) + 1)
+ else 0));
VT : aliased Timeval;
Len : C.int;
Add : System.Address := Null_Address;
Len := VT'Size / 8;
Add := VT'Address;
end if;
+
+ when Bind_To_Device =>
+ VS := C.To_C (ASU.To_String (Option.Device));
+ Len := C.int (VS'Length);
+ Add := VS'Address;
end case;
if Option.Name in Specific_Option_Name then
-- Sets the approximate time in microseconds to busy poll on a blocking
-- receive when there is no data.
+ Bind_To_Device, -- SO_BINDTODEVICE
+ -- Bind to a specific NIC (Network Interface Controller)
+
-------------------------------
-- IP_Protocol_For_TCP_Level --
-------------------------------
Receive_Timeout =>
Timeout : Timeval_Duration;
+ when Bind_To_Device =>
+ Device : Ada.Strings.Unbounded.Unbounded_String;
end case;
end record;