/*

                                   _JNJ`                        
                               .JNMH`                           
                              JMMF`       `;.                   
                            .NMM)          `MN.                 
                            MMM)            (MML                
                           (MMM`             MMML               
                     M  I  D  N  I  G  H  T    C  o  D  E       
                           (NMMF             MHNH               
                            NMML            .MMM                
                             NMML          .NMH                 
                              4MMNL       .#F                   
                               `4HNNL_   `                      
                                   `"""`                        

                          Copyright (C) 2004-2006
       "Ian (Larry) Latter" <ian dot latter at midnightcode dot org>

    Midnight Code is a registered trademark of Ian Latter.

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, and mirrored at the Midnight Code web
    site; as at version 2 of the License only.
  
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    General Public License for more details.
  
    You should have received a copy of the GNU General Public License
    (version 2) along with this program; if not, write to the Free
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA, or see http://midnightcode.org/gplv2.txt

*/


/* midnightcode-resolve.h :: Midnight Code network resolve library	*/


#ifndef __MIDNIGHTCODE_RESOLVE_H
#define __MIDNIGHTCODE_RESOLVE_H 1


#define MIDNIGHTCODE_RESOLVE_STRUCTURE "resolver"
#define MIDNIGHTCODE_RESOLVE_CONF_TIMEOUT 2
#define MIDNIGHTCODE_RESOLVE_CONF_ATTEMPTS 2

struct midnightcode_resolve_element_t
{
  int when;
  char name[256];
  char name_host[256];
  char name_domain[256];
  struct in_addr ipv4_address;
  char ipv4_address_s[32];
  midnightcode_list_entry(midnightcode_resolve_element_t)
};

midnightcode_list_head(midnightcode_resolve_head_t,
                       midnightcode_resolve_element_t)

struct midnightcode_resolve_server_element_t
{
  struct in_addr ipv4_address;
  char ipv4_address_s[32];
  midnightcode_list_entry(midnightcode_resolve_server_element_t)
};

midnightcode_list_head(midnightcode_resolve_server_head_t,
                       midnightcode_resolve_server_element_t)

struct midnightcode_resolve_domain_element_t
{
  char name[256];
  int type;
  midnightcode_list_entry(midnightcode_resolve_domain_element_t)
};

midnightcode_list_head(midnightcode_resolve_domain_head_t,
                       midnightcode_resolve_domain_element_t)

enum midnightcode_resolve_domain_t
{
  MIDNIGHTCODE_RESOLVE_DOMAIN_UNKNOWN = 0,
  MIDNIGHTCODE_RESOLVE_DOMAIN_SEARCH = 1,
  MIDNIGHTCODE_RESOLVE_DOMAIN_WITHIN = 2,
};

enum midnightcode_resolve_test_t
{
  MIDNIGHTCODE_RESOLVE_TEST_DEFAULT = 0,
  MIDNIGHTCODE_RESOLVE_TEST_PRIVATE = 1,
  MIDNIGHTCODE_RESOLVE_TEST_PUBLIC = 2,
  MIDNIGHTCODE_RESOLVE_TEST_REVERSE = 4
};

int midnightcode_resolve_check(int options);
int midnightcode_resolve_writeconf(char * resolve_file,
                     struct midnightcode_resolve_domain_head_t * domains,
                     struct midnightcode_resolve_server_head_t * servers);
int midnightcode_resolve_to_config(
                     struct midnightcode_resolve_domain_head_t * domains,
                     struct midnightcode_resolve_server_head_t * servers,
                     struct midnightcode_config_head_t * config_elements);
int midnightcode_resolve_from_config(
                     struct midnightcode_resolve_domain_head_t * domains,
                     struct midnightcode_resolve_server_head_t * servers,
                     struct midnightcode_config_head_t * config_elements);



#endif
