7 #ifndef __SHEPP_OBJ_SET_H__
8 #define __SHEPP_OBJ_SET_H__
39 ipRange.set_version(version);
40 ipRange.set_ipBegin(ipBegin);
41 ipRange.set_ipEnd(ipEnd);
56 words.erase(words.begin());
58 if (words.size() <= 0) {
71 words.erase(words.begin());
86 words.erase(words.begin());
111 words.erase(words.begin());
131 words.erase(words.begin());
141 st.msg = description;
161 words.erase(words.begin());
182 static int dsInfo(
DSInfo &ds, vector<string> &words,
string &error_msg)
184 words.erase(words.begin());
187 if (words.size() < 4) {
188 error_msg =
"not enough arguments for DS";
194 for (
unsigned int i = 0; i < words[0].length(); i++) {
196 if (c !=
"0" && atoi(c.c_str()) == 0) {
197 error_msg =
"keyTag must be a number";
202 int key_tag = atoi(words[0].c_str());
204 error_msg =
"keyTag cannot be a negative number";
209 int alg = atoi(words[1].c_str());
211 error_msg =
"alg cannot be a negative number";
216 int dig_type = atoi(words[2].c_str());
218 error_msg =
"digestType cannot be a negative number";
224 words.erase(words.begin(), words.begin() + 4);
227 while (!words.empty()) {
228 if (words[0] ==
"-maxlife") {
229 if (words.size() < 2) {
230 error_msg =
"maxSigLife value missing";
233 words.erase(words.begin());
234 int maxlife = atoi(words[0].c_str());
236 error_msg =
"maxSigLife cannot be a negative number";
240 words.erase(words.begin());
241 }
else if (words[0] ==
"-keyData") {
263 words.erase(words.begin());
267 if (words.size() < 5) {
268 error_msg =
"not enough arguments for DS";
274 error_msg =
"invalid IP range";
281 for (
unsigned int i = 0; i < words[1].length(); i++) {
283 if (c !=
"0" && atoi(c.c_str()) == 0) {
284 error_msg =
"keyTag must be a number";
289 int key_tag = atoi(words[1].c_str());
291 error_msg =
"keyTag cannot be a negative number";
296 int alg = atoi(words[2].c_str());
298 error_msg =
"alg cannot be a negative number";
303 int dig_type = atoi(words[3].c_str());
305 error_msg =
"digestType cannot be a negative number";
311 words.erase(words.begin(), words.begin() + 5);
323 if (words.size() < 5) {
324 error_msg =
"not enough arguments for keyData";
328 int flags = atoi(words[1].c_str());
329 int protocol = atoi(words[2].c_str());
330 int algorithm = atoi(words[3].c_str());
332 if (flags < 0 || protocol < 0 || algorithm < 0) {
333 error_msg =
"keyData flags, protocol and alg cannot be negative numbers";
337 dnskey.set_flags(flags);
338 dnskey.set_protocol(protocol);
339 dnskey.set_algorithm(algorithm);
340 dnskey.set_pub_key(words[4]);
342 words.erase(words.begin(), words.begin() + 5);
358 string &error_msg,
bool relaxed)
361 string postal_type = words[0];
362 words.erase(words.begin());
364 error_msg =
"error setting postalInfo type";
367 postal.set_type(postal_type);
369 while (!words.empty()) {
370 if (words[0] ==
"-name") {
372 words.erase(words.begin());
374 error_msg =
"unspecified contact name";
377 string postal_name = words[0];
378 words.erase(words.begin());
380 error_msg =
"error setting contact name";
383 postal.set_name(postal_name);
384 }
else if (words[0] ==
"-org") {
386 words.erase(words.begin());
388 error_msg =
"unspecified organization";
391 string postal_org = words[0];
392 words.erase(words.begin());
394 error_msg =
"error setting organization";
397 postal.set_org(postal_org);
398 }
else if (words[0] ==
"-street1") {
400 words.erase(words.begin());
402 error_msg =
"unspecified address street/line 1";
405 string postal_str1 = words[0];
406 words.erase(words.begin());
408 error_msg =
"error setting address street/line 1";
411 postal.set_str1(postal_str1);
412 }
else if (words[0] ==
"-street2") {
414 words.erase(words.begin());
416 error_msg =
"unspecified address number/line 2";
419 string postal_str2 = words[0];
420 words.erase(words.begin());
422 error_msg =
"error setting address number/line 2";
425 postal.set_str2(postal_str2);
426 }
else if (words[0] ==
"-street3") {
428 words.erase(words.begin());
430 error_msg =
"unspecified street3";
433 string postal_str3 = words[0];
434 words.erase(words.begin());
436 error_msg =
"error setting address line 3";
439 postal.set_str3(postal_str3);
440 }
else if (words[0] ==
"-city") {
442 words.erase(words.begin());
444 error_msg =
"unspecified city";
447 string postal_city = words[0];
448 words.erase(words.begin());
450 error_msg =
"error setting city";
453 postal.set_city(postal_city);
454 }
else if (words[0] ==
"-state") {
456 words.erase(words.begin());
458 error_msg =
"unspecified state";
461 string postal_sp = words[0];
462 words.erase(words.begin());
464 error_msg =
"error setting state/province";
467 postal.set_sp(postal_sp);
468 }
else if (words[0] ==
"-pc") {
470 words.erase(words.begin());
472 error_msg =
"unspecified postal code";
475 string postal_pc = words[0];
476 words.erase(words.begin());
478 error_msg =
"error setting postal code";
481 postal.set_pc(postal_pc);
482 }
else if (words[0] ==
"-cc") {
484 words.erase(words.begin());
486 error_msg =
"unspecified country code";
489 string postal_cc = words[0];
490 words.erase(words.begin());
492 error_msg =
"error setting country code";
495 postal.set_cc(postal_cc);
503 if (postal.get_name() ==
"") {
504 error_msg =
"name is mandatory";
508 if (postal.get_str1() ==
"") {
509 error_msg =
"address street/line 1 is mandatory";
513 if (postal.get_city() ==
"") {
514 error_msg =
"city is mandatory";
518 if (postal.get_cc() ==
"") {
519 error_msg =
"country code is mandatory";
523 if (postal.get_name() ==
"" &&
524 postal.get_org() ==
"" &&
525 postal.get_str1() ==
"" &&
526 postal.get_str2() ==
"" &&
527 postal.get_str3() ==
"" &&
528 postal.get_city() ==
"" &&
529 postal.get_sp() ==
"" &&
530 postal.get_pc() ==
"" &&
531 postal.get_cc() ==
"") {
532 error_msg =
"empty postal info";
553 words.erase(words.begin());
569 if (opt1 ==
"name_int") {
570 disclose.name_int =
true;
571 }
else if (opt1 ==
"name_loc") {
572 disclose.name_loc =
true;
573 }
else if (opt1 ==
"org_int") {
574 disclose.org_int =
true;
575 }
else if (opt1 ==
"org_loc") {
576 disclose.org_loc =
true;
577 }
else if (opt1 ==
"addr_int") {
578 disclose.addr_int =
true;
579 }
else if (opt1 ==
"addr_loc") {
580 disclose.addr_loc =
true;
581 }
else if (opt1 ==
"voice") {
582 disclose.voice =
true;
583 }
else if (opt1 ==
"fax") {
585 }
else if (opt1 ==
"email") {
586 disclose.email =
true;
605 string args,
string &error_msg)
612 error_msg =
"invalid contact";
619 error_msg =
"invalid contact";
640 words.erase(words.begin());
641 if (words.size() < 3) {
642 error =
"not enough arguments for Claims Notice";
649 words.erase(words.begin(), words.begin() + 3);
665 words.erase(words.begin());
668 error_msg =
"invalid number of arguments for RGP";
672 rgp_restore.
set_operation(RGPRestore::Operation::fromString(words[0]));
673 if (rgp_restore.
get_operation() == RGPRestore::Operation::NONE) {
674 error_msg =
"invalid RGP operation";
678 words.erase(words.begin());
679 bool fillReport =
false;
681 while(!words.empty()) {
682 if (words[0] ==
"-rgp-report") {
683 if (rgp_restore.
get_operation() == RGPRestore::Operation::REQUEST) {
684 error_msg =
"RGP request do not have -rgp-report parameters";
688 words.erase(words.begin());
693 error_msg =
"pre data is missing in RGP report";
697 string pre_data = words[0];
698 words.erase(words.begin());
700 error_msg =
"invalid pre data in RGP report";
706 error_msg =
"post data is missing in RGP report";
710 string post_data = words[0];
711 words.erase(words.begin());
713 error_msg =
"invalid post data in RGP report";
719 error_msg =
"del time is missing in RGP report";
724 words.erase(words.begin());
727 error_msg =
"res time is missing in RGP report";
732 words.erase(words.begin());
735 error_msg =
"res reason is missing in RGP report";
739 string res_reason = words[0];
740 words.erase(words.begin());
742 error_msg =
"invalid res reason in RGP report";
748 error_msg =
"statement is missing in RGP report";
752 string statement1 = words[0];
753 words.erase(words.begin());
755 error_msg =
"invalid statement in RGP report";
761 error_msg =
"statement is missing in RGP report";
765 string statement2 = words[0];
766 words.erase(words.begin());
768 error_msg =
"invalid statement in RGP report";
776 }
else if (words[0] ==
"-rgp-other") {
777 words.erase(words.begin());
780 error_msg =
"other value missing in RGP report";
784 string other = words[0];
785 words.erase(words.begin());
787 error_msg =
"invalid other in RGP report";
800 if (rgp_restore.
get_operation() == RGPRestore::Operation::REPORT && !fillReport) {
801 error_msg =
"RGP report fields are mandatory";
809 #endif //__SHEPP_OBJ_SET_H__
static int claimsNotice(ClaimsNotice ¬ice, vector< string > &words, string &error)
Fill a claims notice object.
Definition: SheppObjSet.H:638
void set_res_time(const string &res_time)
Sets the res time.
Definition: RGPRestore.H:93
Operation::Value get_operation() const
Returns the operation.
Definition: RGPRestore.H:356
static int split(string input, string &first, string &second, string splitter, bool relaxed=false)
Definition: SheppStrUtil.H:120
void set_ipRange(const IpRange &ipRange)
Sets ip range.
Definition: ReverseDSInfo.H:37
void set_algo(const unsigned int algo)
Sets algorithm.
Definition: DSInfo.H:63
EPP DomainUpdateCmd Class.
void set_digest_type(const unsigned int digest_type)
Sets the digest type.
Definition: DSInfo.H:79
Definition: CommonData.H:183
static int phone(CommonData::Phone &phone, vector< string > &words)
fills a Phone based on input command line
Definition: SheppObjSet.H:546
static int keyData(KeyData &dnskey, vector< string > &words, string &error_msg)
fills a KeyData based on input command line
Definition: SheppObjSet.H:321
void set_digest(const string &digest)
Sets the digest.
Definition: ReverseDSInfo.H:103
void set_id(const string &id)
Definition: ClaimsNotice.H:28
PostalInfo class.
Definition: CommonData.H:281
void set_roid(const string &roid)
Sets repository object ID.
Definition: CommonData.H:103
void set_report(const RGPReport &report)
Sets the report.
Definition: RGPRestore.H:365
static int dsInfo(ReverseDSInfo &ds, vector< string > &words, string &error_msg)
fills a ReverseDSInfo based on input command line
Definition: SheppObjSet.H:261
void set_operation(const Operation::Value operation)
Sets the operation.
Definition: RGPRestore.H:346
static int status(DefRegUpdateCmd::Status &st, vector< string > &words)
fills a Status based on input command line
Definition: SheppObjSet.H:152
Describes IpRange structure.
Definition: CommonData.H:192
void set_notAfter(const string ¬After)
Sets the expiry of the claims notice.
Definition: ClaimsNotice.H:42
static int status(DomainUpdateCmd::Status &st, vector< string > &words)
fills a Status based on input command line
Definition: SheppObjSet.H:122
void set_key_tag(const unsigned int key_tag)
Sets key tag.
Definition: DSInfo.H:44
void set_statement2(const string &statement2)
Sets the statement.
Definition: RGPRestore.H:178
DSInfo Class.
Definition: DSInfo.H:16
void set_del_time(const string &del_time)
Sets the del time.
Definition: RGPRestore.H:73
void set_status(const string &status)
Sets the status of the defensive registration object.
Definition: DefRegUpdateCmd.H:64
Definition: DomainUpdateCmd.H:36
void set_msg(const string &msg)
Sets the status' message.
Definition: DefRegUpdateCmd.H:88
void set_key_data(const KeyData &key_data)
Sets the key data.
Definition: DSInfo.H:132
static int parse_iprange(const string &input, IpRange &ipRange)
reads an IpRange object from args
Definition: SheppObjSet.H:26
EPP Notice Class.
Definition: ClaimsNotice.H:13
EPP DefRegUpdateCmd::Status Class.
Definition: DefRegUpdateCmd.H:28
void set_other(const string &other)
Sets the other.
Definition: RGPRestore.H:219
Definition: CommonData.H:491
void set_max_sig_life(const unsigned int max_sig_life)
Sets the maximum signature life (deprecated by RFC5910)
Definition: DSInfo.H:114
EPP RGPReport Class.
Definition: RGPRestore.H:19
static int postalInfo(PostalInfo &postal, vector< string > &words, string &error_msg, bool relaxed)
fills a PostalInfo based on input command line
Definition: SheppObjSet.H:357
void set_digest_type(const unsigned int digest_type)
Sets the digest type.
Definition: ReverseDSInfo.H:88
void set_statement1(const string &statement1)
Sets the statement.
Definition: RGPRestore.H:134
static int disclose(CommonData::Disclose &disclose, string word)
fills a Disclose based on input command line
Definition: SheppObjSet.H:563
Definition: CommonData.H:524
void set_digest(const string &digest)
Sets the digest.
Definition: DSInfo.H:95
EPP/RGP Restore information class.
RGPReport get_report() const
Returns the report.
Definition: RGPRestore.H:374
static int quote_gathering(vector< string > &words, string &gather)
Gathers command-line arguments bounded by quotes in a string.
Definition: SheppStrUtil.H:152
void set_algo(const unsigned int algo)
Sets algorithm.
Definition: ReverseDSInfo.H:73
Definition: CommonData.H:175
void set_res_reason(const string &res_reason)
Sets the res reason.
Definition: RGPRestore.H:113
shepp specific objects information setting class
Definition: SheppObjSet.H:17
void set_acceptedDate(const string &acceptedDate)
Sets the date and time that the Claims Notice was accepted.
Definition: ClaimsNotice.H:55
EPP RGPRestore Class.
Definition: RGPRestore.H:290
static int contacts(map< string, string, less< string > > &contacts, string args, string &error_msg)
fills a map of contacts based on input command line
Definition: SheppObjSet.H:604
static int nameServer(NameServer &ns, vector< string > &words)
fills a NameServer based on input command line
Definition: SheppObjSet.H:84
void set_key_tag(const unsigned int key_tag)
Sets key tag.
Definition: ReverseDSInfo.H:55
void set_pre_data(const string &pre_data)
Sets the pre data.
Definition: RGPRestore.H:33
static int dsInfo(DSInfo &ds, vector< string > &words, string &error_msg)
fills a DSInfo based on input command line
Definition: SheppObjSet.H:182
static int authInfo(AuthInfo &auth, vector< string > &words)
fills an AuthInfo based on input command line
Definition: SheppObjSet.H:54
EPP DefRegUpdateCmd Class.
void set_pw(const string &pw)
Sets password.
Definition: CommonData.H:130
Reverse DSInfo Class.
Definition: ReverseDSInfo.H:16
static int rgpRestore(vector< string > &words, RGPRestore &rgp_restore, string &error_msg)
fill a registry grace period structure
Definition: SheppObjSet.H:661
AuthInfo Class.
Definition: CommonData.H:83
void set_lang(const string &lang)
Sets the status' message language.
Definition: DefRegUpdateCmd.H:76
void set_post_data(const string &post_data)
Sets the post data.
Definition: RGPRestore.H:53