text stringlengths 0 234 |
|---|
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; |
Value_Str : String) |
is |
begin |
Config.Upstream_DNS_Server := To_Unbounded_String (Value_Str); |
exception |
when Constraint_Error => |
raise Malformed_Line with "Invalid upstrema DNS Server"; |
end Parse_Upstream_DNS_Server; |
-- Loads the upstream DNS Server port 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_Port |
(Config : in out Configuration; |
Value_Str : String) |
is |
begin |
Config.Upstream_DNS_Server_Port := Port_Type'Value (Value_Str); |
exception |
when Constraint_Error => |
raise Malformed_Line |
with "Upstream_DNS_Server_Port not a valid port number"; |
end Parse_Upstream_DNS_Server_Port; |
procedure Initialize_Config_Parse is |
begin |
-- Load String to Type Mapping |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.