Remove unused INET functions for D'Arcy.

This commit is contained in:
Bruce Momjian 1998-10-20 23:03:20 +00:00
parent d7fc00c20d
commit a824add49a
3 changed files with 3 additions and 121 deletions

View File

@ -3,7 +3,7 @@
* is for IP V4 CIDR notation, but prepared for V6: just
* add the necessary bits where the comments indicate.
*
* $Id: inet.c,v 1.5 1998/10/17 04:08:40 momjian Exp $
* $Id: inet.c,v 1.6 1998/10/20 23:03:19 momjian Exp $
*/
#include <sys/types.h>
@ -312,115 +312,6 @@ inet_masklen(inet *ip)
return ip_bits(ip);
}
text *
inet_host(inet *ip)
{
char *dst,
tmp[sizeof("255.255.255.255/32")];
if (ip_family(ip) == AF_INET)
{
#ifdef BAD
/* It's an IP V4 address: */
if (inet_cidr_ntop(AF_INET, &ip_v4addr(ip), 4, -1,
tmp, sizeof(tmp)) < 0)
{
elog(ERROR, "unable to print host (%s)", strerror(errno));
return (NULL);
}
#endif
}
else
{
/* Go for an IPV6 address here, before faulting out: */
elog(ERROR, "unknown address family (%d)", ip_family(ip));
return (NULL);
}
dst = palloc(strlen(tmp) + 1);
if (dst == NULL)
{
elog(ERROR, "unable to allocate memory in inet_out()");
return (NULL);
}
strcpy(dst, tmp);
return (dst);
}
text *
inet_network_without_bits(inet *ip)
{
char *dst,
tmp[sizeof("255.255.255.255/32")];
if (ip_family(ip) == AF_INET)
{
/* It's an IP V4 address: */
int addr = ip_v4addr(ip) & (-1 << (32 - ip_bits(ip)));
#ifdef BAD
if (inet_cidr_ntop(AF_INET, &addr, (int)(ip_bits(ip)/8), -1,
tmp, sizeof(tmp)) < 0)
{
elog(ERROR, "unable to print address (%s)", strerror(errno));
return (NULL);
}
#endif
}
else
{
/* Go for an IPV6 address here, before faulting out: */
elog(ERROR, "unknown address family (%d)", ip_family(ip));
return (NULL);
}
dst = palloc(strlen(tmp) + 1);
if (dst == NULL)
{
elog(ERROR, "unable to allocate memory in inet_out()");
return (NULL);
}
strcpy(dst, tmp);
return (dst);
}
text *
inet_network_with_bits(inet *ip)
{
char *dst,
tmp[sizeof("255.255.255.255/32")];
if (ip_family(ip) == AF_INET)
{
/* It's an IP V4 address: */
int addr = ip_v4addr(ip) & (-1 << (32 - ip_bits(ip)));
#ifdef BAD
if (inet_cidr_ntop(AF_INET, &addr, (int)(ip_bits(ip)/8),
ip_bits(ip), tmp, sizeof(tmp)) < 0)
{
elog(ERROR, "unable to print address (%s)", strerror(errno));
return (NULL);
}
#endif
}
else
{
/* Go for an IPV6 address here, before faulting out: */
elog(ERROR, "unknown address family (%d)", ip_family(ip));
return (NULL);
}
dst = palloc(strlen(tmp) + 1);
if (dst == NULL)
{
elog(ERROR, "unable to allocate memory in inet_out()");
return (NULL);
}
strcpy(dst, tmp);
return (dst);
}
text *
inet_broadcast(inet *ip)
{

View File

@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_proc.h,v 1.73 1998/10/12 04:07:48 momjian Exp $
* $Id: pg_proc.h,v 1.74 1998/10/20 23:03:19 momjian Exp $
*
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
@ -2101,12 +2101,6 @@ DATA(insert OID = 940 ( inet_netmask PGUID 11 f t f 1 f 25 "869" 100 0 0 100
DESCR("netmask of inet address");
DATA(insert OID = 941 ( inet_masklen PGUID 11 f t f 1 f 23 "869" 100 0 0 100 foo bar ));
DESCR("netmask length");
DATA(insert OID = 942 ( inet_host PGUID 11 f t f 1 f 25 "869" 100 0 0 100 foo bar ));
DESCR("host adress");
DATA(insert OID = 943 ( inet_network_without_bits PGUID 11 f t f 1 f 25 "869" 100 0 0 100 foo bar ));
DESCR("netmask without bits");
DATA(insert OID = 944 ( inet_network_with_bits PGUID 11 f t f 1 f 25 "869" 100 0 0 100 foo bar ));
DESCR("netmask with bits");
DATA(insert OID = 945 ( inet_broadcast PGUID 11 f t f 1 f 25 "869" 100 0 0 100 foo bar ));
DESCR("broadcast address");

View File

@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: builtins.h,v 1.61 1998/10/12 04:07:51 momjian Exp $
* $Id: builtins.h,v 1.62 1998/10/20 23:03:20 momjian Exp $
*
* NOTES
* This should normally only be included by fmgr.h.
@ -535,9 +535,6 @@ int4 inet_cmp(inet * a1, inet * a2);
text *inet_netmask(inet * addr);
int4 inet_masklen(inet * addr);
text *inet_host(inet * addr);
text *inet_network_without_bits(inet * addr);
text *inet_network_with_bits(inet * addr);
text *inet_broadcast(inet * addr);