|
fred-mod-whoisd-3.12.1
|
Implementation of CORBA backend used for querying CORBA server for information about an object. More...
#include <assert.h>#include <signal.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <orbit/orbit.h>#include <ORBitservices/CosNaming.h>#include "whois-client.h"#include "Whois.h"
Macros | |
| #define | ID_STATUS_OBJ_LINKED 16 |
| ID of object status 'Linked'. | |
| #define | ID_STATUS_OBJ_MOJEIDCONTACT 24 |
| ID of object status 'mojeidContact'. | |
| #define | raised_exception(ev) ((ev)->_major != CORBA_NO_EXCEPTION) |
| A shortcut for testing of CORBA exception appearence. More... | |
| #define | MAX_RETRIES 3 |
| Max # of retries when COMM_FAILURE exception during CORBA call occurs. More... | |
| #define | RETR_SLEEP 100000 |
| Sleep interval in microseconds between retries. More... | |
| #define | IS_NOT_COMM_FAILURE_EXCEPTION(_ev) (strcmp((_ev)->_id, "IDL:omg.org/CORBA/COMM_FAILURE:1.0")) |
| True if CORBA exception is COMM_FAILURE, which is used in retry loop. More... | |
| #define | IS_OBJECT_NOT_FOUND(_ev) (!strcmp((_ev)->_id, "IDL:ccReg/Whois/ObjectNotFound:1.0")) |
| True if CORBA exception is ObjectNotFound. | |
| #define | NULL_STRDUP(src) ((*(src) == '\0') ? NULL : strdup(src)) |
| Call strdup on string only if it is not empty, otherwise return NULL. More... | |
| #define | COPY_ADDRESS_LINE(str) do{ if (*(str) != '\0') r->address[line++] = strdup(str); }while(0) |
| #define | COPY_ADDRESS_LINE(str) do{ if (*(str) != '\0') c->address[line++] = strdup(str); }while(0) |
Functions | |
| int | check_duplicates (int type, char *handle, general_object *objects, int index_free) |
| Check for duplicates in array of objects. More... | |
| static int | get_registrar_by_handle (service_Whois service, const char *handle, general_object *objects, int *index_free, char *errmsg) |
| Search registrar by handle. More... | |
| static int | get_contact_by_handle (service_Whois service, const char *handle, general_object *objects, int *index_free, char *errmsg) |
| Search contact by handle. More... | |
| static void | copy_nsset (general_object *obj, ccReg_NSSetDetail *c_nsset) |
| Copy corba representation of nsset object to our representation. More... | |
| static void | copy_keyset (general_object *obj, ccReg_KeySetDetail *c_keyset) |
| Copy corba representation of keyset object to our representation. More... | |
| static int | recurse_nsset (service_Whois service, int rec, obj_nsset *n, general_object *objects, int *index_free, char *errmsg) |
| The function does recursion on nsset. More... | |
| static int | recurse_keyset (service_Whois service, int rec, obj_keyset *k, general_object *objects, int *index_free, char *errmsg) |
| The function does recursion on keyset. More... | |
| static int | get_nsset_by_handle (service_Whois service, const char *handle, int rec, general_object *objects, int *index_free, char *errmsg) |
| Search nsset by handle and dependent objects if recursion is switched on. More... | |
| static int | get_keyset_by_handle (service_Whois service, const char *handle, int rec, general_object *objects, int *index_free, char *errmsg) |
| Search keyset by handle and dependent objects if recursion is switched on. More... | |
| static int | get_nsset_by_attr (service_Whois service, const char *key, ccReg_NSSetInvKeyType attr, int rec, general_object *objects, int *index_free, char *errmsg) |
| Search nsset by its attribute and dependent objects if recursion is switched on. More... | |
| static int | get_keyset_by_attr (service_Whois service, const char *key, ccReg_KeySetInvKeyType attr, int rec, general_object *objects, int *index_free, char *errmsg) |
| Search keyset by its attribute and dependent objects if recursion is switched on. More... | |
| static int | translate_status (service_Whois service, general_object *objects, char *errmsg) |
| Translate status ids by domain objects to appropriate strings. More... | |
| static void | copy_domain (general_object *obj, ccReg_DomainDetail *c_domain) |
| Copy corba representation of domain object to our representation. More... | |
| static int | recurse_domain (service_Whois service, int rec, obj_domain *d, general_object *objects, int *index_free, char *errmsg) |
| The function does recursion on domain. More... | |
| static int | get_domain_by_handle (service_Whois service, const char *handle, int rec, general_object *objects, int *index_free, char *errmsg) |
| Search domain by fqdn and dependent objects if recursion is switched on. More... | |
| static int | get_domain_by_attr (service_Whois service, const char *key, ccReg_DomainInvKeyType attr, int rec, general_object *objects, int *index_free, char *errmsg) |
| Search domain by its attribute and dependent objects if recursion is switched on. More... | |
| int | whois_log_new_message (service_Logger service, const char *sourceIP, const char *content, ccReg_RequestProperties *properties, ccReg_TID *log_entry_id, char *errmsg) |
| Log a new event using logging daemon. More... | |
| int | whois_close_log_message (service_Logger service, const char *content, ccReg_RequestProperties *properties, ccReg_TID log_entry_id, CORBA_long result_code, char *errmsg) |
| Update and close existing event using logging daemon. More... | |
| int | whois_corba_call (service_Whois service, const whois_request *wr, general_object *objects, char *timebuf, char *errmsg) |
| Call the right function for the specific object type / search axis / handle combination. More... | |
| void | whois_release_data (general_object *objects) |
| Release data of any of the objects. More... | |
Variables | |
| const int | IP_ADDR_LEN = 39 |
| maximum length of a string containing IP address | |
| const int | LC_UNIX_WHOIS = 0 |
| code of the servie according to the database table ‘service’ | |
Implementation of CORBA backend used for querying CORBA server for information about an object.
| #define IS_NOT_COMM_FAILURE_EXCEPTION | ( | _ev | ) | (strcmp((_ev)->_id, "IDL:omg.org/CORBA/COMM_FAILURE:1.0")) |
True if CORBA exception is COMM_FAILURE, which is used in retry loop.
| #define MAX_RETRIES 3 |
Max # of retries when COMM_FAILURE exception during CORBA call occurs.
| #define NULL_STRDUP | ( | src | ) | ((*(src) == '\0') ? NULL : strdup(src)) |
Call strdup on string only if it is not empty, otherwise return NULL.
| #define raised_exception | ( | ev | ) | ((ev)->_major != CORBA_NO_EXCEPTION) |
A shortcut for testing of CORBA exception appearence.
| #define RETR_SLEEP 100000 |
Sleep interval in microseconds between retries.
| int check_duplicates | ( | int | type, |
| char * | handle, | ||
| general_object * | objects, | ||
| int | index_free | ||
| ) |
Check for duplicates in array of objects.
| type | Which type of objects to look for. |
| handle | Handle of the object. |
| objects | The structure for holding any type of object |
| index_free | First free item in array of objects. |
Referenced by get_contact_by_handle(), get_domain_by_handle(), get_keyset_by_handle(), get_nsset_by_handle(), and get_registrar_by_handle().

