Open Ethernet Networking (OpEN) API Guide and Reference Manual  3.6.0.3
Functions
DNS Configuration And Status [OPENAPI_DNS]

Functions

open_error_t openapiDNSAdminModeGet (openapiClientHandle_t *client_handle, OPEN_CONTROL_t *adminMode)
 Get the global admin mode for the DNS client. More...
 
open_error_t openapiDNSAdminModeSet (openapiClientHandle_t *client_handle, OPEN_CONTROL_t adminMode)
 Set the global admin mode for the DNS client. More...
 
open_error_t openapiDNSClientInetNameLookup (openapiClientHandle_t *client_handle, open_buffdesc *hostname, open_buffdesc *ipAddr)
 Given a DNS hostname, resolve and return IPv4 or IPv6 address associated with it. More...
 
open_error_t openapiDNSDefaultDomainNameDelete (openapiClientHandle_t *client_handle)
 Clear the DNS default domain name. More...
 
open_error_t openapiDNSDefaultDomainNameGet (openapiClientHandle_t *client_handle, open_buffdesc *defaultDomainName)
 Get the DNS default domain name. More...
 
open_error_t openapiDNSDefaultDomainNameSet (openapiClientHandle_t *client_handle, open_buffdesc *defaultDomainName)
 Set the DNS default domain name. More...
 
open_error_t openapiDNSDomainLabelMaximumSizeGet (openapiClientHandle_t *client_handle, uint32_t *domainLabelMaxSize)
 Get the maximum size of the DNS domain label that is separated by dot. More...
 
open_error_t openapiDNSDomainNameMaxSizeGet (openapiClientHandle_t *client_handle, uint32_t *domainNameMaxSize)
 Get the maximum size of domain name. More...
 
open_error_t openapiDNSIpNameServerAdd (openapiClientHandle_t *client_handle, open_inet_addr_t *ipAddr)
 Add DNS IP name server. More...
 
open_error_t openapiDNSIpNameServerDelete (openapiClientHandle_t *client_handle, open_inet_addr_t *ipAddr)
 Delete DNS IP name server. More...
 
open_error_t openapiDNSIpNameServersMaxSupportedGet (openapiClientHandle_t *client_handle, uint32_t *maxNameServers)
 Get the maximum number of DNS name servers supported. More...
 
open_error_t openapiDNSIpNameServersNextGet (openapiClientHandle_t *client_handle, open_inet_addr_t *ipAddr)
 Get next name server. More...
 
open_error_t openapiDNSStaticHostAddressMappingRemove (openapiClientHandle_t *client_handle, open_buffdesc *hostname)
 Remove static hostname to address mapping. More...
 
open_error_t openapiDNSStaticHostAddressMappingSet (openapiClientHandle_t *client_handle, open_buffdesc *hostname, open_inet_addr_t *ipAddr)
 Set the static hostname to IP address mapping. More...
 
open_error_t openapiDNSStaticHostIpAddrGet (openapiClientHandle_t *client_handle, open_buffdesc *hostname, open_inet_addr_t *ipAddr)
 Get the IP address associated with the static host name. More...
 
open_error_t openapiDNSStaticHostNextGet (openapiClientHandle_t *client_handle, open_buffdesc *hostname)
 Get next static hostname. More...
 
open_error_t openapiInetAddrMaxSizeGet (openapiClientHandle_t *client_handle, uint32_t *inetAddrMaxSize)
 Get the maximum size of inet address length. More...
 

Detailed Description

Function Documentation

open_error_t openapiDNSAdminModeGet ( openapiClientHandle_t client_handle,
OPEN_CONTROL_t adminMode 
)

Get the global admin mode for the DNS client.

Parameters
[in]client_handleclient handle from registration API
[out]adminModeAdmin Mode value
Return values
OPEN_E_NONEGet successful.
OPEN_E_FAILGet failed.
OPEN_E_PARAMError in parameter passed.
OPEN_E_INTERNALOther Internal Failure.
OPEN_E_UNAVAILIf feature is not available.

