CSimpleDNSClient

COM (ActiveX) object implementing ISimpleDNSClient, a DNS resolver.

[ SimpleDNSResolver | Source | Keywords | Summary | Ancestors | All Members | Descendants ]

Quick Index

DESCRIPTION
USAGE
EXAMPLE
ADMINISTRATIVE
SEE ALSO

Class Summary

class ATL_NO_VTABLE CSimpleDNSClient :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<CSimpleDNSClient, &CLSID_SimpleDNSClient>,
public ISupportErrorInfo,
public IDispatchImpl<ISimpleDNSClient, &IID_ISimpleDNSClient, &LIBID_SIMPLEDNSRESOLVERLib>

{

public:
CSimpleDNSClient() ;
STDMETHOD(FindServerAddresses)(VARIANT *pvServerAddresses);
STDMETHOD(get_ServerAddresses)( BSTR *pVal);
STDMETHOD(put_ServerAddresses)( BSTR newVal);
STDMETHOD(Resolve)( BSTR BSearchedName, VARIANT *pvFoundNames, BSTR BResourceClass, BSTR BResourceType);
STDMETHOD(GetEmailServers)( BSTR BDomainName, VARIANT *pvEmailServerNames);
STDMETHOD(get_Separator)( BSTR *pVal);
STDMETHOD(put_Separator)( BSTR newVal);
STDMETHOD(GetDNSDomain)( VARIANT *pvDNSDomainName);
protected:
}; // CSimpleDNSClient

Back to the top of CSimpleDNSClient

DESCRIPTION

This class implements a DNS resolver within a COM object. It relies on a porting of the BIND (Berkeley Internet Name Domain) implementation of DNS.

Back to the top of CSimpleDNSClient

USAGE

To use this class:
bulletCreate an instance of the COMponent
bulletCall any method of the ISimpleDNSClient interface:
bulletResolve()
bulletGetEmailServers()
bulletFindServerAddresses()
bulletget_ServerAddresses()
bulletput_ServerAddresses()
bulletget_Separator()
bulletput_Separator()
bulletGetDNSDomain()
bulletDelete instance of COMponent

Back to the top of CSimpleDNSClient

EXAMPLE

    Dim oDNS
    Set oDNS = CreateObject("Emmanuel.SimpleDNSClient.1")

Dim requested_name requested_name = "www.microsoft.com"

Dim found_names found_names = ""

' Set the server address(es) [optional on Windows NT, mandatory on Win95/98] oDNS.ServerAddresses = "99.99.99.99" ' Set the separator oDNS.Separator = ";"

On Error Resume Next oDNS.GetEmailServers requested_name, found_names If Err <> 0 Then MsgBox Err.Description Else ' Show resolved names (within dialog box) MsgBox "Found names:" & vbCrLf & vbCrLf & found_names End If

Back to the top of CSimpleDNSClient

ADMINISTRATIVE

Author Emmanuel KARTMANN

Date Monday 1/31/00 3:52:04 PM

Back to the top of CSimpleDNSClient

SEE ALSO

RFC1034,
RFC1035.

Back to the top of CSimpleDNSClient

CSimpleDNSClient() ;

Purpose: create an instance of the class

Parameters: none (C++ constructor)

Return value : none (C++ constructor)

Description :

    CSimpleDNSClient()
        ;

Function is currently defined inline.


Back to the top of CSimpleDNSClient

STDMETHOD(FindServerAddresses)(VARIANT *pvServerAddresses);

Purpose: return the known DNS server addresses, as configured in your local machine (Windows Registry)

Parameters:

out pvServerAddresses
list of DNS Server addresses (separated by spaces), in dotted notation, e.g. "192.175.235.1 192.175.234.2"

Return value : HRESULT = S_OK for success, otherwise an error occurred

Description : This function reads the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\NameServer to find the DNS servers on the local machine.

