fred-mod-eppd-2.11.0
|
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 }epp_pollType; 00474 00476 typedef struct { 00477 char *testname; 00478 int status; 00479 char *note; 00480 }epp_testResult; 00481 00482 /* ********************************************************************* */ 00483 00484 00486 typedef struct { 00487 char *clID; 00488 char *pw; 00489 char *newPW; 00490 qhead objuri; 00491 qhead exturi; 00492 unsigned lang; 00493 }epps_login; 00494 00496 typedef struct { 00497 qhead ids; 00498 qhead avails; 00499 }epps_check; 00500 00502 typedef struct { 00503 char *id; 00504 char *handle; 00505 char *roid; 00506 qhead status; 00507 epp_postalInfo pi; 00508 char *voice; 00509 char *fax; 00510 char *email; 00511 char *clID; 00512 char *crID; 00513 char *crDate; 00514 char *upID; 00515 char *upDate; 00516 char *trDate; 00517 char *authInfo; 00518 epp_discl discl; 00519 char *vat; 00520 char *ident; 00521 epp_identType identtype; 00522 char *notify_email; 00523 }epps_info_contact; 00524 00526 typedef struct { 00527 char *name; 00528 char *handle; 00529 char *roid; 00530 qhead status; 00531 char *registrant; 00532 qhead tmpcontact; 00533 qhead admin; 00534 char *nsset; 00535 char *keyset; 00536 char *clID; 00537 char *crID; 00538 char *crDate; 00539 char *exDate; 00540 char *upID; 00541 char *upDate; 00542 char *trDate; 00543 char *authInfo; 00544 qhead extensions; 00545 }epps_info_domain; 00546 00548 typedef struct { 00549 char *id; 00550 char *handle; 00551 char *roid; 00552 qhead status; 00553 char *clID; 00554 char *crID; 00555 char *crDate; 00556 char *upID; 00557 char *upDate; 00558 char *trDate; 00559 char *authInfo; 00560 qhead ns; 00561 qhead tech; 00562 int level; 00563 }epps_info_nsset; 00564 00566 typedef struct { 00567 char *id; 00568 char *handle; 00569 char *roid; 00570 qhead status; 00571 char *clID; 00572 char *crID; 00573 char *crDate; 00574 char *upID; 00575 char *upDate; 00576 char *trDate; 00577 char *authInfo; 00578 qhead keys; 00579 qhead tech; 00580 } epps_info_keyset; 00581 00583 typedef struct { 00584 int count; 00585 char *msgid; 00586 char *qdate; 00587 epp_pollType type; 00588 union { 00589 char *handle; 00590 struct { 00591 char *handle; 00592 char *date; 00593 char *clID; 00594 }hdt; 00595 struct { 00596 char *handle; 00597 char *date; 00598 }hd; 00599 struct { 00600 char *handle; 00601 qhead fqdns; 00602 qhead tests; 00603 }tc; 00604 struct { 00605 char *zone; 00606 char *limit; 00607 char *credit; 00608 }lc; 00609 struct { 00610 char *period_from; 00611 char *period_to; 00612 unsigned long long total_free_count; 00613 unsigned long long used_count; 00614 char *price; 00615 }rfi; 00616 }msg; 00617 }epps_poll_req; 00618 00620 typedef struct { 00621 char *msgid; 00622 int count; 00623 char *newmsgid; 00624 }epps_poll_ack; 00625 00627 typedef struct { 00628 char *id; 00629 epp_postalInfo pi; 00630 char *voice; 00631 char *fax; 00632 char *email; 00633 char *authInfo; 00634 epp_discl discl; 00635 char *vat; 00636 char *ident; 00637 epp_identType identtype; 00638 char *notify_email; 00639 char *crDate; 00640 }epps_create_contact; 00641 00643 typedef struct { 00644 char *name; 00645 char *registrant; 00646 qhead admin; 00647 char *nsset; 00648 char *keyset; 00649 int period; 00650 epp_timeunit unit; 00651 char *authInfo; 00652 qhead extensions; 00653 char *crDate; 00654 char *exDate; 00655 }epps_create_domain; 00656 00658 typedef struct { 00659 char *id; 00660 char *authInfo; 00661 qhead ns; 00662 qhead tech; 00663 char *crDate; 00664 int level; 00665 }epps_create_nsset; 00666 00668 typedef struct { 00669 char *id; 00670 char *authInfo; 00671 qhead keys; 00672 qhead tech; 00673 char *crDate; 00674 }epps_create_keyset; 00675 00677 typedef struct { 00678 char *id; 00679 }epps_delete; 00680 00682 typedef struct { 00683 char *name; 00684 char *curExDate; 00685 int period; 00686 epp_timeunit unit; 00687 qhead extensions; 00688 char *exDate; 00689 }epps_renew; 00690 00692 typedef struct { 00693 char *id; 00694 epp_postalInfo *pi; 00695 char *voice; 00696 char *fax; 00697 char *email; 00698 char *authInfo; 00699 epp_discl discl; 00700 char *vat; 00701 char *ident; 00702 epp_identType identtype; 00703 char *notify_email; 00704 }epps_update_contact; 00705 00707 typedef struct { 00708 char *name; 00709 char *registrant; 00710 qhead add_admin; 00711 qhead rem_admin; 00712 qhead rem_tmpcontact; 00713 char *nsset; 00714 char *keyset; 00715 char *authInfo; 00716 qhead extensions; 00717 }epps_update_domain; 00718 00720 typedef struct { 00721 char *id; 00722 qhead add_tech; 00723 qhead rem_tech; 00724 qhead add_ns; 00725 qhead rem_ns; 00726 char *authInfo; 00727 int level; 00728 }epps_update_nsset; 00729 00731 typedef struct { 00732 char *id; 00733 qhead add_tech; 00734 qhead rem_tech; 00735 qhead add_dnskey; 00736 qhead rem_dnskey; 00737 char *authInfo; 00738 }epps_update_keyset; 00739 00741 typedef struct { 00742 char *id; 00743 char *authInfo; 00744 }epps_transfer; 00745 00747 typedef struct { 00748 char *id; 00749 }epps_sendAuthInfo; 00750 00752 typedef struct { 00753 qhead zonecredits; 00754 }epps_creditInfo; 00755 00757 typedef struct { 00758 char *id; 00759 qhead names; 00760 int level; 00761 }epps_test; 00762 00764 typedef struct { 00765 qhead handles; 00766 }epps_list; 00767 00773 typedef struct { 00774 char *handle; 00775 unsigned int count; 00776 }epps_info; 00777 00787 typedef struct { 00788 char *clTRID; 00789 char *svTRID; 00790 int rc; 00791 char *msg; 00792 char *xml_in; 00794 /* parsed_doc and xpath_ctx are needed for error reporting. */ 00795 void *parsed_doc; 00796 void *xpath_ctx; 00798 short noresdata; 00800 qhead errors; 00801 00806 epp_command_type type; 00811 void *data; 00812 }epp_command_data; 00813 00814 00815 /* ********************************************************************* */ 00816 00824 void epplog(epp_context *epp_ctx, epp_loglevel level, const char *fmt, ...); 00825 00842 void *epp_malloc(void *pool, unsigned size); 00843 00851 void *epp_calloc(void *pool, unsigned size); 00852 00861 char *epp_strdup(void *pool, const char *str); 00862 00875 char *epp_strcat(void *pool, const char *str1, const char *str2); 00876 00884 char *epp_sprintf(void *pool, const char *fmt, ...); 00885 00890 #endif /* EPP_COMMON_H */