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 Gnat.Byte_Swapping; 19package body DNS_Types is 20 21 22 function Byte_Swap_US(U : Unsigned_Short) return Unsigned_Short is 23 --# hide Byte_Swap_US 24 Answer : Unsigned_Short; 25 begin 26 -- 27 Answer := U; 28 Gnat.Byte_Swapping.Swap2(Answer'Address); 29 return Answer; 30 end Byte_Swap_US; 31 32 --------------- 33 -- Byte_Swap -- 34 --------------- 35 36 procedure Byte_Swap (H : in out Header_Type) is 37 begin 38 H.MessageID := Byte_Swap_US(H.MessageID); 39 H.QDCount := Byte_Swap_US(H.QDCount); 40 H.ANCount := Byte_Swap_US(H.ANCount); 41 H.NSCount := Byte_Swap_US(H.NSCount); 42 H.ARCount := Byte_Swap_US(H.ARCount); 43 end Byte_Swap; 44 45end DNS_Types; 46