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 unsigned_types, dns_types;
19use type Unsigned_Types.unsigned32;
20use type Unsigned_Types.unsigned16;
21use type unsigned_types.unsigned8;
22--#inherit rr_type, unsigned_types, dns_types;
23package Rr_Type.Rrsig_Record_Type is
24   TimeStringLength : constant Natural := 14;   --YYYYMMDDHHmmSS
25   MAX_YEAR : constant natural := 2020;   --seems reasonable to bound this is some way
26   subtype TimeStringTypeIndex is Natural range 1..TimeStringLength;
27   SUBTYPE TimeStringType IS String(TimeStringTypeIndex);
28
29   maxrrsigLength : constant natural := (1024*4)/3;  -- =1365, * 4/3 due to Base64 expansion
30   subtype RRSIGStringTypeIndex is natural range 1..maxRRSIGLength;
31   SUBTYPE RRSIGStringType IS String(RRSIGStringTypeIndex);
32   SUBTYPE SigLengthValueType IS Natural RANGE 0..MaxRRSIGLength;
33
34   type RRSIGRecordType is new rr_type.ResourceRecordType with
35      record
36         TypeCovered : dns_types.Query_Type;
37         algorithm : Unsigned_Types.Unsigned8; --will be 5 for RSA/SHA1
38         numLabels : Unsigned_Types.Unsigned8;
39         origTTL: Unsigned_Types.Unsigned32;
40         sigExpiration: Unsigned_Types.Unsigned32;
41         SigInception: Unsigned_Types.Unsigned32;
42         keyTag : unsigned_types.Unsigned16;
43         signerName : rr_type.DomainNameStringType;
44         signature: RRSIGStringType;
45         signatureLength : SigLengthValueType;
46   end record;
47
48--placeholder for empty slots in hash table
49   blankRRSIGRecord : constant RRSIGRecordType := RRSIGRecordType'(
50      TtlInSeconds => 0,
51      Class => Rr_Type.INTERNET,
52      TypeCovered => dns_types.ERROR,
53      Algorithm => 0,
54      NumLabels => 1,
55      OrigTTL => 0,
56      SigExpiration => 0,
57      SigInception => 0,
58      KeyTag => 0,
59      signerName => Rr_Type.Spaces128,
60      signature => Rr_Type.Spaces1024 & Rr_Type.Spaces256 & Rr_Type.Spaces64
61         & "                     ", -- =1365 spaces
62      signatureLength => 0
63   );
64
65--hash table (2d array) for RRSIG records
66type RRSIGRecordBucketType is array(rr_type.ReturnedRecordsIndexType) of
67     RRSIGRecordType;
68type RRSIGRecordHashTableType is array(rr_type.NumBucketsIndexType) of
69   RRSIGRecordBucketType;
70
71end rr_type.rrsig_record_type;
72