OpEN API Version: 1.19

Examples:
dns_example.c.
open_error_t openapiDNSAdminModeSet ( openapiClientHandle_t client_handle,
OPEN_CONTROL_t  adminMode 
)

Set the global admin mode for the DNS client.

Parameters
[in]client_handleclient handle from registration API
[in]adminModeAdmin Mode value
Return values
OPEN_E_NONESet successful.
OPEN_E_FAILSet failed.
OPEN_E_PARAMError in parameter passed.
OPEN_E_UNAVAILIf feature is not available.

OpEN API Version: 1.19

Examples:
dns_example.c.
open_error_t openapiDNSClientInetNameLookup ( openapiClientHandle_t client_handle,
open_buffdesc hostname,
open_buffdesc ipAddr 
)

Given a DNS hostname, resolve and return IPv4 or IPv6 address associated with it.

Parameters
[in]client_handleClient handle from registration API
[in]hostnamePointer to hostname string storage
-Minimum value OPENAPI_DNS_HOST_NAME_LEN_MIN
-Maximum value OPENAPI_DNS_HOST_NAME_LEN_MAX
[out]ipAddrPointer to resolved IP address string storage.
Return values
OPEN_E_NONEif successfully
OPEN_E_FAILif DNS hostname look up failed
OPEN_E_ERRORif operation has failed
OPEN_E_PARAMif invalid parameter is supplied

OpEN API Version: 1.8

Examples:
dns_example.c.
open_error_t openapiDNSDefaultDomainNameDelete ( openapiClientHandle_t client_handle)

Clear the DNS default domain name.

Parameters
[in]client_handleClient handle from registration API
Return values
OPEN_E_NONEif default domain name is deleted.
OPEN_E_FAILif failed to delete default domain name.
OPEN_E_PARAMif invalid parameter is passed.
OPEN_E_UNAVAILif not supported for this platform.
Note
Calling this API will change the running configuration of the switch.

OpEN API Version: 1.1

Examples:
dns_example.c.
open_error_t openapiDNSDefaultDomainNameGet ( openapiClientHandle_t client_handle,
open_buffdesc defaultDomainName 
)

Get the DNS default domain name.

Parameters
[in]client_handleClient handle from registration API
[out]defaultDomainNameDefault domain name
Return values
OPEN_E_NONEif default domain name is returned.
OPEN_E_NOT_FOUNDif default domain name is not configured.
OPEN_E_PARAMif invalid parameter is passed.
OPEN_E_UNAVAILif not supported for this platform.
Note
Maximum size for defaultDomainName is determined by calling openapiDNSDomainNameMaxSizeGet().

OpEN API Version: 1.1

Examples:
dns_example.c.
open_error_t openapiDNSDefaultDomainNameSet ( openapiClientHandle_t client_handle,
open_buffdesc defaultDomainName 
)

Set the DNS default domain name.

Parameters
[in]client_handleClient handle from registration API
[in]defaultDomainNameDefault domain name
Return values
OPEN_E_NONEif default domain name is set.
OPEN_E_FAILif invalid domain name is passed.
OPEN_E_PARAMif invalid parameter is passed.
OPEN_E_UNAVAILif not supported for this platform.
Note
Calling this API will change the running configuration of the switch.
A valid domain name;
(i) Must not contain spaces/dots at the end and beginning.
(ii) Each substring separated by dot must not exceed characters as returned by openapiDNSDomainLabelMaximumSizeGet() and overall length must not exceed maximum characters as returned by openapiDNSDomainNameMaxSizeGet().
(iii) Each substring must start with an alphanumeric character.
(iv) Must not contain subsequent dots.

OpEN API Version: 1.1

Examples:
dns_example.c.
open_error_t openapiDNSDomainLabelMaximumSizeGet ( openapiClientHandle_t client_handle,
uint32_t *  domainLabelMaxSize 
)

Get the maximum size of the DNS domain label that is separated by dot.

