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 SheppPrint.H 27 * @brief shepp object information screen printing class 28 */ 29 30 #ifndef __SHEPP_PRINT_H__ 31 #define __SHEPP_PRINT_H__ 32 33 #include "CommonData.H" 34 35 /// shepp object information screen printing class 36 class SheppPrint { 37 public: 38 //used by both domain and contact 39 40 /// prints an AuthInfo object 41 /** 42 @param auth AuthInfo object to be printed 43 */ authInfo(AuthInfo auth)44 static void authInfo(AuthInfo auth) { 45 if (auth.get_pw() != "") { 46 printf(" authInfo pw: [%s]\n", auth.get_pw().c_str()); 47 if (auth.get_roid() != "") { 48 printf(" roid: [%s]\n", auth.get_roid().c_str()); 49 } 50 } 51 } 52 53 //used by domain only 54 55 /// prints a NameServer object 56 /** 57 @param ns NameServer object to be printed 58 */ nameserver(NameServer ns)59 static void nameserver(NameServer ns) 60 { 61 printf(" nameserver %s\n", ns.name.c_str()); 62 63 set<NSIPAddr>::const_iterator it; 64 set<NSIPAddr> ips = ns.ips; 65 for (it = ips.begin(); it != ips.end(); it++) { 66 printf(" %s: %s\n", (*it).version.c_str(), (*it).addr.c_str()); 67 } 68 } 69 70 //used by contact only 71 72 /// prints a PostalInfo object 73 /** 74 @param postal PostalInfo object to be printed 75 */ postal_info(PostalInfo postal)76 static void postal_info(PostalInfo postal) 77 { 78 printf(" PostalInfo:\n"); 79 printf(" type: [%s]\n", postal.get_type().c_str()); 80 81 if (postal.get_name() != "") { 82 printf(" name: [%s]\n", postal.get_name().c_str()); 83 } 84 if (postal.get_org() != "") { 85 printf(" org : [%s]\n", postal.get_org().c_str()); 86 } 87 88 if (postal.get_str1() != "") { 89 printf(" str1: [%s]\n", postal.get_str1().c_str()); 90 } 91 if (postal.get_str2() != "") { 92 printf(" str2: [%s]\n", postal.get_str2().c_str()); 93 } 94 if (postal.get_str3() != "") { 95 printf(" str3: [%s]\n", postal.get_str3().c_str()); 96 } 97 98 if (postal.get_city() != "") { 99 printf(" city: [%s]\n", postal.get_city().c_str()); 100 } 101 102 if (postal.get_sp() != "") { 103 printf(" s/p : [%s]\n", postal.get_sp().c_str()); 104 } 105 106 if (postal.get_pc() != "") { 107 printf(" pc : [%s]\n", postal.get_pc().c_str()); 108 } 109 110 if (postal.get_cc() != "") { 111 printf(" cc : [%s]\n", postal.get_cc().c_str()); 112 } 113 } 114 115 /// prints a Phone object 116 /** 117 @param phone Phone object to be printed 118 */ phone(CommonData::Phone phone)119 static void phone(CommonData::Phone phone) 120 { 121 printf(" number: [%s] ext: [%s]\n", phone.number.c_str(), 122 phone.ext.c_str()); 123 } 124 125 /// prints a Disclose object 126 /** 127 @param disclose object to be printed 128 */ disclose(CommonData::Disclose disclose)129 static void disclose(CommonData::Disclose disclose) 130 { 131 printf(" disclose (flag=%d) [ ", disclose.flag); 132 if (disclose.name_int) { 133 printf("name_int "); 134 } 135 if (disclose.name_loc) { 136 printf("name_loc "); 137 } 138 if (disclose.org_int) { 139 printf("org_int "); 140 } 141 if (disclose.org_loc) { 142 printf("org_loc "); 143 } 144 if (disclose.addr_int) { 145 printf("addr_int "); 146 } 147 if (disclose.addr_loc) { 148 printf("addr_loc "); 149 } 150 if (disclose.voice) { 151 printf("voice "); 152 } 153 if (disclose.fax) { 154 printf("fax "); 155 } 156 if (disclose.email) { 157 printf("email "); 158 } 159 printf("]\n"); 160 } 161 }; 162 163 #endif //__SHEPP_PRINT_H__ 164