*** empty log message ***
[bpt/guile.git] / libguile / net_db.c
CommitLineData
370312ae 1/* "net_db.c" network database support
2eca09c5 2 * Copyright (C) 1995-2000 Free Software Foundation, Inc.
370312ae
GH
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this software; see the file COPYING. If not, write to
82892bed
JB
16 * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
17 * Boston, MA 02111-1307 USA
370312ae
GH
18 *
19 * As a special exception, the Free Software Foundation gives permission
20 * for additional uses of the text contained in its release of GUILE.
21 *
22 * The exception is that, if you link the GUILE library with other files
23 * to produce an executable, this does not by itself cause the
24 * resulting executable to be covered by the GNU General Public License.
25 * Your use of that executable is in no way restricted on account of
26 * linking the GUILE library code into it.
27 *
28 * This exception does not however invalidate any other reasons why
29 * the executable file might be covered by the GNU General Public License.
30 *
31 * This exception applies only to the code released by the
32 * Free Software Foundation under the name GUILE. If you copy
33 * code from other Free Software Foundation releases into a copy of
34 * GUILE, as the General Public License permits, the exception does
35 * not apply to the code that you add in this way. To avoid misleading
36 * anyone as to the status of such modified files, you must delete
37 * this exception notice from them.
38 *
39 * If you write modifications of your own for GUILE, it is your choice
40 * whether to permit this exception to apply to your modifications.
82892bed 41 * If you do not wish that, delete this exception notice. */
370312ae 42
1bbd0b84
GB
43/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
44 gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
45
46
370312ae
GH
47/* Written in 1994 by Aubrey Jaffer.
48 * Thanks to Hallvard.Tretteberg@si.sintef.no for inspiration and discussion.
49 * Rewritten by Gary Houston to be a closer interface to the C socket library.
50 * Split into net_db.c and socket.c.
51 */
52\f
53
54#include <stdio.h>
55#include "_scm.h"
56#include "feature.h"
57
1bbd0b84 58#include "scm_validate.h"
370312ae
GH
59#include "net_db.h"
60
61#ifdef HAVE_STRING_H
62#include <string.h>
63#endif
64
65#include <sys/types.h>
cae76441 66#include <sys/socket.h>
370312ae
GH
67#include <netdb.h>
68#include <netinet/in.h>
69#include <arpa/inet.h>
70
e6393a4a
JB
71/* Some systems do not declare this. Some systems do declare it, as a
72 macro. */
73#ifndef h_errno
7a98cdb9 74extern int h_errno;
e6393a4a 75#endif
7a98cdb9 76
370312ae
GH
77\f
78
79#ifndef STDC_HEADERS
80int close ();
81#endif /* STDC_HEADERS */
82
83extern int inet_aton ();
84
a1ec6916 85SCM_DEFINE (scm_inet_aton, "inet-aton", 1, 0, 0,
1bbd0b84 86 (SCM address),
4079f87e
GB
87"Converts a string containing an Internet host address in the traditional
88dotted decimal notation into an integer.
89
90@smalllisp
91(inet-aton "127.0.0.1") @result{} 2130706433
92
93@end smalllisp")
1bbd0b84 94#define FUNC_NAME s_scm_inet_aton
370312ae
GH
95{
96 struct in_addr soka;
97
3b3b36dd 98 SCM_VALIDATE_ROSTRING (1,address);
370312ae
GH
99 if (SCM_SUBSTRP (address))
100 address = scm_makfromstr (SCM_ROCHARS (address), SCM_ROLENGTH (address), 0);
101 if (inet_aton (SCM_ROCHARS (address), &soka) == 0)
1bbd0b84 102 SCM_MISC_ERROR ("bad address", SCM_EOL);
370312ae
GH
103 return scm_ulong2num (ntohl (soka.s_addr));
104}
1bbd0b84 105#undef FUNC_NAME
370312ae
GH
106
107
a1ec6916 108SCM_DEFINE (scm_inet_ntoa, "inet-ntoa", 1, 0, 0,
1bbd0b84 109 (SCM inetid),
4079f87e
GB
110"Converts an integer Internet host address into a string with the
111traditional dotted decimal representation.
112
113@smalllisp
114(inet-ntoa 2130706433) @result{} "127.0.0.1"
115@end smalllisp")
1bbd0b84 116#define FUNC_NAME s_scm_inet_ntoa
370312ae
GH
117{
118 struct in_addr addr;
119 char *s;
120 SCM answer;
1bbd0b84 121 addr.s_addr = htonl (SCM_NUM2ULONG (1,inetid));
370312ae
GH
122 s = inet_ntoa (addr);
123 answer = scm_makfromstr (s, strlen (s), 0);
370312ae
GH
124 return answer;
125}
1bbd0b84 126#undef FUNC_NAME
370312ae 127
0e958795 128#ifdef HAVE_INET_NETOF
a1ec6916 129SCM_DEFINE (scm_inet_netof, "inet-netof", 1, 0, 0,
1bbd0b84 130 (SCM address),
4079f87e
GB
131"Returns the network number part of the given integer Internet address.
132
133@smalllisp
134(inet-netof 2130706433) @result{} 127
135@end smalllisp")
1bbd0b84 136#define FUNC_NAME s_scm_inet_netof
370312ae
GH
137{
138 struct in_addr addr;
1bbd0b84 139 addr.s_addr = htonl (SCM_NUM2ULONG (1,address));
370312ae
GH
140 return scm_ulong2num ((unsigned long) inet_netof (addr));
141}
1bbd0b84 142#undef FUNC_NAME
0e958795 143#endif
370312ae 144
0e958795 145#ifdef HAVE_INET_LNAOF
a1ec6916 146SCM_DEFINE (scm_lnaof, "inet-lnaof", 1, 0, 0,
1bbd0b84 147 (SCM address),
4079f87e
GB
148"Returns the local-address-with-network part of the given Internet
149address.
150
151@smalllisp
152(inet-lnaof 2130706433) @result{} 1
153@end smalllisp")
1bbd0b84 154#define FUNC_NAME s_scm_lnaof
370312ae
GH
155{
156 struct in_addr addr;
1bbd0b84 157 addr.s_addr = htonl (SCM_NUM2ULONG (1,address));
370312ae
GH
158 return scm_ulong2num ((unsigned long) inet_lnaof (addr));
159}
1bbd0b84 160#undef FUNC_NAME
0e958795 161#endif
370312ae 162
0e958795 163#ifdef HAVE_INET_MAKEADDR
a1ec6916 164SCM_DEFINE (scm_inet_makeaddr, "inet-makeaddr", 2, 0, 0,
1bbd0b84 165 (SCM net, SCM lna),
4079f87e
GB
166"Makes an Internet host address by combining the network number @var{net}
167with the local-address-within-network number @var{lna}.
168
169@smalllisp
170(inet-makeaddr 127 1) @result{} 2130706433
171@end smalllisp")
1bbd0b84 172#define FUNC_NAME s_scm_inet_makeaddr
370312ae
GH
173{
174 struct in_addr addr;
175 unsigned long netnum;
176 unsigned long lnanum;
177
2eca09c5 178#if 0 /* GJB:FIXME:: */
3b3b36dd
GB
179 SCM_VALIDATE_INUM_COPY (1,net,netnum);
180 SCM_VALIDATE_INUM_COPY (2,lna,lnanum);
2cf37714
GB
181#else
182 netnum = SCM_NUM2ULONG (1, net);
183 lnanum = SCM_NUM2ULONG (2, lna);
184#endif
370312ae
GH
185 addr = inet_makeaddr (netnum, lnanum);
186 return scm_ulong2num (ntohl (addr.s_addr));
187}
1bbd0b84 188#undef FUNC_NAME
0e958795 189#endif
370312ae 190
5c11cc9d
GH
191SCM_SYMBOL (scm_host_not_found_key, "host-not-found");
192SCM_SYMBOL (scm_try_again_key, "try-again");
193SCM_SYMBOL (scm_no_recovery_key, "no-recovery");
194SCM_SYMBOL (scm_no_data_key, "no-data");
370312ae 195
5c11cc9d
GH
196static void scm_resolv_error (const char *subr, SCM bad_value)
197{
198 if (h_errno == NETDB_INTERNAL)
199 {
200 /* errno supposedly contains a useful value. */
201 scm_syserror (subr);
202 }
203 else
204 {
205 SCM key;
206 const char *errmsg;
207
208 switch (h_errno)
209 {
210 case HOST_NOT_FOUND:
211 key = scm_host_not_found_key;
212 errmsg = "Unknown host";
213 break;
214 case TRY_AGAIN:
215 key = scm_try_again_key;
216 errmsg = "Host name lookup failure";
217 break;
218 case NO_RECOVERY:
219 key = scm_no_recovery_key;
220 errmsg = "Unknown server error";
221 break;
222 case NO_DATA:
223 key = scm_no_data_key;
224 errmsg = "No address associated with name";
225 break;
226 default:
227 scm_misc_error (subr, "Unknown resolver error", SCM_EOL);
228 errmsg = NULL;
229 }
230
231#ifdef HAVE_HSTRERROR
232 errmsg = hstrerror (h_errno);
233#endif
234 scm_error (key, subr, errmsg, scm_cons (bad_value, SCM_EOL), SCM_EOL);
235 }
236}
237
238/* Should take an extra arg for address format (will be needed for IPv6).
239 Should use reentrant facilities if available.
370312ae
GH
240 */
241
a1ec6916 242SCM_DEFINE (scm_gethost, "gethost", 0, 1, 0,
1bbd0b84 243 (SCM name),
4079f87e
GB
244"@deffnx procedure gethostbyname hostname
245@deffnx procedure gethostbyaddr address
246Look up a host by name or address, returning a host object. The
247@code{gethost} procedure will accept either a string name or an integer
248address; if given no arguments, it behaves like @code{gethostent} (see
249below). If a name or address is supplied but the address can not be
250found, an error will be thrown to one of the keys:
251@code{host-not-found}, @code{try-again}, @code{no-recovery} or
252@code{no-data}, corresponding to the equivalent @code{h_error} values.
253Unusual conditions may result in errors thrown to the
254@code{system-error} or @code{misc_error} keys.")
1bbd0b84 255#define FUNC_NAME s_scm_gethost
370312ae 256{
a8741caa 257 SCM ans = scm_make_vector (SCM_MAKINUM (5), SCM_UNSPECIFIED);
370312ae
GH
258 SCM *ve = SCM_VELTS (ans);
259 SCM lst = SCM_EOL;
260 struct hostent *entry;
261 struct in_addr inad;
262 char **argv;
263 int i = 0;
370312ae
GH
264 if (SCM_UNBNDP (name))
265 {
cd34a384 266#ifdef HAVE_GETHOSTENT
370312ae 267 entry = gethostent ();
cd34a384
JB
268#else
269 entry = NULL;
270#endif
07513939
JB
271 if (! entry)
272 {
273 /* As far as I can tell, there's no good way to tell whether
274 zero means an error or end-of-file. The trick of
275 clearing errno before calling gethostent and checking it
276 afterwards doesn't cut it, because, on Linux, it seems to
277 try to contact some other server (YP?) and fails, which
278 is a benign failure. */
07513939
JB
279 return SCM_BOOL_F;
280 }
370312ae 281 }
0c95b57d 282 else if (SCM_ROSTRINGP (name))
370312ae 283 {
89958ad0 284 SCM_COERCE_SUBSTR (name);
ae2fa5bc 285 entry = gethostbyname (SCM_ROCHARS (name));
370312ae
GH
286 }
287 else
288 {
426b4cde 289 inad.s_addr = htonl (SCM_NUM2ULONG (1,name));
370312ae
GH
290 entry = gethostbyaddr ((char *) &inad, sizeof (inad), AF_INET);
291 }
370312ae 292 if (!entry)
1bbd0b84 293 scm_resolv_error (FUNC_NAME, name);
5c11cc9d
GH
294
295 ve[0] = scm_makfromstr (entry->h_name,
296 (scm_sizet) strlen (entry->h_name), 0);
370312ae
GH
297 ve[1] = scm_makfromstrs (-1, entry->h_aliases);
298 ve[2] = SCM_MAKINUM (entry->h_addrtype + 0L);
299 ve[3] = SCM_MAKINUM (entry->h_length + 0L);
300 if (sizeof (struct in_addr) != entry->h_length)
301 {
302 ve[4] = SCM_BOOL_F;
303 return ans;
304 }
305 for (argv = entry->h_addr_list; argv[i]; i++);
306 while (i--)
307 {
308 inad = *(struct in_addr *) argv[i];
309 lst = scm_cons (scm_ulong2num (ntohl (inad.s_addr)), lst);
310 }
311 ve[4] = lst;
312 return ans;
313}
1bbd0b84 314#undef FUNC_NAME
370312ae
GH
315
316
07513939
JB
317/* In all subsequent getMUMBLE functions, when we're called with no
318 arguments, we're supposed to traverse the tables entry by entry.
319 However, there doesn't seem to be any documented way to distinguish
320 between end-of-table and an error; in both cases the functions
321 return zero. Gotta love Unix. For the time being, we clear errno,
322 and if we get a zero and errno is set, we signal an error. This
323 doesn't seem quite right (what if errno gets set as part of healthy
324 operation?), but it seems to work okay. We'll see. */
325
0e958795 326#if defined(HAVE_GETNETENT) && defined(HAVE_GETNETBYNAME) && defined(HAVE_GETNETBYADDR)
a1ec6916 327SCM_DEFINE (scm_getnet, "getnet", 0, 1, 0,
1bbd0b84 328 (SCM name),
4079f87e
GB
329"@deffnx procedure getnetbyname net-name
330@deffnx procedure getnetbyaddr net-number
331Look up a network by name or net number in the network database. The
332@var{net-name} argument must be a string, and the @var{net-number}
333argument must be an integer. @code{getnet} will accept either type of
334argument, behaving like @code{getnetent} (see below) if no arguments are
335given.")
1bbd0b84 336#define FUNC_NAME s_scm_getnet
370312ae
GH
337{
338 SCM ans;
339 SCM *ve;
340 struct netent *entry;
341
a8741caa 342 ans = scm_make_vector (SCM_MAKINUM (4), SCM_UNSPECIFIED);
370312ae
GH
343 ve = SCM_VELTS (ans);
344 if (SCM_UNBNDP (name))
345 {
07513939 346 errno = 0;
370312ae 347 entry = getnetent ();
07513939
JB
348 if (! entry)
349 {
07513939 350 if (errno)
1bbd0b84 351 SCM_SYSERROR;
07513939
JB
352 else
353 return SCM_BOOL_F;
354 }
370312ae 355 }
0c95b57d 356 else if (SCM_ROSTRINGP (name))
370312ae 357 {
89958ad0 358 SCM_COERCE_SUBSTR (name);
ae2fa5bc 359 entry = getnetbyname (SCM_ROCHARS (name));
370312ae
GH
360 }
361 else
362 {
363 unsigned long netnum;
4638e087 364 netnum = SCM_NUM2ULONG (1, name);
370312ae
GH
365 entry = getnetbyaddr (netnum, AF_INET);
366 }
370312ae 367 if (!entry)
5d2d2ffc 368 SCM_SYSERROR_MSG ("no such network ~A",
07513939 369 scm_listify (name, SCM_UNDEFINED), errno);
370312ae
GH
370 ve[0] = scm_makfromstr (entry->n_name, (scm_sizet) strlen (entry->n_name), 0);
371 ve[1] = scm_makfromstrs (-1, entry->n_aliases);
372 ve[2] = SCM_MAKINUM (entry->n_addrtype + 0L);
373 ve[3] = scm_ulong2num (entry->n_net + 0L);
374 return ans;
375}
1bbd0b84 376#undef FUNC_NAME
0e958795 377#endif
370312ae 378
0e958795 379#ifdef HAVE_GETPROTOENT
a1ec6916 380SCM_DEFINE (scm_getproto, "getproto", 0, 1, 0,
1bbd0b84 381 (SCM name),
4079f87e
GB
382"@deffnx procedure getprotobyname name
383@deffnx procedure getprotobynumber number
384Look up a network protocol by name or by number. @code{getprotobyname}
385takes a string argument, and @code{getprotobynumber} takes an integer
386argument. @code{getproto} will accept either type, behaving like
387@code{getprotoent} (see below) if no arguments are supplied.")
1bbd0b84 388#define FUNC_NAME s_scm_getproto
370312ae
GH
389{
390 SCM ans;
391 SCM *ve;
392 struct protoent *entry;
393
a8741caa 394 ans = scm_make_vector (SCM_MAKINUM (3), SCM_UNSPECIFIED);
370312ae
GH
395 ve = SCM_VELTS (ans);
396 if (SCM_UNBNDP (name))
397 {
07513939 398 errno = 0;
370312ae 399 entry = getprotoent ();
07513939
JB
400 if (! entry)
401 {
07513939 402 if (errno)
1bbd0b84 403 SCM_SYSERROR;
07513939
JB
404 else
405 return SCM_BOOL_F;
406 }
370312ae 407 }
0c95b57d 408 else if (SCM_ROSTRINGP (name))
370312ae 409 {
89958ad0 410 SCM_COERCE_SUBSTR (name);
ae2fa5bc 411 entry = getprotobyname (SCM_ROCHARS (name));
370312ae
GH
412 }
413 else
414 {
415 unsigned long protonum;
1bbd0b84 416 protonum = SCM_NUM2ULONG (1,name);
370312ae
GH
417 entry = getprotobynumber (protonum);
418 }
370312ae 419 if (!entry)
70d63753 420 SCM_SYSERROR_MSG ("no such protocol ~A",
07513939 421 scm_listify (name, SCM_UNDEFINED), errno);
370312ae
GH
422 ve[0] = scm_makfromstr (entry->p_name, (scm_sizet) strlen (entry->p_name), 0);
423 ve[1] = scm_makfromstrs (-1, entry->p_aliases);
424 ve[2] = SCM_MAKINUM (entry->p_proto + 0L);
425 return ans;
426}
1bbd0b84 427#undef FUNC_NAME
0e958795 428#endif
370312ae 429
370312ae 430static SCM
1bbd0b84 431scm_return_entry (struct servent *entry)
370312ae
GH
432{
433 SCM ans;
434 SCM *ve;
435
a8741caa 436 ans = scm_make_vector (SCM_MAKINUM (4), SCM_UNSPECIFIED);
370312ae
GH
437 ve = SCM_VELTS (ans);
438 ve[0] = scm_makfromstr (entry->s_name, (scm_sizet) strlen (entry->s_name), 0);
439 ve[1] = scm_makfromstrs (-1, entry->s_aliases);
440 ve[2] = SCM_MAKINUM (ntohs (entry->s_port) + 0L);
441 ve[3] = scm_makfromstr (entry->s_proto, (scm_sizet) strlen (entry->s_proto), 0);
370312ae
GH
442 return ans;
443}
444
0e958795 445#ifdef HAVE_GETSERVENT
a1ec6916 446SCM_DEFINE (scm_getserv, "getserv", 0, 2, 0,
1bbd0b84 447 (SCM name, SCM proto),
4079f87e
GB
448"@deffnx procedure getservbyname name protocol
449@deffnx procedure getservbyport port protocol
450Look up a network service by name or by service number, and return a
451network service object. The @var{protocol} argument specifies the name
452of the desired protocol; if the protocol found in the network service
453database does not match this name, a system error is signalled.
454
455The @code{getserv} procedure will take either a service name or number
456as its first argument; if given no arguments, it behaves like
457@code{getservent} (see below).")
1bbd0b84 458#define FUNC_NAME s_scm_getserv
370312ae
GH
459{
460 struct servent *entry;
461 if (SCM_UNBNDP (name))
462 {
07513939 463 errno = 0;
370312ae 464 entry = getservent ();
07513939
JB
465 if (!entry)
466 {
467 if (errno)
1bbd0b84 468 SCM_SYSERROR;
07513939
JB
469 else
470 return SCM_BOOL_F;
471 }
370312ae
GH
472 return scm_return_entry (entry);
473 }
3b3b36dd 474 SCM_VALIDATE_ROSTRING (2,proto);
89958ad0 475 SCM_COERCE_SUBSTR (proto);
0c95b57d 476 if (SCM_ROSTRINGP (name))
370312ae 477 {
89958ad0 478 SCM_COERCE_SUBSTR (name);
ae2fa5bc 479 entry = getservbyname (SCM_ROCHARS (name), SCM_ROCHARS (proto));
370312ae
GH
480 }
481 else
482 {
3b3b36dd 483 SCM_VALIDATE_INUM (1,name);
ae2fa5bc 484 entry = getservbyport (htons (SCM_INUM (name)), SCM_ROCHARS (proto));
370312ae
GH
485 }
486 if (!entry)
70d63753 487 SCM_SYSERROR_MSG("no such service ~A",
1bbd0b84 488 scm_listify (name, SCM_UNDEFINED), errno);
370312ae
GH
489 return scm_return_entry (entry);
490}
1bbd0b84 491#undef FUNC_NAME
0e958795 492#endif
370312ae 493
0e958795 494#if defined(HAVE_SETHOSTENT) && defined(HAVE_ENDHOSTENT)
a1ec6916 495SCM_DEFINE (scm_sethost, "sethost", 0, 1, 0,
1bbd0b84 496 (SCM arg),
4079f87e
GB
497"If @var{stayopen} is omitted, this is equivalent to @code{endhostent}.
498Otherwise it is equivalent to @code{sethostent stayopen}.")
1bbd0b84 499#define FUNC_NAME s_scm_sethost
370312ae
GH
500{
501 if (SCM_UNBNDP (arg))
502 endhostent ();
503 else
504 sethostent (SCM_NFALSEP (arg));
505 return SCM_UNSPECIFIED;
506}
1bbd0b84 507#undef FUNC_NAME
0e958795 508#endif
370312ae 509
0e958795 510#if defined(HAVE_SETNETENT) && defined(HAVE_ENDNETENT)
a1ec6916 511SCM_DEFINE (scm_setnet, "setnet", 0, 1, 0,
1bbd0b84 512 (SCM arg),
4079f87e
GB
513"If @var{stayopen} is omitted, this is equivalent to @code{endnetent}.
514Otherwise it is equivalent to @code{setnetent stayopen}.")
1bbd0b84 515#define FUNC_NAME s_scm_setnet
370312ae
GH
516{
517 if (SCM_UNBNDP (arg))
518 endnetent ();
519 else
520 setnetent (SCM_NFALSEP (arg));
521 return SCM_UNSPECIFIED;
522}
1bbd0b84 523#undef FUNC_NAME
0e958795 524#endif
370312ae 525
0e958795 526#if defined(HAVE_SETPROTOENT) && defined(HAVE_ENDPROTOENT)
a1ec6916 527SCM_DEFINE (scm_setproto, "setproto", 0, 1, 0,
1bbd0b84 528 (SCM arg),
4079f87e
GB
529"If @var{stayopen} is omitted, this is equivalent to @code{endprotoent}.
530Otherwise it is equivalent to @code{setprotoent stayopen}.")
1bbd0b84 531#define FUNC_NAME s_scm_setproto
370312ae
GH
532{
533 if (SCM_UNBNDP (arg))
534 endprotoent ();
535 else
536 setprotoent (SCM_NFALSEP (arg));
537 return SCM_UNSPECIFIED;
538}
1bbd0b84 539#undef FUNC_NAME
0e958795 540#endif
370312ae 541
0e958795 542#if defined(HAVE_SETSERVENT) && defined(HAVE_ENDSERVENT)
a1ec6916 543SCM_DEFINE (scm_setserv, "setserv", 0, 1, 0,
1bbd0b84 544 (SCM arg),
4079f87e
GB
545"If @var{stayopen} is omitted, this is equivalent to @code{endservent}.
546Otherwise it is equivalent to @code{setservent stayopen}.")
1bbd0b84 547#define FUNC_NAME s_scm_setserv
370312ae
GH
548{
549 if (SCM_UNBNDP (arg))
550 endservent ();
551 else
552 setservent (SCM_NFALSEP (arg));
553 return SCM_UNSPECIFIED;
554}
1bbd0b84 555#undef FUNC_NAME
0e958795 556#endif
370312ae
GH
557
558
559void
560scm_init_net_db ()
561{
562#ifdef INADDR_ANY
563 scm_sysintern ("INADDR_ANY", scm_ulong2num (INADDR_ANY));
564#endif
565#ifdef INADDR_BROADCAST
566 scm_sysintern ("INADDR_BROADCAST", scm_ulong2num (INADDR_BROADCAST));
567#endif
568#ifdef INADDR_NONE
569 scm_sysintern ("INADDR_NONE", scm_ulong2num (INADDR_NONE));
570#endif
571#ifdef INADDR_LOOPBACK
572 scm_sysintern ("INADDR_LOOPBACK", scm_ulong2num (INADDR_LOOPBACK));
573#endif
574
575 scm_add_feature ("net-db");
576#include "net_db.x"
577}