summaryrefslogtreecommitdiffstats
path: root/contrib/query-loc-0.4.0/loc.h
blob: c9b74db594a91704d9fe3ba118c7d63b6ad49f4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* $Id: loc.h,v 1.1 2008/02/15 01:47:15 marka Exp $ */

#define VERSION "0.4.0"

#include "config.h"

/* Probably too many inclusions but this is to keep 'gcc -Wall' happy... */
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/time.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
#include <arpa/nameser.h>
#include <resolv.h>

#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif

#if SIZEOF_LONG == 4
#define u_int32_t unsigned long
#ifndef int32_t 
#define int32_t   long
#endif
#else
#define u_int32_t unsigned int
#ifndef int32_t 
#define int32_t   int
#endif
#endif

#if SIZEOF_CHAR == 1
#define u_int8_t unsigned char
#ifndef int8_t 
#define int8_t   char
#endif
#else 
#if SIZEOF_SHORT == 1
#define u_int8_t unsigned short
#ifndef int8_t 
#define int8_t   short
#endif
#else
#error "No suitable native type for storing bytes"
#endif
#endif

#ifndef INADDR_NONE
#define INADDR_NONE (in_addr_t)-1
#endif

struct list_in_addr
  {
    struct in_addr addr;
    void *next;
  };

void usage ();
void panic ();

char *getlocbyname ();
char *getlocbyaddr ();
char *getlocbynet ();
char *findRR ();
struct list_in_addr *findA ();

extern char *progname;
extern short debug;