![]() |
WE310F5
39.00.000
|
This section describes the M2MB APIs to perform various Domain Name System (DNS) client operations. More...
enum | M2MB_DNS_SERVER_ID { M2MB_DNS_SERVER_PRIMARY, M2MB_DNS_SERVER_SECONDARY, M2MB_DNS_SERVER_MAX_SUPPORTED } |
MACROs used to signify the server IDs for SET/GET DNS server details. More... | |
enum | M2MB_DNSC_CONF_ID { M2MB_DNSC_CONF_INVALID = 0, M2MB_DNSC_CONF_SET_SRV_ADD = 1, M2MB_DNSC_CONF_SET_SRV_DEL = 2, M2MB_DNSC_CONF_GET_IS_STARTED = 3, M2MB_DNSC_CONF_GET_SERVER_LIST = 4 } |
DNS client GET/SET Configuration enumeration. More... | |
typedef enum M2MB_DNS_SERVER_ID | M2MB_DNS_SERVER_ID_E |
MACROs used to signify the server IDs for SET/GET DNS server details. More... | |
typedef enum M2MB_DNSC_CONF_ID | M2MB_DNSC_CONF_ID_E |
DNS client GET/SET Configuration enumeration. More... | |
typedef struct M2MB_HOST_NAME_TO_IP | M2MB_HOST_NAME_TO_IP_T |
Structure to get IP address from host name. More... | |
typedef struct M2MB_DNSC_SRV_ADD_INFO | M2MB_DNSC_SRV_ADD_INFO_T |
Structure is used by the Configuration ID M2MB_DNSC_CONF_SET_SRV_ADD to configure the given dns server information. More... | |
typedef struct M2MB_HOST_NAME_TO_IP_INFO | M2MB_HOST_NAME_TO_IP_INFO_T |
Structure is used by the CONF IDs M2MB_DNSC_CONF_GET_HOST_BY_NAME and M2MB_DNSC_CONF_GET_HOST_BY_NAME2 to get IP address from host name. More... | |
M2MB_STATUS_T | m2mb_dns_client_init (HANDLE *handle) |
Initialize DNS client. More... | |
M2MB_STATUS_T | m2mb_dns_client_set_cfg (HANDLE handle, M2MB_DNSC_CONF_ID_E conf_id, M2MB_DNSC_CONF_PARAMS_T *conf_params) |
SET the dns client configuration parameters. More... | |
M2MB_STATUS_T | m2mb_dns_client_get_cfg (HANDLE handle, M2MB_DNSC_CONF_ID_E conf_id, M2MB_DNSC_CONF_PARAMS_T *conf_params) |
GET the dns client configuration parameters. More... | |
M2MB_HOST_NAME_TO_IP_T * | m2mb_dns_client_get_host_by_name (UINT8 *name) |
Get IP address of host name. More... | |
M2MB_HOST_NAME_TO_IP_T * | m2mb_dns_client_get_host_by_name2 (UINT8 *name, INT32 af) |
Get the IP address from the host name of the server. More... | |
M2MB_STATUS_T | m2mb_dns_client_resolve_host (UINT8 *hostname, M2MB_IP46_ADDR_T *ipaddr) |
Resolve the URL details. More... | |
M2MB_STATUS_T | m2mb_dns_client_deinit (HANDLE handle) |
De-initialize DNS client module. More... | |
This section describes the M2MB APIs to perform various Domain Name System (DNS) client operations.
typedef enum M2MB_DNS_SERVER_ID M2MB_DNS_SERVER_ID_E |
MACROs used to signify the server IDs for SET/GET DNS server details.
typedef enum M2MB_DNSC_CONF_ID M2MB_DNSC_CONF_ID_E |
DNS client GET/SET Configuration enumeration.
This enum defines macros for various GET/SET Configuration for DNS client.
typedef struct M2MB_DNSC_SRV_ADD_INFO M2MB_DNSC_SRV_ADD_INFO_T |
Structure is used by the Configuration ID M2MB_DNSC_CONF_SET_SRV_ADD to configure the given dns server information.
Structure is used by the Configuration ID M2MB_DNSC_CONF_SET_SRV_ADD to configure the given dns server ip address at the server id.
typedef struct M2MB_HOST_NAME_TO_IP_INFO M2MB_HOST_NAME_TO_IP_INFO_T |
Structure is used by the CONF IDs M2MB_DNSC_CONF_GET_HOST_BY_NAME and M2MB_DNSC_CONF_GET_HOST_BY_NAME2 to get IP address from host name.
M2MB_HOST_NAME_TO_IP_T is the same as the UNIX struct hostent{}.
typedef struct M2MB_HOST_NAME_TO_IP M2MB_HOST_NAME_TO_IP_T |
Structure to get IP address from host name.
This data structure is used to get the IP address of a given host name.
This is the same as the UNIX struct hostent{}.
enum M2MB_DNS_SERVER_ID |
MACROs used to signify the server IDs for SET/GET DNS server details.
Enumerator | |
---|---|
M2MB_DNS_SERVER_PRIMARY | MACRO to set primary server details |
M2MB_DNS_SERVER_SECONDARY | MACRO to set secondary server details |
M2MB_DNS_SERVER_MAX_SUPPORTED |
Definition at line 65 of file m2mb_dns_client.h.
enum M2MB_DNSC_CONF_ID |
DNS client GET/SET Configuration enumeration.
This enum defines macros for various GET/SET Configuration for DNS client.
Definition at line 80 of file m2mb_dns_client.h.
M2MB_STATUS_T m2mb_dns_client_deinit | ( | HANDLE | handle | ) |
De-initialize DNS client module.
This API de-initializes the DNS client module.
[in] | handle | Specifies the context handle initialized by m2mb_dns_init API. |
m2mb_dns_client_deinit( handle );
M2MB_STATUS_T m2mb_dns_client_get_cfg | ( | HANDLE | handle, |
M2MB_DNSC_CONF_ID_E | conf_id, | ||
M2MB_DNSC_CONF_PARAMS_T * | conf_params | ||
) |
GET the dns client configuration parameters.
This API is called to GET the configuration of the dns client based on the conf IDs.
[in] | handle | Specifies the context handle initialized by m2mb_dns_init API. |
[in] | conf_id | GET configuration ID from enum M2MB_DNSC_CONF_ID_E. |
[in] | conf_params | configuration params to be passed according to the configuration required. |
M2MB_HOST_NAME_TO_IP_T* m2mb_dns_client_get_host_by_name | ( | UINT8 * | name | ) |
Get IP address of host name.
This API initiates DNS resolution to get the IP address from the given host name.
Implements a standard Unix version of gethostbyname().
The returned structure should not be freed by the caller.
[in] | name | Either a hostname or an IPv4 address in standard dot notation. |
Example
M2MB_HOST_NAME_TO_IP_T* m2mb_dns_client_get_host_by_name2 | ( | UINT8 * | name, |
INT32 | af | ||
) |
Get the IP address from the host name of the server.
m2mb_dns_client_get_host_by_name2 initiates DNS resolution to get the IP address from the given host name.
Implements a standard Unix version of gethostbyname2().
The returned M2MB_HOST_NAME_TO_IP_T structure is not thread safe. It can be freed by internal DNS client routines if the entry ages out or if the table becomes full and space is needed for another entry.
[in] | name | Either a hostname or an IPv4 address in standard dot notation. |
[in] | af | Address family; either M2MB_SOCKET_BSD_AF_INET or M2MB_SOCKET_BSD_AF_INET6. |
Example
M2MB_STATUS_T m2mb_dns_client_init | ( | HANDLE * | handle | ) |
Initialize DNS client.
This API initializes the DNS client module.
[in] | handle | Specifies the pointer to the context handle that can be used by other dns client APIs. |
m2mb_dns_client_init( &handle );
M2MB_STATUS_T m2mb_dns_client_resolve_host | ( | UINT8 * | hostname, |
M2MB_IP46_ADDR_T * | ipaddr | ||
) |
Resolve the URL details.
This API resolves the URL details.
[in] | hostname | URL mentioned in a string format. |
[out] | ipaddr | Pointer to the URL's IP address structure (M2MB_IP46_ADDR_T *). |
Example
M2MB_STATUS_T m2mb_dns_client_set_cfg | ( | HANDLE | handle, |
M2MB_DNSC_CONF_ID_E | conf_id, | ||
M2MB_DNSC_CONF_PARAMS_T * | conf_params | ||
) |
SET the dns client configuration parameters.
This API is called to configure the dns client based on the conf IDs.
[in] | handle | Specifies the context handle initialized by m2mb_dns_init API. |
[in] | conf_id | SET configuration ID from enum M2MB_DNSC_CONF_ID_E. |
[in] | conf_params | configuration params to be passed according to the configuration to be done. To add the server, use conf ID M2MB_DNSC_CONF_SET_SRV_ADD with the server name and server ID with M2MB_DNSC_SRV_ADD_INFO_T *srv_info in the M2MB_DNSC_CONF_PARAMS_T. To delete the server, use conf ID M2MB_DNSC_CONF_SET_SRV_DEL and with the information of serverID in the M2MB_DNSC_CONF_PARAMS_T. |