fred-mod-eppd-2.14.1
|
00001 /* 00002 * Copyright (C) 2007 CZ.NIC, z.s.p.o. 00003 * 00004 * This file is part of FRED. 00005 * 00006 * FRED is free software: you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation, version 2 of the License. 00009 * 00010 * FRED is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with FRED. If not, see <http://www.gnu.org/licenses/>. 00017 */ 00027 #ifndef EPP_COMMON_H 00028 #define EPP_COMMON_H 00029 00031 typedef enum { 00032 EPP_FATAL = 1, 00033 EPP_ERROR, 00034 EPP_WARNING, 00035 EPP_INFO, 00036 EPP_DEBUG 00037 }epp_loglevel; 00038 00044 typedef struct { 00045 void *pool; 00046 void *conn; 00047 int session; 00048 }epp_context; 00049 00054 typedef enum { 00055 EPP_UNKNOWN_CMD = 0, 00056 /* 00057 * 'dummy' is not a command from point of view of epp client, but is 00058 * command from central repository's point of view 00059 */ 00060 EPP_DUMMY, 00061 /* session commands */ 00062 EPP_LOGIN, 00063 EPP_LOGOUT, 00064 /* query commands */ 00065 EPP_CHECK_CONTACT, 00066 EPP_CHECK_DOMAIN, 00067 EPP_CHECK_NSSET, 00068 EPP_CHECK_KEYSET, 00069 EPP_INFO_CONTACT, 00070 EPP_INFO_DOMAIN, 00071 EPP_INFO_NSSET, 00072 EPP_INFO_KEYSET, 00073 EPP_LIST_CONTACT, 00074 EPP_LIST_DOMAIN, 00075 EPP_LIST_NSSET, 00076 EPP_LIST_KEYSET, 00077 EPP_POLL_REQ, 00078 EPP_POLL_ACK, 00079 /* transform commands */ 00080 EPP_CREATE_CONTACT, 00081 EPP_CREATE_DOMAIN, 00082 EPP_CREATE_NSSET, 00083 EPP_CREATE_KEYSET, 00084 EPP_DELETE_CONTACT, 00085 EPP_DELETE_DOMAIN, 00086 EPP_DELETE_NSSET, 00087 EPP_DELETE_KEYSET, 00088 EPP_UPDATE_CONTACT, 00089 EPP_UPDATE_DOMAIN, 00090 EPP_UPDATE_NSSET, 00091 EPP_UPDATE_KEYSET, 00092 EPP_TRANSFER_CONTACT, 00093 EPP_TRANSFER_DOMAIN, 00094 EPP_TRANSFER_NSSET, 00095 EPP_TRANSFER_KEYSET, 00096 EPP_RENEW_DOMAIN, 00097 /* protocol extensions */ 00098 EPP_SENDAUTHINFO_CONTACT, 00099 EPP_SENDAUTHINFO_DOMAIN, 00100 EPP_SENDAUTHINFO_NSSET, 00101 EPP_SENDAUTHINFO_KEYSET, 00102 EPP_TEST_NSSET, 00103 EPP_CREDITINFO, 00104 /* info functions */ 00105 EPP_INFO_LIST_CONTACTS, 00106 EPP_INFO_LIST_DOMAINS, 00107 EPP_INFO_LIST_NSSETS, 00108 EPP_INFO_LIST_KEYSETS, 00109 EPP_INFO_DOMAINS_BY_NSSET, 00110 EPP_INFO_DOMAINS_BY_KEYSET, 00111 EPP_INFO_DOMAINS_BY_CONTACT, 00112 EPP_INFO_NSSETS_BY_CONTACT, 00113 EPP_INFO_NSSETS_BY_NS, 00114 EPP_INFO_KEYSETS_BY_CONTACT, 00115 EPP_INFO_GET_RESULTS 00116 }epp_command_type; 00117 00121 typedef enum { 00122 EPP_EXT_ENUMVAL 00123 }domain_ext_type; 00124 00128 typedef enum { 00129 EPP_UNKNOWN_OBJ = 0, 00130 EPP_CONTACT, 00131 EPP_DOMAIN, 00132 EPP_NSSET, 00133 EPP_KEYSET 00134 }epp_object_type; 00135 00139 typedef enum { 00140 LANG_EN = 0, 00141 LANG_CS, 00142 }epp_lang; 00143 00151 typedef enum { 00152 errspec_poll_msgID = 0, 00153 errspec_contact_handle, 00154 errspec_contact_cc, 00155 errspec_nsset_handle, 00156 errspec_nsset_tech, 00157 errspec_nsset_dns_name, 00158 errspec_nsset_dns_addr, 00159 errspec_nsset_dns_name_add, 00160 errspec_nsset_dns_name_rem, 00161 errspec_nsset_tech_add, 00162 errspec_nsset_tech_rem, 00163 errspec_keyset_handle, 00164 errspec_keyset_tech, 00165 errspec_keyset_dnskey, 00166 errspec_keyset_dnskey_add, 00167 errspec_keyset_dnskey_rem, 00168 errspec_keyset_tech_add, 00169 errspec_keyset_tech_rem, 00170 errspec_registrar_author, 00171 errspec_domain_fqdn, 00172 errspec_domain_registrant, 00173 errspec_domain_nsset, 00174 errspec_domain_keyset, 00175 errspec_domain_period, 00176 errspec_domain_admin, 00177 errspec_domain_tmpcontact, 00178 errspec_domain_ext_valDate, 00179 errspec_domain_ext_valDate_missing, 00180 errspec_domain_curExpDate, 00181 errspec_domain_admin_add, 00182 errspec_domain_admin_rem, 00183 /* input errors */ 00184 errspec_not_valid, 00185 errspec_poll_msgID_missing, 00186 errspec_contact_identtype_missing, 00187 errspec_transfer_op 00188 }epp_errorspec; 00189 00197 typedef struct { 00199 char *value; 00205 epp_errorspec spec; 00214 char *reason; 00216 int position; 00217 }epp_error; 00218 00225 typedef enum { 00226 ClientLogin = 100, 00227 ClientLogout = 101, 00228 ClientGreeting = 105, 00229 PollAcknowledgement = 120, 00230 PollResponse = 121, 00231 ContactCheck = 200, 00232 ContactInfo = 201, 00233 ContactDelete = 202, 00234 ContactUpdate = 203, 00235 ContactCreate = 204, 00236 ContactTransfer = 205, 00237 NSsetCheck = 400, 00238 NSsetInfo = 401, 00239 NSsetDelete = 402, 00240 NSsetUpdate = 403, 00241 NSsetCreate = 404, 00242 NSsetTransfer = 405, 00243 DomainCheck = 500, 00244 DomainInfo = 501, 00245 DomainDelete = 502, 00246 DomainUpdate = 503, 00247 DomainCreate = 504, 00248 DomainTransfer = 505, 00249 DomainRenew = 506, 00250 DomainTrade = 507, 00251 KeysetCheck = 600, 00252 KeysetInfo = 601, 00253 KeysetDelete = 602, 00254 KeysetUpdate = 603, 00255 KeysetCreate = 604, 00256 KeysetTransfer = 605, 00257 UnknownAction = 1000, 00258 ListContact = 1002, 00259 ListNSset = 1004, 00260 ListDomain = 1005, 00261 ListKeySet = 1006, 00262 ClientCredit = 1010, 00263 nssetTest = 1012, 00264 ContactSendAuthInfo = 1101, 00265 NSSetSendAuthInfo = 1102, 00266 DomainSendAuthInfo = 1103, 00267 KeySetSendAuthInfo = 1106, 00268 InfoListContacts = 1200, 00269 InfoListDomains = 1201, 00270 InfoListNssets = 1202, 00271 InfoListKeysets = 1203, 00272 InfoDomainsByNsset = 1204, 00273 InfoDomainsByKeyset = 1205, 00274 InfoDomainsByContact = 1206, 00275 InfoNssetsByContact = 1207, 00276 InfoNssetsByNs = 1208, 00277 InfoKeysetsByContact = 1209, 00278 InfoGetResults = 1210 00279 } epp_action_type; 00280 00289 typedef struct queue_item_t qitem; 00293 struct queue_item_t { 00294 qitem *next; 00295 void *content; 00296 }; 00297 00303 typedef struct { 00304 int count; 00305 qitem *body; 00306 qitem *cur; 00307 }qhead; 00308 00310 #define q_length(_qhead) ((_qhead).count) 00311 00312 #define q_next(_qhead) \ 00313 ((_qhead)->cur = ((_qhead)->cur) ? (_qhead)->cur->next : NULL) 00314 00315 #define q_content(_qhead) ((_qhead)->cur->content) 00316 00317 #define q_reset(_qhead) ((_qhead)->cur = (_qhead)->body) 00318 00324 #define q_foreach(_qhead) \ 00325 for ((_qhead)->cur = (_qhead)->body; (_qhead)->cur != NULL; (_qhead)->cur = (_qhead)->cur->next) 00326 00334 int q_add(void *pool, qhead *head, void *data); 00335 00339 /* ********************************************************************* */ 00340 00341 00345 typedef struct { 00346 char *value; 00347 char *text; 00348 }epp_status; 00349 00353 typedef struct { 00354 char *name; 00355 char *org; 00356 qhead streets; 00357 char *city; 00358 char *sp; 00359 char *pc; 00360 char *cc; 00361 }epp_postalInfo; 00362 00371 typedef struct { 00380 char flag; 00381 unsigned char name; 00382 unsigned char org; 00383 unsigned char addr; 00384 unsigned char voice; 00385 unsigned char fax; 00386 unsigned char email; 00387 unsigned char vat; 00388 unsigned char ident; 00390 unsigned char notifyEmail; 00391 }epp_discl; 00392 00396 typedef struct { 00397 char *name; 00398 qhead addr; 00399 }epp_ns; 00400 00402 typedef struct { 00403 unsigned short flags; 00404 unsigned char protocol; 00405 unsigned char alg; 00406 char *public_key; 00407 } epp_dnskey; 00408 00410 typedef enum { 00411 ident_UNKNOWN, 00412 ident_OP, 00413 ident_PASSPORT, 00414 ident_MPSV, 00415 ident_ICO, 00416 ident_BIRTHDAY 00417 }epp_identType; 00418 00419 typedef enum { 00420 TIMEUNIT_MONTH, 00421 TIMEUNIT_YEAR 00422 }epp_timeunit; 00423 00425 typedef struct { 00426 int avail; 00427 char *reason; 00428 }epp_avail; 00429 00431 typedef struct { 00432 char *zone; 00433 char *credit; 00434 }epp_zonecredit; 00435 00437 typedef struct { 00438 qhead chg_ds; 00439 qhead add_ds; 00440 qhead rem_ds; 00441 }epp_ext_domain_upd_dnssec; 00442 00443 typedef struct { 00444 char *ext_enumval; 00445 int publish; 00446 } epp_ext_enum; 00447 00448 typedef struct { 00449 domain_ext_type extType; 00450 union { 00451 epp_ext_enum ext_enum; 00452 }ext; 00453 }epp_ext_item; 00454 00456 typedef enum { 00457 pt_transfer_contact, 00458 pt_delete_contact, 00459 pt_transfer_nsset, 00460 pt_delete_nsset, 00461 pt_transfer_keyset, 00462 pt_delete_keyset, 00463 pt_techcheck, 00464 pt_transfer_domain, 00465 pt_impexpiration, 00466 pt_expiration, 00467 pt_impvalidation, 00468 pt_validation, 00469 pt_outzone, 00470 pt_delete_domain, 00471 pt_lowcredit, 00472 pt_request_fee_info, 00473 pt_update_domain, 00474 pt_update_nsset, 00475 pt_update_keyset 00476 }epp_pollType; 00477 00479 typedef struct { 00480 char *testname; 00481 int status; 00482 char *note; 00483 }epp_testResult; 00484 00485 /* ********************************************************************* */ 00486 00487 00489 typedef struct { 00490 char *clID; 00491 char *pw; 00492 char *newPW; 00493 qhead objuri; 00494 qhead exturi; 00495 unsigned lang; 00496 }epps_login; 00497 00499 typedef struct { 00500 qhead ids; 00501 qhead avails; 00502 }epps_check; 00503 00505 typedef struct { 00506 char *id; 00507 char *handle; 00508 char *roid; 00509 qhead status; 00510 epp_postalInfo pi; 00511 char *voice; 00512 char *fax; 00513 char *email; 00514 char *clID; 00515 char *crID; 00516 char *crDate; 00517 char *upID; 00518 char *upDate; 00519 char *trDate; 00520 char *authInfo; 00521 epp_discl discl; 00522 char *vat; 00523 char *ident; 00524 epp_identType identtype; 00525 char *notify_email; 00526 }epps_info_contact; 00527 00529 typedef struct { 00530 char *name; 00531 char *handle; 00532 char *roid; 00533 qhead status; 00534 char *registrant; 00535 qhead tmpcontact; 00536 qhead admin; 00537 char *nsset; 00538 char *keyset; 00539 char *clID; 00540 char *crID; 00541 char *crDate; 00542 char *exDate; 00543 char *upID; 00544 char *upDate; 00545 char *trDate; 00546 char *authInfo; 00547 qhead extensions; 00548 }epps_info_domain; 00549 00551 typedef struct { 00552 char *id; 00553 char *handle; 00554 char *roid; 00555 qhead status; 00556 char *clID; 00557 char *crID; 00558 char *crDate; 00559 char *upID; 00560 char *upDate; 00561 char *trDate; 00562 char *authInfo; 00563 qhead ns; 00564 qhead tech; 00565 int level; 00566 }epps_info_nsset; 00567 00569 typedef struct { 00570 char *id; 00571 char *handle; 00572 char *roid; 00573 qhead status; 00574 char *clID; 00575 char *crID; 00576 char *crDate; 00577 char *upID; 00578 char *upDate; 00579 char *trDate; 00580 char *authInfo; 00581 qhead keys; 00582 qhead tech; 00583 } epps_info_keyset; 00584 00586 typedef struct { 00587 unsigned long long count; 00588 char *msgid; 00589 char *qdate; 00590 epp_pollType type; 00591 union { 00592 char *handle; 00593 struct { 00594 char *handle; 00595 char *date; 00596 char *clID; 00597 }hdt; 00598 struct { 00599 char *handle; 00600 char *date; 00601 }hd; 00602 struct { 00603 char *handle; 00604 qhead fqdns; 00605 qhead tests; 00606 }tc; 00607 struct { 00608 char *zone; 00609 char *limit; 00610 char *credit; 00611 }lc; 00612 struct { 00613 char *period_from; 00614 char *period_to; 00615 unsigned long long total_free_count; 00616 unsigned long long used_count; 00617 char *price; 00618 }rfi; 00619 struct { 00620 char *optrid; 00621 unsigned long long pollid; 00622 epps_info_domain old_data; 00623 epps_info_domain new_data; 00624 }upd; 00625 struct { 00626 char *optrid; 00627 unsigned long long pollid; 00628 epps_info_nsset old_data; 00629 epps_info_nsset new_data; 00630 }upn; 00631 struct { 00632 char *optrid; 00633 unsigned long long pollid; 00634 epps_info_keyset old_data; 00635 epps_info_keyset new_data; 00636 }upk; 00637 }msg; 00638 }epps_poll_req; 00639 00641 typedef struct { 00642 char *msgid; 00643 unsigned long long count; 00644 char *newmsgid; 00645 }epps_poll_ack; 00646 00648 typedef struct { 00649 char *id; 00650 epp_postalInfo pi; 00651 char *voice; 00652 char *fax; 00653 char *email; 00654 char *authInfo; 00655 epp_discl discl; 00656 char *vat; 00657 char *ident; 00658 epp_identType identtype; 00659 char *notify_email; 00660 char *crDate; 00661 }epps_create_contact; 00662 00664 typedef struct { 00665 char *name; 00666 char *registrant; 00667 qhead admin; 00668 char *nsset; 00669 char *keyset; 00670 int period; 00671 epp_timeunit unit; 00672 char *authInfo; 00673 qhead extensions; 00674 char *crDate; 00675 char *exDate; 00676 }epps_create_domain; 00677 00679 typedef struct { 00680 char *id; 00681 char *authInfo; 00682 qhead ns; 00683 qhead tech; 00684 char *crDate; 00685 int level; 00686 }epps_create_nsset; 00687 00689 typedef struct { 00690 char *id; 00691 char *authInfo; 00692 qhead keys; 00693 qhead tech; 00694 char *crDate; 00695 }epps_create_keyset; 00696 00698 typedef struct { 00699 char *id; 00700 }epps_delete; 00701 00703 typedef struct { 00704 char *name; 00705 char *curExDate; 00706 int period; 00707 epp_timeunit unit; 00708 qhead extensions; 00709 char *exDate; 00710 }epps_renew; 00711 00713 typedef struct { 00714 char *id; 00715 epp_postalInfo *pi; 00716 char *voice; 00717 char *fax; 00718 char *email; 00719 char *authInfo; 00720 epp_discl discl; 00721 char *vat; 00722 char *ident; 00723 epp_identType identtype; 00724 char *notify_email; 00725 }epps_update_contact; 00726 00728 typedef struct { 00729 char *name; 00730 char *registrant; 00731 qhead add_admin; 00732 qhead rem_admin; 00733 qhead rem_tmpcontact; 00734 char *nsset; 00735 char *keyset; 00736 char *authInfo; 00737 qhead extensions; 00738 }epps_update_domain; 00739 00741 typedef struct { 00742 char *id; 00743 qhead add_tech; 00744 qhead rem_tech; 00745 qhead add_ns; 00746 qhead rem_ns; 00747 char *authInfo; 00748 int level; 00749 }epps_update_nsset; 00750 00752 typedef struct { 00753 char *id; 00754 qhead add_tech; 00755 qhead rem_tech; 00756 qhead add_dnskey; 00757 qhead rem_dnskey; 00758 char *authInfo; 00759 }epps_update_keyset; 00760 00762 typedef struct { 00763 char *id; 00764 char *authInfo; 00765 }epps_transfer; 00766 00768 typedef struct { 00769 char *id; 00770 }epps_sendAuthInfo; 00771 00773 typedef struct { 00774 qhead zonecredits; 00775 }epps_creditInfo; 00776 00778 typedef struct { 00779 char *id; 00780 qhead names; 00781 int level; 00782 }epps_test; 00783 00785 typedef struct { 00786 qhead handles; 00787 }epps_list; 00788 00794 typedef struct { 00795 char *handle; 00796 unsigned int count; 00797 }epps_info; 00798 00808 typedef struct { 00809 char *clTRID; 00810 char *svTRID; 00811 int rc; 00812 char *msg; 00813 char *xml_in; 00815 /* parsed_doc and xpath_ctx are needed for error reporting. */ 00816 void *parsed_doc; 00817 void *xpath_ctx; 00819 short noresdata; 00821 qhead errors; 00822 00827 epp_command_type type; 00832 void *data; 00833 }epp_command_data; 00834 00835 00836 /* ********************************************************************* */ 00837 00845 void epplog(epp_context *epp_ctx, epp_loglevel level, const char *fmt, ...); 00846 00863 void *epp_malloc(void *pool, unsigned size); 00864 00872 void *epp_calloc(void *pool, unsigned size); 00873 00882 char *epp_strdup(void *pool, const char *str); 00883 00896 char *epp_strcat(void *pool, const char *str1, const char *str2); 00897 00905 char *epp_sprintf(void *pool, const char *fmt, ...); 00906 00911 #endif /* EPP_COMMON_H */