sdk/modules/lte/altcom/api/socket/altcom_getaddrinfo.c
/****************************************************************************
 * Name: altcom_getaddrinfo
 *
 * Description:
 *   Given node and service, which identify an Internet host and a service,
 *   altcom_getaddrinfo() returns one or more addrinfo structures, each of
 *   which contains an Internet address that can be specified in a call to
 *   altcom_bind() or altcom_connect(). The altcom_getaddrinfo() is reentrant
 *   and allows programs to eliminate IPv4-versus-IPv6 dependencies. 
 *
 * Parameters:
 *   nodename - Specifies either a numerical network address, or a network
 *              hostname, whose network addresses are looked up and resolved
 *   servname - Sets the port in each returned address structure
 *   hints - Points to an addrinfo structure that specifies criteria for
 *           selecting the socket address structures returned in the list
 *           pointed to by res
 *   res - Pointer to the start of the list
 *
 * Returned Value:
 *  altcom_getaddrinfo() returns 0 if it succeeds, or one of the following
 *  nonzero error codes:
 *
 *     ALTCOM_EAI_NONAME
 *     ALTCOM_EAI_SERVICE
 *     ALTCOM_EAI_FAIL
 *     ALTCOM_EAI_MEMORY
 *     ALTCOM_EAI_FAMILY
 *
 ****************************************************************************/
altcom_getaddrinfo
Description:
Given node and service, which identify an Internet host and a service,
altcom_getaddrinfo() returns one or more addrinfo structures, each of
which contains an Internet address that can be specified in a call to
altcom_bind() or altcom_connect(). The altcom_getaddrinfo() is reentrant
and allows programs to eliminate IPv4-versus-IPv6 dependencies.

Specifies either a numerical network address, or a network
hostname, whose network addresses are looked up and resolved
servname - Sets the port in each returned address structure
hints - Points to an addrinfo structure that specifies criteria for
selecting the socket address structures returned in the list
pointed to by res
res - Pointer to the start of the list

Returned Value:
altcom_getaddrinfo() returns 0 if it succeeds, or one of the following
nonzero error codes.


altcom_getaddrinfo Description : Given node and service which identify an Internet host and a service altcom_getaddrinfo () returns one or more addrinfo structures each of which contains an Internet address that can be specified in a call to altcom_bind () or altcom_connect () . The altcom_getaddrinfo () is reentrant and allows programs to eliminate IPv4 - versus - IPv6 dependencies . Specifies either a numerical network address or a network hostname whose network addresses are looked up and resolved servname - Sets the port in each returned address structure hints - Points to an addrinfo structure that specifies criteria for selecting the socket address structures returned in the list pointed to by res res - Pointer to the start of the list Returned Value : altcom_getaddrinfo () returns 0 if it succeeds or one of the following nonzero error codes .
int altcom_getaddrinfo(const char *nodename, const char *servname,
                       const struct altcom_addrinfo *hints,
                       struct altcom_addrinfo **res)
{
  int32_t result;
  struct getaddrinfo_req_s req;
  if (!altcom_isinit())
    {
      DBGIF_LOG_ERROR("Not intialized\n");
      return ALTCOM_EAI_FAIL;
    }
  if (!nodename && !servname)
    {
      DBGIF_LOG_ERROR("Invalid parameter\n");
      return ALTCOM_EAI_NONAME;
    }
  *res = NULL;
  req.nodename = nodename;
  req.servname = servname;
  req.hints    = hints;
  req.res      = res;
  result = getaddrinfo_request(&req);
  if (APICMD_GETADDRINFO_RES_RET_CODE_OK != result)
    {
      return result;
    }
  return 0;
}
int altcom_getaddrinfo ( const char * nodename , const char * servname , const struct altcom_addrinfo * hints , struct altcom_addrinfo * * res ) { int32_t result ; struct getaddrinfo_req_s req ; if ( ! altcom_isinit ( ) ) { DBGIF_LOG_ERROR ( " \n " ) ; return ALTCOM_EAI_FAIL ; } if ( ! nodename && ! servname ) { DBGIF_LOG_ERROR ( " \n " ) ; return ALTCOM_EAI_NONAME ; } * res = NULL ; req . nodename = nodename ; req . servname = servname ; req . hints = hints ; req . res = res ; result = getaddrinfo_request ( & req ) ; if ( APICMD_GETADDRINFO_RES_RET_CODE_OK != result ) { return result ; } return 0 ; }
Name: altcom_getaddrinfo
 Description:
   Given node and service, which identify an Internet host and a service,
   altcom_getaddrinfo() returns one or more addrinfo structures, each of
   which contains an Internet address that can be specified in a call to
   altcom_bind() or altcom_connect().
Name : altcom_getaddrinfo Description : Given node and service which identify an Internet host and a service altcom_getaddrinfo () returns one or more addrinfo structures each of which contains an Internet address that can be specified in a call to altcom_bind () or altcom_connect () .