libepp_nicbr
ReverseDSInfo.H
Go to the documentation of this file.
1 /* ${copyright}$ */
2 /* $Id$ */
7 #ifndef __REVERSE_DSINFO_H__
8 #define __REVERSE_DSINFO_H__
9 
10 #include "CommonData.H"
11 #include "DSInfo.H"
12 
13 LIBEPP_NICBR_NS_BEGIN
14 
17 public:
18  ReverseDSInfo& operator=(const ReverseDSInfo &dsInfo) {
19  _ipRange.reset();
20  _key_tag = dsInfo._key_tag;
21  _algo = dsInfo._algo;
22  _digest_type = dsInfo._digest_type;
23  _digest = dsInfo._digest;
24  return *this;
25  }
26 
29  {
30  this->reset();
31  }
32 
34 
37  void set_ipRange(const IpRange &ipRange)
38  {
39  _ipRange = ipRange;
40  }
41 
43 
47  {
48  return _ipRange;
49  }
50 
52 
55  void set_key_tag(const unsigned int key_tag)
56  {
57  _key_tag = key_tag;
58  }
59 
61 
64  unsigned int get_key_tag() const
65  {
66  return _key_tag;
67  }
68 
70 
73  void set_algo(const unsigned int algo)
74  {
75  _algo = algo;
76  }
77 
79 
82  unsigned int get_algo() const { return _algo; }
83 
85 
88  void set_digest_type(const unsigned int digest_type)
89  {
90  _digest_type = digest_type;
91  }
92 
94 
97  unsigned int get_digest_type() const { return _digest_type; }
98 
100 
103  void set_digest(const string& digest)
104  {
105  _digest = digest;
106  }
107 
109 
112  string get_digest() const
113  {
114  return _digest;
115  }
116 
118 
121  string get_xml_format(string secDnsVersion = "") const
122  {
123  string xml = "<ipnetwork:dsData>"
124  "<ipnetwork:ipRange version=\"" +
125  StrUtil::esc_xml_markup(_ipRange.get_version()) + "\">"
126  "<ipnetwork:startAddress>" +
127  StrUtil::esc_xml_markup(_ipRange.get_ipBegin()) +
128  "</ipnetwork:startAddress>"
129  "<ipnetwork:endAddress>" +
130  StrUtil::esc_xml_markup(_ipRange.get_ipEnd()) +
131  "</ipnetwork:endAddress>"
132  "</ipnetwork:ipRange>"
133  "<ipnetwork:keyTag>" + StrUtil::to_string("%u", _key_tag) +
134  "</ipnetwork:keyTag>"
135  "<ipnetwork:alg>" + StrUtil::to_string("%u", _algo) +
136  "</ipnetwork:alg>"
137  "<ipnetwork:digestType>" + StrUtil::to_string("%u", _digest_type) +
138  "</ipnetwork:digestType>"
139  "<ipnetwork:digest>" + StrUtil::esc_xml_markup(_digest) +
140  "</ipnetwork:digest>"
141  "</ipnetwork:dsData>";
142 
143  return xml;
144  }
145 
146  void reset()
147  {
148  _ipRange.reset();
149  _key_tag = 0;
150  _algo = 0;
151  _digest_type = 0;
152  _digest = "";
153  }
154 
155 private:
156  // DS Info attributes
157  IpRange _ipRange;
158  unsigned int _key_tag;
159  unsigned int _algo;
160  unsigned int _digest_type;
161  string _digest;
162 };
163 
164 LIBEPP_NICBR_NS_END
165 
166 #endif // __REVERSE_DSINFO_H__
static string to_string(const char *format, const kind &number)
Convert number to string where the format string looks like printf format.
Definition: StrUtil.H:57
void set_ipRange(const IpRange &ipRange)
Sets ip range.
Definition: ReverseDSInfo.H:37
string get_xml_format(string secDnsVersion="") const
Returns the xml format.
Definition: ReverseDSInfo.H:121
unsigned int get_key_tag() const
Returns the key tag.
Definition: ReverseDSInfo.H:64
EPP CommonData Class.
void set_digest(const string &digest)
Sets the digest.
Definition: ReverseDSInfo.H:103
ReverseDSInfo()
Default constructor.
Definition: ReverseDSInfo.H:28
Describes IpRange structure.
Definition: CommonData.H:192
IpRange get_ipRange() const
Returns ip range.
Definition: ReverseDSInfo.H:46
static string esc_xml_markup(const string &input_txt)
Escape &'><" characters.
void set_digest_type(const unsigned int digest_type)
Sets the digest type.
Definition: ReverseDSInfo.H:88
void set_algo(const unsigned int algo)
Sets algorithm.
Definition: ReverseDSInfo.H:73
EPP/DNSSEC DS information class.
void set_key_tag(const unsigned int key_tag)
Sets key tag.
Definition: ReverseDSInfo.H:55
unsigned int get_digest_type() const
Returns the digest type.
Definition: ReverseDSInfo.H:97
unsigned int get_algo() const
Returns the algorithm.
Definition: ReverseDSInfo.H:82
string get_digest() const
Returns the digest.
Definition: ReverseDSInfo.H:112
Reverse DSInfo Class.
Definition: ReverseDSInfo.H:16