text
stringlengths 0
234
|
|---|
procedure Initialize (Addr : System.Address);
|
pragma Import (C, Initialize, "__gnat_initialize");
|
procedure Finalize;
|
pragma Import (C, Finalize, "__gnat_finalize");
|
SEH : aliased array (1 .. 2) of Integer;
|
Ensure_Reference : aliased System.Address := Ada_Main_Program_Name'Address;
|
pragma Volatile (Ensure_Reference);
|
begin
|
if gnat_argc = 0 then
|
gnat_argc := argc;
|
gnat_argv := argv;
|
end if;
|
gnat_envp := envp;
|
Initialize (SEH'Address);
|
adainit;
|
Ada_Main_Program;
|
adafinal;
|
Finalize;
|
return (gnat_exit_status);
|
Function Definition: procedure Main is
|
Function Body: Agent_Port : constant Port_Type := 10_161;
|
-- Changed from 161 to 10161 to avoid Linux permission issues.
|
Agent_Addr : constant Sock_Addr_Type :=
|
(Addr => Inet_Addr ("127.0.0.1"), Port => Agent_Port, others => <>);
|
Peer_Addr : Sock_Addr_Type;
|
Buffer :
|
Stream_Element_Array
|
(1 .. Stream_Element_Offset (Snowpeak.Max_UDP_Payload_Size));
|
Last : Stream_Element_Offset;
|
Socket : Snowpeak.UDP_Socket.UDP_Socket;
|
Querier : Snowpeak.Querier.Map_Querier;
|
Count : Integer := 0;
|
-- REQUIRED FOR DUMMY QUERIER
|
package Types renames RFLX.RFLX_Types;
|
Dummy_Contact_OID : Types.Bytes := [43, 6, 1, 2, 1, 1, 4, 0];
|
Dummy_Contact : Types.Bytes_Ptr :=
|
new Types.Bytes'([102, 111, 46, 111, 98, 64, 97, 114, 98, 46, 97, 122]);
|
Dummy_Name_OID : Types.Bytes := [43, 6, 1, 2, 1, 1, 5, 0];
|
Dummy_Name : Types.Bytes_Ptr := new Types.Bytes'([70, 54, 51, 48, 48]);
|
begin
|
-- INIT OF DUMMY QUERIER
|
declare
|
Element : Varbind;
|
begin
|
for B of Dummy_Contact_OID loop
|
Element.OID.Push (Types.Byte (B));
|
end loop;
|
Element.Variable := (Tag_Num => 4, Data => Dummy_Contact, others => <>);
|
Querier.Data.Push (Element);
|
Function Definition: function As_Bytes is new Ada.Unchecked_Conversion (BE_I64, I64_Bytes);
|
Function Body: Len : constant Short_Length := I64_Length (I);
|
begin
|
return As_Bytes ((Inner => I)) (Types.Index (8 - Len + 1) .. 8);
|
end To_BE_Bytes;
|
-- Encodes an interger with ASN.1 BER.
|
function Length (Self : TLV) return Short_Length is
|
(Short_Length (if Self.Data = null then 0 else Self.Data.all'Length));
|
-- Returns the length of Data in bytes.
|
function Length (Self : Varbind) return Short_Length is
|
(Short_Length (Self.OID.Length) + Self.Variable.Length + 2 * 2);
|
-- Returns the length of the ASN.1 BER encoding of this record.
|
function Length (Self : PDU) return Short_Length is
|
Res : Short_Length :=
|
Short_Length
|
(I64_Length (Self.Request_ID) + I64_Length (Self.Error_Status) +
|
I64_Length (Self.Error_Index)) +
|
4 * 2;
|
-- + [for V of Self.Variable_Bindings.View => V.Length + 2]'Reduce("+", 0)
|
begin
|
-- HACK: Workaround for compiler internal error in version `23.0w-20220508`.
|
for V of Self.Variable_Bindings.View loop
|
Res := @ + V.Length + 2;
|
end loop;
|
return Res;
|
end Length;
|
-- Returns the length of the ASN.1 BER encoding of this record.
|
function Length (Self : Message) return Short_Length is
|
(I64_Length (Self.Version) + Short_Length (Self.Community.Length) +
|
Self.Data.Length + 3 * 2);
|
function Write (Item : Message) return Stream_Element_Array is
|
Buffer : Types.Bytes_Ptr :=
|
new Types.Bytes (1 .. Types.Index (Snowpeak.Max_UDP_Payload_Size));
|
Context : Packet.Context;
|
Item_Full_Length : constant Stream_Element_Offset :=
|
2 + Stream_Element_Offset (Item.Length);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.