Merged into the current source tree.  Please test.


> Bruce Momjian <maillist@candle.pha.pa.us> writes:
> 
> > Is this the version you want me to install in the current source tree?
> 
> Yup.  It seems to work right, so it's what I'm using right now.  As
> soon as I've got an IPV6 kit installed here, I'll expand it with code
> to handle that data type -- as you can see, I've left comments all
> over the code showing what needs to be done for that.  I reckon the
> thing to do is for you to get it properly into the tree, and then I'll
> do further maintenance on that code, and send patches.
> 
> The SQL code to set up indexing capability doesn't work after your
> changes to add OIDs to various names, but I guess that's irrelevant
> when you integrate it into the base system, right?  As for the MAC
> level ethernet address stuff, if you want to add that as well, I guess
> we should consider replacing the hard-coded table of manufacturers
> with a table in template1 -- that is the SQL way, after all.  Also,
> the names of these types should maybe be changed?  I use "ipaddr" and
> "macaddr", but I can't remember if consensus was reached on whether
> the IP address data type should be "cidr", or "inet", or what...  If
> you want me to go through the code and change that before you do the
> integration, just let me know.
> 
> -tih
> -- 
> Popularity is the hallmark of mediocrity.  --Niles Crane, "Frasier"
> 


-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026


Sat, 3 Oct 1998 01:46:33 -0400 (EDT)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: CIDR/IP types.  Was: [GENERAL] big numbers
On Sat, 3 Oct 1998, Bruce Momjian wrote:

> Merged into the current source tree.  Please test.
> 
> 
> > Bruce Momjian <maillist@candle.pha.pa.us> writes:
> > 
> > > Is this the version you want me to install in the current source tree?
> > 
> > Yup.  It seems to work right, so it's what I'm using right now.  As
> > soon as I've got an IPV6 kit installed here, I'll expand it with code
> > to handle that data type -- as you can see, I've left comments all
> > over the code showing what needs to be done for that.  I reckon the
> > thing to do is for you to get it properly into the tree, and then I'll
> > do further maintenance on that code, and send patches.
> > 
> > The SQL code to set up indexing capability doesn't work after your
> > changes to add OIDs to various names, but I guess that's irrelevant
> > when you integrate it into the base system, right?  As for the MAC
> > level ethernet address stuff, if you want to add that as well, I guess
> > we should consider replacing the hard-coded table of manufacturers
> > with a table in template1 -- that is the SQL way, after all.  Also,
> > the names of these types should maybe be changed?  I use "ipaddr" and
> > "macaddr", but I can't remember if consensus was reached on whether
> > the IP address data type should be "cidr", or "inet", or what...  If

	*Please* make the appropriate changes and submit a patch...it
should be listed as CIDR, not as IPADDR.  MACADDR, IMHO, is okay, as its
the only way I've ever heard of it being referred...but I do not consider
IPADDR to be correct terminology...


Marc G. Fournier                               scrappy@hub.org
Systems Administrator @ hub.org                    
scrappy@{postgresql|isc}.org                       ICQ#7615664


Sun, 4 Oct 1998 19:52:38 -0400 (EDT)
"Marc G. Fournier" <scrappy@hub.org>
Re: [HACKERS] Re: CIDR/IP types.  Was: [GENERAL] big numbers
> 	*Please* make the appropriate changes and submit a patch...it
> should be listed as CIDR, not as IPADDR.  MACADDR, IMHO, is okay, as its
> the only way I've ever heard of it being referred...but I do not consider
> IPADDR to be correct terminology...

That is OK, but just let me that CIDR is for networks addresses, and
this type supports both host and network addresses.

Attached is a message from Paul Vixie mentioning this issue.  It argues
for the use of INET, rather than CIDR or IPADDR.

---------------------------------------------------------------------------


Replies to three messages here.

> From: Bruce Momjian <maillist@candle.pha.pa.us>
> Date: Tue, 21 Jul 1998 01:13:34 -0400 (EDT)
>
> The only problem is that if we assume /32, how do we auto-netmask class
> A/B/C addresses?  I guess we don't.  If they want a netmask, they are
> going to have to specify it in cidr format.