|
static |
Copy corba representation of domain object to our representation.
| obj | Field in object array which is destination of copy. |
| c_domain | Domain detail returned from CORBA. |
References general_object::type.
Referenced by get_domain_by_attr().
|
static |
Copy corba representation of keyset object to our representation.
| obj | Field in object array which is destination of copy. |
| c_keyset | Keyset detail returned from CORBA. |
References general_object::type.
Referenced by get_keyset_by_attr().
|
static |
Copy corba representation of nsset object to our representation.
| obj | Field in object array which is destination of copy. |
| c_nsset | Nsset detail returned from CORBA. |
References IP_ADDR_LEN, and general_object::type.
Referenced by get_nsset_by_attr().
|
static |
Search contact by handle.
Supress duplicities in array of objects.
| service | Whois CORBA object reference. |
| handle | Handle of contact. |
| objects | Array of resulting objects. |
| index_free | First free item in array of objects. |
| errmsg | Buffer for error message. |
References check_duplicates(), CORBA_OK, CORBA_SERVICE_FAILED, IS_NOT_COMM_FAILURE_EXCEPTION, IS_OBJECT_NOT_FOUND, MAX_ERROR_MSG_LEN, MAX_RETRIES, raised_exception, and RETR_SLEEP.
Referenced by recurse_domain(), recurse_keyset(), and recurse_nsset().
|
static |
Search domain by its attribute and dependent objects if recursion is switched on.
| service | Whois CORBA object reference. |
| key | Attribute of domain. |
| attr | Attribute type. |
| rec | Recursive lookup is performed if true. |
| objects | Array of resulting objects. |
| index_free | First free item in array of objects. |
| errmsg | Buffer for error message. |
References copy_domain(), CORBA_OK, CORBA_SERVICE_FAILED, IS_NOT_COMM_FAILURE_EXCEPTION, MAX_ERROR_MSG_LEN, MAX_OBJECT_COUNT, MAX_RETRIES, raised_exception, recurse_domain(), and RETR_SLEEP.
|
static |
Search domain by fqdn and dependent objects if recursion is switched on.
Supress duplicates in array of objects
| service | Whois CORBA object reference. |
| handle | Fqdn of domain. |
| rec | Recursive lookup is performed if true. |
| objects | Array of resulting objects. |
| index_free | First free item in array of objects. |
| errmsg | Buffer for error message. |
References check_duplicates(), CORBA_OK, CORBA_SERVICE_FAILED, IS_NOT_COMM_FAILURE_EXCEPTION, IS_OBJECT_NOT_FOUND, MAX_ERROR_MSG_LEN, MAX_RETRIES, raised_exception, and RETR_SLEEP.
|
static |
Search keyset by its attribute and dependent objects if recursion is switched on.
| service | Whois CORBA object reference. |
| key | Attribute of keyset. |
| attr | Attribute type. |
| rec | Recursive lookup is performed if true. |
| objects | Array of resulting objects. |
| index_free | First free item in array of objects. |
| errmsg | Buffer for error message. |
References copy_keyset(), CORBA_OK, CORBA_SERVICE_FAILED, IS_NOT_COMM_FAILURE_EXCEPTION, MAX_ERROR_MSG_LEN, MAX_OBJECT_COUNT, MAX_RETRIES, raised_exception, recurse_keyset(), and RETR_SLEEP.
|
static |
Search keyset by handle and dependent objects if recursion is switched on.
Supress duplicities in array of objects.
| service | Whois CORBA object reference. |
| handle | Handle of keyset. |
| rec | Recursive lookup is performed if true. |
| objects | Array of resulting objects. |
| index_free | First free item in array of objects. |
| errmsg | Buffer for error message. |
References check_duplicates(), CORBA_OK, CORBA_SERVICE_FAILED, IS_NOT_COMM_FAILURE_EXCEPTION, IS_OBJECT_NOT_FOUND, MAX_ERROR_MSG_LEN, MAX_RETRIES, raised_exception, and RETR_SLEEP.
Referenced by recurse_domain().
|
static |
Search nsset by its attribute and dependent objects if recursion is switched on.
| service | Whois CORBA object reference. |
| key | Attribute of nsset. |
| attr | Attribute type. |
| rec | Recursive lookup is performed if true. |
| objects | Array of resulting objects. |
| index_free | First free item in array of objects. |
| errmsg | Buffer for error message. |
References copy_nsset(), CORBA_OK, CORBA_SERVICE_FAILED, IS_NOT_COMM_FAILURE_EXCEPTION, MAX_ERROR_MSG_LEN, MAX_OBJECT_COUNT, MAX_RETRIES, raised_exception, recurse_nsset(), and RETR_SLEEP.
|
static |
Search nsset by handle and dependent objects if recursion is switched on.
Supress duplicities in array of objects.
| service | Whois CORBA object reference. |
| handle | Handle of nsset. |
| rec | Recursive lookup is performed if true. |
| objects | Array of resulting objects. |
| index_free | First free item in array of objects. |
| errmsg | Buffer for error message. |
References check_duplicates(), CORBA_OK, CORBA_SERVICE_FAILED, IS_NOT_COMM_FAILURE_EXCEPTION, IS_OBJECT_NOT_FOUND, MAX_ERROR_MSG_LEN, MAX_RETRIES, raised_exception, and RETR_SLEEP.
Referenced by recurse_domain().
|
static |
Search registrar by handle.
Supress duplicities in array of objects.
| service | Whois CORBA object reference. |
| handle | Handle of registrar. |
| objects | Array of resulting objects. |
| index_free | First free item in array of objects. |
| errmsg | Buffer for error message. |
References check_duplicates(), CORBA_OK, CORBA_SERVICE_FAILED, IS_NOT_COMM_FAILURE_EXCEPTION, IS_OBJECT_NOT_FOUND, MAX_ERROR_MSG_LEN, MAX_RETRIES, raised_exception, and RETR_SLEEP.
|
static |
The function does recursion on domain.
| service | Whois corba object reference. |
| rec | Recursive lookup is performed if true. |
| d | Domain object on which recursion is done. |
| objects | Array of results. |
| index_free | First free index in array of results. |
| errmsg | Buffer for error message. |
References obj_domain::admin_c, CORBA_OK, CORBA_OK_LIMIT, get_contact_by_handle(), get_keyset_by_handle(), get_nsset_by_handle(), obj_domain::keyset, MAX_OBJECT_COUNT, obj_domain::nsset, obj_domain::registrant, and obj_domain::temp_c.
Referenced by get_domain_by_attr().
|
static |
The function does recursion on keyset.
| service | Whois corba object reference. |
| rec | Switches recursion on/off |
| k | Keyset object on which recursion is done. |
| objects | Array of results. |
| index_free | First free index in array of results. |
| errmsg | Buffer for error message. |
References CORBA_OK, CORBA_OK_LIMIT, get_contact_by_handle(), MAX_OBJECT_COUNT, and obj_keyset::tech_c.
Referenced by get_keyset_by_attr().
|
static |
The function does recursion on nsset.
| service | Whois corba object reference. |
| rec | Switches recursion on/off |
| n | Nsset object on which is done recursion. |
| objects | Array of results. |
| index_free | First free index in array of results. |
| errmsg | Buffer for error message. |
References CORBA_OK, CORBA_OK_LIMIT, get_contact_by_handle(), MAX_OBJECT_COUNT, and obj_nsset::tech_c.
Referenced by get_nsset_by_attr().
|
static |
Translate status ids by domain objects to appropriate strings.
| service | Whois corba object reference. |
| objects | Array of objects. |
| errmsg | Buffer for error message. |
References CORBA_SERVICE_FAILED, IS_NOT_COMM_FAILURE_EXCEPTION, MAX_ERROR_MSG_LEN, MAX_OBJECT_COUNT, MAX_RETRIES, raised_exception, RETR_SLEEP, and general_object::type.
| int whois_close_log_message | ( | service_Logger | service, |
| const char * | content, | ||
| ccReg_RequestProperties * | properties, | ||
| ccReg_TID | log_entry_id, | ||
| CORBA_long | result_code, | ||
| char * | errmsg | ||
| ) |
Update and close existing event using logging daemon.
| service | Whois CORBA object reference. |
| content | Raw content of the message. |
| properties | Custom properties parsed from the content |
| log_entry_id | ID of the log entry to be close |
| errmsg | Buffer for error message. |
References CORBA_OK, CORBA_SERVICE_FAILED, IS_NOT_COMM_FAILURE_EXCEPTION, MAX_ERROR_MSG_LEN, MAX_RETRIES, raised_exception, and RETR_SLEEP.
| int whois_corba_call | ( | service_Whois | service, |
| const whois_request * | wr, | ||
| general_object * | objects, | ||
| char * | timebuf, | ||
| char * | errmsg | ||
| ) |
Call the right function for the specific object type / search axis / handle combination.
The core function of whois module performs actual query.
| service | Whois CORBA object reference. |
| wr | Whois request. |
| objects | Array of resulting objects. |
| timebuf | Timestamp. |
| errmsg |
References whois_request::axe, whois_request::norecursion, and TIME_BUFFER_LENGTH.
| int whois_log_new_message | ( | service_Logger | service, |
| const char * | sourceIP, | ||
| const char * | content, | ||
| ccReg_RequestProperties * | properties, | ||
| ccReg_TID * | log_entry_id, | ||
| char * | errmsg | ||
| ) |
Log a new event using logging daemon.
Log a message using logging daemon.
| service | Whois CORBA object reference. |
| sourceIP | IP of the host which sent the request. |
| content | Raw content of the message. |
| properties | Custom properties parsed from the content |
| log_entry_id | Output of ID from event logger |
| errmsg | Buffer for error message. |
References CORBA_SERVICE_FAILED, LC_UNIX_WHOIS, and MAX_RETRIES.
| void whois_release_data | ( | general_object * | objects | ) |
Release data of any of the objects.
Release data.
| objects | Object to release |
References general_object::type.
1.8.15