6 #ifndef __BRORG_FUNCTIONS_H__
7 #define __BRORG_FUNCTIONS_H__
24 if (error_msg !=
"") {
25 printf(
"error: %s\n", error_msg.c_str());
28 printf(
"brorg command syntax help:\n");
31 if (specific ==
"" || specific ==
"check") {
32 printf(
" check <brorg1> [brorg2 ... brorgN]\n");
35 if (specific ==
"" || specific ==
"info") {
36 printf(
" info <brorg> [-auth authInfoPw]\n");
39 if (specific ==
"" || specific ==
"transfer") {
40 printf(
" transfer: not implemented\n");
43 if (specific ==
"" || specific ==
"create") {
44 printf(
" create <brorg>\n");
45 printf(
" [-postalInfo <type> <-name \"BrOrg Name\"> "
46 "[-org \"Org Name\"]\n");
47 printf(
" <-street1 \"address street/line 1\"> "
48 "[-street2 \"address number/line 2\"]\n");
49 printf(
" [-street3 \"address line 3\"] <-city \"City Name\"> "
50 "[-state \"State or Province\"]\n");
51 printf(
" [-pc \"postal code\"] <-cc country-code> ...]\n");
52 printf(
" <-voice number:ext> [-fax number:ext]\n");
53 printf(
" <-email emailAddr> [-auth authInfoPw]\n");
54 printf(
" [-disclose opt,opt,...] "
55 " [-responsible \"Responsible Name\"]\n"
56 " -contact key=value[,key=value,...]\n"
57 " [-type \"value\"] [-epp-password \"password\"] "
58 "[-epp-ip \"ip\" ...]\n"
59 " [-renewal-type type ...] [-resources-class class]\n");
61 printf(
" available values for opt:\n");
62 printf(
" {name_int name_loc org_int org_loc addr_int addr_loc "
63 "voice fax email}\n");
66 if (specific ==
"" || specific ==
"delete") {
67 printf(
" delete <brorg>\n");
70 if (specific ==
"" || specific ==
"renew") {
71 printf(
" renew: not implemented\n");
74 if (specific ==
"" || specific ==
"update") {
75 printf(
" update <brorg> [-add-status st1,...,stN] "
76 "[-rem-status st1,...,stN]\n");
77 printf(
" [-postalInfo <type> [-name \"BrOrg Name\"] "
78 "[-org \"Org Name\"]\n");
79 printf(
" [-street1 \"address street/line 1\"] "
80 "[-street2 \"address number/line 2\"]\n");
81 printf(
" [-street3 \"address line 3\"] [-city \"City Name\"] "
82 "[-state \"State or Province\"]\n");
83 printf(
" [-pc \"postal code\"] [-cc country-code] ...]\n");
84 printf(
" [-voice number:ext] [-fax number:ext]\n");
85 printf(
" [-email emailAddr] [-auth authInfoPw] "
86 "[-disclose opt,opt,...]\n");
87 printf(
" [-responsible \"Responsible Name\"]\n");
88 printf(
" [-exdate expirationDate]\n");
89 printf(
" [-add-contact key=value[,key=value,...]\n");
90 printf(
" [-rem-contact key=value[,key=value,...]\n");
91 printf(
" [-suspended <true|false>]\n"
92 " [-type \"value\"] [-epp-status <active|blocked>]\n"
93 " [-epp-password \"password\"]\n"
94 " [-epp-ip-add \"ip\" ...] [-epp-ip-rem \"ip\" ...]\n"
95 " [-renewal-type-add type ...] [-renewal-type-rem type ...]\n"
96 " [-resources-class class] [-password \"password\"]\n");
98 printf(
" available values for opt:\n");
99 printf(
" {name_int name_loc org_int org_loc addr_int addr_loc "
100 "voice fax email}\n");
104 if (error_msg !=
"") {
120 string cmd_name =
"check";
124 while (!args.empty()) {
128 args.erase(args.begin());
138 map<string, string, less<string> >::const_iterator it;
139 printf(
"brorgs to be checked:\n");
140 for (it = brorgs.begin(); it != brorgs.end(); it++) {
141 printf(
" id: [%s] org: [%s]\n", (*it).first.c_str(),
142 (*it).second.c_str());
162 string cmd_name =
"info";
170 args.erase(args.begin());
172 while (!args.empty()) {
173 if (args[0] ==
"-auth") {
194 printf(
"id to get info: [%s]\n", cmd->
get_id().c_str());
213 string cmd_name =
"transfer";
226 string cmd_name =
"create";
237 args.erase(args.begin());
243 while (!args.empty()) {
244 if (args[0] ==
"-postalInfo") {
246 args.erase(args.begin());
256 for (
int i = 0; i < (int) postal_list.size(); i++) {
257 if (postal_list[i].get_type() == postal.get_type()) {
262 }
else if (args[0] ==
"-voice") {
264 args.erase(args.begin());
271 }
else if (args[0] ==
"-fax") {
273 args.erase(args.begin());
280 }
else if (args[0] ==
"-email") {
282 args.erase(args.begin());
287 args.erase(args.begin());
288 }
else if (args[0] ==
"-auth") {
301 }
else if (args[0] ==
"-disclose") {
303 args.erase(args.begin());
308 args.erase(args.begin());
310 }
else if (args[0] ==
"-contact") {
312 args.erase(args.begin());
316 map<string, string, less<string> > my_contacts;
321 map<string, string, less<string> >::const_iterator it;
322 for (it = my_contacts.begin(); it != my_contacts.end(); it++) {
325 args.erase(args.begin());
326 }
else if (args[0] ==
"-responsible") {
328 args.erase(args.begin());
332 string responsible_name = args[0];
333 args.erase(args.begin());
335 return cmd_brorg_help(
"error setting responsible name", cmd_name);
339 }
else if (args[0] ==
"-type") {
341 args.erase(args.begin());
345 string type = args[0];
346 args.erase(args.begin());
352 }
else if (args[0] ==
"-epp-password") {
354 args.erase(args.begin());
358 string epp_password = args[0];
359 args.erase(args.begin());
365 }
else if (args[0] ==
"-epp-ip") {
367 args.erase(args.begin());
371 string epp_ip = args[0];
372 args.erase(args.begin());
378 }
else if (args[0] ==
"-renewal-type") {
380 args.erase(args.begin());
384 string renewal_type = args[0];
385 args.erase(args.begin());
391 }
else if (args[0] ==
"-resources-class") {
393 args.erase(args.begin());
397 string resources_class = args[0];
398 args.erase(args.begin());
419 if (common_data.
get_voice().number ==
"") {
420 return cmd_brorg_help(
"voice telephone number is mandatory", cmd_name);
428 return cmd_brorg_help(
"at least one contact must be entered", cmd_name);
436 vector<PostalInfo>::const_iterator it;
437 vector<PostalInfo> postal_list;
439 for (it = postal_list.begin(); it != postal_list.end(); it++) {
465 map<string, string, less<string> >::const_iterator c_it;
466 for (c_it = contacts.begin(); c_it != contacts.end(); c_it++) {
467 printf(
" contact[%s] = [%s]\n", (*c_it).first.c_str(),
468 (*c_it).second.c_str());
473 printf(
" type: %s\n", cmd->
get_type().c_str());
481 for (
int i = 0; i < epp_ips.size(); i++) {
482 printf(
" epp ip: %s\n", epp_ips[i].c_str());
486 for (
int i = 0; i < renewal_types.size(); i++) {
487 printf(
" renewal type: %s\n", renewal_types[i].c_str());
511 string cmd_name =
"delete";
519 args.erase(args.begin());
535 string cmd_name =
"renew";
548 string cmd_name =
"update";
558 args.erase(args.begin());
560 while (!args.empty()) {
561 if (args[0] ==
"-add-status") {
563 args.erase(args.begin());
567 string tmp1 = args[0];
576 args.erase(args.begin());
577 }
else if (args[0] ==
"-rem-status") {
579 args.erase(args.begin());
583 string tmp1 = args[0];
592 args.erase(args.begin());
593 }
else if (args[0] ==
"-postalInfo") {
595 args.erase(args.begin());
605 for (
int i = 0; i < (int) postal_list.size(); i++) {
606 if (postal_list[i].get_type() == postal.get_type()) {
611 }
else if (args[0] ==
"-voice") {
613 args.erase(args.begin());
620 }
else if (args[0] ==
"-fax") {
622 args.erase(args.begin());
629 }
else if (args[0] ==
"-email") {
631 args.erase(args.begin());
636 args.erase(args.begin());
637 }
else if (args[0] ==
"-auth") {
650 }
else if (args[0] ==
"-disclose") {
652 args.erase(args.begin());
657 args.erase(args.begin());
659 }
else if (args[0] ==
"-add-contact") {
661 args.erase(args.begin());
666 map<string, string, less<string> > my_contacts;
671 map<string, string, less<string> >::const_iterator it;
672 for (it = my_contacts.begin(); it != my_contacts.end(); it++) {
675 args.erase(args.begin());
676 }
else if (args[0] ==
"-rem-contact") {
678 args.erase(args.begin());
683 map<string, string, less<string> > my_contacts;
688 map<string, string, less<string> >::const_iterator it;
689 for (it = my_contacts.begin(); it != my_contacts.end(); it++) {
692 args.erase(args.begin());
694 }
else if (args[0] ==
"-responsible") {
696 args.erase(args.begin());
700 string responsible_name = args[0];
701 args.erase(args.begin());
703 return cmd_brorg_help(
"error setting responsible name", cmd_name);
706 }
else if (args[0] ==
"-exdate") {
708 args.erase(args.begin());
713 args.erase(args.begin());
714 }
else if (args[0] ==
"-suspended") {
716 args.erase(args.begin());
721 if (args[0] ==
"true") {
723 }
else if (args[0] ==
"false") {
729 args.erase(args.begin());
730 }
else if (args[0] ==
"-type") {
732 args.erase(args.begin());
736 string type = args[0];
737 args.erase(args.begin());
743 }
else if (args[0] ==
"-epp-status") {
745 args.erase(args.begin());
749 string epp_status = args[0];
750 args.erase(args.begin());
756 }
else if (args[0] ==
"-epp-password") {
758 args.erase(args.begin());
762 string epp_password = args[0];
763 args.erase(args.begin());
769 }
else if (args[0] ==
"-epp-ip-add") {
771 args.erase(args.begin());
775 string epp_ip = args[0];
776 args.erase(args.begin());
782 }
else if (args[0] ==
"-epp-ip-rem") {
784 args.erase(args.begin());
788 string epp_ip = args[0];
789 args.erase(args.begin());
795 }
else if (args[0] ==
"-renewal-type-add") {
797 args.erase(args.begin());
801 string renewal_type = args[0];
802 args.erase(args.begin());
804 return cmd_brorg_help(
"error setting renewal type add", cmd_name);
808 }
else if (args[0] ==
"-renewal-type-rem") {
810 args.erase(args.begin());
814 string renewal_type = args[0];
815 args.erase(args.begin());
817 return cmd_brorg_help(
"error setting renewal type rem", cmd_name);
821 }
else if (args[0] ==
"-resources-class") {
823 args.erase(args.begin());
827 string resources_class = args[0];
828 args.erase(args.begin());
834 }
else if (args[0] ==
"-password") {
836 args.erase(args.begin());
840 string password = args[0];
841 args.erase(args.begin());
857 common_data.
get_fax().number ==
"" &&
870 return cmd_brorg_help(
"not enough information for update", cmd_name);
879 set<string>::const_iterator st_it;
880 if (!status.empty()) {
881 printf(
" status to add: [ ");
882 for (st_it = status.begin(); st_it != status.end(); st_it++) {
883 printf(
"%s ", (*st_it).c_str());
889 if (!status.empty()) {
890 printf(
" status to rem: [ ");
891 for (st_it = status.begin(); st_it != status.end(); st_it++) {
892 printf(
"%s ", (*st_it).c_str());
897 vector<PostalInfo> postal_list;
899 for (
int i = 0; i < (int) postal_list.size(); i++) {
929 map<string, string, less<string> > contacts =
931 map<string, string, less<string> >::const_iterator c_it;
932 for (c_it = contacts.begin(); c_it != contacts.end(); c_it++) {
933 printf(
" contact to add [%s] = [%s]\n", (*c_it).first.c_str(),
934 (*c_it).second.c_str());
938 for (c_it = contacts.begin(); c_it != contacts.end(); c_it++) {
939 printf(
" contact to rem [%s] = [%s]\n", (*c_it).first.c_str(),
940 (*c_it).second.c_str());
946 printf(
" type: [%s]\n", cmd->
get_type().c_str());
959 for (
unsigned int i = 0; i < eppIPsAdd.size(); i++) {
960 printf(
" epp ip add: [%s]\n", eppIPsAdd[i].c_str());
966 for (
unsigned int i = 0; i < eppIPsRem.size(); i++) {
967 printf(
" epp ip rem: [%s]\n", eppIPsRem[i].c_str());
973 for (
unsigned int i = 0; i < renewalTypesAdd.size(); i++) {
974 printf(
" renewal types add: [%s]\n", renewalTypesAdd[i].c_str());
980 for (
unsigned int i = 0; i < renewalTypesRem.size(); i++) {
981 printf(
" renewal types rem: [%s]\n", renewalTypesRem[i].c_str());
1005 if (!args.empty() && !(args[0] ==
"help")) {
1006 if (args[0] ==
"check") {
1007 args.erase(args.begin());
1009 }
else if (args[0] ==
"info") {
1010 args.erase(args.begin());
1012 }
else if (args[0] ==
"transfer") {
1013 args.erase(args.begin());
1015 }
else if (args[0] ==
"create") {
1016 args.erase(args.begin());
1018 }
else if (args[0] ==
"delete") {
1019 args.erase(args.begin());
1021 }
else if (args[0] ==
"renew") {
1022 args.erase(args.begin());
1024 }
else if (args[0] ==
"update") {
1025 args.erase(args.begin());
1035 #endif //__BRORG_FUNCTIONS_H__
map< string, string, less< string > > get_contact_list_add() const
Returns the Contact List of additions.
Definition: BrOrgUpdateCmd.H:114
string get_resources_class() const
Returns the organization resources class.
Definition: BrOrgCreateCmd.H:209
string get_epp_status() const
Returns the EPP Status.
Definition: BrOrgUpdateCmd.H:192
string get_organization() const
Returns the Organization.
Definition: BrOrgCreateCmd.H:49
string get_type() const
Returns the organization type.
Definition: BrOrgCreateCmd.H:126
int cmd_brorg_delete(vector< string > &args)
brorg delete command function
Definition: BrOrgFunctions.H:507
EPP BrOrgDeleteCmd Class.
Definition: BrOrgDeleteCmd.H:21
int cmd_brorg_info(vector< string > &args)
brorg info command function
Definition: BrOrgFunctions.H:158
void insert_contact(const string &type, const string &id)
Inserts a Contact into the list.
Definition: BrOrgCreateCmd.H:96
static int split(string input, string &first, string &second, string splitter, bool relaxed=false)
Definition: SheppStrUtil.H:120
void set_id(const string &id)
Sets the object's id.
int cmd_brorg_check(vector< string > &args)
brorg check command function
Definition: BrOrgFunctions.H:116
vector< string > get_epp_ips_add() const
Definition: BrOrgUpdateCmd.H:230
BrOrgUpdateCmd * get_command()
Returns raw pointer to the command.
Definition: BrOrgUpdate.H:45
int cmd_brorg(vector< string > &args)
main brorg command
Definition: BrOrgFunctions.H:1002
string get_email() const
Returns the object's email.
int cmd_brorg_renew(vector< string > &args)
brorg renew command function
Definition: BrOrgFunctions.H:533
map< string, string, less< string > > get_contact_list_rem() const
Returns the Contact List.
Definition: BrOrgUpdateCmd.H:133
int cmd_brorg_update(vector< string > &args)
brorg update command function
Definition: BrOrgFunctions.H:544
void set_organization(const string &organization)
Sets Organization attribute.
Definition: BrOrgCreateCmd.H:40
Disclose get_disclose() const
Returns the object's disclosure policy.
string get_organization() const
Returns the Organization.
Definition: BrOrgUpdateCmd.H:49
void set_disclose(const Disclose &disclose)
Sets the object's disclosure policy.
map< string, string, less< string > > get_contact_list() const
Returns the Contact List.
Definition: BrOrgCreateCmd.H:105
EPP BrOrgUpdate Class.
Definition: BrOrgUpdate.H:23
void set_email(const string &email)
Sets the object's email.
static void authInfo(AuthInfo auth)
prints an AuthInfo object
Definition: SheppPrint.H:21
static int phone(CommonData::Phone &phone, vector< string > &words)
fills a Phone based on input command line
Definition: SheppObjSet.H:546
vector< string > get_epp_ips_rem() const
Definition: BrOrgUpdateCmd.H:250
void insert_organization(const string &id, const string &organization)
Inserts an Organization attribute.
Definition: BrOrgCheckCmd.H:40
EPP BrOrgInfoCmd Class.
Definition: BrOrgInfoCmd.H:21
void set_organization(const string &organization)
Sets the Organization.
Definition: BrOrgDeleteCmd.H:36
void set_suspended(const bool suspended)
Sets suspended by payment flag.
Definition: BrOrgUpdateCmd.H:143
void set_responsible(const string &responsible)
Sets Responsible for the organization.
Definition: BrOrgUpdateCmd.H:58
int cmd_brorg_help(string error_msg, string specific="")
print brorg command usage info
Definition: BrOrgFunctions.H:22
PostalInfo class.
Definition: CommonData.H:281
void set_fax(const Phone &fax)
Sets the object's fax number.
void insert_postal_info(const PostalInfo &postal_info)
Inserts postal information into the object.
void insert_epp_ip(const string &ip)
Definition: BrOrgCreateCmd.H:154
EPP BrOrgCheck Class.
Definition: BrOrgCheck.H:17
string get_organization() const
Returns the Organization.
Definition: BrOrgInfoCmd.H:45
EPP BrOrgUpdateCmd Class.
Definition: BrOrgUpdateCmd.H:25
Phone get_fax() const
Returns the object's fax number.
void insert_renewal_type(const string &type)
Inserts a renewal type.
Definition: BrOrgCreateCmd.H:173
void insert_renewal_type_add(const string &type)
Inserts a renewal type to be added.
Definition: BrOrgUpdateCmd.H:259
void set_epp_password(const string &password)
Sets the EPP password.
Definition: BrOrgUpdateCmd.H:201
vector< string > get_renewal_types_add() const
Returns the renewal types to be added.
Definition: BrOrgUpdateCmd.H:268
EPP BrOrgInfo Class.
Definition: BrOrgInfo.H:23
void insert_epp_ip_rem(const string &ip)
Definition: BrOrgUpdateCmd.H:240
string get_resources_class() const
Returns the organization resources class.
Definition: BrOrgUpdateCmd.H:304
void set_voice(const Phone &voice)
Sets the object's voice telephone number.
void insert_contact_rem(const string &type, const string &id)
Inserts a Contact into the list of deletions.
Definition: BrOrgUpdateCmd.H:124
void set_epp_status(const string &epp_status)
Sets the EPP Status.
Definition: BrOrgUpdateCmd.H:183
string get_type() const
Returns the organization type.
Definition: BrOrgUpdateCmd.H:171
void insert_contact_add(const string &type, const string &id)
Inserts a Contact into the list of additions.
Definition: BrOrgUpdateCmd.H:105
static void postal_info(PostalInfo postal)
prints a PostalInfo object
Definition: SheppPrint.H:53
bool get_roid_f() const
Returns the roid change flag.
Definition: CommonData.H:121
int process_action(Action &act)
Send and EPP Action.
Definition: SheppCommandFunctions.H:871
EPP BrOrgDelete Class.
Definition: BrOrgDelete.H:23
Definition: CommonData.H:491
void set_organization(const string &organization)
Sets the Organization.
Definition: BrOrgInfoCmd.H:36
vector< PostalInfo > get_postal_info() const
Returns the object's postal information.
void set_exDate(const string &exDate)
Sets expiration date.
Definition: BrOrgUpdateCmd.H:92
vector< string > get_epp_ips() const
Definition: BrOrgCreateCmd.H:164
static void disclose(CommonData::Disclose disclose)
prints a Disclose object
Definition: SheppPrint.H:106
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
vector< string > get_renewal_types() const
Returns list of renewal types of an organization.
Definition: BrOrgCreateCmd.H:191
EPP CommonData Class.
Definition: CommonData.H:487
Phone get_voice() const
Returns the object's voice telephone number.
string get_pw() const
Returns the password.
Definition: CommonData.H:140
void set_responsible(const string &responsible)
Sets the responsible for the organization.
Definition: BrOrgCreateCmd.H:58
vector< string > get_renewal_types_rem() const
Returns the renewal types to be removed.
Definition: BrOrgUpdateCmd.H:286
void set_type(const string &type)
Sets the organization type.
Definition: BrOrgUpdateCmd.H:162
EPP command-line shell client command functions include file.
static int disclose(CommonData::Disclose &disclose, string word)
fills a Disclose based on input command line
Definition: SheppObjSet.H:563
Definition: CommonData.H:524
BrOrgInfoCmd * get_command()
Returns raw pointer to the command.
Definition: BrOrgInfo.H:45
void set_password(const string &password)
Sets the legacy organization password.
Definition: BrOrgUpdateCmd.H:313
static int quote_gathering(vector< string > &words, string &gather)
Gathers command-line arguments bounded by quotes in a string.
Definition: SheppStrUtil.H:152
BrOrgCheckCmd * get_command()
Returns raw pointer to the command.
Definition: BrOrgCheck.H:48
EPP BrOrgCreateCmd Class.
Definition: BrOrgCreateCmd.H:25
map< string, string, less< string > > get_organization_list() const
Returns the Organization List.
Definition: BrOrgCheckCmd.H:49
EPP BrOrgCheckCmd Class.
Definition: BrOrgCheckCmd.H:24
void set_epp_password(const string &password)
Sets the EPP password.
Definition: BrOrgCreateCmd.H:135
void set_organization(const string &organization)
Sets Organization attribute.
Definition: BrOrgUpdateCmd.H:40
void insert_renewal_type_rem(const string &type)
Inserts a renewal type to be removed.
Definition: BrOrgUpdateCmd.H:277
string get_epp_password() const
Returns the EPP password.
Definition: BrOrgCreateCmd.H:144
void set_resources_class(const string &resources_class)
Sets the organization resources class.
Definition: BrOrgCreateCmd.H:200
int cmd_brorg_transfer(vector< string > &args)
brorg transfer command function
Definition: BrOrgFunctions.H:211
int cmd_brorg_create(vector< string > &args)
brorg create command function
Definition: BrOrgFunctions.H:222
void insert_epp_ip_add(const string &ip)
Definition: BrOrgUpdateCmd.H:220
void set_resources_class(const string &resources_class)
Sets the organization resources class.
Definition: BrOrgUpdateCmd.H:295
string get_id() const
Returns the object's id.
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
string get_epp_password() const
Returns the EPP password.
Definition: BrOrgUpdateCmd.H:210
EPP BrOrgCreate Class.
Definition: BrOrgCreate.H:23
static int authInfo(AuthInfo &auth, vector< string > &words)
fills an AuthInfo based on input command line
Definition: SheppObjSet.H:54
BrOrgCreateCmd * get_command()
Returns raw pointer to the command.
Definition: BrOrgCreate.H:45
static string doc2id(const string &doc)
Removes chars [./-] from document strings.
Definition: SheppStrUtil.H:196
static void phone(CommonData::Phone phone)
prints a Phone object
Definition: SheppPrint.H:96
BrOrgDeleteCmd * get_command()
Returns raw pointer to the command.
Definition: BrOrgDelete.H:45
AuthInfo Class.
Definition: CommonData.H:83
void set_type(const string &type)
Sets the organization type.
Definition: BrOrgCreateCmd.H:117