1 /* 2 * Copyright (C) 2006-2021 Registro.br. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are 6 * met: 7 * 1. Redistribution of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY REGISTRO.BR ``AS IS AND ANY EXPRESS OR 14 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 * WARRANTIE OF FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 16 * EVENT SHALL REGISTRO.BR BE LIABLE FOR ANY DIRECT, INDIRECT, 17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 18 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 19 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 20 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 21 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 22 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 23 * DAMAGE. 24 */ 25 /* $Id$ */ 26 /** @file Greeting.H 27 * @brief EPP Greeting Class 28 */ 29 30 #ifndef __GREETING_H__ 31 #define __GREETING_H__ 32 33 #include <string> 34 #include <set> 35 36 #include "libepp_nicbr.H" 37 38 using std::string; 39 using std::set; 40 41 LIBEPP_NICBR_NS_BEGIN 42 43 /// EPP Greeting Class 44 class Greeting 45 { 46 public: 47 48 /// For details about the following codes, see RFC 3730 - Session 2.4 49 enum Access { 50 UNSET_AC = -1, 51 ALL = 0, 52 NONE_AC, 53 NULL_AC, 54 PERSONAL, 55 PERSONAL_AND_OTHER, 56 OTHER_AC 57 }; 58 59 /// For details about the following codes, see RFC 3730 - Session 2.4 60 enum Purpose { 61 ADMIN = 0, 62 CONTACT, 63 PROV, 64 OTHER_PR 65 }; 66 67 /// For details about the following codes, see RFC 3730 - Session 2.4 68 enum Recipient { 69 OTHER_RC = 0, 70 OURS, 71 PUBLIC, 72 SAME, 73 UNRELATED 74 }; 75 76 /// For details about the following codes, see RFC 3730 - Session 2.4 77 enum Retention { 78 UNSET_RT = -1, 79 BUSINESS = 0, 80 INDEFINITE, 81 LEGAL, 82 NONE_RT, 83 STATED 84 }; 85 86 /// Sets the svID 87 /** 88 @param svID Server Name 89 */ 90 void set_svID(const string &svID); 91 92 /// Sets the server's current date and time 93 /** 94 @param svDate Server Current Date and Time (UTC) 95 */ 96 void set_svDate(const string &svDate); 97 98 /// Sets the protocol version 99 /** 100 @param version Protocol versions supported by the server 101 */ 102 void set_version(const string &version); 103 104 /// Sets the language supported by the server 105 /** 106 @param lang Languages known by the server (format defined by RFC3066) 107 */ 108 void set_lang(const string &lang); 109 110 /// Sets the object the server supports 111 /** 112 @param objURI Objects that the server is capable of managing 113 */ 114 void set_objURI(const string &objURI); 115 116 /// Sets object extensions the server supports 117 /** 118 @param extURI Object extensions supported by the server 119 */ 120 void set_extURI(const string &extURI); 121 122 /// Sets the server's Access parameter 123 /** 124 @param access Access provided by the server 125 */ 126 void set_access(const Access &access); 127 128 /// Sets the server's Purpose parameter 129 /** 130 @param purpose Data collection purposes 131 */ 132 void set_purpose(const Purpose &purpose); 133 134 /// Sets the server's Recipient parameter 135 /** 136 @param recipient Data recipients 137 */ 138 void set_recipient(const Recipient &recipient); 139 140 /// Sets the server's Recipient description 141 /** 142 @param recDesc Recipient description 143 */ 144 void set_recDesc(const string &recDesc); 145 146 /// Sets the server's Retention parameter 147 /** 148 @param retention Data retention 149 */ 150 void set_retention(const Retention &retention); 151 152 /// Sets the server's policy expiry 153 /** 154 @param type 0 = absolute, 1 = relative 155 @param expiry Policy lifetime 156 */ 157 void set_expiry(const int &type, const string &expiry); 158 159 /// Returns the svID 160 /** 161 @return svID 162 */ 163 string get_svID() const; 164 165 /// Returns the server's current date and time 166 /** 167 @return svDate 168 */ 169 string get_svDate() const; 170 171 /// Returns the protocol version 172 /** 173 @return version 174 */ 175 set<string> get_version() const; 176 177 /// Returns the language supported by the server 178 /** 179 @return lang 180 */ 181 set<string> get_lang() const; 182 183 /// Returns the object the server supports 184 /** 185 @return objURI 186 */ 187 set<string> get_objURI() const; 188 189 /// Returns the object extensions the server supports 190 /** 191 @return extURI 192 */ 193 set<string> get_extURI() const; 194 195 /// Returns the server's Access parameter 196 /** 197 @return access 198 */ 199 Access get_access() const; 200 201 /// Returns the server's Purpose parameter 202 /** 203 @return purpose 204 */ 205 set<Purpose> get_purpose() const; 206 207 /// Returns the server's Recipient parameter 208 /** 209 @return recipient 210 */ 211 set<Recipient> get_recipient() const; 212 213 /// Returns the server's Recipient description 214 /** 215 @return recDesc 216 */ 217 string get_recDesc() const; 218 219 /// Returns the server's Retention parameter 220 /** 221 @return retention 222 */ 223 Retention get_retention() const; 224 225 /// Returns the server's policy expiry type 226 /** 227 @return expiry type (absolute = 0, relative = 1) 228 */ 229 int get_type_expiry() const; 230 231 /// Returns the server's policy expiry 232 /** 233 @return expiry 234 */ 235 string get_expiry() const; 236 237 /// reset attributes reset()238 void reset() 239 { 240 _svID = ""; 241 _svDate = ""; 242 _version.clear(); 243 _lang.clear(); 244 _objURI.clear(); 245 _extURI.clear(); 246 _access = UNSET_AC; 247 _purpose.clear(); 248 _recipient.clear(); 249 _recDesc = ""; 250 _retention = UNSET_RT; 251 _type_expiry = -1; 252 _expiry = ""; 253 } 254 255 protected: 256 /// Server Name 257 string _svID; 258 259 /// Server Current Date and Time (UTC) 260 string _svDate; 261 262 /// Protocol versions supported by the server 263 set<string> _version; 264 265 /// Languages known by the server 266 set<string> _lang; 267 268 /// Objects that the server is capable of managing 269 set<string> _objURI; 270 271 /// Object extensions supported by the server (optional) 272 set<string> _extURI; 273 274 /// Access provided by the server (optional) 275 Access _access; 276 277 /// Data collection purposes (optional) 278 set<Purpose> _purpose; 279 280 /// Data recipients (optional) 281 set<Recipient> _recipient; 282 283 /// Recipient description (optional) 284 string _recDesc; 285 286 /// Data retention (optional) 287 Retention _retention; 288 289 /// Expiry type (absolute = 0, relative = 1) (optional) 290 int _type_expiry; 291 292 /// Policy lifetime (optional) 293 string _expiry; 294 }; 295 296 LIBEPP_NICBR_NS_END 297 #endif //__GREETING_H__ 298