more progress -- still not compiling
[captive-validator.git] / src / se / rfc / unbound / SecurityStatus.java
1 /*
2  * $Id$
3  * 
4  * Copyright (c) 2005 VeriSign. All rights reserved.
5  * 
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  * 
9  * 1. Redistributions of source code must retain the above copyright notice,
10  * this list of conditions and the following disclaimer. 2. Redistributions in
11  * binary form must reproduce the above copyright notice, this list of
12  * conditions and the following disclaimer in the documentation and/or other
13  * materials provided with the distribution. 3. The name of the author may not
14  * be used to endorse or promote products derived from this software without
15  * specific prior written permission.
16  * 
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
20  * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
22  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *  
28  */
29
30 package se.rfc.unbound;
31
32 /**
33  * Codes for DNSSEC security statuses.
34  * 
35  * @author davidb
36  */
37 public class SecurityStatus
38 {
39
40   /**
41    * UNCHECKED means that object has yet to be validated.
42    */
43   public static final byte UNCHECKED     = 0;
44   /**
45    * BOGUS means that the object (RRset or message) failed to validate
46    * (according to local policy), but should have validated.
47    */
48   public static final byte BOGUS         = 1;
49   /**
50    * BAD is a synonym for BOGUS.
51    */
52   public static final byte BAD           = BOGUS;
53   /**
54    * INDTERMINATE means that the object is insecure, but not authoritatively
55    * so. Generally this means that the RRset is not below a configured trust
56    * anchor.
57    */
58   public static final byte INDETERMINATE = 2;
59   /**
60    * INSECURE means that the object is authoritatively known to be insecure.
61    * Generally this means that this RRset is below a trust anchor, but also
62    * below a verified, insecure delegation.
63    */
64   public static final byte INSECURE      = 3;
65   /**
66    * SECURE means that the object (RRset or message) validated according to
67    * local policy.
68    */
69   public static final byte SECURE        = 4;
70
71   private byte              status;
72
73   public static String string(int status)
74   {
75     switch (status)
76     {
77       case BOGUS :
78         return "Bogus";
79       case SECURE :
80         return "Secure";
81       case INSECURE :
82         return "Insecure";
83       case INDETERMINATE :
84         return "Indeterminate";
85       case UNCHECKED :
86         return "Unchecked";
87       default :
88         return "UNKNOWN";
89     }
90   }
91
92   public SecurityStatus() 
93   {
94     status = UNCHECKED;
95   }
96   
97   public SecurityStatus(byte status)
98   {
99     setStatus(status);
100   }
101   
102   public byte getStatus()
103   {
104     return status;
105   }
106
107   public void setStatus(byte status)
108   {
109     this.status = status;
110   }
111
112 }