Commit 33c4072d authored by Bruce Momjian's avatar Bruce Momjian

INET/CIDR cleanup from D'Arcy.

parent 002657f7
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# Makefile for utils/adt # Makefile for utils/adt
# #
# IDENTIFICATION # IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.19 1998/10/08 00:19:33 momjian Exp $ # $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.20 1998/10/22 20:40:44 momjian Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -24,7 +24,7 @@ OBJS = acl.o arrayfuncs.o arrayutils.o bool.o cash.o char.o chunk.o \ ...@@ -24,7 +24,7 @@ OBJS = acl.o arrayfuncs.o arrayutils.o bool.o cash.o char.o chunk.o \
oid.o oracle_compat.o \ oid.o oracle_compat.o \
regexp.o regproc.o ruleutils.o selfuncs.o sets.o \ regexp.o regproc.o ruleutils.o selfuncs.o sets.o \
tid.o timestamp.o varchar.o varlena.o version.o \ tid.o timestamp.o varchar.o varlena.o version.o \
inet.o mac.o inet_net_ntop.o inet_net_pton.o network.o mac.o inet_net_ntop.o inet_net_pton.o
all: SUBSYS.o all: SUBSYS.o
......
This diff is collapsed.
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: pg_opclass.h,v 1.14 1998/10/21 16:06:46 momjian Exp $ * $Id: pg_opclass.h,v 1.15 1998/10/22 20:40:46 momjian Exp $
* *
* NOTES * NOTES
* the genbki.sh script reads this file and generates .bki * the genbki.sh script reads this file and generates .bki
...@@ -109,9 +109,9 @@ DATA(insert OID = 1313 ( timespan_ops 1186 )); ...@@ -109,9 +109,9 @@ DATA(insert OID = 1313 ( timespan_ops 1186 ));
DESCR(""); DESCR("");
DATA(insert OID = 810 ( macaddr_ops 829 )); DATA(insert OID = 810 ( macaddr_ops 829 ));
DESCR(""); DESCR("");
DATA(insert OID = 935 ( inet_ops 869 )); DATA(insert OID = 935 ( network_ops 869 ));
DESCR(""); DESCR("");
DATA(insert OID = 652 ( inet_ops 650 )); DATA(insert OID = 652 ( network_ops 650 ));
DESCR(""); DESCR("");
#endif /* PG_OPCLASS_H */ #endif /* PG_OPCLASS_H */
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: pg_operator.h,v 1.42 1998/10/22 13:51:00 momjian Exp $ * $Id: pg_operator.h,v 1.43 1998/10/22 20:40:47 momjian Exp $
* *
* NOTES * NOTES
* the genbki.sh script reads this file and generates .bki * the genbki.sh script reads this file and generates .bki
...@@ -644,28 +644,28 @@ DATA(insert OID = 1224 ( ">" PGUID 0 b t f 829 829 16 1222 1223 0 0 macaddr ...@@ -644,28 +644,28 @@ DATA(insert OID = 1224 ( ">" PGUID 0 b t f 829 829 16 1222 1223 0 0 macaddr
DATA(insert OID = 1225 ( ">=" PGUID 0 b t f 829 829 16 1223 1222 0 0 macaddr_ge intltsel intltjoinsel )); DATA(insert OID = 1225 ( ">=" PGUID 0 b t f 829 829 16 1223 1222 0 0 macaddr_ge intltsel intltjoinsel ));
/* INET type */ /* INET type */
DATA(insert OID = 1201 ( "=" PGUID 0 b t t 869 869 16 1201 1202 0 0 inet_eq eqsel eqjoinsel )); DATA(insert OID = 1201 ( "=" PGUID 0 b t t 869 869 16 1201 1202 0 0 network_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 = 1202 ( "<>" PGUID 0 b t f 869 869 16 1202 1201 0 0 network_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 = 1203 ( "<" PGUID 0 b t f 869 869 16 1205 1206 0 0 network_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 = 1204 ( "<=" PGUID 0 b t f 869 869 16 1206 1205 0 0 network_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 = 1205 ( ">" PGUID 0 b t f 869 869 16 1203 1204 0 0 network_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 = 1206 ( ">=" PGUID 0 b t f 869 869 16 1204 1203 0 0 network_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 = 931 ( "<<" PGUID 0 b t f 869 869 16 933 934 0 0 network_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 = 932 ( "<<=" PGUID 0 b t f 869 869 16 934 933 0 0 network_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 = 933 ( ">>" PGUID 0 b t f 869 869 16 931 932 0 0 network_sup intltsel intltjoinsel ));
DATA(insert OID = 934 ( ">>=" PGUID 0 b t f 869 869 16 932 931 0 0 inet_supeq intltsel intltjoinsel )); DATA(insert OID = 934 ( ">>=" PGUID 0 b t f 869 869 16 932 931 0 0 network_supeq intltsel intltjoinsel ));
/* CIDR type */ /* CIDR type */
DATA(insert OID = 820 ( "=" PGUID 0 b t t 650 650 16 820 821 0 0 inet_eq eqsel eqjoinsel )); DATA(insert OID = 820 ( "=" PGUID 0 b t t 650 650 16 820 821 0 0 network_eq eqsel eqjoinsel ));
DATA(insert OID = 821 ( "<>" PGUID 0 b t f 650 650 16 821 820 0 0 inet_ne neqsel neqjoinsel )); DATA(insert OID = 821 ( "<>" PGUID 0 b t f 650 650 16 821 820 0 0 network_ne neqsel neqjoinsel ));
DATA(insert OID = 822 ( "<" PGUID 0 b t f 650 650 16 824 825 0 0 inet_lt intltsel intltjoinsel )); DATA(insert OID = 822 ( "<" PGUID 0 b t f 650 650 16 824 825 0 0 network_lt intltsel intltjoinsel ));
DATA(insert OID = 823 ( "<=" PGUID 0 b t f 650 650 16 825 824 0 0 inet_le intltsel intltjoinsel )); DATA(insert OID = 823 ( "<=" PGUID 0 b t f 650 650 16 825 824 0 0 network_le intltsel intltjoinsel ));
DATA(insert OID = 824 ( ">" PGUID 0 b t f 650 650 16 822 823 0 0 inet_gt intltsel intltjoinsel )); DATA(insert OID = 824 ( ">" PGUID 0 b t f 650 650 16 822 823 0 0 network_gt intltsel intltjoinsel ));
DATA(insert OID = 825 ( ">=" PGUID 0 b t f 650 650 16 823 822 0 0 inet_ge intltsel intltjoinsel )); DATA(insert OID = 825 ( ">=" PGUID 0 b t f 650 650 16 823 822 0 0 network_ge intltsel intltjoinsel ));
DATA(insert OID = 826 ( "<<" PGUID 0 b t f 650 650 16 828 1004 0 0 inet_sub intltsel intltjoinsel )); DATA(insert OID = 826 ( "<<" PGUID 0 b t f 650 650 16 828 1004 0 0 network_sub intltsel intltjoinsel ));
DATA(insert OID = 827 ( "<<=" PGUID 0 b t f 650 650 16 1004 828 0 0 inet_subeq intltsel intltjoinsel )); DATA(insert OID = 827 ( "<<=" PGUID 0 b t f 650 650 16 1004 828 0 0 network_subeq intltsel intltjoinsel ));
DATA(insert OID = 828 ( ">>" PGUID 0 b t f 650 650 16 826 827 0 0 inet_sup intltsel intltjoinsel )); DATA(insert OID = 828 ( ">>" PGUID 0 b t f 650 650 16 826 827 0 0 network_sup intltsel intltjoinsel ));
DATA(insert OID = 1004 ( ">>=" PGUID 0 b t f 650 650 16 827 826 0 0 inet_supeq intltsel intltjoinsel )); DATA(insert OID = 1004 ( ">>=" PGUID 0 b t f 650 650 16 827 826 0 0 network_supeq intltsel intltjoinsel ));
/* /*
* function prototypes * function prototypes
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: pg_proc.h,v 1.80 1998/10/22 13:51:02 momjian Exp $ * $Id: pg_proc.h,v 1.81 1998/10/22 20:40:49 momjian Exp $
* *
* NOTES * NOTES
* The script catalog/genbki.sh reads this file and generates .bki * The script catalog/genbki.sh reads this file and generates .bki
...@@ -2081,39 +2081,52 @@ DATA(insert OID = 1416 ( cidr_out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo ...@@ -2081,39 +2081,52 @@ DATA(insert OID = 1416 ( cidr_out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo
DESCR("(internal)"); DESCR("(internal)");
/* these are used for both inet and cidr */ /* these are used for both inet and cidr */
DATA(insert OID = 920 ( inet_eq PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100 foo bar )); DATA(insert OID = 920 ( network_eq PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100 foo bar ));
DESCR("equal"); DESCR("equal");
DATA(insert OID = 921 ( inet_lt PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100 foo bar )); DATA(insert OID = 921 ( network_lt PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100 foo bar ));
DESCR("less-than"); DESCR("less-than");
DATA(insert OID = 922 ( inet_le PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100 foo bar )); DATA(insert OID = 922 ( network_le PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100 foo bar ));
DESCR("less-than-or-equal"); DESCR("less-than-or-equal");
DATA(insert OID = 923 ( inet_gt PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100 foo bar )); DATA(insert OID = 923 ( network_gt PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100 foo bar ));
DESCR("greater-than"); DESCR("greater-than");
DATA(insert OID = 924 ( inet_ge PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100 foo bar )); DATA(insert OID = 924 ( network_ge PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100 foo bar ));
DESCR("greater-than-or-equal"); DESCR("greater-than-or-equal");
DATA(insert OID = 925 ( inet_ne PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100 foo bar )); DATA(insert OID = 925 ( network_ne PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100 foo bar ));
DESCR("not equal"); DESCR("not equal");
DATA(insert OID = 926 ( inet_cmp PGUID 11 f t f 2 f 23 "869 869" 100 0 0 100 foo bar )); DATA(insert OID = 926 ( network_cmp PGUID 11 f t f 2 f 23 "869 869" 100 0 0 100 foo bar ));
DESCR("less-equal-greater"); DESCR("less-equal-greater");
DATA(insert OID = 927 ( inet_sub PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100 foo bar )); DATA(insert OID = 927 ( network_sub PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100 foo bar ));
DESCR("is-subnet"); DESCR("is-subnet");
DATA(insert OID = 928 ( inet_subeq PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100 foo bar )); DATA(insert OID = 928 ( network_subeq PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100 foo bar ));
DESCR("is-subnet-or-equal"); DESCR("is-subnet-or-equal");
DATA(insert OID = 929 ( inet_sup PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100 foo bar )); DATA(insert OID = 929 ( network_sup PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100 foo bar ));
DESCR("is-supernet"); DESCR("is-supernet");
DATA(insert OID = 930 ( inet_supeq PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100 foo bar )); DATA(insert OID = 930 ( network_supeq PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100 foo bar ));
DESCR("is-supernet-or-equal"); DESCR("is-supernet-or-equal");
/* inet/cidr versions */ /* inet/cidr versions */
DATA(insert OID = 940 ( netmask PGUID 11 f t f 1 f 25 "869" 100 0 0 100 foo bar )); DATA(insert OID = 940 ( network_netmask PGUID 11 f t f 1 f 25 "869" 100 0 0 100 foo bar ));
DESCR("netmask of address"); DESCR("netmask of address");
DATA(insert OID = 941 ( masklen PGUID 11 f t f 1 f 23 "869" 100 0 0 100 foo bar )); DATA(insert OID = 941 ( network_masklen PGUID 11 f t f 1 f 23 "869" 100 0 0 100 foo bar ));
DESCR("netmask length"); DESCR("netmask length");
DATA(insert OID = 945 ( broadcast PGUID 11 f t f 1 f 25 "869" 100 0 0 100 foo bar )); DATA(insert OID = 945 ( network_broadcast PGUID 11 f t f 1 f 25 "869" 100 0 0 100 foo bar ));
DESCR("broadcast address"); DESCR("broadcast address");
DATA(insert OID = 682 ( host PGUID 11 f t f 1 f 25 "869" 100 0 0 100 foo bar )); DATA(insert OID = 682 ( network_host PGUID 11 f t f 1 f 25 "869" 100 0 0 100 foo bar ));
DESCR("host address"); DESCR("host address");
DATA(insert OID = 473 ( network_network PGUID 11 f t f 1 f 25 "869" 100 0 0 100 foo bar ));
DESCR("network address");
/* shortcut names */
DATA(insert OID = 696 ( netmask PGUID 14 f t f 1 f 25 "869" 100 0 0 100 "select network_netmask($1)" - ));
DESCR("netmask of address");
DATA(insert OID = 697 ( masklen PGUID 14 f t f 1 f 23 "869" 100 0 0 100 "select network_masklen($1)" - ));
DESCR("netmask length");
DATA(insert OID = 698 ( broadcast PGUID 14 f t f 1 f 25 "869" 100 0 0 100 "select network_broadcast($1)" - ));
DESCR("broadcast address");
DATA(insert OID = 699 ( host PGUID 14 f t f 1 f 25 "869" 100 0 0 100 "select network_host($1)" - ));
DESCR("host address");
DATA(insert OID = 683 ( network PGUID 14 f t f 1 f 25 "869" 100 0 0 100 "select network_network($1)" - ));
DESCR("network address");
/* /*
* prototypes for functions pg_proc.c * prototypes for functions pg_proc.c
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: builtins.h,v 1.67 1998/10/22 13:51:07 momjian Exp $ * $Id: builtins.h,v 1.68 1998/10/22 20:40:50 momjian Exp $
* *
* NOTES * NOTES
* This should normally only be included by fmgr.h. * This should normally only be included by fmgr.h.
...@@ -516,27 +516,28 @@ char *inet_cidr_ntop(int af, const void *src, int bits, char *dst, size_t size); ...@@ -516,27 +516,28 @@ char *inet_cidr_ntop(int af, const void *src, int bits, char *dst, size_t size);
/* inet_net_pton.c */ /* inet_net_pton.c */
int inet_net_pton(int af, const char *src, void *dst, size_t size); int inet_net_pton(int af, const char *src, void *dst, size_t size);
/* inet.c */ /* network.c */
inet *inet_in(char *str); inet *inet_in(char *str);
char *inet_out(inet * addr); char *inet_out(inet * addr);
inet *cidr_in(char *str); inet *cidr_in(char *str);
char *cidr_out(inet *addr); char *cidr_out(inet *addr);
bool inet_lt(inet * a1, inet * a2); bool network_lt(inet * a1, inet * a2);
bool inet_le(inet * a1, inet * a2); bool network_le(inet * a1, inet * a2);
bool inet_eq(inet * a1, inet * a2); bool network_eq(inet * a1, inet * a2);
bool inet_ge(inet * a1, inet * a2); bool network_ge(inet * a1, inet * a2);
bool inet_gt(inet * a1, inet * a2); bool network_gt(inet * a1, inet * a2);
bool inet_ne(inet * a1, inet * a2); bool network_ne(inet * a1, inet * a2);
bool inet_sub(inet * a1, inet * a2); bool network_sub(inet * a1, inet * a2);
bool inet_subeq(inet * a1, inet * a2); bool network_subeq(inet * a1, inet * a2);
bool inet_sup(inet * a1, inet * a2); bool network_sup(inet * a1, inet * a2);
bool inet_supeq(inet * a1, inet * a2); bool network_supeq(inet * a1, inet * a2);
int4 inet_cmp(inet * a1, inet * a2); int4 network_cmp(inet * a1, inet * a2);
text *netmask(inet * addr); text *network_network(inet * addr);
int4 masklen(inet * addr); text *network_netmask(inet * addr);
text *broadcast(inet * addr); int4 network_masklen(inet * addr);
text *host(inet * addr); text *network_broadcast(inet * addr);
text *network_host(inet * addr);
/* mac.c */ /* mac.c */
macaddr *macaddr_in(char *str); macaddr *macaddr_in(char *str);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment