summaryrefslogtreecommitdiff
path: root/src/include/utils/inet.h
diff options
context:
space:
mode:
authorTom Lane2016-08-23 13:39:54 +0000
committerTom Lane2016-08-23 13:39:54 +0000
commit7b405b3e04779fc0a026c9c6ac3e06194948b253 (patch)
tree4d79e7916b923853e961b48c1678085458589e36 /src/include/utils/inet.h
parentf2e016f8d55ee029c5d6ec853ff6802aaf49fb0a (diff)
Refactor some network.c code to create cidr_set_masklen_internal().
Merge several copies of "copy an inet value and adjust the mask length" code to create a single, conveniently C-callable function. This function is exported for future use by inet SPGiST support, but it's good cleanup anyway since we had three slightly-different-for-no-good-reason copies. (Extracted from a larger patch, to separate new code from refactoring of old code) Emre Hasegeli
Diffstat (limited to 'src/include/utils/inet.h')
-rw-r--r--src/include/utils/inet.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/include/utils/inet.h b/src/include/utils/inet.h
index 2fe3ca8c3c8..dfa0b9f7113 100644
--- a/src/include/utils/inet.h
+++ b/src/include/utils/inet.h
@@ -28,10 +28,12 @@ typedef struct
} inet_struct;
/*
+ * We use these values for the "family" field.
+ *
* Referencing all of the non-AF_INET types to AF_INET lets us work on
* machines which may not have the appropriate address family (like
* inet6 addresses when AF_INET6 isn't present) but doesn't cause a
- * dump/reload requirement. Existing databases used AF_INET for the family
+ * dump/reload requirement. Pre-7.4 databases used AF_INET for the family
* type on disk.
*/
#define PGSQL_AF_INET (AF_INET + 0)
@@ -117,6 +119,7 @@ typedef struct macaddr
/*
* Support functions in network.c
*/
+extern inet *cidr_set_masklen_internal(const inet *src, int bits);
extern int bitncmp(const unsigned char *l, const unsigned char *r, int n);
extern int bitncommon(const unsigned char *l, const unsigned char *r, int n);