Right.  But read on -- what you're calling a netmask is really a 
prefix length, and I think there's some confusion as to what it is.

> I will be honest.  I always found the network/host IP address
> distinction to be very unclearly outlined in old/non-cidr address
> displays, and this causes major confusion for me when trying to figure
> out how things are configured.

Me too.

> I like INET too.  It is up to you.

How do folks feel about polymorphism between IPv4 and IPv6?  Should we (a)
make it work (either by making internal_length=10 or going variable length)
or (b) just make this thing IPv4 only and take care of IPv6 separately/later?

I've started to wonder if we ought to call the type INET and limit it to V4.
(In the C socket bindings, IPv6 addresses are in_addr6 / sockaddr_in6, and
the address family is AF_INET6 -- I don't know whether to plan on reflecting
this in the postgres types, i.e., use a separate one for IPv6, or not.)

> From: Bruce Momjian <maillist@candle.pha.pa.us>
> Date: Tue, 21 Jul 1998 01:30:05 -0400 (EDT)
>
> > ...  but why would you want to know the mantissa without the scale?
> 
> I guess I thought someone might want to have ipaddr() and netmask()
> functions so they can do:
> 
> 	x = 192.7.34.21/24
> 	ipaddr(x)  -> 192.7.34.21
> 	netmask(x) -> 255.255.255.0

This is the downreference from above.  It does not work that way.  /24 is
not a shorthand for specifying a netmask -- in CIDR, it's a "prefix length".
That means "192.7.34.21/24" is either (a) a syntax error or (b) equivilent
to "192.7.34/24".

Btw, it appears from my research that the BIND functions *do* impute a "class"
if (a) no "/width" is specified and (b) the classful interpretation would be
longer than the classless interpretation.  No big deal but it qualifies 
something I said earlier so I thought I'd mention it.

> 	x = 192.7.0.0/16
> 	ipaddr(x)  -> 192.7.0.0
> 	netmask(x) -> 255.255.0.0
> 
> These function are defined on the cidr type, and can be called if
> someone wants the old output format.

Can we wait and see if someone misses / asks for these before we make them?

> ..., the 127.1 ambiguity was very strange.  netstat -rn is very hard to
> understand using the old format.

I was amazed at the number of people who had hardwired "127.1" though :-(.

> From: Bruce Momjian <maillist@candle.pha.pa.us>
> Date: Tue, 21 Jul 1998 01:33:41 -0400 (EDT)
>
> Doing complex stuff like indexing with contrib stuff is tricky, and one
> reason we want to move stuff out of there as it becomes popular.  It is
> just too hard for someone not experienced with the code to implement. 
> Add to this the fact that the oid at the time of contrib installation
> will change every time you install it, so it is even harder/impossible
> to automate.

Perhaps we ought to make new type insertion easier since it's so cool?




-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026


Sun, 4 Oct 1998 20:57:19 -0400 (EDT)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] Re: CIDR/IP types.  Was: [GENERAL] big numbers
"Marc G. Fournier" <scrappy@hub.org> writes:

> 	*Please* make the appropriate changes and submit a patch...it
> should be listed as CIDR, not as IPADDR.  MACADDR, IMHO, is okay, as its
> the only way I've ever heard of it being referred...but I do not consider
> IPADDR to be correct terminology...

I agree.  I think, though, that the best argument presented in the
debate was from Paul Vixie, who wanted INET to be the name covering
both IPV4 and IPV6.  The following kit makes the needed changes:

WARNING!  This posting contains two separate patch kits, to be applied
at different times, renaming a couple of files in between them!  The
steps to be taken are marked with "[***]".

[***] First apply these patches to change ipaddr to inet.  Affected files are:

- src/backend/utils/adt/ip.c
- src/include/catalog/pg_opclass.h
- src/include/catalog/pg_operator.h
- src/include/catalog/pg_proc.h
- src/include/catalog/pg_type.h
- src/include/utils/builtins.h
- src/include/utils/mac.h
- src/tools/pgindent/pgindent