Parameters
[in]client_handleClient handle from registration API
[out]domainLabelMaxSizeDomain name label maximum size
Return values
OPEN_E_NONEif maximum size of domain label is returned.
OPEN_E_PARAMif invalid parameter is passed.
OPEN_E_UNAVAILif not supported for this platform.

OpEN API Version: 1.1

open_error_t openapiDNSDomainNameMaxSizeGet ( openapiClientHandle_t client_handle,
uint32_t *  domainNameMaxSize 
)

Get the maximum size of domain name.

Parameters
[in]client_handleClient handle from registration API
[out]domainNameMaxSizeMaximum size of domain name
Return values
OPEN_E_NONEif maximum size of domain name is returned.
OPEN_E_PARAMif invalid parameter is passed.
OPEN_E_UNAVAILif not supported for this platform.

OpEN API Version: 1.1

Examples:
dns_example.c.
open_error_t openapiDNSIpNameServerAdd ( openapiClientHandle_t client_handle,
open_inet_addr_t ipAddr 
)

Add DNS IP name server.

Parameters
[in]client_handleClient handle from registration API
[in]ipAddrIPv4/IPv6 address of name server
Return values
OPEN_E_NONEif name server is added successfully.
OPEN_E_FAILif invalid IP address.
OPEN_E_FULLif maximum number of name servers are reached.
OPEN_E_PARAMif invalid parameter is passed.
OPEN_E_UNAVAILif not supported for this platform.
Note
Calling this API will change the running configuration of the switch.
IP name servers added will be in precedence with the first added server having first preference.
IP address validation can be made via openapiInetAddrGet() as it validates the given IP and also converts it to network byte order.

OpEN API Version: 1.1

Examples:
dns_example.c.
open_error_t openapiDNSIpNameServerDelete ( openapiClientHandle_t client_handle,
open_inet_addr_t ipAddr 
)

Delete DNS IP name server.

Parameters
[in]client_handleClient handle from registration API
[in]ipAddrIPv4/IPv6 address of name server
Return values
OPEN_E_NONEif name server is deleted successfully.
OPEN_E_FAILif IP address is not found.
OPEN_E_PARAMif invalid parameter is passed.
OPEN_E_UNAVAILif not supported for this platform.
Note
Calling this API will change the running configuration of the switch.
To delete all the servers at a time pass empty ipAddr structure.
IP address validation can be made via openapiInetAddrGet() as it validates the given IP and also converts it to network byte order.

OpEN API Version: 1.1

Examples:
dns_example.c.
open_error_t openapiDNSIpNameServersMaxSupportedGet ( openapiClientHandle_t client_handle,
uint32_t *  maxNameServers 
)

Get the maximum number of DNS name servers supported.

Parameters
[in]client_handleClient handle from registration API
[out]maxNameServersMaximum number of name servers supported
Return values
OPEN_E_NONEif maximum number supported is returned.
OPEN_E_PARAMif invalid parameter is passed.
OPEN_E_UNAVAILif not supported for this platform.

OpEN API Version: 1.1

Examples:
dns_example.c.
open_error_t openapiDNSIpNameServersNextGet ( openapiClientHandle_t client_handle,
open_inet_addr_t ipAddr 
)

Get next name server.

Parameters
[in]client_handleClient handle from registration API
[in,out]ipAddrIPv4/IPv6 address of name server
Return values
OPEN_E_NONEif name server is returned.
OPEN_E_FAILif no more name severs are found.
OPEN_E_PARAMif invalid parameter is passed.
OPEN_E_UNAVAILif not supported for this platform.

OpEN API Version: 1.1

Examples:
dns_example.c.
open_error_t openapiDNSStaticHostAddressMappingRemove ( openapiClientHandle_t client_handle,
open_buffdesc hostname 
)

Remove static hostname to address mapping.

