text: /** @file
  
    A brief file description
  
    @section license License
  
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
  
        http://www.apache.org/licenses/LICENSE-2.0
  
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
  
   */
  
  #if !defined (_ink_inet_h_)
  #define _ink_inet_h_
  
  #include "ink_platform.h"
  #include "ink_port.h"
  #include "ink_apidefs.h"
  
  #define INK_GETHOSTBYNAME_R_DATA_SIZE 1024
  #define INK_GETHOSTBYADDR_R_DATA_SIZE 1024
  
  struct ink_gethostbyname_r_data
  {
    int herrno;
    struct hostent ent;
    char buf[INK_GETHOSTBYNAME_R_DATA_SIZE];
  };
  
  struct ink_gethostbyaddr_r_data
  {
    int herrno;
    struct hostent ent;
    char buf[INK_GETHOSTBYADDR_R_DATA_SIZE];
  };
  
  /**
    returns the IP address of the hostname. If the hostname has
    multiple IP addresses, the first IP address in the list returned
    by 'gethostbyname' is returned.
  
    @note Not thread-safe
  
  */
  unsigned int host_to_ip(char *hostname);
  
  /**
    Wrapper for gethostbyname_r(). If successful, returns a pointer
    to the hostent structure. Returns NULL and sets data->herrno to
    the appropriate error code on failure.
  
    @param hostname null-terminated host name string
    @param data pointer to ink_gethostbyname_r_data allocated by the caller
  
  */
  struct hostent *ink_gethostbyname_r(char *hostname, ink_gethostbyname_r_data * data);
  
  /**
    Wrapper for gethostbyaddr_r(). If successful, returns a pointer
    to the hostent structure. Returns NULL and sets data->herrno to
    the appropriate error code on failure.
  
    @param ip IP address of the host
    @param len length of the buffer indicated by ip
    @param type family of the address
    @param data pointer to ink_gethostbyname_r_data allocated by the caller
  
  */
  struct hostent *ink_gethostbyaddr_r(char *ip, int len, int type, ink_gethostbyaddr_r_data * data);
  
  /**
    Wrapper for inet_addr().
  
    @param s IP address in the Internet standard dot notation.
  
  */
  inkcoreapi inku32 ink_inet_addr(const char *s);
  
  #endif // _ink_inet.h
  