Index: src/backend/utils/adt/ip.c
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/backend/utils/adt/ip.c,v
retrieving revision 1.4
diff -r1.4 ip.c
2c2
<  *	PostgreSQL type definitions for IP addresses.  This
---
>  *	PostgreSQL type definitions for the INET type.  This
23a24,25
> static int v4bitncmp(unsigned int a1, unsigned int a2, int bits);
> 
28,29c30,31
< #define ip_addrsize(ipaddrptr) \
< 	(((ipaddr_struct *)VARDATA(ipaddrptr))->family == AF_INET ? 4 : -1)
---
> #define ip_addrsize(inetptr) \
> 	(((inet_struct *)VARDATA(inetptr))->family == AF_INET ? 4 : -1)
31,32c33,34
< #define ip_family(ipaddrptr) \
< 	(((ipaddr_struct *)VARDATA(ipaddrptr))->family)
---
> #define ip_family(inetptr) \
> 	(((inet_struct *)VARDATA(inetptr))->family)
34,35c36,37
< #define ip_bits(ipaddrptr) \
< 	(((ipaddr_struct *)VARDATA(ipaddrptr))->bits)
---
> #define ip_bits(inetptr) \
> 	(((inet_struct *)VARDATA(inetptr))->bits)
37,38c39,40
< #define ip_v4addr(ipaddrptr) \
< 	(((ipaddr_struct *)VARDATA(ipaddrptr))->addr.ipv4_addr)
---
> #define ip_v4addr(inetptr) \
> 	(((inet_struct *)VARDATA(inetptr))->addr.ipv4_addr)
44,45c46,47
< ipaddr *
< ipaddr_in(char *src)
---
> inet *
> inet_in(char *src)
48c50
< 	ipaddr	   *dst;
---
> 	inet	   *dst;
50c52
< 	dst = palloc(VARHDRSZ + sizeof(ipaddr_struct));
---
> 	dst = palloc(VARHDRSZ + sizeof(inet_struct));
53c55
< 		elog(ERROR, "unable to allocate memory in ipaddr_in()");
---
> 		elog(ERROR, "unable to allocate memory in inet_in()");
78c80
< ipaddr_out(ipaddr *src)
---
> inet_out(inet *src)
102c104
< 		elog(ERROR, "unable to allocate memory in ipaddr_out()");
---
> 		elog(ERROR, "unable to allocate memory in inet_out()");
114c116
< ipaddr_lt(ipaddr *a1, ipaddr *a2)
---
> inet_lt(inet *a1, inet *a2)
132c134
< ipaddr_le(ipaddr *a1, ipaddr *a2)
---
> inet_le(inet *a1, inet *a2)
134c136
< 	return (ipaddr_lt(a1, a2) || ipaddr_eq(a1, a2));
---
> 	return (inet_lt(a1, a2) || inet_eq(a1, a2));
138c140
< ipaddr_eq(ipaddr *a1, ipaddr *a2)
---
> inet_eq(inet *a1, inet *a2)
155c157
< ipaddr_ge(ipaddr *a1, ipaddr *a2)
---
> inet_ge(inet *a1, inet *a2)
157c159
< 	return (ipaddr_gt(a1, a2) || ipaddr_eq(a1, a2));
---
> 	return (inet_gt(a1, a2) || inet_eq(a1, a2));
161c163
< ipaddr_gt(ipaddr *a1, ipaddr *a2)
---
> inet_gt(inet *a1, inet *a2)
179c181
< ipaddr_ne(ipaddr *a1, ipaddr *a2)
---
> inet_ne(inet *a1, inet *a2)
181c183
< 	return (!ipaddr_eq(a1, a2));
---
> 	return (!inet_eq(a1, a2));
185c187
< ipaddr_sub(ipaddr *a1, ipaddr *a2)
---
> inet_sub(inet *a1, inet *a2)
202c204
< ipaddr_subeq(ipaddr *a1, ipaddr *a2)
---
> inet_subeq(inet *a1, inet *a2)
219c221
< ipaddr_sup(ipaddr *a1, ipaddr *a2)
---
> inet_sup(inet *a1, inet *a2)
236c238
< ipaddr_supeq(ipaddr *a1, ipaddr *a2)
---
> inet_supeq(inet *a1, inet *a2)
257c259
< ipaddr_cmp(ipaddr *a1, ipaddr *a2)
---
> inet_cmp(inet *a1, inet *a2)
270c272
< int
---
> static int
Index: src/include/catalog/pg_opclass.h
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/include/catalog/pg_opclass.h,v
retrieving revision 1.12
diff -r1.12 pg_opclass.h
112c112
< DATA(insert OID = 935  (	ipaddr_ops   869   ));
---
> DATA(insert OID = 935  (	inet_ops   869   ));
Index: src/include/catalog/pg_operator.h
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/include/catalog/pg_operator.h,v
retrieving revision 1.39
diff -r1.39 pg_operator.h
647,656c647,656
< DATA(insert OID = 1201 (  "="	   PGUID 0 b t t 869 869	 16 1201 1202 0 0 ipaddr_eq eqsel eqjoinsel ));
< DATA(insert OID = 1202 (  "<>"	   PGUID 0 b t f 869 869	 16 1202 1201 0 0 ipaddr_ne neqsel neqjoinsel ));
< DATA(insert OID = 1203 (  "<"	   PGUID 0 b t f 869 869	 16 1205 1206 0 0 ipaddr_lt intltsel intltjoinsel ));
< DATA(insert OID = 1204 (  "<="	   PGUID 0 b t f 869 869	 16 1206 1205 0 0 ipaddr_le intltsel intltjoinsel ));
< DATA(insert OID = 1205 (  ">"	   PGUID 0 b t f 869 869	 16 1203 1204 0 0 ipaddr_gt intltsel intltjoinsel ));
< DATA(insert OID = 1206 (  ">="	   PGUID 0 b t f 869 869	 16 1204 1203 0 0 ipaddr_ge intltsel intltjoinsel ));
< DATA(insert OID = 931  (  "<<"	   PGUID 0 b t f 869 869     16 933  934  0 0 ipaddr_sub intltsel intltjoinsel ));
< DATA(insert OID = 932  (  "<<="	   PGUID 0 b t f 869 869     16 934  933  0 0 ipaddr_subeq intltsel intltjoinsel ));
< DATA(insert OID = 933  (  ">>"	   PGUID 0 b t f 869 869     16 931  932  0 0 ipaddr_sup intltsel intltjoinsel ));
< DATA(insert OID = 934  (  ">>="	   PGUID 0 b t f 869 869     16 932  931  0 0 ipaddr_supeq intltsel intltjoinsel ));
---
> DATA(insert OID = 1201 (  "="	   PGUID 0 b t t 869 869	 16 1201 1202 0 0 inet_eq eqsel eqjoinsel ));
> DATA(insert OID = 1202 (  "<>"	   PGUID 0 b t f 869 869	 16 1202 1201 0 0 inet_ne neqsel neqjoinsel ));
> DATA(insert OID = 1203 (  "<"	   PGUID 0 b t f 869 869	 16 1205 1206 0 0 inet_lt intltsel intltjoinsel ));
> DATA(insert OID = 1204 (  "<="	   PGUID 0 b t f 869 869	 16 1206 1205 0 0 inet_le intltsel intltjoinsel ));
> DATA(insert OID = 1205 (  ">"	   PGUID 0 b t f 869 869	 16 1203 1204 0 0 inet_gt intltsel intltjoinsel ));
> DATA(insert OID = 1206 (  ">="	   PGUID 0 b t f 869 869	 16 1204 1203 0 0 inet_ge intltsel intltjoinsel ));
> DATA(insert OID = 931  (  "<<"	   PGUID 0 b t f 869 869     16 933  934  0 0 inet_sub intltsel intltjoinsel ));
> DATA(insert OID = 932  (  "<<="	   PGUID 0 b t f 869 869     16 934  933  0 0 inet_subeq intltsel intltjoinsel ));
> DATA(insert OID = 933  (  ">>"	   PGUID 0 b t f 869 869     16 931  932  0 0 inet_sup intltsel intltjoinsel ));
> DATA(insert OID = 934  (  ">>="	   PGUID 0 b t f 869 869     16 932  931  0 0 inet_supeq intltsel intltjoinsel ));
Index: src/include/catalog/pg_proc.h
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/include/catalog/pg_proc.h,v
retrieving revision 1.71
diff -r1.71 pg_proc.h
2072c2072
< DATA(insert OID = 910 (  ipaddr_in			PGUID 11 f t f 1 f 869 "0" 100 0 0 100	foo bar ));
---
> DATA(insert OID = 910 (  inet_in			PGUID 11 f t f 1 f 869 "0" 100 0 0 100	foo bar ));
2074c2074
< DATA(insert OID = 911 (  ipaddr_out			PGUID 11 f t f 1 f 23 "0" 100 0 0 100  foo bar ));
---
> DATA(insert OID = 911 (  inet_out			PGUID 11 f t f 1 f 23 "0" 100 0 0 100  foo bar ));
2077c2077
< DATA(insert OID = 920 (  ipaddr_eq		   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
---
> DATA(insert OID = 920 (  inet_eq		   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
2079c2079
< DATA(insert OID = 921 (  ipaddr_lt		   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
---
> DATA(insert OID = 921 (  inet_lt		   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
2081c2081
< DATA(insert OID = 922 (  ipaddr_le		   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
---
> DATA(insert OID = 922 (  inet_le		   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
2083c2083
< DATA(insert OID = 923 (  ipaddr_gt		   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
---
> DATA(insert OID = 923 (  inet_gt		   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
2085c2085
< DATA(insert OID = 924 (  ipaddr_ge		   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
---
> DATA(insert OID = 924 (  inet_ge		   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
2087c2087
< DATA(insert OID = 925 (  ipaddr_ne		   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
---
> DATA(insert OID = 925 (  inet_ne		   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
2089c2089
< DATA(insert OID = 926 (  ipaddr_cmp	   	   PGUID 11 f t f 2 f 23 "869 869" 100 0 0 100  foo bar ));
---
> DATA(insert OID = 926 (  inet_cmp	   	   PGUID 11 f t f 2 f 23 "869 869" 100 0 0 100  foo bar ));
2091c2091
< DATA(insert OID = 927 (  ipaddr_sub	   	   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
---
> DATA(insert OID = 927 (  inet_sub	   	   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
2093c2093
< DATA(insert OID = 928 (  ipaddr_subeq  	   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
---
> DATA(insert OID = 928 (  inet_subeq  	   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
2095c2095
< DATA(insert OID = 929 (  ipaddr_sup	   	   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
---
> DATA(insert OID = 929 (  inet_sup	   	   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
2097c2097
< DATA(insert OID = 930 (  ipaddr_supeq  	   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
---
> DATA(insert OID = 930 (  inet_supeq  	   PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100  foo bar ));
Index: src/include/catalog/pg_type.h
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/include/catalog/pg_type.h,v
retrieving revision 1.48
diff -r1.48 pg_type.h
303c303
< DATA(insert OID = 869 ( ipaddr	   PGUID  -1 -1 f b t \054 0 0 ipaddr_in ipaddr_out ipaddr_in ipaddr_out i _null_ ));
---
> DATA(insert OID = 869 ( inet	   PGUID  -1 -1 f b t \054 0 0 inet_in inet_out inet_in inet_out i _null_ ));
342c342
< DATA(insert OID = 1041 (  _ipaddr    PGUID -1 -1 f b t \054 0  869 array_in array_out array_in array_out i _null_ ));
---
> DATA(insert OID = 1041 (  _inet    PGUID -1 -1 f b t \054 0  869 array_in array_out array_in array_out i _null_ ));
Index: src/include/utils/builtins.h
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/include/utils/builtins.h,v
retrieving revision 1.57
diff -r1.57 builtins.h
522,535c522,534
< ipaddr	   *ipaddr_in(char *str);
< char	   *ipaddr_out(ipaddr * addr);
< bool		ipaddr_lt(ipaddr * a1, ipaddr * a2);
< bool		ipaddr_le(ipaddr * a1, ipaddr * a2);
< bool		ipaddr_eq(ipaddr * a1, ipaddr * a2);
< bool		ipaddr_ge(ipaddr * a1, ipaddr * a2);
< bool		ipaddr_gt(ipaddr * a1, ipaddr * a2);
< bool		ipaddr_ne(ipaddr * a1, ipaddr * a2);
< bool		ipaddr_sub(ipaddr * a1, ipaddr * a2);
< bool		ipaddr_subeq(ipaddr * a1, ipaddr * a2);
< bool		ipaddr_sup(ipaddr * a1, ipaddr * a2);
< bool		ipaddr_supeq(ipaddr * a1, ipaddr * a2);
< int4		ipaddr_cmp(ipaddr * a1, ipaddr * a2);
< int			v4bitncmp(unsigned int a1, unsigned int a2, int bits);
---
> inet	   *inet_in(char *str);
> char	   *inet_out(inet * addr);
> bool		inet_lt(inet * a1, inet * a2);
> bool		inet_le(inet * a1, inet * a2);
> bool		inet_eq(inet * a1, inet * a2);
> bool		inet_ge(inet * a1, inet * a2);
> bool		inet_gt(inet * a1, inet * a2);
> bool		inet_ne(inet * a1, inet * a2);
> bool		inet_sub(inet * a1, inet * a2);
> bool		inet_subeq(inet * a1, inet * a2);
> bool		inet_sup(inet * a1, inet * a2);
> bool		inet_supeq(inet * a1, inet * a2);
> int4		inet_cmp(inet * a1, inet * a2);
Index: src/include/utils/mac.h
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/include/utils/mac.h,v
retrieving revision 1.2
diff -r1.2 mac.h
29c29
< }			ipaddr_struct;
---
> }			inet_struct;
31c31
< typedef struct varlena ipaddr;
---
> typedef struct varlena inet;
Index: src/tools/pgindent/pgindent
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/tools/pgindent/pgindent,v
retrieving revision 1.11
diff -r1.11 pgindent
789c789
< -Tipaddr \
---
> -Tinet \

[***] Then, some renaming is in order:

- rename doc/README.ipaddr to doc/README.inet
- rename src/backend/utils/adt/ip.c to src/backend/utils/adt/inet.c
- rename src/include/utils/mac.h to src/include/utils/network.h

[***] Finally, apply these patches to reflect the renaming.  Files are:

- src/backend/utils/adt/Makefile
- src/backend/utils/adt/inet.c
- src/backend/utils/adt/mac.c
- src/include/utils/builtins.h

*** src/backend/utils/adt/Makefile.old	Wed Oct  7 10:45:34 1998
--- src/backend/utils/adt/Makefile	Wed Oct  7 10:46:38 1998
***************
*** 24,30 ****
  	oid.o oracle_compat.o \
  	regexp.o regproc.o ruleutils.o selfuncs.o sets.o \
  	tid.o timestamp.o varchar.o varlena.o version.o \
! 	ip.o mac.o inet_net_ntop.o inet_net_pton.o
  
  all: SUBSYS.o
  
--- 24,30 ----
  	oid.o oracle_compat.o \
  	regexp.o regproc.o ruleutils.o selfuncs.o sets.o \
  	tid.o timestamp.o varchar.o varlena.o version.o \
! 	inet.o mac.o inet_net_ntop.o inet_net_pton.o
  
  all: SUBSYS.o
  
*** src/backend/utils/adt/inet.c.old	Wed Oct  7 10:45:38 1998
--- src/backend/utils/adt/inet.c	Wed Oct  7 10:46:52 1998
***************
*** 19,25 ****
  #include <postgres.h>
  #include <utils/palloc.h>
  #include <utils/builtins.h>
! #include <utils/mac.h>
  
  static int v4bitncmp(unsigned int a1, unsigned int a2, int bits);
  
--- 19,25 ----
  #include <postgres.h>
  #include <utils/palloc.h>
  #include <utils/builtins.h>
! #include <utils/network.h>
  
  static int v4bitncmp(unsigned int a1, unsigned int a2, int bits);
  
*** src/backend/utils/adt/mac.c.old	Wed Oct  7 10:45:43 1998
--- src/backend/utils/adt/mac.c	Wed Oct  7 10:47:11 1998
***************
*** 10,16 ****
  #include <postgres.h>
  #include <utils/palloc.h>
  #include <utils/builtins.h>
! #include <utils/mac.h>
  
  manufacturer manufacturers[] = {
    {0x00, 0x00, 0x0C, "Cisco"},
--- 10,16 ----
  #include <postgres.h>
  #include <utils/palloc.h>
  #include <utils/builtins.h>
! #include <utils/network.h>
  
  manufacturer manufacturers[] = {
    {0x00, 0x00, 0x0C, "Cisco"},
*** src/include/utils/builtins.h.old	Wed Oct  7 10:45:54 1998
--- src/include/utils/builtins.h	Wed Oct  7 10:47:28 1998
***************
*** 28,34 ****
  #include <utils/nabstime.h>
  #include <utils/int8.h>
  #include <utils/cash.h>
! #include <utils/mac.h>
  #include <utils/rel.h>
  
  /*
--- 28,34 ----
  #include <utils/nabstime.h>
  #include <utils/int8.h>
  #include <utils/cash.h>
! #include <utils/network.h>
  #include <utils/rel.h>
  
  /*
***************
*** 518,524 ****
  /* inet_net_pton.c */
  int inet_net_pton(int af, const char *src, void *dst, size_t size);
  
! /* ip.c */
  inet	   *inet_in(char *str);
  char	   *inet_out(inet * addr);
  bool		inet_lt(inet * a1, inet * a2);
--- 518,524 ----
  /* inet_net_pton.c */
  int inet_net_pton(int af, const char *src, void *dst, size_t size);
  
! /* inet.c */
  inet	   *inet_in(char *str);
  char	   *inet_out(inet * addr);
  bool		inet_lt(inet * a1, inet * a2);

[***] Hope that I got it right!  "It works for me."  :-)

-tih
-- 
Popularity is the hallmark of mediocrity.  --Niles Crane, "Frasier"

07 Oct 1998 11:28:08 +0200
Tom Ivar Helbekkmo <tih@nhh.no>
Re: [HACKERS] Re: CIDR/IP types.  Was: [GENERAL] big numbers
Applied.

Thomas, did remove the README.ip, or did you leave it when you decided
to merge it into the docs.  I still show it here, so I am renaming it.



> "Marc G. Fournier" <scrappy@hub.org> writes:
> 
> > 	*Please* make the appropriate changes and submit a patch...it
> > should be listed as CIDR, not as IPADDR.  MACADDR, IMHO, is okay, as its
> > the only way I've ever heard of it being referred...but I do not consider
> > IPADDR to be correct terminology...
> 
> I agree.  I think, though, that the best argument presented in the
> debate was from Paul Vixie, who wanted INET to be the name covering
> both IPV4 and IPV6.  The following kit makes the needed changes:
> 
> WARNING!  This posting contains two separate patch kits, to be applied
> at different times, renaming a couple of files in between them!  The
> steps to be taken are marked with "[***]".
> 
> [***] First apply these patches to change ipaddr to inet.  Affected files are:


-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026


Wed, 7 Oct 1998 20:19:51 -0400 (EDT)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] Re: CIDR/IP types.  Was: [GENERAL] big numbers
> Thomas, did remove the README.ip, or did you leave it when you decided
> to merge it into the docs.  I still show it here, so I am renaming it.

I have not yet merged it; it is on my ToDo list for documenting along
with the other new datatypes INT8 and SERIAL. We should leave it in the
README until I do the merge, just in case...

                   - Tom

Thu, 08 Oct 1998 07:16:24 +0000
"Thomas G. Lockhart" <lockhart@alumni.caltech.edu>
Re: [HACKERS] Re: CIDR/IP types.  Was: [GENERAL] big numbers