This function works on Windows NT only.

    STDMETHOD(FindServerAddresses)(VARIANT *pvServerAddresses);

Back to the top of CSimpleDNSClient

STDMETHOD(get_ServerAddresses)( BSTR *pVal);

Purpose: return value of the ServerAddresses property, i.e. the list of DNS servers.

Parameters:

out pVal
list of DNS Server addresses (separated by spaces), in dotted notation, e.g. "192.175.235.1 192.175.234.2"

Return value : HRESULT = S_OK for success, otherwise an error occurred

Description : The property ServerAddresses can be set via method put_ServerAddresses().

    STDMETHOD(get_ServerAddresses)(/*[out, retval]*/ BSTR *pVal);

Back to the top of CSimpleDNSClient

STDMETHOD(put_ServerAddresses)( BSTR newVal);

Purpose: set value of the ServerAddresses property, i.e. the list of DNS servers.

Parameters:

in newVal
new list of DNS Server addresses (separated by spaces), in dotted notation, e.g. "192.175.235.1 192.175.234.2"

Return value : HRESULT = S_OK for success, otherwise an error occurred

Description : The property ServerAddresses can be read via method get_ServerAddresses().

    STDMETHOD(put_ServerAddresses)(/*[in]*/ BSTR newVal);

Back to the top of CSimpleDNSClient

STDMETHOD(Resolve)( BSTR BSearchedName, VARIANT *pvFoundNames, BSTR BResourceClass, BSTR BResourceType);

Purpose: resolve a name in DNS, i.e. send a request and build a list (string) of results with the server's answer(s).

Parameters:

in BSearchedName
name of the searched resource record
out pvFoundNames
list of found records (a string with every entry separated by value of 'Separator' property).
in BResourceClass
class of searched record. Can be any of the following classes:
bulletC_IN: ARPA Internet (default)
bulletC_CHAOS: Chaos Net at MIT
bulletC_HS: Hesiod at MIT
bulletC_ANY: Any class

in BResourceType
type of searched record. Can be any of the following types:
bulletT_A: host address (IPv4) (default)
bulletT_NS: authoritative server
bulletT_MD: mail destination
bulletT_MF: mail forwarder
bulletT_CNAME: canonical name
bulletT_SOA: start of authority zone
bulletT_MB: mailbox domain name
bulletT_MG: mail group member
bulletT_MR: mail rename name
bulletT_NULL: null resource record
bulletT_WKS: well known service
bulletT_PTR: domain name pointer
bulletT_HINFO: host information
bulletT_MINFO: mailbox information
bulletT_MX: mail routing information
bulletT_TXT: text strings
bulletT_RP: responsible person
bulletT_AFSDB: AFS cell database
bulletT_X25: X_25 calling address
bulletT_ISDN: ISDN calling address
bulletT_RT: router
bulletT_NSAP: NSAP address
bulletT_NSAP_PTR: reverse NSAP lookup (deprecated)
bulletT_SIG: security signature
bulletT_KEY: security key
bulletT_PX: X.400 mail mapping
bulletT_GPOS: geographical position (withdrawn)
bulletT_AAAA: IPv6 Address
bulletT_LOC: Location Information
bulletT_NXT: Next Valid Name in Zone
bulletT_EID: Endpoint identifier
bulletT_NIMLOC: Nimrod locator
bulletT_SRV: Server selection
bulletT_ATMA: ATM Address
bulletT_NAPTR: Naming Authority PoinTeR
bulletT_UINFO: user (finger) information (non standard)
bulletT_UID: user ID (non standard)
bulletT_GID: group ID (non standard)
bulletT_UNSPEC: Unspecified format (binary data/non standard)
bulletT_IXFR: incremental zone transfer
bulletT_AXFR: transfer zone of authority
bulletT_MAILB: transfer mailbox records
bulletT_MAILA: transfer mail agent records
bulletT_ANY: wildcard match

