resolver.h
来自「AMLOGIC DPF source code」· C头文件 代码 · 共 92 行
H
92 行
/*******************************************************************
*
* Copyright C 2005 by Amlogic, Inc. All Rights Reserved.
*
* Description:
*
* Author: Amlogic Software
* Created: Fri Nov 11 00:51:49 2005
*
*******************************************************************/
/** @file
*/
#ifndef __LWIP_RESOLVER_H__
#define __LWIP_RESOLVER_H__
#include "lwip/opt.h"
#include "lwip/netif.h"
#include "lwip/udp.h"
/*
_define()
*/
/** DNS resolver return status */
#define RES_SUCCESS 0 /* DNS done */
/** DNS resolver return status */
#define RES_TIMEOUT 1 /* DNS failed due to timeout. */
/** DNS resolver return status */
#define RES_FAILED 3 /* Bad Domain Name. */
/** DNS resolver return status */
#define RES_FAMILY_ERR 4 /* unknown family type. */
/** DNS resolver return status */
#define RES_NAME_ERR 5 /* wrong domain name. */
/** DNS resolver return status */
#define RES_BUFF_ERR 6 /* query buffer alloc error */
typedef struct _resolver_s RESOLVER;
/**
* Set the IP address for the DNS server.
* @param addr DNS Server address
*/
void
dns_set_server(struct in_addr *primary, struct in_addr *secondary);
/**
* Get the IP address for the DNS server.
*/
void
dns_get_server(struct in_addr *primary, struct in_addr *secondary);
/**
* Clear the IP address for the DNS server.
*/
void
dns_clear_server(void);
/**
* callback function, return domain address in hostent structure pointer,
* be sure call res_free(res) at the end of callback function to free memory.
*
* @param arg User context used in callbacks.
* @param status DNS resolver return status.
* @param host_result A pointer to a hostent structure
* @param res A pointer to a RESOLVER structure.
*
* @see gethostbyname_a(const char *name, int af, RES_CALLBACK callback, void *arg)
* @see res_free(void *res)
*/
typedef void (*RES_CALLBACK)(void *arg, int status, struct hostent *host_result, void *res);
/** DNS server address */
extern struct ip_addr res_DNS_addr;
/*
_function()
*/
/** Synchronous function, return domain address in hostent structure pointer*/
struct hostent *gethostbyname (const char *name);
/** Asynchronous function, return domain address in callback function */
RESOLVER *gethostbyname_a(const char *name, int af, RES_CALLBACK callback, void *arg);
/** remove RESOLVER descriptor. Calling this function invalidates
* any hostents returned. */
void res_free(void *res);
/** Create a hostent independent of a resolver context including
* deep copies of the host name and the alias strings. */
extern struct hostent *
hostent_duplicate(struct hostent *hp);
#endif /*__LWIP_RESOLVER_H__*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?