summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1998-10-21 16:06:50 +0000
committerBruce Momjian <bruce@momjian.us>1998-10-21 16:06:50 +0000
commit858a3b570ab4e402e7b0b8f383237ad4a5d13c41 (patch)
tree98cc9cfa6f1a89378648fd97700f435390ad7f3b /src/include
parent56f96f56dfb0f084c0579af2893cab5719fb958f (diff)
downloadpostgresql-858a3b570ab4e402e7b0b8f383237ad4a5d13c41.tar.gz
New CIDR type and fixed INET type, from D'Arcy.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/catalog/pg_opclass.h4
-rw-r--r--src/include/catalog/pg_operator.h16
-rw-r--r--src/include/catalog/pg_proc.h35
-rw-r--r--src/include/catalog/pg_type.h7
-rw-r--r--src/include/utils/builtins.h8
-rw-r--r--src/include/utils/inet.h3
6 files changed, 62 insertions, 11 deletions
diff --git a/src/include/catalog/pg_opclass.h b/src/include/catalog/pg_opclass.h
index 94186e469c..d342cd6c52 100644
--- a/src/include/catalog/pg_opclass.h
+++ b/src/include/catalog/pg_opclass.h
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_opclass.h,v 1.13 1998/10/08 00:19:38 momjian Exp $
+ * $Id: pg_opclass.h,v 1.14 1998/10/21 16:06:46 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -111,5 +111,7 @@ DATA(insert OID = 810 ( macaddr_ops 829 ));
DESCR("");
DATA(insert OID = 935 ( inet_ops 869 ));
DESCR("");
+DATA(insert OID = 652 ( inet_ops 650 ));
+DESCR("");
#endif /* PG_OPCLASS_H */
diff --git a/src/include/catalog/pg_operator.h b/src/include/catalog/pg_operator.h
index 14166d5aef..53bdfc73ef 100644
--- a/src/include/catalog/pg_operator.h
+++ b/src/include/catalog/pg_operator.h
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_operator.h,v 1.40 1998/10/08 00:19:39 momjian Exp $
+ * $Id: pg_operator.h,v 1.41 1998/10/21 16:06:46 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -643,7 +643,7 @@ DATA(insert OID = 1223 ( "<=" PGUID 0 b t f 829 829 16 1225 1224 0 0 macadd
DATA(insert OID = 1224 ( ">" PGUID 0 b t f 829 829 16 1222 1223 0 0 macaddr_gt intltsel intltjoinsel ));
DATA(insert OID = 1225 ( ">=" PGUID 0 b t f 829 829 16 1223 1222 0 0 macaddr_ge intltsel intltjoinsel ));
-/* IP 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 = 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 ));
@@ -655,6 +655,18 @@ DATA(insert OID = 932 ( "<<=" PGUID 0 b t f 869 869 16 934 933 0 0 in
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 ));
+/* 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 = 821 ( "<>" PGUID 0 b t f 650 650 16 821 820 0 0 inet_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 = 823 ( "<=" PGUID 0 b t f 650 650 16 825 824 0 0 inet_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 = 825 ( ">=" PGUID 0 b t f 650 650 16 823 822 0 0 inet_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 = 827 ( "<<=" PGUID 0 b t f 650 650 16 1004 828 0 0 inet_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 = 1004 ( ">>=" PGUID 0 b t f 650 650 16 827 826 0 0 inet_supeq intltsel intltjoinsel ));
+
/*
* function prototypes
diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h
index 1be26d5891..ae17cf1a1b 100644
--- a/src/include/catalog/pg_proc.h
+++ b/src/include/catalog/pg_proc.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_proc.h,v 1.74 1998/10/20 23:03:19 momjian Exp $
+ * $Id: pg_proc.h,v 1.75 1998/10/21 16:06:47 momjian Exp $
*
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
@@ -2068,12 +2068,17 @@ DESCR("less-equal-greater");
DATA(insert OID = 837 ( macaddr_manuf PGUID 11 f t f 1 f 25 "829" 100 0 0 100 foo bar ));
DESCR("MAC manufacturer");
-/* for ip type support */
+/* for inet type support */
DATA(insert OID = 910 ( inet_in PGUID 11 f t f 1 f 869 "0" 100 0 0 100 foo bar ));
DESCR("(internal)");
DATA(insert OID = 911 ( inet_out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar ));
DESCR("(internal)");
+/* for cidr type support */
+DATA(insert OID = 1267 ( cidr_in PGUID 11 f t f 1 f 650 "0" 100 0 0 100 foo bar ));
+DESCR("(internal)");
+
+/* 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 ));
DESCR("equal");
DATA(insert OID = 921 ( inet_lt PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100 foo bar ));
@@ -2097,12 +2102,36 @@ 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 ));
DESCR("is-supernet-or-equal");
+/* inet/cidr base versions */
DATA(insert OID = 940 ( inet_netmask PGUID 11 f t f 1 f 25 "869" 100 0 0 100 foo bar ));
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 ));
+DATA(insert OID = 941 ( inet_netmasklen PGUID 11 f t f 1 f 23 "869" 100 0 0 100 foo bar ));
DESCR("netmask length");
DATA(insert OID = 945 ( inet_broadcast PGUID 11 f t f 1 f 25 "869" 100 0 0 100 foo bar ));
DESCR("broadcast address");
+DATA(insert OID = 682 ( inet_host PGUID 11 f t f 1 f 25 "869" 100 0 0 100 foo bar ));
+DESCR("host address");
+
+/* inet versions */
+DATA(insert OID = 940 ( netmask PGUID 14 f t f 1 f 25 "869" 100 0 0 100 "select inet_netmask($1)" - ));
+DESCR("netmask of address");
+DATA(insert OID = 941 ( netmasklen PGUID 14 f t f 1 f 23 "869" 100 0 0 100 "select inet_netmasklen($1)" - ));
+DESCR("netmask length");
+DATA(insert OID = 945 ( broadcast PGUID 14 f t f 1 f 25 "869" 100 0 0 100 "select inet_broadcast($1)" - ));
+DESCR("broadcast address");
+DATA(insert OID = 682 ( host PGUID 14 f t f 1 f 25 "869" 100 0 0 100 "select inet_host($1)" - ));
+DESCR("host address");
+
+/* cidr versions */
+DATA(insert OID = 940 ( netmask PGUID 14 f t f 1 f 25 "650" 100 0 0 100 "select inet_netmask($1)" - ));
+DESCR("netmask of address");
+DATA(insert OID = 941 ( netmasklen PGUID 14 f t f 1 f 23 "650" 100 0 0 100 "select inet_netmasklen($1)" - ));
+DESCR("netmask length");
+DATA(insert OID = 945 ( broadcast PGUID 14 f t f 1 f 25 "650" 100 0 0 100 "select inet_broadcast($1)" - ));
+DESCR("broadcast address");
+DATA(insert OID = 682 ( host PGUID 14 f t f 1 f 25 "650" 100 0 0 100 "select inet_host($1)" - ));
+DESCR("host address");
+
/*
diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h
index 64118e3e9d..03a90370ac 100644
--- a/src/include/catalog/pg_type.h
+++ b/src/include/catalog/pg_type.h
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_type.h,v 1.49 1998/10/08 00:19:42 momjian Exp $
+ * $Id: pg_type.h,v 1.50 1998/10/21 16:06:48 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -301,7 +301,9 @@ DATA(insert OID = 791 ( _money PGUID -1 -1 f b t \054 0 790 array_in array
DATA(insert OID = 829 ( macaddr PGUID 6 -1 f b t \054 0 0 macaddr_in macaddr_out macaddr_in macaddr_out i _null_ ));
DESCR("MAC address");
DATA(insert OID = 869 ( inet PGUID -1 -1 f b t \054 0 0 inet_in inet_out inet_in inet_out i _null_ ));
-DESCR("IP address");
+DESCR("Host address");
+DATA(insert OID = 650 ( cidr PGUID -1 -1 f b t \054 0 0 cidr_in inet_out cidr_in inet_out i _null_ ));
+DESCR("Network address");
/* OIDS 900 - 999 */
@@ -340,6 +342,7 @@ DESCR("access control list");
DATA(insert OID = 1034 ( _aclitem PGUID -1 -1 f b t \054 0 1033 array_in array_out array_in array_out i _null_ ));
DATA(insert OID = 1040 ( _macaddr PGUID -1 -1 f b t \054 0 829 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_ ));
+DATA(insert OID = 651 ( _cidr PGUID -1 -1 f b t \054 0 650 array_in array_out array_in array_out i _null_ ));
DATA(insert OID = 1042 ( bpchar PGUID -1 -1 f b t \054 0 18 bpcharin bpcharout bpcharin bpcharout i _null_ ));
DESCR("blank-padded characters, length specifed when created");
#define BPCHAROID 1042
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 9d9989a7c9..f6048b76b6 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: builtins.h,v 1.62 1998/10/20 23:03:20 momjian Exp $
+ * $Id: builtins.h,v 1.63 1998/10/21 16:06:49 momjian Exp $
*
* NOTES
* This should normally only be included by fmgr.h.
@@ -518,6 +518,9 @@ int inet_net_pton(int af, const char *src, void *dst, size_t size);
char *inet_cidr_ntop(int af, const void *src, size_t len, int bits, char *dst, size_t size);
int inet_cidr_pton(int af, const void *src, void *dst, size_t size, int *used);
+/* cidr.c */
+inet *cidr_in(char *str);
+
/* inet.c */
inet *inet_in(char *str);
char *inet_out(inet * addr);
@@ -534,8 +537,9 @@ bool inet_supeq(inet * a1, inet * a2);
int4 inet_cmp(inet * a1, inet * a2);
text *inet_netmask(inet * addr);
-int4 inet_masklen(inet * addr);
+int4 inet_netmasklen(inet * addr);
text *inet_broadcast(inet * addr);
+text *inet_host(inet * addr);
/* mac.c */
diff --git a/src/include/utils/inet.h b/src/include/utils/inet.h
index 5b5546ffbf..ea87c6a5c5 100644
--- a/src/include/utils/inet.h
+++ b/src/include/utils/inet.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: inet.h,v 1.1 1998/10/08 00:19:45 momjian Exp $
+ * $Id: inet.h,v 1.2 1998/10/21 16:06:50 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,6 +21,7 @@ typedef struct
{
unsigned char family;
unsigned char bits;
+ unsigned char type;
union
{
unsigned int ipv4_addr; /* network byte order */