API Reference


Brew Release
Brew MP 1.0.2
See Also
IAddrInfoCache AddrInfo error codes
This interface provides host name resolving functionality, allowing the retrieving of IP addresses associated with a specified host name.
This interface attempts to follow the spirit of RFC 3493 section 6.1 "Protocol-Independent Nodename and Service Name Translation".
The main exception is that instead of getaddrinfo() and freeaddrinfo() APIs IAddrInfo encapsulates a single resolve transaction and thus exposes a somewhat different API. getaddrinfo() approximately corresponds to calling IAddrInfo_StartQuery(), IAddrInfo_GetResult() and IAddrInfo_GetResultAddr(). freeaddrinfo() corresponds to releasing the IAddrInfo instance with IAddrInfo_Release.
Another difference is in error values: There are no EAI_NONAME and EAI_AGAIN errors. Errors AEE_NET_EAI_BADREQUEST, AEE_NET_UNKDOMAIN, AEE_NET_BADDOMAIN and AEE_NET_BADRESPONSE are roughly equivalent to EAI_NONAME. AEE_NET_ETIMEDOUT is roughly equivalent to EGAI_AGAIN. See AddrInfo error codes.
There is also a difference in the addrinfo structure. Please see AEEAddrInfo documentation.
IAddrInfo_StartQuery() is used for setting the address information data for the resolving query and for starting the resolving transaction. An AEECallback is used to inform the client when the transaction has completed.
IAddrInfo_GetResult() is used for retrieving the transaction results, and IAddrInfo_GetResultAddr() is used to retrieve a specific address in the case of a successful transaction.
An IAddrInfo instance only supports a single transaction. This means that after transaction start or end, the instance cannot be used to start a new transaction. For each transaction a different IAddrInfo instance is required.
After creating an IAddrInfo instance, the user should call IAddrInfo_SelectNetwork() to select the data network (unless the default network is to be used) to work with. See the documentation of IAddrInfo_SelectNetwork() for additional information regarding network selection.
Initiating a query:
CALLBACK_Init(&pMe->cb, addrInfoResultPfn, pMe); nErr = IAddrInfo_StartQuery(pMe->pIAddrInfo, "", NULL, NULL, &pMe->cb); if (AEE_SUCCESS != nErr) { ... }
Retrieving query results in addrInfoResultPfn:
nErr = IAddrInfo_GetResult(pMe->pIAddrInfo, &queryStatus, &numberOfAddresses, &maxAddrInfoSizeInBytes); if (AEE_SUCCESS != nErr) { ... } if (AEE_SUCCESS != queryStatus) { ... } IEnv_ErrMalloc(piEnv, maxAddrInfoSizeInBytes, (void**)(&pAddr)); if (!pAddr) { ... }
// retrieve the first address (index 0) nErr = IAddrInfo_GetResultAddr(pMe->pIAddrInfo, 0, pAddr, &maxAddrInfoSizeInBytes); if (AEE_SUCCESS != nErr) { ... }
The following header file is required:
BREW 4.0 - AEEIAddrInfo.h
BREW 3.1 - AEEAddrInfo.h
  • Follow