Parameters
[in]client_handleClient handle from registration API
[in]hostnameDNS hostname
Return values
OPEN_E_NONEif hostname to IP address mapping id removed.
OPEN_E_NOT_FOUNDif host name is not found.
OPEN_E_FAILif invalid hostname is passed.
OPEN_E_PARAMif invalid parameter is passed.
OPEN_E_INTERNALif internal error has occurred.
OPEN_E_UNAVAILif not supported for this platform.
Note
Maximum size for defaultDomainName is determined by calling openapiDNSDomainNameMaxSizeGet().
A valid hostname
(i) Must not contain spaces/dot at the end and beginning.
(ii) Each substring separated by dot must not exceed 63 characters and overall length must not exceed 255 chars.
(iii) Each substring must start with an alphanumeric character.
(iv) Must not contain subsequent dots.

OpEN API Version: 1.1

Examples:
dns_example.c.
open_error_t openapiDNSStaticHostAddressMappingSet ( openapiClientHandle_t client_handle,
open_buffdesc hostname,
open_inet_addr_t ipAddr 
)

Set the static hostname to IP address mapping.

Parameters
[in]client_handleClient handle from registration API
[in]hostnameDNS hostname
[in]ipAddrIP address mapped to the hostname
Return values
OPEN_E_NONEif hostname to IP address mapping is successful.
OPEN_E_FAILif invalid hostname is passed.
OPEN_E_FULLif no more space to add entries.
OPEN_E_PARAMif invalid parameter is passed.
OPEN_E_INTERNALif internal error has occurred.
OPEN_E_UNAVAILif not supported for this platform.
Note
Maximum size for defaultDomainName is determined by calling openapiDNSDomainNameMaxSizeGet().
A valid domain name;
(i) Must not contain spaces/dots at the end and beginning.
(ii) Each substring separated by dot must not exceed characters as returned by openapiDNSDomainLabelMaximumSizeGet() and overall length must not exceed maximum characters as returned by openapiDNSDomainNameMaxSizeGet().
(iii) Each substring must start with an alphanumeric character.
(iv) Must not contain subsequent dots.
IP address validation can be made via openapiInetAddrGet() as it validates the given IP and also converts it to network byte order.

OpEN API Version: 1.1

Examples:
dns_example.c.
open_error_t openapiDNSStaticHostIpAddrGet ( openapiClientHandle_t client_handle,
open_buffdesc hostname,
open_inet_addr_t ipAddr 
)

Get the IP address associated with the static host name.

Parameters
[in]client_handleClient handle from registration API
[in]hostnameDNS hostname
[out]ipAddrIP address associated with the static hostname
Return values
OPEN_E_NONEif the IP address associated with the static hostname is returned.
OPEN_E_FAILif host name does not exist.
OPEN_E_PARAMif invalid parameter is passed.
OPEN_E_UNAVAILif not supported for this platform.
Note
Maximum size for defaultDomainName is determined by calling openapiDNSDomainNameMaxSizeGet().

OpEN API Version: 1.1

Examples:
dns_example.c.
open_error_t openapiDNSStaticHostNextGet ( openapiClientHandle_t client_handle,
open_buffdesc hostname 
)

Get next static hostname.

Parameters
[in]client_handleClient handle from registration API
[in,out]hostnameDNS hostname
Return values
OPEN_E_NONEif next static entry is returned successfully.
OPEN_E_FAILif no more entries are found.
OPEN_E_PARAMif invalid parameter is passed.
OPEN_E_UNAVAILif not supported for this platform.
Note
Maximum size for defaultDomainName is determined by calling openapiDNSDomainNameMaxSizeGet().
Pass hostname as empty string to get the first entry.

OpEN API Version: 1.1

Examples:
dns_example.c.
open_error_t openapiInetAddrMaxSizeGet ( openapiClientHandle_t client_handle,
uint32_t *  inetAddrMaxSize 
)

Get the maximum size of inet address length.

Parameters
[in]client_handleClient handle from registration API
[out]inetAddrMaxSizeInet address maximum length
Return values
OPEN_E_NONEif maximum size of inet address is returned.
OPEN_E_PARAMif invalid parameter is passed.
OPEN_E_UNAVAILif not supported for this platform.

OpEN API Version: 1.1