text stringlengths 0 234 |
|---|
goto Shutdown_Procedure; |
Function Definition: function Uint8_To_Character is new Ada.Unchecked_Conversion |
Function Body: (Source => Unsigned_8, Target => Character); |
function Uint16_To_String is new Ada.Unchecked_Conversion |
(Source => Unsigned_16, Target => QAttributes); |
-- Actually does the dirty work of creating a question |
function Create_QName_Record |
(Domain_Section : String) |
return String |
is |
Label : String (1 .. Domain_Section'Length + 1); |
begin |
if Domain_Section /= "." |
then |
Label (1) := |
Uint8_To_Character (Unsigned_8 (Domain_Section'Length)); |
Label |
(2 .. Domain_Section'Length + 1) := Domain_Section; |
else |
-- If this is a "." by itself, it's the terminator, and we need to |
-- do special handling |
declare |
Empty_Label : String (1 .. 1); |
begin |
Empty_Label (1) := Uint8_To_Character (Unsigned_8 (0)); |
return Empty_Label; |
Function Definition: function String_To_Packet is new Ada.Unchecked_Conversion |
Function Body: (Source => String, Target => QData_SEA); |
begin |
Outbound_Packet.Raw_Data.Data := |
new Stream_Element_Array (1 .. QData'Length); |
Outbound_Packet.Raw_Data.Data.all := String_To_Packet (QData); |
Outbound_Packet.Raw_Data_Length := |
DNS_PACKET_HEADER_SIZE + QData'Length; |
Function Definition: -- Parse_Procedure is an access procedure that is used as a common prototype |
Function Body: -- for all parsing functionality dispatched from GCP_Management and other |
-- vectors. |
-- |
-- @value Config |
-- Configuration struct to update |
-- |
-- @value Value_Str |
-- Pure text version of the configuration argument |
-- |
type Parse_Procedure is access procedure |
(Config : in out Configuration; |
Value_Str : String); |
-- GCP_Management is a vector that handles dynamic dispatch to the |
-- parsing parameters above; it is used to match key/values from the |
-- config file to |
package GCP_Management is new Ada.Containers.Indefinite_Ordered_Maps |
(String, Parse_Procedure); |
GCP_Map : GCP_Management.Map; |
-- Configuration constructor |
procedure Initialize (Config : in out Configuration) is |
begin |
-- We initialize the ports to 53 by default |
Config.Local_Listen_Port := 53; |
Config.Upstream_DNS_Server_Port := 53; |
-- No upstream server is set |
Config.Upstream_DNS_Server := To_Unbounded_String (""); |
end Initialize; |
-- Loads the load listen value and sets it in the config record |
-- |
-- @value Config |
-- Configuration struct to update |
-- |
-- @value Value_Str |
-- Pure text version of the configuration argument |
-- |
procedure Parse_Local_Listen_Port |
(Config : in out Configuration; |
Value_Str : String) |
is |
begin |
Config.Local_Listen_Port := Port_Type'Value (Value_Str); |
exception |
when Constraint_Error => |
raise Malformed_Line with "Local_Listen_Port not a valid port number"; |
end Parse_Local_Listen_Port; |
-- Loads the upstream DNS Server from the config file |
-- |
-- @value Config |
-- Configuration struct to update |
-- |
-- @value Value_Str |
-- Pure text version of the configuration argument |
-- |
procedure Parse_Upstream_DNS_Server |
(Config : in out Configuration; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.