Return value : HRESULT = S_OK for success, otherwise an error occurred

Description : IP addresses are returned in dotted notation (e.g. "123.123.123.123")

    STDMETHOD(Resolve)(/*[in]*/ BSTR BSearchedName, /*[out]*/ VARIANT *pvFoundNames, /*[in, optional, defaultvalue("C_IN")]*/ BSTR BResourceClass, /*[in, optional, defaultvalue("T_A")]*/ BSTR BResourceType);

Back to the top of CSimpleDNSClient

STDMETHOD(GetEmailServers)( BSTR BDomainName, VARIANT *pvEmailServerNames);

Purpose: get the Email (SMTP) Servers for a given domain

Parameters:

in BDomainName
domain name to look for. Note that if this parameter is empty, the domain name for local machine will be used (see method GetDNSDomain()).
out pvEmailServerNames
list of found server names (a string with every entry separated by value of 'Separator' property).

Return value : HRESULT = S_OK for success, otherwise an error occurred

Description : SMTP servers are declared in the DNS database. This function calls method Resolve() with class "C_IN" and type "T_MX" for the given domain; the returned records, if any, consist in the SMTP servers declared for that domain.

    STDMETHOD(GetEmailServers)(/*[in, optional, defaultvalue("")]*/ BSTR BDomainName, /*[out]*/ VARIANT *pvEmailServerNames);

Back to the top of CSimpleDNSClient

STDMETHOD(get_Separator)( BSTR *pVal);

Purpose: return the string used to separate multiple results of method Resolve()

Parameters:

out pVal
separator string (defaults to ", ")

Return value : HRESULT = S_OK for success, otherwise an error occurred

Description :

    STDMETHOD(get_Separator)(/*[out, retval]*/ BSTR *pVal);

Back to the top of CSimpleDNSClient

STDMETHOD(put_Separator)( BSTR newVal);

Purpose: set the string used to separate multiple results of method Resolve()

Parameters:

in newVal
new separator string

Return value : HRESULT = S_OK for success, otherwise an error occurred

Description :

    STDMETHOD(put_Separator)(/*[in]*/ BSTR newVal);

Back to the top of CSimpleDNSClient

STDMETHOD(GetDNSDomain)( VARIANT *pvDNSDomainName);

Purpose: returns the DNS domain as defined in machine configuration (Windows Registry).

Parameters:

out pvDNSDomainName
DNS domain name (e.g. "kartmann.org").

Return value : HRESULT = S_OK for success, otherwise an error occurred

Description :

    STDMETHOD(GetDNSDomain)(/*[out]*/ VARIANT *pvDNSDomainName);

Back to the top of CSimpleDNSClient

All Members

public:
STDMETHOD(FindServerAddresses)(VARIANT *pvServerAddresses);
STDMETHOD(get_ServerAddresses)( BSTR *pVal);
STDMETHOD(put_ServerAddresses)( BSTR newVal);
STDMETHOD(Resolve)( BSTR BSearchedName, VARIANT *pvFoundNames, BSTR BResourceClass, BSTR BResourceType);
STDMETHOD(GetEmailServers)( BSTR BDomainName, VARIANT *pvEmailServerNames);
STDMETHOD(get_Separator)( BSTR *pVal);
STDMETHOD(put_Separator)( BSTR newVal);
STDMETHOD(GetDNSDomain)( VARIANT *pvDNSDomainName);
protected:

Back to the top of CSimpleDNSClient

Ancestors

Inheritance chain for CSimpleDNSClient:

bulletCComCoClass
bulletCComObjectRootEx
bulletIDispatchImpl
bulletISupportErrorInfo

Back to the top of CSimpleDNSClient

Descendants

Class is not inherited by any others.

Back to the top of CSimpleDNSClient

Generated from source by the Cocoon utilities on Wed Feb 09 17:55:46 2000 .

Report problems to jkotula@stratasys.com