1---------------------------------------------------------------- 2-- IRONSIDES - DNS SERVER 3-- 4-- By: Martin C. Carlisle and Barry S. Fagin 5-- Department of Computer Science 6-- United States Air Force Academy 7-- 8-- This is free software; you can redistribute it and/or 9-- modify without restriction. We do ask that you please keep 10-- the original author information, and clearly indicate if the 11-- software has been modified. 12-- 13-- This software is distributed in the hope that it will be useful, 14-- but WITHOUT ANY WARRANTY; without even the implied warranty 15-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16---------------------------------------------------------------- 17 18WITH DNS_Types; 19with DNS_Network; 20--# inherit DNS_Types,DNS_Network; 21PACKAGE Dns_Network_Receive IS 22 procedure Receive_DNS_Packet_TCP 23 (Packet : out DNS_Types.DNS_Tcp_Packet; 24 Number_Bytes : out DNS_Types.Packet_Length_Range; 25 Socket : in DNS_Network.DNS_Socket; 26 Failure : out Boolean); 27 --# global in out DNS_Network.Network; 28 --# derives DNS_Network.Network, Packet, Number_Bytes, Failure from DNS_Network.Network, Socket; 29 --# post (not Failure) -> (Number_Bytes >= DNS_Types.Packet_Length_Range(1+DNS_Types.Header_Bits/8) 30 --# and Number_Bytes <= DNS_Network.MAX_QUERY_SIZE); 31 32 -- Reads a single UDP packet from network on port 53 33 -- Last is the number of bytes read (assuming no failure) 34 procedure Receive_DNS_Packet( 35 Packet : out DNS_Types.DNS_Packet; 36 Number_Bytes : out DNS_Types.Packet_Length_Range; 37 Reply_Address : out DNS_Network.Network_Address_and_Port; 38 Failure : out Boolean); 39 --# global in out DNS_Network.Network; 40 --# derives DNS_Network.Network, Packet, Number_Bytes, Reply_Address, Failure from DNS_Network.Network; 41 --# post (not Failure) -> (Number_Bytes >= DNS_Types.Packet_Length_Range(1+DNS_Types.Header_Bits/8) 42 --# and Number_Bytes <= DNS_Network.MAX_QUERY_SIZE); 43END Dns_Network_Receive; 44 45