77 * passing such bits
88 *
99 * @author Emiel Bruijntjes <[email protected] > 10- * @copyright 2020 Copernica BV
10+ * @copyright 2020 - 2023 Copernica BV
1111 */
1212
1313/* *
@@ -37,6 +37,7 @@ namespace DNS {
3737const int BIT_AD = 1 ;
3838const int BIT_CD = 2 ;
3939const int BIT_DO = 4 ;
40+ const int BIT_RD = 8 ;
4041
4142/* *
4243 * Class definition
@@ -59,10 +60,10 @@ class Bits
5960
6061public:
6162 /* *
62- * Constructor
63+ * Constructor - default behavior is to enable recursion
6364 * @param value
6465 */
65- Bits (int value = 0 ) : _value(value) {}
66+ Bits (int value = BIT_RD ) : _value(value) {}
6667
6768 /* *
6869 * Destructor
@@ -76,6 +77,7 @@ class Bits
7677 bool AD () const { return _value & BIT_AD; }
7778 bool CD () const { return _value & BIT_CD; }
7879 bool DO () const { return _value & BIT_DO; }
80+ bool RD () const { return _value & BIT_RD; }
7981
8082 /* *
8183 * Get access to the bits in long notation
@@ -84,6 +86,7 @@ class Bits
8486 bool authentic () const { return AD (); }
8587 bool checkingdisabled () const { return CD (); }
8688 bool dnssec () const { return DO (); }
89+ bool recursion () const { return RD (); }
8790
8891 /* *
8992 * Setters
@@ -92,6 +95,7 @@ class Bits
9295 void AD (bool value) { value ? add (BIT_AD) : del (BIT_AD); }
9396 void CD (bool value) { value ? add (BIT_CD) : del (BIT_CD); }
9497 void DO (bool value) { value ? add (BIT_DO) : del (BIT_DO); }
98+ void RD (bool value) { value ? add (BIT_RD) : del (BIT_RD); }
9599
96100 /* *
97101 * Setters, long notation
@@ -100,6 +104,7 @@ class Bits
100104 void authentic (bool value) { AD (value); }
101105 void checkingdisabled (bool value) { CD (value); }
102106 void dnssec (bool value) { DO (value); }
107+ void recursion (bool value) { RD (value); }
103108
104109};
105110
0 commit comments