Watt-32 tcp/ip  2.2 dev-rel.10
get_xby.h
Go to the documentation of this file.
1 
3 #ifndef _w32_GET_X_BY_Y_H
4 #define _w32_GET_X_BY_Y_H
5 
6 #ifndef _REENTRANT
7 #define _REENTRANT /* pull in the *_r() prototypes */
8 #endif
9 
10 #ifndef __NETDB_H
11 #include <netdb.h>
12 #endif
13 
14 #define MAX_SERV_ALIASES 5
15 #define MAX_HOST_ALIASES 5
16 #define MAX_NETENT_ALIASES 5
17 #define MAX_PROTO_ALIASES 0
18 #define MAX_CACHE_LIFE (15*60)
19 
20 #define ReadHostsFile W32_NAMESPACE (ReadHostsFile)
21 #define GetHostsFile W32_NAMESPACE (GetHostsFile)
22 #define CloseHostFile W32_NAMESPACE (CloseHostFile)
23 
24 #define ReadHosts6File W32_NAMESPACE (ReadHosts6File)
25 #define CloseHost6File W32_NAMESPACE (CloseHost6File)
26 #define GetHosts6File W32_NAMESPACE (GetHosts6File)
27 
28 #define ReadServFile W32_NAMESPACE (ReadServFile)
29 #define GetServFile W32_NAMESPACE (GetServFile)
30 #define CloseServFile W32_NAMESPACE (CloseServFile)
31 
32 #define ReadProtoFile W32_NAMESPACE (ReadProtoFile)
33 #define GetProtoFile W32_NAMESPACE (GetProtoFile)
34 #define CloseProtoFile W32_NAMESPACE (CloseProtoFile)
35 
36 #define ReadNetworksFile W32_NAMESPACE (ReadNetworksFile)
37 #define CloseNetworksFile W32_NAMESPACE (CloseNetworksFile)
38 #define GetNetFile W32_NAMESPACE (GetNetFile)
39 
40 #define InitEthersFile W32_NAMESPACE (InitEthersFile)
41 #define ReadEthersFile W32_NAMESPACE (ReadEthersFile)
42 #define GetEthersFile W32_NAMESPACE (GetEthersFile)
43 #define GetEtherName W32_NAMESPACE (GetEtherName)
44 #define NumEtherEntries W32_NAMESPACE (NumEtherEntries)
45 
46 #define DumpHostsCache W32_NAMESPACE (DumpHostsCache)
47 #define DumpHosts6Cache W32_NAMESPACE (DumpHosts6Cache)
48 #define DumpEthersCache W32_NAMESPACE (DumpEthersCache)
49 
53 struct _hostent {
54  char *h_name; /* official name of host */
55  char *h_aliases[MAX_HOST_ALIASES+1]; /* hostname alias list */
56  int h_num_addr; /* how many real addr below */
57  DWORD h_address[MAX_ADDRESSES+1]; /* addresses (network order) */
58  DWORD h_real_ttl; /* TTL from udp_dom.c */
59  time_t h_timeout; /* cached entry expiry time */
60  struct _hostent *h_next; /* next entry (or NULL) */
61 };
62 
66 struct _hostent6 {
67  char *h_name; /* official name of host */
68  char *h_aliases[MAX_HOST_ALIASES+1]; /* hostname alias list */
69  int h_num_addr; /* how many real addr below */
70  ip6_address h_address[MAX_ADDRESSES+1]; /* addresses */
71  DWORD h_real_ttl; /* TTL from udp_dom.c */
72  time_t h_timeout; /* cached entry expiry time */
73  struct _hostent6 *h_next;
74 };
75 
79 struct _netent {
80  char *n_name; /* official name of net */
81  char *n_aliases [MAX_NETENT_ALIASES+1]; /* alias list */
82  int n_addrtype; /* net address type */
83  DWORD n_net; /* network (host order) */
84  struct _netent *n_next;
85 };
86 
90 struct _protoent {
91  char *p_name;
92  char *p_aliases [MAX_PROTO_ALIASES+1];
93  int p_proto;
94  struct _protoent *p_next;
95 };
96 
100 struct _servent {
101  char *s_name;
102  char *s_aliases [MAX_SERV_ALIASES+1];
103  int s_port;
104  char *s_proto;
105  struct _servent *s_next;
106 };
107 
108 extern BOOL called_from_getai;
109 extern unsigned netdbCacheLife;
110 
111 /* These are not in any ./inc headers (<netdb.h> etc.). We export
112  * them anyway since they could come in handy. Now, only ./bin/tcpinfo.c
113  * uses some of them.
114  */
115 
116 W32_FUNC void W32_CALL ReadHostsFile (const char *fname); /* gethost.c */
117 W32_FUNC void W32_CALL ReadServFile (const char *fname); /* getserv.c */
118 W32_FUNC void W32_CALL ReadProtoFile (const char *fname); /* getprot.c */
119 W32_FUNC void W32_CALL ReadNetworksFile (const char *fname); /* getnet.c */
120 W32_FUNC void W32_CALL ReadEthersFile (void); /* geteth.c */
121 W32_FUNC int W32_CALL NumEtherEntries (void); /* geteth.c */
122 W32_FUNC void W32_CALL InitEthersFile (const char *fname); /* geteth.c */
123 
124 W32_FUNC void W32_CALL CloseHostFile (void);
125 W32_FUNC void W32_CALL CloseServFile (void);
126 W32_FUNC void W32_CALL CloseProtoFile (void);
127 W32_FUNC void W32_CALL CloseNetworksFile(void);
128 
129 W32_FUNC const char *W32_CALL GetHostsFile (void);
130 W32_FUNC const char *W32_CALL GetServFile (void);
131 W32_FUNC const char *W32_CALL GetProtoFile (void);
132 W32_FUNC const char *W32_CALL GetNetFile (void);
133 W32_FUNC const char *W32_CALL GetEthersFile(void);
134 W32_FUNC const char *W32_CALL GetEtherName (const eth_address *eth);
135 
136 W32_FUNC void W32_CALL DumpHostsCache (void);
137 W32_FUNC void W32_CALL DumpEthersCache (void);
138 
139 #if defined(USE_BSD_API) && defined(USE_IPV6) /* gethost6.c */
140  W32_FUNC void W32_CALL ReadHosts6File (const char *fname);
141  W32_FUNC void W32_CALL CloseHost6File (void);
142  W32_FUNC void W32_CALL DumpHosts6Cache (void);
143  W32_FUNC const char *W32_CALL GetHosts6File (void);
144 #endif
145 
146 #endif
W32_FUNC const char *W32_CALL GetHostsFile(void)
Return name of hosts-file.
Definition: gethost.c:187
W32_FUNC void W32_CALL CloseHostFile(void)
Close hosts-file.
Definition: gethost.c:197
W32_FUNC void W32_CALL ReadEthersFile(void)
Read the /etc/ethers file.
Definition: geteth.c:104