PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <sys/socket.h>
#include "access/gist.h"
#include "access/stratnum.h"
#include "utils/fmgrprotos.h"
#include "utils/inet.h"
#include "varatt.h"
Go to the source code of this file.
Data Structures | |
struct | GistInetKey |
Typedefs | |
typedef struct GistInetKey | GistInetKey |
Functions | |
Datum | inet_gist_consistent (PG_FUNCTION_ARGS) |
static void | calc_inet_union_params (GISTENTRY *ent, int m, int n, int *minfamily_p, int *maxfamily_p, int *minbits_p, int *commonbits_p) |
static void | calc_inet_union_params_indexed (GISTENTRY *ent, OffsetNumber *offsets, int noffsets, int *minfamily_p, int *maxfamily_p, int *minbits_p, int *commonbits_p) |
static GistInetKey * | build_inet_union_key (int family, int minbits, int commonbits, unsigned char *addr) |
Datum | inet_gist_union (PG_FUNCTION_ARGS) |
Datum | inet_gist_compress (PG_FUNCTION_ARGS) |
Datum | inet_gist_fetch (PG_FUNCTION_ARGS) |
Datum | inet_gist_penalty (PG_FUNCTION_ARGS) |
Datum | inet_gist_picksplit (PG_FUNCTION_ARGS) |
Datum | inet_gist_same (PG_FUNCTION_ARGS) |
#define DatumGetInetKeyP | ( | X | ) | ((GistInetKey *) DatumGetPointer(X)) |
Definition at line 88 of file network_gist.c.
#define gk_ip_addr | ( | gkptr | ) | ((gkptr)->ipaddr) |
Definition at line 99 of file network_gist.c.
#define gk_ip_addrsize | ( | gkptr | ) | (gk_ip_family(gkptr) == PGSQL_AF_INET6 ? 16 : 4) |
Definition at line 103 of file network_gist.c.
#define gk_ip_commonbits | ( | gkptr | ) | ((gkptr)->commonbits) |
Definition at line 98 of file network_gist.c.
#define gk_ip_family | ( | gkptr | ) | ((gkptr)->family) |
Definition at line 96 of file network_gist.c.
#define gk_ip_maxbits | ( | gkptr | ) | ip_family_maxbits(gk_ip_family(gkptr)) |
Definition at line 105 of file network_gist.c.
#define gk_ip_minbits | ( | gkptr | ) | ((gkptr)->minbits) |
Definition at line 97 of file network_gist.c.
#define InetKeyPGetDatum | ( | X | ) | PointerGetDatum(X) |
Definition at line 89 of file network_gist.c.
#define INETSTRAT_EQ RTEqualStrategyNumber |
Definition at line 60 of file network_gist.c.
#define INETSTRAT_GE RTGreaterEqualStrategyNumber |
Definition at line 65 of file network_gist.c.
#define INETSTRAT_GT RTGreaterStrategyNumber |
Definition at line 64 of file network_gist.c.
#define INETSTRAT_LE RTLessEqualStrategyNumber |
Definition at line 63 of file network_gist.c.
#define INETSTRAT_LT RTLessStrategyNumber |
Definition at line 62 of file network_gist.c.
#define INETSTRAT_NE RTNotEqualStrategyNumber |
Definition at line 61 of file network_gist.c.
#define INETSTRAT_OVERLAPS RTOverlapStrategyNumber |
Definition at line 59 of file network_gist.c.
#define INETSTRAT_SUB RTSubStrategyNumber |
Definition at line 66 of file network_gist.c.
#define INETSTRAT_SUBEQ RTSubEqualStrategyNumber |
Definition at line 67 of file network_gist.c.
#define INETSTRAT_SUP RTSuperStrategyNumber |
Definition at line 68 of file network_gist.c.
#define INETSTRAT_SUPEQ RTSuperEqualStrategyNumber |
Definition at line 69 of file network_gist.c.
#define ip_family_maxbits | ( | fam | ) | ((fam) == PGSQL_AF_INET6 ? 128 : 32) |
Definition at line 100 of file network_gist.c.
#define SET_GK_VARSIZE | ( | dst | ) | SET_VARSIZE_SHORT(dst, offsetof(GistInetKey, ipaddr) + gk_ip_addrsize(dst)) |
Definition at line 107 of file network_gist.c.
typedef struct GistInetKey GistInetKey |
|
static |
Definition at line 472 of file network_gist.c.
References gk_ip_addr, gk_ip_commonbits, gk_ip_family, gk_ip_minbits, palloc0(), and SET_GK_VARSIZE.
Referenced by inet_gist_picksplit(), and inet_gist_union().
|
static |
Definition at line 345 of file network_gist.c.
References Assert, bitncommon(), DatumGetInetKeyP, gk_ip_addr, gk_ip_commonbits, gk_ip_family, gk_ip_minbits, i, and sort-test::key.
Referenced by inet_gist_picksplit(), and inet_gist_union().
|
static |
Definition at line 407 of file network_gist.c.
References Assert, bitncommon(), DatumGetInetKeyP, gk_ip_addr, gk_ip_commonbits, gk_ip_family, gk_ip_minbits, i, and sort-test::key.
Referenced by inet_gist_picksplit().
Datum inet_gist_compress | ( | PG_FUNCTION_ARGS | ) |
Definition at line 542 of file network_gist.c.
References DatumGetInetPP(), DatumGetPointer(), gistentryinit, gk_ip_addr, gk_ip_addrsize, gk_ip_commonbits, gk_ip_family, gk_ip_maxbits, gk_ip_minbits, ip_addr, ip_bits, ip_family, GISTENTRY::key, GISTENTRY::leafkey, GISTENTRY::offset, GISTENTRY::page, palloc(), palloc0(), PG_GETARG_POINTER, PG_RETURN_POINTER, PointerGetDatum(), GISTENTRY::rel, and SET_GK_VARSIZE.
Datum inet_gist_consistent | ( | PG_FUNCTION_ARGS | ) |
Definition at line 115 of file network_gist.c.
References Assert, bitncmp(), DatumGetInetKeyP, elog, ERROR, GIST_LEAF, gk_ip_addr, gk_ip_commonbits, gk_ip_family, gk_ip_maxbits, gk_ip_minbits, INETSTRAT_EQ, INETSTRAT_GE, INETSTRAT_GT, INETSTRAT_LE, INETSTRAT_LT, INETSTRAT_NE, INETSTRAT_OVERLAPS, INETSTRAT_SUB, INETSTRAT_SUBEQ, INETSTRAT_SUP, INETSTRAT_SUPEQ, ip_addr, ip_bits, ip_family, GISTENTRY::key, sort-test::key, Min, PG_GETARG_INET_PP, PG_GETARG_POINTER, PG_GETARG_UINT16, and PG_RETURN_BOOL.
Datum inet_gist_fetch | ( | PG_FUNCTION_ARGS | ) |
Definition at line 590 of file network_gist.c.
References DatumGetInetKeyP, gistentryinit, gk_ip_addr, gk_ip_family, gk_ip_minbits, InetPGetDatum(), ip_addr, ip_addrsize, ip_bits, ip_family, GISTENTRY::key, sort-test::key, GISTENTRY::offset, GISTENTRY::page, palloc(), palloc0(), PG_GETARG_POINTER, PG_RETURN_POINTER, GISTENTRY::rel, and SET_INET_VARSIZE.
Datum inet_gist_penalty | ( | PG_FUNCTION_ARGS | ) |
Definition at line 620 of file network_gist.c.
References bitncommon(), DatumGetInetKeyP, gk_ip_addr, gk_ip_commonbits, gk_ip_family, gk_ip_minbits, GISTENTRY::key, Min, PG_GETARG_POINTER, and PG_RETURN_POINTER.
Datum inet_gist_picksplit | ( | PG_FUNCTION_ARGS | ) |
Definition at line 663 of file network_gist.c.
References build_inet_union_key(), calc_inet_union_params(), calc_inet_union_params_indexed(), DatumGetInetKeyP, FirstOffsetNumber, gk_ip_addr, gk_ip_family, i, ip_family_maxbits, sort-test::key, GistEntryVector::n, OffsetNumberNext, palloc(), PG_GETARG_POINTER, PG_RETURN_POINTER, PointerGetDatum(), GIST_SPLITVEC::spl_ldatum, GIST_SPLITVEC::spl_left, GIST_SPLITVEC::spl_nleft, GIST_SPLITVEC::spl_nright, GIST_SPLITVEC::spl_rdatum, GIST_SPLITVEC::spl_right, and GistEntryVector::vector.
Datum inet_gist_same | ( | PG_FUNCTION_ARGS | ) |
Definition at line 797 of file network_gist.c.
References DatumGetInetKeyP, gk_ip_addr, gk_ip_addrsize, gk_ip_commonbits, gk_ip_family, gk_ip_minbits, PG_GETARG_DATUM, PG_GETARG_POINTER, and PG_RETURN_POINTER.
Datum inet_gist_union | ( | PG_FUNCTION_ARGS | ) |
Definition at line 505 of file network_gist.c.
References build_inet_union_key(), calc_inet_union_params(), DatumGetInetKeyP, gk_ip_addr, sort-test::key, GistEntryVector::n, PG_GETARG_POINTER, PG_RETURN_POINTER, and GistEntryVector::vector.