mirror of https://github.com/postgres/postgres
parent
607cd930d5
commit
2d69fd90b9
@ -1,27 +0,0 @@ |
||||
#
|
||||
# PostgreSQL types for IP and MAC addresses
|
||||
#
|
||||
# $Id: Makefile,v 1.5 1998/06/16 05:35:10 momjian Exp $
|
||||
|
||||
all: ip.so mac.so |
||||
|
||||
ip.so: ip.o |
||||
ld -Bshareable -o ip.so ip.o
|
||||
|
||||
ip.o: ip.c |
||||
cc -g -O -fPIC -I/usr/local/pgsql/include -c ip.c
|
||||
|
||||
mac.so: mac.o |
||||
ld -Bshareable -o mac.so mac.o
|
||||
|
||||
mac.o: mac.c mac.h |
||||
cc -g -O -fPIC -I/usr/local/pgsql/include -c mac.c
|
||||
|
||||
install: ip.so mac.so |
||||
install -c ip.so mac.so /usr/local/pgsql/contrib/ip_and_macs
|
||||
|
||||
clean: |
||||
rm -f *.o *.so *.b
|
||||
#
|
||||
# eof
|
||||
#
|
@ -1,43 +0,0 @@ |
||||
|
||||
This directory contain 2 new classes - macaddr to store mac addresses |
||||
written by (Bergen, Norway, 1998-01-31, Tom Ivar Helbekkmo |
||||
(tih@Hamartun.Priv.NO)), and ipaddr type and ipaddr_ops operator class, |
||||
rewritten by me (alex@relcom.EU.net, Aleksei Roudnev, Moscow, Russia, |
||||
25.05.98) and written first by Bergen. |
||||
|
||||
To see the description of macaddr type, read README.ORIG file. To see |
||||
the description of ipaddr type, read ipaddr.html file. |
||||
^^^^^^^^^^^ |
||||
|
||||
This ipaddr type differ slightly from the original one. First, if you |
||||
input '193.124.23.0' it sets /24 prefix instead of /32 (this is in |
||||
accordance to CISCO's notification and our internal data bases and |
||||
records); if you input '0.0.0.0' it's '0.0.0.0/0' (default) but not NULL |
||||
or NOADDR value. |
||||
|
||||
Then, you can store ADDRESS/PREFIX pair, even if ADDRESS is not the |
||||
subnet address (for example, you can store interface address and mask at |
||||
the single attribute). This allow us to determine, for example, which |
||||
interfaces/routers are accessible by connected network for our interface |
||||
(select * from database where '193.124.23.4' @ interface_address); |
||||
|
||||
Then, it have been written a few new functions and a few operators |
||||
(addr1 @ addr - TRUE if addr1 is the part of subnet addr2); |
||||
'ipaddr_print' function allow you to convert address to any form you |
||||
want; and so on. |
||||
|
||||
And then, I add ipi.sql setup script and test1.sql + test2.sql test |
||||
scripts to allow and test indexing by this new class. |
||||
|
||||
This ipaddr type/opclass are used for our internal IP ROUTING and |
||||
ACCOUNTING data base, and I hope it shpuld be usefull for more people. |
||||
|
||||
For those who like crazy tasks, I propose to realise 'RTREE' indexing |
||||
method to allow effectively use '@' operation for the binding statistic |
||||
records to the customers etc networks. Note 'ipaddr' type can be written |
||||
as 'start,end' coordination pair and it's possible to define all '<<, |
||||
&<, @@, etc graphical operators over this type. |
||||
|
||||
|
||||
25.05.1998, Aleksei Roudnev, alex@relcom.EU.net, Relcom, Moscow, Russia. /+7-095-194-1995. |
||||
========================================================================================== |
@ -1,56 +0,0 @@ |
||||
PostgreSQL type extensions for IP and MAC addresses. |
||||
--------------------------------------------------- |
||||
|
||||
$Id: README.ORIG,v 1.2 1998/06/16 05:35:10 momjian Exp $ |
||||
|
||||
I needed to record IP and MAC level ethernet addresses in a data |
||||
base, and I really didn't want to store them as plain strings, with |
||||
no enforced error checking, so I put together the accompanying code |
||||
as my first experiment with adding a data type to PostgreSQL. I |
||||
then thought that this might be useful to others, both directly and |
||||
as a very simple example of how to do this sort of thing, so here |
||||
it is, in the hope that it will be useful. |
||||
|
||||
IP addresses are implemented as a 6 byte struct (this may be 1 byte |
||||
more than is useful, but I figured that since it has to be at least 5, |
||||
it might as well be an even number of bytes) that contains the four |
||||
byte address and a mask width. The external representation of an IP |
||||
address looks like '158.37.96.15/32' (or just '158.37.96.15', which is |
||||
understood to mean the same thing). This address happens to be part |
||||
of a subnet where I work; '158.37.96.0/24', which itself is a part of |
||||
the larger subnet allocated to our site, which is '158.37.96.0/21', |
||||
which again, if you go by the old book, is part of the class "B" net |
||||
called '158.37.0.0/16'. |
||||
|
||||
Input and output functions are supplied, along with the "normal" <, |
||||
<=, =, >=, > and <> operators, which all do what you expect. In |
||||
addition, there is a function to check whether a given address is a |
||||
member of a given subnet: ipaddr_in_net(addr, net), and functions to |
||||
return the netmask and the broadcast address of a given network: |
||||
ipaddr_mask(net) and ipaddr_bcast(net). |
||||
|
||||
MAC level ethernet addresses are implemented as a 6 byte struct that |
||||
contains the address as unsigned chars. Several input forms are |
||||
accepted; the following are all the same address: '08002b:010203', |
||||
'08002b-010203', '0800.2b01.0203', '08-00-2b-01-02-03' and |
||||
'08:00:2b:01:02:03'. Upper and lower case is accepted for the digits |
||||
'a' through 'f'. Output is always in the latter of the given forms. |
||||
|
||||
As with IP addresses, input and output functions are supplied as well |
||||
as the "normal" operators, which do what you expect. As an extra |
||||
feature, a function macaddr_manuf() is defined, which returns the name |
||||
of the manufacturer as a string. This is currently held in a |
||||
hard-coded struct internal to the C module -- it might be smarter to |
||||
put this information into an actual data base table, and look up the |
||||
manufacturer there. (Another TODO, for both new data types, is to |
||||
interface them to indices. If anyone can explain this to me in a way |
||||
that is easier to understand than the current documentation, I would |
||||
be most grateful!) |
||||
|
||||
I don't know what changes are needed to the Makefile for other systems |
||||
than the one I'm running (NetBSD 1.3), but anyway: to install on a BSD |
||||
system: fix the path names in the SQL files and the Makefile if you |
||||
need to, then make, make install, slurp the SQL files into psql or |
||||
whatever, and you're off. Enjoy! |
||||
|
||||
Bergen, Norway, 1998-01-31, Tom Ivar Helbekkmo (tih@Hamartun.Priv.NO). |
@ -1,448 +0,0 @@ |
||||
/*
|
||||
* PostgreSQL type definitions for IP addresses. |
||||
* |
||||
* $Id: ip.c,v 1.5 1998/06/16 05:35:10 momjian Exp $ |
||||
*/ |
||||
|
||||
#include <stdio.h> |
||||
|
||||
#include <postgres.h> |
||||
#include <utils/palloc.h> |
||||
|
||||
/*
|
||||
* This is the internal storage format for IP addresses: |
||||
*/ |
||||
|
||||
typedef struct ipaddr |
||||
{ |
||||
uint32 address; |
||||
int16 width; |
||||
} ipaddr; |
||||
|
||||
/*
|
||||
* Various forward declarations: |
||||
*/ |
||||
|
||||
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); |
||||
|
||||
int4 ipaddr_cmp(ipaddr * a1, ipaddr * a2); |
||||
|
||||
bool ipaddr_in_net(ipaddr * a1, ipaddr * a2); |
||||
ipaddr *ipaddr_mask(ipaddr * a); |
||||
ipaddr *ipaddr_bcast(ipaddr * a); |
||||
|
||||
/*
|
||||
* Build a mask of a given width: |
||||
*/ |
||||
|
||||
unsigned long |
||||
build_mask(unsigned char bits) |
||||
{ |
||||
unsigned long mask = 0; |
||||
int i; |
||||
|
||||
for (i = 0; i < bits; i++) |
||||
mask = (mask >> 1) | 0x80000000; |
||||
return mask; |
||||
} |
||||
|
||||
/*
|
||||
* IP address reader. Note how the count returned by sscanf() |
||||
* is used to determine whether the mask size was specified. |
||||
*/ |
||||
|
||||
ipaddr * |
||||
ipaddr_in(char *str) |
||||
{ |
||||
int a, |
||||
b, |
||||
c, |
||||
d, |
||||
w; |
||||
ipaddr *result; |
||||
int count; |
||||
|
||||
if (strlen(str) > 0) |
||||
{ |
||||
|
||||
count = sscanf(str, "%d.%d.%d.%d/%d", &a, &b, &c, &d, &w); |
||||
|
||||
if (count < 4) |
||||
{ |
||||
elog(ERROR, "ipaddr_in: error in parsing \"%s\"", str); |
||||
return (NULL); |
||||
} |
||||
if ( count == 3 ) { |
||||
d = 0; |
||||
count = 4; |
||||
}; |
||||
if (count == 4) |
||||
{ |
||||
w = 32; |
||||
if ( a >= 192 && a < 224 && d == 0 ) w = 24; |
||||
if ( a >= 128 && a < 192 && d == 0 && c == 0 ) w = 16; |
||||
if ( a > 0 && a < 128 && c == 0 && b == 0 && a < 128 ) w = 8; |
||||
if ( a == 0 && b == 0 && c == 0 && d == 0 ) w = 0; |
||||
}; |
||||
if ((a < 0) || (a > 255) || (b < 0) || (b > 255) || |
||||
(c < 0) || (c > 255) || (d < 0) || (d > 255) || |
||||
(w < 0) || (w > 32)) |
||||
{ |
||||
elog(ERROR, "ipaddr_in: illegal address \"%s\"", str); |
||||
return (NULL); |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
a = b = c = d = w = 255; /* special case for missing address */ |
||||
} |
||||
|
||||
result = (ipaddr *) palloc(sizeof(ipaddr)); |
||||
|
||||
result->address = (uint32) ((a << 24) | (b << 16) | (c << 8) | d); |
||||
result->width = w; |
||||
|
||||
return (result); |
||||
} |
||||
|
||||
/*
|
||||
* IP address output function. Note mask size specification |
||||
* generated only for subnets, not for plain host addresses. |
||||
*/ |
||||
|
||||
char * |
||||
ipaddr_out(ipaddr * addr) |
||||
{ |
||||
char *result; |
||||
int a, b, c, d, w; |
||||
if (addr == NULL) |
||||
return (NULL); |
||||
|
||||
result = (char *) palloc(32); |
||||
|
||||
w = addr->width; |
||||
a = (addr->address >> 24) & 0xff; |
||||
b = (addr->address >> 16) & 0xff; |
||||
c = (addr->address >> 8) & 0xff; |
||||
d = (addr->address >> 0) & 0xff; |
||||
/* Check by missing address (w > 32 ) */ |
||||
if ( w >= 0 && w <= 32 ) |
||||
{ |
||||
/* In case of NATURAL network don't output the prefix */ |
||||
if ( (a == 0 && b == 0 && c == 0 && d == 0 && w == 0 ) || |
||||
(a < 128 && b == 0 && c == 0 && d == 0 && w == 8 ) || |
||||
(a < 192 && c == 0 && d == 0 && w == 16 ) || |
||||
(a < 224 && d == 0 && w == 24 ) || |
||||
( d != 0 ) ) w = -1; |
||||
if (w == -1 ) |
||||
sprintf(result, "%d.%d.%d.%d",a,b,c,d); |
||||
else |
||||
sprintf(result, "%d.%d.%d.%d/%d",a,b,c,d,w); |
||||
} |
||||
else |
||||
{ |
||||
result[0] = 0; /* special case for missing address */ |
||||
} |
||||
return (result); |
||||
} |
||||
|
||||
/*
|
||||
* Print ipaddr by format |
||||
* %A - address |
||||
* %M - maska |
||||
* %P - prefix |
||||
* %B - negated maska |
||||
*/ |
||||
# define TXT_LEN_0 4 |
||||
text * |
||||
ipaddr_print(ipaddr * addr, text *fmt) |
||||
{ |
||||
text *result; |
||||
char *p, *op; |
||||
uint32 aaa; |
||||
int a, b, c, d; |
||||
if (addr == NULL) |
||||
return (NULL); |
||||
|
||||
result = (text *) palloc( sizeof(text) + 64 ); |
||||
|
||||
/* Check by missing address (w > 32 ) */ |
||||
for ( p = fmt->vl_dat, op = result->vl_dat; *p && (p - fmt->vl_dat) < (fmt->vl_len - TXT_LEN_0) && (op - result->vl_dat) < 48; p++) { |
||||
if ( *p != '%' ) { |
||||
*op++ = *p; |
||||
continue; |
||||
}; |
||||
p++; |
||||
if ( *p == 'A' ) |
||||
{ |
||||
aaa = addr->address; |
||||
goto pta; |
||||
}; |
||||
if ( *p == 'M' ) { |
||||
aaa = build_mask(addr->width); |
||||
goto pta; |
||||
} |
||||
if ( *p == 'B' ) { |
||||
aaa = build_mask(32 - addr->width) >> addr->width; |
||||
goto pta; |
||||
} |
||||
if ( *p == 'P' ) { |
||||
sprintf(op,"%d",addr->width); |
||||
while ( *op) op++; |
||||
continue; |
||||
}; |
||||
*op++ = *p; |
||||
continue; |
||||
pta: |
||||
a = (aaa >> 24) & 0xff; |
||||
b = (aaa >> 16) & 0xff; |
||||
c = (aaa >> 8) & 0xff; |
||||
d = (aaa >> 0) & 0xff; |
||||
sprintf(op, "%d.%d.%d.%d",a,b,c,d); |
||||
while ( *op ) op++; |
||||
continue; |
||||
}; |
||||
*op = 0; |
||||
result->vl_len = (op - result->vl_dat) + TXT_LEN_0; |
||||
return (result); |
||||
} |
||||
|
||||
/*
|
||||
* Boolean tests for magnitude. |
||||
*/ |
||||
|
||||
bool |
||||
ipaddr_lt(ipaddr * a1, ipaddr * a2) |
||||
{ |
||||
if ( a1->address == a2->address ) return(a1->width < a2->width); |
||||
return (a1->address < a2->address); |
||||
}; |
||||
|
||||
bool |
||||
ipaddr_le(ipaddr * a1, ipaddr * a2) |
||||
{ |
||||
if ( a1->address == a2->address ) return(a1->width <= a2->width); |
||||
return (a1->address <= a2->address); |
||||
}; |
||||
|
||||
bool |
||||
ipaddr_eq(ipaddr * a1, ipaddr * a2) |
||||
{ |
||||
if ( a1->address == a2->address ) return(a1->width == a2->width); |
||||
return (a1->address == a2->address); |
||||
}; |
||||
|
||||
bool |
||||
ipaddr_ge(ipaddr * a1, ipaddr * a2) |
||||
{ |
||||
if ( a1->address == a2->address ) return(a1->width >= a2->width); |
||||
return (a1->address >= a2->address); |
||||
}; |
||||
|
||||
bool |
||||
ipaddr_gt(ipaddr * a1, ipaddr * a2) |
||||
{ |
||||
if ( a1->address == a2->address ) return(a1->width > a2->width); |
||||
return (a1->address > a2->address); |
||||
}; |
||||
|
||||
bool |
||||
ipaddr_ne(ipaddr * a1, ipaddr * a2) |
||||
{ |
||||
if ( a1->address == a2->address ) return(a1->width != a2->width); |
||||
return (a1->address != a2->address); |
||||
}; |
||||
|
||||
/*
|
||||
* Comparison function for sorting: |
||||
*/ |
||||
|
||||
int4 |
||||
ipaddr_cmp(ipaddr * a1, ipaddr * a2) |
||||
{ |
||||
if (a1->address < a2->address) |
||||
return -1; |
||||
else if (a1->address > a2->address) |
||||
return 1; |
||||
else |
||||
{ |
||||
if (a1->width < a2->width) |
||||
return -1; |
||||
else if (a1->width > a2->width) |
||||
return 1; |
||||
} |
||||
return 0; |
||||
} |
||||
|
||||
/*
|
||||
* The number of hosts in the network |
||||
*/ |
||||
int4 |
||||
ipaddr_len(ipaddr * a) |
||||
{ |
||||
if ( a->width > 32 || a->width < 0 ) return(0); |
||||
return(1 << (32 - a->width)); |
||||
} |
||||
|
||||
/*
|
||||
* The number of network bits |
||||
*/ |
||||
int4 |
||||
ipaddr_pref(ipaddr * a) |
||||
{ |
||||
if ( a->width > 32 || a->width < 0 ) return(0); |
||||
return(a->width); |
||||
} |
||||
|
||||
/*
|
||||
* The host addr as an integer |
||||
*/ |
||||
int4 |
||||
ipaddr_integer(ipaddr * a) |
||||
{ |
||||
return(a->address); |
||||
} |
||||
|
||||
/*
|
||||
* Test whether an address is within a given subnet: |
||||
*/ |
||||
|
||||
bool |
||||
ipaddr_in_net(ipaddr * a1, ipaddr * a2) |
||||
{ |
||||
uint32 maskbits; |
||||
|
||||
if (a1->width < a2->width) |
||||
return FALSE; |
||||
if ((a1->width == 32) && (a2->width == 32)) |
||||
return ipaddr_eq(a1, a2); |
||||
maskbits = build_mask(a2->width); |
||||
if ((a1->address & maskbits) == (a2->address & maskbits)) |
||||
return TRUE; |
||||
return FALSE; |
||||
} |
||||
|
||||
/*
|
||||
* Test whether an address is the network or a host in the network: |
||||
*/ |
||||
|
||||
bool |
||||
ipaddr_is_net(ipaddr * a) |
||||
{ |
||||
uint32 maskbits; |
||||
|
||||
if (a->width == 32) |
||||
return FALSE; |
||||
maskbits = build_mask(a->width); |
||||
if ( (a->address & maskbits) == a->address ) |
||||
return TRUE; |
||||
return FALSE; |
||||
} |
||||
|
||||
/*
|
||||
* Pick out just the mask of a network: |
||||
*/ |
||||
|
||||
ipaddr * |
||||
ipaddr_mask(ipaddr * a) |
||||
{ |
||||
ipaddr *result; |
||||
|
||||
result = (ipaddr *) palloc(sizeof(ipaddr)); |
||||
result->address = build_mask(a->width); |
||||
result->width = 32; |
||||
|
||||
return result; |
||||
} |
||||
|
||||
/*
|
||||
* Return the broadcast address of a network: |
||||
*/ |
||||
|
||||
ipaddr * |
||||
ipaddr_bcast(ipaddr * a) |
||||
{ |
||||
ipaddr *result; |
||||
|
||||
result = (ipaddr *) palloc(sizeof(ipaddr)); |
||||
result->address = a->address; |
||||
result->address |= (build_mask(32 - a->width) >> a->width); |
||||
result->width = 32; |
||||
|
||||
return result; |
||||
} |
||||
|
||||
/*
|
||||
* Return the base network of the address/network: |
||||
*/ |
||||
|
||||
ipaddr * |
||||
ipaddr_net(ipaddr * a) |
||||
{ |
||||
ipaddr *result; |
||||
|
||||
result = (ipaddr *) palloc(sizeof(ipaddr)); |
||||
result->address = a->address; |
||||
result->address &= build_mask(a->width); |
||||
result->width = a->width; |
||||
|
||||
return result; |
||||
} |
||||
|
||||
/*
|
||||
* Compose ipaddr from ADDR and PREFIX |
||||
*/ |
||||
ipaddr * |
||||
ipaddr_compose(int4 addr, int4 pref) |
||||
{ |
||||
ipaddr *result; |
||||
|
||||
result = (ipaddr *) palloc(sizeof(ipaddr)); |
||||
if ( pref < 0 || pref > 32 ) { |
||||
pref = 255; |
||||
addr = 0; |
||||
}; |
||||
result->address = addr; |
||||
result->width = pref; |
||||
return result; |
||||
} |
||||
|
||||
/*
|
||||
* Plus and Minus operators |
||||
*/ |
||||
ipaddr * |
||||
ipaddr_plus(ipaddr * a, int4 i) |
||||
{ |
||||
ipaddr *result; |
||||
|
||||
result = (ipaddr *) palloc(sizeof(ipaddr)); |
||||
result->address = a->address + i; |
||||
result->width = a->width; |
||||
|
||||
return result; |
||||
} |
||||
|
||||
ipaddr * |
||||
ipaddr_minus(ipaddr * a, int4 i) |
||||
{ |
||||
ipaddr *result; |
||||
|
||||
result = (ipaddr *) palloc(sizeof(ipaddr)); |
||||
result->address = a->address - i; |
||||
result->width = a->width; |
||||
|
||||
return result; |
||||
} |
||||
|
||||
/*
|
||||
* eof |
||||
*/ |
@ -1,301 +0,0 @@ |
||||
-- |
||||
-- PostgreSQL code for IP addresses. |
||||
-- |
||||
-- $Id: ip.sql,v 1.5 1998/06/16 05:35:10 momjian Exp $ |
||||
-- Invoced from 1998/02/14 17:58:04 scrappy |
||||
-- |
||||
-- New - INPUT/OUTPUT, functions, indexing by btree, test. |
||||
-- PART # 1 - ip.sql - load new type, functions and operators. |
||||
-- Then you should execute ipi.sql - add ipaddr_ops class to allow indexing. |
||||
|
||||
load '/usr/local/pgsql/contrib/ip_and_macs/ip.so'; |
||||
|
||||
-- |
||||
-- Input and output functions and the type itself: |
||||
-- Note - we input 193.124.23.1 as /32, and 193.124.23.0 as /24. |
||||
-- We output /24 network withouth /24 suffix, and /32 hosts wothouth suffixes |
||||
-- if it is not '0' address of /24 network. |
||||
-- Just the same, we threat 0.0.0.0 as 0.0.0.0/0 == DEFAULT. |
||||
-- |
||||
|
||||
create function ipaddr_in(opaque) |
||||
returns opaque |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/ip.so' |
||||
language 'c'; |
||||
|
||||
|
||||
|
||||
create function ipaddr_out(opaque) |
||||
returns opaque |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/ip.so' |
||||
language 'c'; |
||||
|
||||
create type ipaddr ( |
||||
internallength = 6, |
||||
externallength = variable, |
||||
input = ipaddr_in, |
||||
output = ipaddr_out |
||||
); |
||||
|
||||
-- |
||||
-- Print address by format |
||||
-- %A - address |
||||
-- %P - /Pref |
||||
-- %M - maska |
||||
-- %B - reversed maska |
||||
drop function ipaddr_print; |
||||
create function ipaddr_print(ipaddr, text) |
||||
returns text |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/ip.so' |
||||
language 'c'; |
||||
); |
||||
|
||||
-- |
||||
-- The various boolean tests: |
||||
-- In case if addresseas are equal, we compare prefix length |
||||
-- It means 193.124.23.0/24 < 193.124.23.0/32 |
||||
-- |
||||
|
||||
create function ipaddr_lt(ipaddr, ipaddr) |
||||
returns bool |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/ip.so' |
||||
language 'c'; |
||||
|
||||
create function ipaddr_le(ipaddr, ipaddr) |
||||
returns bool |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/ip.so' |
||||
language 'c'; |
||||
|
||||
create function ipaddr_eq(ipaddr, ipaddr) |
||||
returns bool |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/ip.so' |
||||
language 'c'; |
||||
|
||||
create function ipaddr_ge(ipaddr, ipaddr) |
||||
returns bool |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/ip.so' |
||||
language 'c'; |
||||
|
||||
create function ipaddr_gt(ipaddr, ipaddr) |
||||
returns bool |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/ip.so' |
||||
language 'c'; |
||||
|
||||
create function ipaddr_ne(ipaddr, ipaddr) |
||||
returns bool |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/ip.so' |
||||
language 'c'; |
||||
|
||||
-- |
||||
-- Test if a1 is in net a2 |
||||
-- Return TRUE if a1 is IN a2 subnet or if a1 == a2 |
||||
-- |
||||
create function ipaddr_in_net(ipaddr, ipaddr) |
||||
returns bool |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/ip.so' |
||||
language 'c'; |
||||
|
||||
-- |
||||
-- Return the network from the host/network address. This means |
||||
-- 193.124.23.4/24 -> 193.124.23.0/24. |
||||
-- This allow to use interface address (with the real netmask) to create |
||||
-- network, and to link interfaces and addresses belongs to the same network. |
||||
-- |
||||
|
||||
create function ipaddr_net(ipaddr) |
||||
returns ipaddr |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/ip.so' |
||||
language 'c'; |
||||
|
||||
-- |
||||
-- Return TRUE if addr describe NETWORK, not host in the network |
||||
-- It's equivalent to ipaddr_net(a) == a |
||||
-- |
||||
|
||||
create function ipaddr_is_net(ipaddr) |
||||
returns boolean |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/ip.so' |
||||
language 'c'; |
||||
|
||||
-- |
||||
-- Return the number of the hosts in the network |
||||
-- |
||||
|
||||
create function ipaddr_len(ipaddr) |
||||
returns int4 |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/ip.so' |
||||
language 'c'; |
||||
|
||||
-- |
||||
-- Return the prefix length of the network |
||||
-- |
||||
|
||||
create function ipaddr_pref(ipaddr) |
||||
returns int4 |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/ip.so' |
||||
language 'c'; |
||||
|
||||
-- |
||||
-- Convert network into the integer. |
||||
-- Can be used for 'compose' function |
||||
-- |
||||
|
||||
create function ipaddr_integer(ipaddr) |
||||
returns int4 |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/ip.so' |
||||
language 'c'; |
||||
|
||||
-- |
||||
-- Compose ipaddr from the ADDRESS and PREF |
||||
-- ipaddr_compose(ipaddr_integer(a),ipaddr_pref(a)) == a |
||||
-- |
||||
|
||||
create function ipaddr_compose(int4,int4) |
||||
returns ipaddr |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/ip.so' |
||||
language 'c'; |
||||
|
||||
-- |
||||
-- Return MASK for the network |
||||
-- |
||||
|
||||
create function ipaddr_mask(ipaddr) |
||||
returns ipaddr |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/ip.so' |
||||
language 'c'; |
||||
|
||||
-- |
||||
-- Return BROADCAST address for the network |
||||
-- |
||||
|
||||
create function ipaddr_bcast(ipaddr) |
||||
returns ipaddr |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/ip.so' |
||||
language 'c'; |
||||
|
||||
-- |
||||
-- Compare 2 addresses. First, compare addresses, then, compare prefixes (if the addresses |
||||
-- are the same). |
||||
-- |
||||
|
||||
create function ipaddr_cmp(ipaddr,ipaddr) |
||||
returns int4 |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/ip.so' |
||||
language 'c'; |
||||
|
||||
-- |
||||
-- Plus and Minus operators |
||||
-- |
||||
|
||||
create function ipaddr_plus(ipaddr,int4) |
||||
returns ipaddr |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/ip.so' |
||||
language 'c'; |
||||
|
||||
create function ipaddr_minus(ipaddr,int4) |
||||
returns ipaddr |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/ip.so' |
||||
language 'c'; |
||||
|
||||
-- |
||||
-- Now the operators. Note how some of the parameters to some |
||||
-- of the 'create operator' commands are commented out. This |
||||
-- is because they reference as yet undefined operators, and |
||||
-- will be implicitly defined when those are, further down. |
||||
-- |
||||
|
||||
-- drop operator < ( ipaddr, ipaddr); |
||||
create operator < ( |
||||
leftarg = ipaddr, |
||||
rightarg = ipaddr, |
||||
-- negator = >=, |
||||
procedure = ipaddr_lt, |
||||
restrict = intltsel, |
||||
join = intltjoinsel |
||||
); |
||||
|
||||
-- drop operator <= (ipaddr,ipaddr); |
||||
create operator <= ( |
||||
leftarg = ipaddr, |
||||
rightarg = ipaddr, |
||||
-- negator = >, |
||||
procedure = ipaddr_le, |
||||
restrict = intltsel, |
||||
join = intltjoinsel |
||||
); |
||||
|
||||
-- drop operator = (ipaddr,ipaddr); |
||||
create operator = ( |
||||
leftarg = ipaddr, |
||||
rightarg = ipaddr, |
||||
commutator = =, |
||||
-- negator = <>, |
||||
restrict = eqsel, |
||||
join = eqjoinsel, |
||||
procedure = ipaddr_eq |
||||
); |
||||
|
||||
|
||||
-- drop operator >= (ipaddr,ipaddr); |
||||
create operator >= ( |
||||
leftarg = ipaddr, |
||||
rightarg = ipaddr, |
||||
negator = <, |
||||
procedure = ipaddr_ge, |
||||
restrict = intgtsel, |
||||
join = intgtjoinsel |
||||
); |
||||
|
||||
-- drop operator > (ipaddr,ipaddr); |
||||
create operator > ( |
||||
leftarg = ipaddr, |
||||
rightarg = ipaddr, |
||||
negator = <=, |
||||
procedure = ipaddr_gt, |
||||
restrict = intgtsel, |
||||
join = intgtjoinsel |
||||
); |
||||
|
||||
-- drop operator <> (ipaddr,ipaddr); |
||||
create operator <> ( |
||||
leftarg = ipaddr, |
||||
rightarg = ipaddr, |
||||
negator = =, |
||||
procedure = ipaddr_ne, |
||||
restrict = neqsel, |
||||
join = neqjoinsel |
||||
); |
||||
|
||||
create operator @ ( |
||||
leftarg = ipaddr, |
||||
rightarg = ipaddr, |
||||
procedure = ipaddr_in_net |
||||
); |
||||
|
||||
create operator + ( |
||||
leftarg = ipaddr, |
||||
rightarg = int4, |
||||
procedure = ipaddr_plus |
||||
); |
||||
|
||||
create operator - ( |
||||
leftarg = ipaddr, |
||||
rightarg = int4, |
||||
procedure = ipaddr_minus |
||||
); |
||||
|
||||
-- ***************************************************************************************** |
||||
-- * For now, you have: input/output (remember, '193.124.23.0' means /24 network, * |
||||
-- * '193.124.23.1' means /32 host) * |
||||
-- * <, <=, = <>, >=, > relational operations; host @ net (host is the part of the net) op * |
||||
-- * varchar ipaddr_print(addr, '%A/%P %M %B') - print by pattern function * |
||||
-- * ipaddr ipaddr_mask(a),ipaddr_bcast(a),ipaddr_net(a) functions (mask,bcast, start addr)* |
||||
-- * int4 ipaddr_len(a) - lenght of subnet; ipaddr_pref(a) - prefix length, * |
||||
-- * int4 ipaddr_integer(a) - integer value; ipaddr ipaddr_compose(integer_addr,pref_len) * |
||||
-- * compose ipaddr from addr and mask * |
||||
-- * '+' and '-' operators (ipaddr = ipaddr + integer),(ipaddr = ipaddr - integer) ops * |
||||
-- ***************************************************************************************** |
||||
-- * R E A D T H I S T E X T B E F O R E E X I T I N G : * |
||||
-- * Now you should execute ipi.sql to allow BTREE indexing on this class. * |
||||
-- ***************************************************************************************** |
||||
-- eof |
@ -1,257 +0,0 @@ |
||||
/*
|
||||
* PostgreSQL type definitions for IP addresses. |
||||
* |
||||
* $Id: ip_orig.c,v 1.1 1998/06/16 05:35:11 momjian Exp $ |
||||
*/ |
||||
|
||||
#include <stdio.h> |
||||
|
||||
#include <postgres.h> |
||||
#include <utils/palloc.h> |
||||
|
||||
/*
|
||||
* This is the internal storage format for IP addresses: |
||||
*/ |
||||
|
||||
typedef struct ipaddr |
||||
{ |
||||
uint32 address; |
||||
int16 width; |
||||
} ipaddr; |
||||
|
||||
/*
|
||||
* Various forward declarations: |
||||
*/ |
||||
|
||||
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); |
||||
|
||||
int4 ipaddr_cmp(ipaddr * a1, ipaddr * a2); |
||||
|
||||
bool ipaddr_in_net(ipaddr * a1, ipaddr * a2); |
||||
ipaddr *ipaddr_mask(ipaddr * a); |
||||
ipaddr *ipaddr_bcast(ipaddr * a); |
||||
|
||||
/*
|
||||
* Build a mask of a given width: |
||||
*/ |
||||
|
||||
unsigned long |
||||
build_mask(unsigned char bits) |
||||
{ |
||||
unsigned long mask = 0; |
||||
int i; |
||||
|
||||
for (i = 0; i < bits; i++) |
||||
mask = (mask >> 1) | 0x80000000; |
||||
return mask; |
||||
} |
||||
|
||||
/*
|
||||
* IP address reader. Note how the count returned by sscanf() |
||||
* is used to determine whether the mask size was specified. |
||||
*/ |
||||
|
||||
ipaddr * |
||||
ipaddr_in(char *str) |
||||
{ |
||||
int a, |
||||
b, |
||||
c, |
||||
d, |
||||
w; |
||||
ipaddr *result; |
||||
int count; |
||||
|
||||
if (strlen(str) > 0) |
||||
{ |
||||
|
||||
count = sscanf(str, "%d.%d.%d.%d/%d", &a, &b, &c, &d, &w); |
||||
|
||||
if (count < 4) |
||||
{ |
||||
elog(ERROR, "ipaddr_in: error in parsing \"%s\"", str); |
||||
return (NULL); |
||||
} |
||||
|
||||
if (count == 4) |
||||
w = 32; |
||||
|
||||
if ((a < 0) || (a > 255) || (b < 0) || (b > 255) || |
||||
(c < 0) || (c > 255) || (d < 0) || (d > 255) || |
||||
(w < 0) || (w > 32)) |
||||
{ |
||||
elog(ERROR, "ipaddr_in: illegal address \"%s\"", str); |
||||
return (NULL); |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
a = b = c = d = w = 0; /* special case for missing address */ |
||||
} |
||||
|
||||
result = (ipaddr *) palloc(sizeof(ipaddr)); |
||||
|
||||
result->address = (uint32) ((a << 24) | (b << 16) | (c << 8) | d); |
||||
result->address &= build_mask(w); |
||||
result->width = w; |
||||
|
||||
return (result); |
||||
} |
||||
|
||||
/*
|
||||
* IP address output function. Note mask size specification |
||||
* generated only for subnets, not for plain host addresses. |
||||
*/ |
||||
|
||||
char * |
||||
ipaddr_out(ipaddr * addr) |
||||
{ |
||||
char *result; |
||||
|
||||
if (addr == NULL) |
||||
return (NULL); |
||||
|
||||
result = (char *) palloc(32); |
||||
|
||||
if (addr->address > 0) |
||||
{ |
||||
if (addr->width == 32) |
||||
sprintf(result, "%d.%d.%d.%d", |
||||
(addr->address >> 24) & 0xff, |
||||
(addr->address >> 16) & 0xff, |
||||
(addr->address >> 8) & 0xff, |
||||
addr->address & 0xff); |
||||
else |
||||
sprintf(result, "%d.%d.%d.%d/%d", |
||||
(addr->address >> 24) & 0xff, |
||||
(addr->address >> 16) & 0xff, |
||||
(addr->address >> 8) & 0xff, |
||||
addr->address & 0xff, |
||||
addr->width); |
||||
} |
||||
else |
||||
{ |
||||
result[0] = 0; /* special case for missing address */ |
||||
} |
||||
return (result); |
||||
} |
||||
|
||||
/*
|
||||
* Boolean tests for magnitude. |
||||
*/ |
||||
|
||||
bool |
||||
ipaddr_lt(ipaddr * a1, ipaddr * a2) |
||||
{ |
||||
return (a1->address < a2->address); |
||||
}; |
||||
|
||||
bool |
||||
ipaddr_le(ipaddr * a1, ipaddr * a2) |
||||
{ |
||||
return (a1->address <= a2->address); |
||||
}; |
||||
|
||||
bool |
||||
ipaddr_eq(ipaddr * a1, ipaddr * a2) |
||||
{ |
||||
return (a1->address == a2->address); |
||||
}; |
||||
|
||||
bool |
||||
ipaddr_ge(ipaddr * a1, ipaddr * a2) |
||||
{ |
||||
return (a1->address >= a2->address); |
||||
}; |
||||
|
||||
bool |
||||
ipaddr_gt(ipaddr * a1, ipaddr * a2) |
||||
{ |
||||
return (a1->address > a2->address); |
||||
}; |
||||
|
||||
bool |
||||
ipaddr_ne(ipaddr * a1, ipaddr * a2) |
||||
{ |
||||
return (a1->address != a2->address); |
||||
}; |
||||
|
||||
/*
|
||||
* Comparison function for sorting: |
||||
*/ |
||||
|
||||
int4 |
||||
ipaddr_cmp(ipaddr * a1, ipaddr * a2) |
||||
{ |
||||
if (a1->address < a2->address) |
||||
return -1; |
||||
else if (a1->address > a2->address) |
||||
return 1; |
||||
else |
||||
return 0; |
||||
} |
||||
|
||||
/*
|
||||
* Test whether an address is within a given subnet: |
||||
*/ |
||||
|
||||
bool |
||||
ipaddr_in_net(ipaddr * a1, ipaddr * a2) |
||||
{ |
||||
uint32 maskbits; |
||||
|
||||
if (a1->width < a2->width) |
||||
return FALSE; |
||||
if ((a1->width == 32) && (a2->width == 32)) |
||||
return ipaddr_eq(a1, a2); |
||||
maskbits = build_mask(a2->width); |
||||
if ((a1->address & maskbits) == (a2->address & maskbits)) |
||||
return TRUE; |
||||
return FALSE; |
||||
} |
||||
|
||||
/*
|
||||
* Pick out just the mask of a network: |
||||
*/ |
||||
|
||||
ipaddr * |
||||
ipaddr_mask(ipaddr * a) |
||||
{ |
||||
ipaddr *result; |
||||
|
||||
result = (ipaddr *) palloc(sizeof(ipaddr)); |
||||
result->address = build_mask(a->width); |
||||
result->width = 32; |
||||
|
||||
return result; |
||||
} |
||||
|
||||
/*
|
||||
* Return the broadcast address of a network: |
||||
*/ |
||||
|
||||
ipaddr * |
||||
ipaddr_bcast(ipaddr * a) |
||||
{ |
||||
ipaddr *result; |
||||
|
||||
result = (ipaddr *) palloc(sizeof(ipaddr)); |
||||
result->address = a->address; |
||||
result->address |= (build_mask(32 - a->width) >> a->width); |
||||
result->width = 32; |
||||
|
||||
return result; |
||||
} |
||||
|
||||
/*
|
||||
* eof |
||||
*/ |
@ -1,64 +0,0 @@ |
||||
begin; |
||||
select pgam.oid from pg_am pgam |
||||
where amname = 'btree'; |
||||
-- |
||||
-- Temporary oper table |
||||
-- |
||||
-- drop table tmp_op; |
||||
create table tmp_op ( oprname name, opi int2); |
||||
-- |
||||
-- Fill in this table |
||||
-- |
||||
insert into tmp_op values('<','1'); |
||||
insert into tmp_op values('<=','2'); |
||||
insert into tmp_op values('=','3'); |
||||
insert into tmp_op values('>=','4'); |
||||
insert into tmp_op values('>','5'); |
||||
select * from tmp_op; |
||||
-- |
||||
-- Add record to the pg_opclass |
||||
-- |
||||
DELETE FROM pg_opclass WHERE opcname = 'ipaddr_ops'; |
||||
INSERT INTO pg_opclass (opcname,opcdeftype) |
||||
select 'ipaddr_ops',oid from pg_type where typname = 'ipaddr'; |
||||
-- |
||||
-- And determine oid |
||||
-- |
||||
SELECT opc.oid,opc.opcname |
||||
FROM pg_opclass opc |
||||
WHERE opc.opcname = 'ipaddr_ops'; |
||||
-- |
||||
SELECT o.oid AS opoid, o.oprname |
||||
INTO TABLE ipaddr_tmp |
||||
FROM pg_operator o, pg_type t |
||||
WHERE o.oprleft = t.oid and o.oprright = t.oid and t.typname = 'ipaddr'; |
||||
SELECT * FROM ipaddr_tmp; |
||||
-- |
||||
INSERT INTO pg_amop (amopid, amopclaid, amopopr, amopstrategy, amopselect, amopnpages) |
||||
SELECT am.oid,opcl.oid,c.opoid,t.opi,'btreesel'::regproc, 'btreenpage'::regproc |
||||
FROM pg_am am, pg_opclass opcl, ipaddr_tmp c, tmp_op t |
||||
WHERE t.oprname = c.oprname |
||||
and amname = 'btree' |
||||
and opcname = 'ipaddr_ops'; |
||||
-- |
||||
SELECT prc.oid, prc.proname FROM pg_proc prc |
||||
WHERE prc.proname = 'ipaddr_cmp'; |
||||
-- |
||||
INSERT INTO pg_amproc (amid, amopclaid, amproc, amprocnum) |
||||
SELECT pgam.oid, opc.oid,prc.oid,'1'::int2 |
||||
FROM pg_am pgam, |
||||
pg_opclass opc, |
||||
pg_proc prc |
||||
WHERE prc.proname = 'ipaddr_cmp' |
||||
and pgam.amname = 'btree' |
||||
and opc.opcname = 'ipaddr_ops'; |
||||
|
||||
drop table tmp_op; |
||||
DROP TABLE ipaddr_tmp; |
||||
COMMIT; |
||||
|
||||
-- ***************************************************************** |
||||
-- * Now you should test this by running test1.sql and test2.sql * |
||||
-- * In test2, be sure the 'explain' operator show you * |
||||
-- * search by index in the last line of output * |
||||
-- ***************************************************************** |
@ -1,244 +0,0 @@ |
||||
/*
|
||||
* PostgreSQL type definitions for MAC addresses. |
||||
* |
||||
* $Id: mac.c,v 1.3 1998/02/26 04:27:44 momjian Exp $ |
||||
*/ |
||||
|
||||
#include <stdio.h> |
||||
|
||||
#include <postgres.h> |
||||
#include <utils/palloc.h> |
||||
|
||||
#include "mac.h" |
||||
|
||||
/*
|
||||
* This is the internal storage format for MAC addresses: |
||||
*/ |
||||
|
||||
typedef struct macaddr |
||||
{ |
||||
unsigned char a; |
||||
unsigned char b; |
||||
unsigned char c; |
||||
unsigned char d; |
||||
unsigned char e; |
||||
unsigned char f; |
||||
} macaddr; |
||||
|
||||
/*
|
||||
* Various forward declarations: |
||||
*/ |
||||
|
||||
macaddr *macaddr_in(char *str); |
||||
char *macaddr_out(macaddr * addr); |
||||
|
||||
bool macaddr_lt(macaddr * a1, macaddr * a2); |
||||
bool macaddr_le(macaddr * a1, macaddr * a2); |
||||
bool macaddr_eq(macaddr * a1, macaddr * a2); |
||||
bool macaddr_ge(macaddr * a1, macaddr * a2); |
||||
bool macaddr_gt(macaddr * a1, macaddr * a2); |
||||
|
||||
bool macaddr_ne(macaddr * a1, macaddr * a2); |
||||
|
||||
int4 macaddr_cmp(macaddr * a1, macaddr * a2); |
||||
|
||||
text *macaddr_manuf(macaddr * addr); |
||||
|
||||
/*
|
||||
* Utility macros used for sorting and comparing: |
||||
*/ |
||||
|
||||
#define hibits(addr) \ |
||||
((unsigned long)((addr->a<<16)|(addr->b<<8)|(addr->c))) |
||||
|
||||
#define lobits(addr) \ |
||||
((unsigned long)((addr->c<<16)|(addr->e<<8)|(addr->f))) |
||||
|
||||
/*
|
||||
* MAC address reader. Accepts several common notations. |
||||
*/ |
||||
|
||||
macaddr * |
||||
macaddr_in(char *str) |
||||
{ |
||||
int a, |
||||
b, |
||||
c, |
||||
d, |
||||
e, |
||||
f; |
||||
macaddr *result; |
||||
int count; |
||||
|
||||
if (strlen(str) > 0) |
||||
{ |
||||
|
||||
count = sscanf(str, "%x:%x:%x:%x:%x:%x", &a, &b, &c, &d, &e, &f); |
||||
if (count != 6) |
||||
count = sscanf(str, "%x-%x-%x-%x-%x-%x", &a, &b, &c, &d, &e, &f); |
||||
if (count != 6) |
||||
count = sscanf(str, "%2x%2x%2x:%2x%2x%2x", &a, &b, &c, &d, &e, &f); |
||||
if (count != 6) |
||||
count = sscanf(str, "%2x%2x%2x-%2x%2x%2x", &a, &b, &c, &d, &e, &f); |
||||
if (count != 6) |
||||
count = sscanf(str, "%2x%2x.%2x%2x.%2x%2x", &a, &b, &c, &d, &e, &f); |
||||
|
||||
if (count != 6) |
||||
{ |
||||
elog(ERROR, "macaddr_in: error in parsing \"%s\"", str); |
||||
return (NULL); |
||||
} |
||||
|
||||
if ((a < 0) || (a > 255) || (b < 0) || (b > 255) || |
||||
(c < 0) || (c > 255) || (d < 0) || (d > 255) || |
||||
(e < 0) || (e > 255) || (f < 0) || (f > 255)) |
||||
{ |
||||
elog(ERROR, "macaddr_in: illegal address \"%s\"", str); |
||||
return (NULL); |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
a = b = c = d = e = f = 0; /* special case for missing
|
||||
* address */ |
||||
} |
||||
|
||||
result = (macaddr *) palloc(sizeof(macaddr)); |
||||
|
||||
result->a = a; |
||||
result->b = b; |
||||
result->c = c; |
||||
result->d = d; |
||||
result->e = e; |
||||
result->f = f; |
||||
|
||||
return (result); |
||||
} |
||||
|
||||
/*
|
||||
* MAC address output function. Fixed format. |
||||
*/ |
||||
|
||||
char * |
||||
macaddr_out(macaddr * addr) |
||||
{ |
||||
char *result; |
||||
|
||||
if (addr == NULL) |
||||
return (NULL); |
||||
|
||||
result = (char *) palloc(32); |
||||
|
||||
if ((hibits(addr) > 0) || (lobits(addr) > 0)) |
||||
{ |
||||
sprintf(result, "%02x:%02x:%02x:%02x:%02x:%02x", |
||||
addr->a, addr->b, addr->c, addr->d, addr->e, addr->f); |
||||
} |
||||
else |
||||
{ |
||||
result[0] = 0; /* special case for missing address */ |
||||
} |
||||
return (result); |
||||
} |
||||
|
||||
/*
|
||||
* Boolean tests. |
||||
*/ |
||||
|
||||
bool |
||||
macaddr_lt(macaddr * a1, macaddr * a2) |
||||
{ |
||||
return ((hibits(a1) < hibits(a2)) || |
||||
((hibits(a1) == hibits(a2)) && lobits(a1) < lobits(a2))); |
||||
}; |
||||
|
||||
bool |
||||
macaddr_le(macaddr * a1, macaddr * a2) |
||||
{ |
||||
return ((hibits(a1) < hibits(a2)) || |
||||
((hibits(a1) == hibits(a2)) && lobits(a1) <= lobits(a2))); |
||||
}; |
||||
|
||||
bool |
||||
macaddr_eq(macaddr * a1, macaddr * a2) |
||||
{ |
||||
return ((hibits(a1) == hibits(a2)) && (lobits(a1) == lobits(a2))); |
||||
}; |
||||
|
||||
bool |
||||
macaddr_ge(macaddr * a1, macaddr * a2) |
||||
{ |
||||
return ((hibits(a1) > hibits(a2)) || |
||||
((hibits(a1) == hibits(a2)) && lobits(a1) >= lobits(a2))); |
||||
}; |
||||
|
||||
bool |
||||
macaddr_gt(macaddr * a1, macaddr * a2) |
||||
{ |
||||
return ((hibits(a1) > hibits(a2)) || |
||||
((hibits(a1) == hibits(a2)) && lobits(a1) > lobits(a2))); |
||||
}; |
||||
|
||||
bool |
||||
macaddr_ne(macaddr * a1, macaddr * a2) |
||||
{ |
||||
return ((hibits(a1) != hibits(a2)) || (lobits(a1) != lobits(a2))); |
||||
}; |
||||
|
||||
/*
|
||||
* Comparison function for sorting: |
||||
*/ |
||||
|
||||
int4 |
||||
macaddr_cmp(macaddr * a1, macaddr * a2) |
||||
{ |
||||
if (hibits(a1) < hibits(a2)) |
||||
return -1; |
||||
else if (hibits(a1) > hibits(a2)) |
||||
return 1; |
||||
else if (lobits(a1) < lobits(a2)) |
||||
return -1; |
||||
else if (lobits(a1) > lobits(a2)) |
||||
return 1; |
||||
else |
||||
return 0; |
||||
} |
||||
|
||||
/*
|
||||
* The special manufacturer fetching function. See "mac.h". |
||||
*/ |
||||
|
||||
text * |
||||
macaddr_manuf(macaddr * addr) |
||||
{ |
||||
manufacturer *manuf; |
||||
int length; |
||||
text *result; |
||||
|
||||
for (manuf = manufacturers; manuf->name != NULL; manuf++) |
||||
{ |
||||
if ((manuf->a == addr->a) && |
||||
(manuf->b == addr->b) && |
||||
(manuf->c == addr->c)) |
||||
break; |
||||
} |
||||
if (manuf->name == NULL) |
||||
{ |
||||
result = palloc(VARHDRSZ + 1); |
||||
memset(result, 0, VARHDRSZ + 1); |
||||
VARSIZE(result) = VARHDRSZ + 1; |
||||
} |
||||
else |
||||
{ |
||||
length = strlen(manuf->name) + 1; |
||||
result = palloc(length + VARHDRSZ); |
||||
memset(result, 0, length + VARHDRSZ); |
||||
VARSIZE(result) = length + VARHDRSZ; |
||||
memcpy(VARDATA(result), manuf->name, length); |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
/*
|
||||
* eof |
||||
*/ |
@ -1,133 +0,0 @@ |
||||
/*
|
||||
* PostgreSQL type definitions for MAC addresses. |
||||
* |
||||
* $Id: mac.h,v 1.3 1998/02/26 04:27:50 momjian Exp $ |
||||
*/ |
||||
|
||||
typedef struct manufacturer |
||||
{ |
||||
unsigned char a; |
||||
unsigned char b; |
||||
unsigned char c; |
||||
char *name; |
||||
} manufacturer; |
||||
|
||||
manufacturer manufacturers[] = { |
||||
{0x00, 0x00, 0x0C, "Cisco"}, |
||||
{0x00, 0x00, 0x0E, "Fujitsu"}, |
||||
{0x00, 0x00, 0x0F, "NeXT"}, |
||||
{0x00, 0x00, 0x10, "Sytek"}, |
||||
{0x00, 0x00, 0x1D, "Cabletron"}, |
||||
{0x00, 0x00, 0x20, "DIAB"}, |
||||
{0x00, 0x00, 0x22, "Visual Technology"}, |
||||
{0x00, 0x00, 0x2A, "TRW"}, |
||||
{0x00, 0x00, 0x32, "GPT Limited"}, |
||||
{0x00, 0x00, 0x5A, "S & Koch"}, |
||||
{0x00, 0x00, 0x5E, "IANA"}, |
||||
{0x00, 0x00, 0x65, "Network General"}, |
||||
{0x00, 0x00, 0x6B, "MIPS"}, |
||||
{0x00, 0x00, 0x77, "MIPS"}, |
||||
{0x00, 0x00, 0x7A, "Ardent"}, |
||||
{0x00, 0x00, 0x89, "Cayman Systems"}, |
||||
{0x00, 0x00, 0x93, "Proteon"}, |
||||
{0x00, 0x00, 0x9F, "Ameristar Technology"}, |
||||
{0x00, 0x00, 0xA2, "Wellfleet"}, |
||||
{0x00, 0x00, 0xA3, "Network Application Technology"}, |
||||
{0x00, 0x00, 0xA6, "Network General"}, |
||||
{0x00, 0x00, 0xA7, "NCD"}, |
||||
{0x00, 0x00, 0xA9, "Network Systems"}, |
||||
{0x00, 0x00, 0xAA, "Xerox"}, |
||||
{0x00, 0x00, 0xB3, "CIMLinc"}, |
||||
{0x00, 0x00, 0xB7, "Dove Fastnet"}, |
||||
{0x00, 0x00, 0xBC, "Allen-Bradley"}, |
||||
{0x00, 0x00, 0xC0, "Western Digital"}, |
||||
{0x00, 0x00, 0xC5, "Farallon"}, |
||||
{0x00, 0x00, 0xC6, "Hewlett-Packard"}, |
||||
{0x00, 0x00, 0xC8, "Altos"}, |
||||
{0x00, 0x00, 0xC9, "Emulex"}, |
||||
{0x00, 0x00, 0xD7, "Dartmouth College"}, |
||||
{0x00, 0x00, 0xD8, "3Com (?)"}, |
||||
{0x00, 0x00, 0xDD, "Gould"}, |
||||
{0x00, 0x00, 0xDE, "Unigraph"}, |
||||
{0x00, 0x00, 0xE2, "Acer Counterpoint"}, |
||||
{0x00, 0x00, 0xEF, "Alantec"}, |
||||
{0x00, 0x00, 0xFD, "High Level Hardware"}, |
||||
{0x00, 0x01, 0x02, "BBN internal usage"}, |
||||
{0x00, 0x20, 0xAF, "3Com"}, |
||||
{0x00, 0x17, 0x00, "Kabel"}, |
||||
{0x00, 0x80, 0x64, "Wyse Technology"}, |
||||
{0x00, 0x80, 0x2B, "IMAC (?)"}, |
||||
{0x00, 0x80, 0x2D, "Xylogics, Inc."}, |
||||
{0x00, 0x80, 0x8C, "Frontier Software Development"}, |
||||
{0x00, 0x80, 0xC2, "IEEE 802.1 Committee"}, |
||||
{0x00, 0x80, 0xD3, "Shiva"}, |
||||
{0x00, 0xAA, 0x00, "Intel"}, |
||||
{0x00, 0xDD, 0x00, "Ungermann-Bass"}, |
||||
{0x00, 0xDD, 0x01, "Ungermann-Bass"}, |
||||
{0x02, 0x07, 0x01, "Racal InterLan"}, |
||||
{0x02, 0x04, 0x06, "BBN internal usage"}, |
||||
{0x02, 0x60, 0x86, "Satelcom MegaPac"}, |
||||
{0x02, 0x60, 0x8C, "3Com"}, |
||||
{0x02, 0xCF, 0x1F, "CMC"}, |
||||
{0x08, 0x00, 0x02, "3Com"}, |
||||
{0x08, 0x00, 0x03, "ACC"}, |
||||
{0x08, 0x00, 0x05, "Symbolics"}, |
||||
{0x08, 0x00, 0x08, "BBN"}, |
||||
{0x08, 0x00, 0x09, "Hewlett-Packard"}, |
||||
{0x08, 0x00, 0x0A, "Nestar Systems"}, |
||||
{0x08, 0x00, 0x0B, "Unisys"}, |
||||
{0x08, 0x00, 0x11, "Tektronix"}, |
||||
{0x08, 0x00, 0x14, "Excelan"}, |
||||
{0x08, 0x00, 0x17, "NSC"}, |
||||
{0x08, 0x00, 0x1A, "Data General"}, |
||||
{0x08, 0x00, 0x1B, "Data General"}, |
||||
{0x08, 0x00, 0x1E, "Apollo"}, |
||||
{0x08, 0x00, 0x20, "Sun"}, |
||||
{0x08, 0x00, 0x22, "NBI"}, |
||||
{0x08, 0x00, 0x25, "CDC"}, |
||||
{0x08, 0x00, 0x26, "Norsk Data"}, |
||||
{0x08, 0x00, 0x27, "PCS Computer Systems GmbH"}, |
||||
{0x08, 0x00, 0x28, "Texas Instruments"}, |
||||
{0x08, 0x00, 0x2B, "DEC"}, |
||||
{0x08, 0x00, 0x2E, "Metaphor"}, |
||||
{0x08, 0x00, 0x2F, "Prime Computer"}, |
||||
{0x08, 0x00, 0x36, "Intergraph"}, |
||||
{0x08, 0x00, 0x37, "Fujitsu-Xerox"}, |
||||
{0x08, 0x00, 0x38, "Bull"}, |
||||
{0x08, 0x00, 0x39, "Spider Systems"}, |
||||
{0x08, 0x00, 0x41, "DCA Digital Comm. Assoc."}, |
||||
{0x08, 0x00, 0x45, "Xylogics (?)"}, |
||||
{0x08, 0x00, 0x46, "Sony"}, |
||||
{0x08, 0x00, 0x47, "Sequent"}, |
||||
{0x08, 0x00, 0x49, "Univation"}, |
||||
{0x08, 0x00, 0x4C, "Encore"}, |
||||
{0x08, 0x00, 0x4E, "BICC"}, |
||||
{0x08, 0x00, 0x56, "Stanford University"}, |
||||
{0x08, 0x00, 0x58, "DECsystem 20 (?)"}, |
||||
{0x08, 0x00, 0x5A, "IBM"}, |
||||
{0x08, 0x00, 0x67, "Comdesign"}, |
||||
{0x08, 0x00, 0x68, "Ridge"}, |
||||
{0x08, 0x00, 0x69, "Silicon Graphics"}, |
||||
{0x08, 0x00, 0x6E, "Concurrent"}, |
||||
{0x08, 0x00, 0x75, "DDE"}, |
||||
{0x08, 0x00, 0x7C, "Vitalink"}, |
||||
{0x08, 0x00, 0x80, "XIOS"}, |
||||
{0x08, 0x00, 0x86, "Imagen/QMS"}, |
||||
{0x08, 0x00, 0x87, "Xyplex"}, |
||||
{0x08, 0x00, 0x89, "Kinetics"}, |
||||
{0x08, 0x00, 0x8B, "Pyramid"}, |
||||
{0x08, 0x00, 0x8D, "XyVision"}, |
||||
{0x08, 0x00, 0x90, "Retix Inc"}, |
||||
{0x48, 0x44, 0x53, "HDS (?)"}, |
||||
{0x80, 0x00, 0x10, "AT&T"}, |
||||
{0xAA, 0x00, 0x00, "DEC"}, |
||||
{0xAA, 0x00, 0x01, "DEC"}, |
||||
{0xAA, 0x00, 0x02, "DEC"}, |
||||
{0xAA, 0x00, 0x03, "DEC"}, |
||||
{0xAA, 0x00, 0x04, "DEC"}, |
||||
{0x00, 0x00, 0x00, NULL} |
||||
}; |
||||
|
||||
/*
|
||||
* eof |
||||
*/ |
@ -1,125 +0,0 @@ |
||||
-- |
||||
-- PostgreSQL code for MAC addresses. |
||||
-- |
||||
-- $Id: mac.sql,v 1.4 1998/06/16 05:35:11 momjian Exp $ |
||||
-- |
||||
|
||||
load '/usr/local/pgsql/contrib/ip_and_macs/mac.so'; |
||||
|
||||
-- |
||||
-- Input and output functions and the type itself: |
||||
-- |
||||
|
||||
create function macaddr_in(opaque) |
||||
returns opaque |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/mac.so' |
||||
language 'c'; |
||||
|
||||
create function macaddr_out(opaque) |
||||
returns opaque |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/mac.so' |
||||
language 'c'; |
||||
|
||||
create type macaddr ( |
||||
internallength = 6, |
||||
externallength = variable, |
||||
input = macaddr_in, |
||||
output = macaddr_out |
||||
); |
||||
|
||||
-- |
||||
-- The boolean tests: |
||||
-- |
||||
|
||||
create function macaddr_lt(macaddr, macaddr) |
||||
returns bool |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/mac.so' |
||||
language 'c'; |
||||
|
||||
create function macaddr_le(macaddr, macaddr) |
||||
returns bool |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/mac.so' |
||||
language 'c'; |
||||
|
||||
create function macaddr_eq(macaddr, macaddr) |
||||
returns bool |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/mac.so' |
||||
language 'c'; |
||||
|
||||
create function macaddr_ge(macaddr, macaddr) |
||||
returns bool |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/mac.so' |
||||
language 'c'; |
||||
|
||||
create function macaddr_gt(macaddr, macaddr) |
||||
returns bool |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/mac.so' |
||||
language 'c'; |
||||
|
||||
create function macaddr_ne(macaddr, macaddr) |
||||
returns bool |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/mac.so' |
||||
language 'c'; |
||||
|
||||
-- |
||||
-- Now the operators. Note how some of the parameters to some |
||||
-- of the 'create operator' commands are commented out. This |
||||
-- is because they reference as yet undefined operators, and |
||||
-- will be implicitly defined when those are, further down. |
||||
-- |
||||
|
||||
create operator < ( |
||||
leftarg = macaddr, |
||||
rightarg = macaddr, |
||||
-- negator = >=, |
||||
procedure = macaddr_lt |
||||
); |
||||
|
||||
create operator <= ( |
||||
leftarg = macaddr, |
||||
rightarg = macaddr, |
||||
-- negator = >, |
||||
procedure = macaddr_le |
||||
); |
||||
|
||||
create operator = ( |
||||
leftarg = macaddr, |
||||
rightarg = macaddr, |
||||
commutator = =, |
||||
-- negator = <>, |
||||
procedure = macaddr_eq |
||||
); |
||||
|
||||
create operator >= ( |
||||
leftarg = macaddr, |
||||
rightarg = macaddr, |
||||
negator = <, |
||||
procedure = macaddr_ge |
||||
); |
||||
|
||||
create operator > ( |
||||
leftarg = macaddr, |
||||
rightarg = macaddr, |
||||
negator = <=, |
||||
procedure = macaddr_gt |
||||
); |
||||
|
||||
create operator <> ( |
||||
leftarg = macaddr, |
||||
rightarg = macaddr, |
||||
negator = =, |
||||
procedure = macaddr_ne |
||||
); |
||||
|
||||
-- |
||||
-- Finally, the special manufacurer matching function: |
||||
-- |
||||
|
||||
create function macaddr_manuf(macaddr) |
||||
returns text |
||||
as '/usr/local/pgsql/contrib/ip_and_macs/mac.so' |
||||
language 'c'; |
||||
|
||||
-- |
||||
-- eof |
||||
-- |
@ -1,5 +0,0 @@ |
||||
insert into xx values('193.124.23.2','host2'); |
||||
insert into xx values('193.124.23.3','host3'); |
||||
insert into xx values('193.124.22.1','host4'); |
||||
insert into xx values('193.124.22.2','host5'); |
||||
insert into xx values('193.124.22.3','host6'); |
@ -1,999 +0,0 @@ |
||||
193.125.80.35 193.232.202.80 2 880 |
||||
193.125.80.35 194.87.0.22 2 574 |
||||
194.87.42.38 195.16.106.31 262 10696 |
||||
204.62.245.169 193.125.24.10 14 833 |
||||
193.125.80.35 195.24.128.65 3 180 |
||||
193.125.80.35 195.54.2.1 2 630 |
||||
193.125.80.35 195.54.192.33 7 448 |
||||
194.87.42.38 195.16.106.22 14 736 |
||||
193.125.80.35 195.210.140.7 3 1068 |
||||
194.87.41.131 195.46.160.46 10 681 |
||||
194.87.37.2 194.135.213.244 66 9088 |
||||
194.87.36.193 195.9.53.1 8 464 |
||||
194.87.36.193 194.135.2.7 8 464 |
||||
194.87.36.1 195.24.224.1 2 716 |
||||
194.87.34.44 195.16.96.2 2 164 |
||||
194.87.31.230 195.46.160.92 10 757 |
||||
194.87.24.93 195.46.160.46 9 664 |
||||
194.87.24.93 195.16.104.35 8 598 |
||||
194.87.23.28 195.210.155.149 22 1249 |
||||
194.87.22.107 195.46.160.34 76 3630 |
||||
194.87.18.152 195.90.162.2 15 666 |
||||
194.87.18.152 195.90.128.107 1 66 |
||||
193.125.80.35 62.76.114.44 2 880 |
||||
194.87.16.174 195.46.160.120 17 2276 |
||||
204.62.245.168 194.226.45.36 8 444 |
||||
194.87.16.78 195.16.104.35 8 720 |
||||
194.87.16.61 195.16.96.22 29 1248 |
||||
194.87.16.39 194.220.215.66 324 25148 |
||||
194.87.16.10 195.128.133.65 57 4301 |
||||
194.87.16.10 194.135.176.121 237 18379 |
||||
193.125.80.38 194.84.69.5 21 1929 |
||||
193.125.80.38 212.46.1.30 40 3758 |
||||
204.62.245.168 144.206.160.32 8 450 |
||||
193.125.80.44 195.151.199.4 45 2520 |
||||
194.87.15.158 195.46.160.46 2 112 |
||||
193.125.80.60 193.232.127.78 2 880 |
||||
193.125.80.60 193.232.202.80 2 864 |
||||
194.87.15.138 195.16.110.7 2 112 |
||||
193.125.80.60 195.96.65.2 2 864 |
||||
194.87.15.138 193.124.110.130 2 112 |
||||
194.87.15.1 195.90.130.133 3 84 |
||||
193.125.80.144 212.46.4.3 311 21140 |
||||
193.125.80.163 194.84.132.222 261 110114 |
||||
193.125.80.163 194.87.12.50 582 38097 |
||||
193.125.80.163 194.87.13.2 34 2499 |
||||
194.87.14.221 195.46.165.215 5 382 |
||||
193.125.81.139 195.34.34.70 107 7799 |
||||
193.125.81.140 194.67.115.130 5 220 |
||||
204.62.245.167 195.222.130.72 9 475 |
||||
204.62.245.167 193.125.242.225 2 88 |
||||
194.87.14.221 195.46.163.47 117 99564 |
||||
193.125.81.146 194.87.5.3 12 672 |
||||
193.125.81.146 194.87.12.50 4 224 |
||||
193.125.81.146 194.87.13.2 5 280 |
||||
194.87.14.221 195.46.162.91 137 21211 |
||||
193.125.81.146 195.161.0.34 2 112 |
||||
193.125.81.146 195.218.135.39 2 112 |
||||
194.87.14.221 195.12.32.8 131 132002 |
||||
194.87.14.221 193.124.252.73 530 214220 |
||||
193.125.81.148 194.67.146.145 201 8040 |
||||
193.125.81.148 194.87.5.3 49 3140 |
||||
193.125.81.148 194.87.12.50 230 12526 |
||||
193.125.81.148 194.87.13.2 31 2042 |
||||
194.87.14.216 195.210.154.154 68 32028 |
||||
193.125.81.148 194.190.218.2 8 611 |
||||
193.125.81.148 195.161.0.34 17 1473 |
||||
193.125.81.148 195.218.135.39 245 16647 |
||||
193.125.81.152 193.193.192.2 215 14797 |
||||
193.125.81.152 194.87.13.2 12 748 |
||||
193.125.81.152 195.24.128.65 27 1896 |
||||
193.125.81.152 195.54.192.118 53 3209 |
||||
194.87.14.216 195.210.154.152 83 81270 |
||||
193.125.84.12 195.46.160.45 47 2373 |
||||
193.125.84.154 195.90.128.107 1 62 |
||||
193.125.84.154 195.90.140.2 1 62 |
||||
194.87.14.203 195.210.130.62 6 821 |
||||
194.87.14.152 195.46.160.69 12 2172 |
||||
193.125.86.4 195.19.32.1 176 89133 |
||||
194.87.14.73 195.90.162.2 41 42955 |
||||
194.87.14.53 195.46.162.75 149 138236 |
||||
194.87.14.51 195.210.190.19 19 10290 |
||||
194.87.14.6 195.46.163.31 22 24836 |
||||
193.125.90.34 194.87.161.7 2 208 |
||||
193.125.90.34 194.87.161.229 13 8867 |
||||
193.125.90.34 195.54.17.33 644 81839 |
||||
194.87.14.5 193.124.97.131 53 12784 |
||||
193.125.90.130 194.58.95.62 82 7119 |
||||
194.87.13.26 212.248.36.8 14 7757 |
||||
194.87.13.26 195.98.162.111 80 39391 |
||||
194.87.13.26 195.98.161.25 70 76902 |
||||
194.87.13.26 195.46.165.196 30 14838 |
||||
194.87.13.26 195.46.161.219 47 39327 |
||||
193.125.95.121 193.124.1.131 248 101051 |
||||
194.87.13.26 194.85.149.13 28 24599 |
||||
194.87.13.21 195.98.162.9 32 16101 |
||||
194.87.13.21 195.90.136.148 84 93861 |
||||
193.125.95.121 194.186.254.26 79 5470 |
||||
194.87.13.21 195.46.162.244 10 400 |
||||
194.87.13.21 195.12.32.182 96 53171 |
||||
194.87.13.20 212.248.36.8 14 6798 |
||||
194.87.13.20 212.20.8.250 358 438254 |
||||
194.87.13.20 195.222.130.242 4 550 |
||||
194.87.13.20 195.222.130.77 8 6753 |
||||
193.125.95.124 192.124.176.69 4 538 |
||||
193.125.95.124 193.124.5.54 2 126 |
||||
194.87.13.20 195.210.143.145 4 168 |
||||
193.125.95.124 193.124.110.129 21 2181 |
||||
193.125.95.124 193.124.148.81 2 310 |
||||
194.87.13.20 195.210.136.25 4 626 |
||||
193.125.95.124 194.67.2.97 3 382 |
||||
193.125.95.124 194.84.222.2 3 382 |
||||
194.87.13.20 195.208.94.133 115 122276 |
||||
194.87.13.20 195.182.129.11 15 17177 |
||||
194.87.13.20 195.170.195.70 14 14313 |
||||
204.62.245.167 193.124.97.135 9 472 |
||||
194.87.13.20 195.144.198.159 90 40576 |
||||
194.87.13.20 195.144.192.198 79 91293 |
||||
193.125.95.124 195.222.130.67 9 745 |
||||
194.87.13.20 195.128.144.246 14 12816 |
||||
194.87.13.20 195.128.140.71 17 15901 |
||||
194.87.13.20 195.128.140.3 44 47802 |
||||
194.87.13.20 195.128.132.20 25 27119 |
||||
194.87.13.20 195.128.128.98 28 15369 |
||||
194.87.13.20 195.98.162.188 2 3000 |
||||
193.125.98.254 194.190.170.19 26 1456 |
||||
193.125.98.254 195.72.225.204 73 4088 |
||||
204.62.245.166 195.9.80.194 2 88 |
||||
204.62.245.161 193.124.182.40 2 138 |
||||
204.62.132.32 193.124.97.131 3 618 |
||||
193.125.103.137 195.46.163.141 7 372 |
||||
194.87.13.20 195.98.162.170 4 628 |
||||
193.125.121.1 193.124.22.22 2 136 |
||||
193.125.121.121 194.85.157.200 790 31921 |
||||
193.125.125.253 193.124.22.65 80 5411 |
||||
193.125.127.42 193.124.22.65 18 1368 |
||||
193.125.127.42 194.190.170.19 1227 63804 |
||||
194.87.13.20 195.98.162.155 73 70166 |
||||
194.87.13.20 195.98.162.9 323 163018 |
||||
194.87.13.20 195.98.161.32 10 9756 |
||||
194.87.13.20 195.98.161.25 4 1208 |
||||
194.87.13.20 195.90.180.25 3 568 |
||||
194.87.13.20 195.90.162.2 4 738 |
||||
194.87.13.20 195.54.8.139 42 53309 |
||||
194.87.13.20 195.54.5.129 27 13705 |
||||
194.87.13.20 195.46.164.25 11 12641 |
||||
194.87.13.20 195.46.164.16 62 74088 |
||||
194.87.13.20 195.46.163.158 35 37649 |
||||
194.87.13.20 195.46.163.89 52 57716 |
||||
194.87.13.20 195.46.163.15 11 12641 |
||||
193.125.132.129 193.124.215.71 26 4734 |
||||
193.125.132.129 193.124.222.161 5 220 |
||||
194.87.13.20 195.46.162.196 13 12813 |
||||
194.87.13.20 195.46.162.173 30 36193 |
||||
194.87.13.20 195.46.161.242 69 82486 |
||||
194.87.13.20 195.46.161.210 15 13392 |
||||
194.87.13.20 195.46.161.209 43 39183 |
||||
193.125.132.129 194.190.211.25 2 80 |
||||
194.87.13.20 195.46.161.111 85 93111 |
||||
194.87.13.20 195.46.161.100 41 8909 |
||||
194.87.13.20 195.16.102.4 5 3716 |
||||
194.87.13.20 195.16.101.109 17 20273 |
||||
194.87.13.20 195.16.101.101 93 112303 |
||||
194.87.13.20 195.16.98.99 152 171268 |
||||
194.87.13.20 195.9.103.3 11 12641 |
||||
194.87.13.20 194.220.53.195 303 100520 |
||||
194.87.13.20 194.190.56.83 8 1096 |
||||
194.87.13.20 194.85.149.18 43 48875 |
||||
194.87.13.20 194.85.137.152 30 34921 |
||||
194.87.13.20 194.58.169.23 5 590 |
||||
194.87.13.20 194.58.92.67 10 1044 |
||||
194.87.13.20 194.58.72.102 34 31635 |
||||
194.87.13.20 194.58.47.81 4 172 |
||||
194.87.13.20 193.124.241.239 53 51597 |
||||
193.125.142.40 195.54.3.15 7 500 |
||||
193.125.142.40 195.90.183.40 1 40 |
||||
193.125.143.130 195.90.128.103 13 11141 |
||||
193.125.143.135 195.46.160.46 45 2957 |
||||
204.62.129.195 195.19.1.132 10 4438 |
||||
193.125.148.150 193.124.22.65 12 912 |
||||
194.87.13.20 193.124.121.65 4 2216 |
||||
194.87.13.20 193.124.114.33 8 1084 |
||||
194.87.13.16 195.98.162.134 259 254892 |
||||
194.87.13.16 195.46.165.162 292 145058 |
||||
194.87.13.16 195.46.162.200 51 42010 |
||||
194.87.13.16 195.46.160.69 97 45411 |
||||
194.87.13.16 193.124.97.35 74 81434 |
||||
194.87.13.15 212.20.1.95 11 10485 |
||||
194.87.13.15 195.210.136.135 16 15786 |
||||
194.87.13.15 195.210.131.39 6 3168 |
||||
193.125.152.1 147.45.130.1 2 326 |
||||
194.87.13.15 195.98.162.153 136 143332 |
||||
194.87.13.15 195.98.162.9 308 168069 |
||||
194.87.13.15 195.46.165.185 1183 633028 |
||||
194.87.13.15 195.46.165.166 2 104 |
||||
194.87.13.15 195.46.164.44 70 53112 |
||||
194.87.13.15 195.46.163.156 159 113967 |
||||
194.87.13.15 195.46.162.241 64 20483 |
||||
194.87.13.15 195.46.162.30 120 95284 |
||||
194.87.13.15 195.16.101.67 115 82325 |
||||
194.87.13.15 195.9.90.85 7 600 |
||||
194.87.13.15 194.135.176.88 92 7543 |
||||
193.125.152.1 193.124.5.54 382 18328 |
||||
193.125.152.1 193.124.22.22 271 246786 |
||||
193.125.152.1 193.124.22.65 58 3504 |
||||
193.125.152.1 193.124.22.68 12 1443 |
||||
193.125.152.1 193.124.22.69 535 50134 |
||||
193.125.152.1 193.124.22.70 10 1187 |
||||
193.125.152.1 193.124.22.71 430 57506 |
||||
193.125.152.1 193.124.22.72 57 7236 |
||||
193.125.152.1 193.124.22.73 12 1443 |
||||
193.125.152.1 193.124.22.74 9 1059 |
||||
193.125.152.1 193.124.22.75 237 33658 |
||||
193.125.152.1 193.124.22.77 266 37279 |
||||
193.125.152.1 193.124.22.81 2265 522913 |
||||
193.125.152.1 193.124.22.83 739 88013 |
||||
193.125.152.1 193.124.36.45 1639 813217 |
||||
193.125.152.1 193.124.57.65 219 74665 |
||||
194.87.13.15 194.135.2.7 75 27476 |
||||
194.87.13.15 193.124.252.73 254 110171 |
||||
193.125.152.1 193.124.182.41 4 160 |
||||
193.125.152.1 193.124.241.3 15 2284 |
||||
193.125.152.1 193.124.241.14 1 244 |
||||
193.125.152.1 193.124.241.18 3 636 |
||||
193.125.152.1 193.124.241.29 19 3767 |
||||
193.125.152.1 193.124.241.40 13 3140 |
||||
193.125.152.1 193.124.241.53 32 7802 |
||||
193.125.152.1 193.124.241.58 2 420 |
||||
193.125.152.1 193.124.241.75 1 244 |
||||
193.125.152.1 193.124.241.84 4 670 |
||||
193.125.152.1 193.124.241.123 16 3574 |
||||
193.125.152.1 193.124.241.154 2 524 |
||||
193.125.152.1 193.124.241.158 44 10519 |
||||
193.125.152.1 193.124.241.229 1 200 |
||||
193.125.152.1 193.124.241.239 22 4490 |
||||
193.125.152.1 193.124.241.249 6 1748 |
||||
193.125.152.1 193.125.65.235 321 13793 |
||||
193.125.152.1 193.125.80.35 2 476 |
||||
194.87.13.15 193.124.241.39 512 271010 |
||||
194.87.13.15 193.124.32.49 1119 1170153 |
||||
194.87.13.14 195.210.136.135 188 193578 |
||||
193.125.152.1 193.232.0.205 24 1555 |
||||
193.125.152.1 193.232.21.26 17 1138 |
||||
193.125.152.1 193.232.21.31 24 2206 |
||||
193.125.152.1 193.232.69.159 8 1176 |
||||
193.125.152.1 193.232.88.17 19 1387 |
||||
193.125.152.1 193.232.119.131 783 31804 |
||||
193.125.152.1 193.232.202.12 2 818 |
||||
193.125.152.1 193.233.86.14 11 660 |
||||
193.125.152.1 193.233.86.33 11 660 |
||||
193.125.152.1 193.233.208.3 3 738 |
||||
194.87.13.12 212.248.36.8 5 1763 |
||||
194.87.13.12 212.20.8.250 49 37420 |
||||
194.87.13.12 195.210.182.31 50 3544 |
||||
194.87.13.12 195.210.179.4 37 33062 |
||||
193.125.152.1 194.58.169.17 357 155601 |
||||
193.125.152.1 194.58.201.193 6 774 |
||||
193.125.152.1 194.58.230.92 8 1576 |
||||
193.125.152.1 194.58.230.110 1 60 |
||||
193.125.152.1 194.67.2.97 10 2760 |
||||
193.125.152.1 194.67.90.1 8 448 |
||||
194.87.13.12 195.210.154.48 37 13937 |
||||
194.87.13.12 195.210.130.50 20 2117 |
||||
193.125.152.1 194.84.23.125 16 1168 |
||||
193.125.152.1 194.84.41.68 298 127287 |
||||
193.125.152.1 194.84.42.17 16 1325 |
||||
193.125.152.1 194.84.96.2 44 10261 |
||||
193.125.152.1 194.84.204.222 1 112 |
||||
193.125.152.1 194.84.242.126 10 2178 |
||||
193.125.152.1 194.85.80.238 18 1178 |
||||
193.125.152.1 194.85.128.10 25 1375 |
||||
193.125.152.1 194.85.137.89 8 440 |
||||
194.87.13.12 195.208.94.133 33 20968 |
||||
193.125.152.1 194.85.224.33 28 1708 |
||||
193.125.152.1 194.85.224.34 26 1586 |
||||
193.125.152.1 194.87.0.20 12 873 |
||||
193.125.152.1 194.87.5.3 8 448 |
||||
193.125.152.1 194.87.5.21 2 518 |
||||
193.125.152.1 194.87.13.2 4 224 |
||||
193.125.152.1 194.87.44.1 1 146 |
||||
193.125.152.1 194.87.210.41 2 402 |
||||
194.87.13.12 195.182.129.11 23 15865 |
||||
194.87.13.12 195.170.195.70 63 44135 |
||||
194.87.13.12 195.144.192.198 31 6314 |
||||
193.125.152.1 194.117.64.34 20 1271 |
||||
193.125.152.1 194.135.34.19 13 2470 |
||||
193.125.152.1 194.135.34.85 12 2254 |
||||
193.125.152.1 194.135.34.136 6 866 |
||||
193.125.152.1 194.135.34.150 2 488 |
||||
193.125.152.1 194.135.34.159 1 467 |
||||
193.125.152.1 194.135.34.212 11 2560 |
||||
193.125.152.1 194.135.34.229 2 337 |
||||
193.125.152.1 194.135.34.233 4 680 |
||||
193.125.152.1 194.135.102.10 2 414 |
||||
193.125.152.1 194.135.178.74 7 1162 |
||||
193.125.152.1 194.154.93.80 2 284 |
||||
194.87.13.12 195.128.140.3 14 872 |
||||
193.125.152.1 194.190.218.2 2 518 |
||||
194.87.13.12 195.128.130.2 4 352 |
||||
194.87.13.12 195.98.162.155 75 60095 |
||||
194.87.13.12 195.98.162.78 98 64468 |
||||
193.125.152.1 194.220.36.1 37 2850 |
||||
193.125.152.1 194.220.146.79 2 522 |
||||
194.87.13.12 195.98.162.9 62 13543 |
||||
194.87.13.12 195.98.161.59 7 476 |
||||
194.87.13.12 195.98.161.32 12 865 |
||||
204.62.128.51 195.19.1.132 43 38029 |
||||
204.62.128.48 193.124.97.153 9 3356 |
||||
204.59.144.222 194.85.149.1 2 266 |
||||
193.125.152.1 195.5.128.130 2 512 |
||||
194.87.13.12 195.98.161.25 8 3438 |
||||
193.125.152.1 195.16.104.35 5 280 |
||||
193.125.152.1 195.34.19.108 2 312 |
||||
193.125.152.1 195.34.32.11 2 476 |
||||
193.125.152.1 195.34.41.33 9 504 |
||||
194.87.13.12 195.90.136.148 32 3564 |
||||
194.87.13.12 195.90.136.143 10 890 |
||||
193.125.152.1 195.46.160.2 8 448 |
||||
193.125.152.1 195.46.160.34 2 630 |
||||
193.125.152.1 195.54.193.9 18 1405 |
||||
193.125.152.1 195.91.133.77 4 1212 |
||||
193.125.152.1 195.98.55.1 18 1405 |
||||
193.125.152.1 195.133.94.129 23 1485 |
||||
193.125.152.1 195.138.67.91 8 544 |
||||
193.125.152.1 195.138.80.33 19 1245 |
||||
193.125.152.1 195.138.80.34 20 1308 |
||||
193.125.152.1 195.146.64.131 4 472 |
||||
193.125.152.1 195.161.8.6 19 1445 |
||||
193.125.152.1 195.161.8.159 42 3569 |
||||
194.87.13.12 195.54.8.139 74 6178 |
||||
193.125.152.1 195.208.141.38 2 512 |
||||
193.125.152.1 195.209.37.18 2 670 |
||||
193.125.152.1 195.209.39.133 8 1698 |
||||
194.87.13.12 195.46.165.250 2 80 |
||||
193.125.152.1 195.218.133.114 24 1905 |
||||
194.87.13.12 195.46.165.196 9 3478 |
||||
193.125.152.1 195.230.64.66 101 4508 |
||||
193.125.152.1 195.239.88.50 37 1480 |
||||
193.125.152.1 195.239.193.64 2 476 |
||||
193.125.152.1 195.239.210.2 2 500 |
||||
194.87.13.12 195.46.164.25 69 4776 |
||||
194.87.13.12 195.46.164.17 28 16790 |
||||
194.87.13.12 195.46.163.158 30 6337 |
||||
194.87.13.12 195.46.163.89 56 28328 |
||||
194.87.13.12 195.46.163.15 8 336 |
||||
194.87.13.12 195.46.162.213 4 160 |
||||
194.87.13.12 195.46.162.206 41 25676 |
||||
194.87.13.12 195.46.162.196 54 38487 |
||||
194.87.13.12 195.46.162.173 63 40346 |
||||
194.87.13.12 195.46.162.55 7 657 |
||||
194.87.13.12 195.46.162.31 5 200 |
||||
194.87.13.12 195.46.161.242 67 20130 |
||||
194.87.13.12 195.46.161.219 5 1831 |
||||
194.87.13.12 195.46.161.210 12 13389 |
||||
194.87.13.12 195.46.161.209 64 26136 |
||||
194.87.13.12 195.46.161.111 47 3947 |
||||
194.87.13.12 195.16.101.109 31 2924 |
||||
194.87.13.12 195.16.101.101 42 3051 |
||||
194.87.13.12 195.16.98.99 13 903 |
||||
194.87.13.12 195.9.103.3 74 5122 |
||||
194.87.13.12 194.220.215.111 75 5304 |
||||
194.87.13.12 194.220.215.110 22 2367 |
||||
194.87.13.12 194.220.215.66 6 539 |
||||
194.87.13.12 194.190.82.40 14 1558 |
||||
194.87.13.12 193.125.19.101 23 2074 |
||||
194.87.13.12 193.124.241.239 10 4274 |
||||
194.87.13.12 193.124.114.33 42 13726 |
||||
193.125.152.1 62.76.114.44 9 2780 |
||||
194.87.13.8 212.20.8.250 110 87859 |
||||
194.87.13.8 195.222.130.242 4 527 |
||||
194.87.13.8 195.210.182.31 9 1222 |
||||
194.87.13.8 195.210.179.4 14 15689 |
||||
194.87.13.8 195.210.154.48 13 1602 |
||||
194.87.13.8 195.210.136.135 163 171207 |
||||
194.87.13.8 195.210.130.50 8 6213 |
||||
194.87.13.8 195.210.128.65 6 408 |
||||
194.87.13.8 195.208.94.133 63 43061 |
||||
194.87.13.8 195.208.76.33 5 355 |
||||
194.87.13.8 195.208.67.19 400 446069 |
||||
194.87.13.8 195.208.64.146 50 39549 |
||||
194.87.13.8 195.208.64.144 12 12685 |
||||
194.87.13.8 195.182.129.11 16 18647 |
||||
194.87.13.8 195.170.195.70 14 2119 |
||||
194.87.13.8 195.146.70.100 49 27151 |
||||
194.87.13.8 195.144.198.159 12 1336 |
||||
194.87.13.8 195.144.192.198 16 2213 |
||||
194.87.13.8 195.128.140.71 15 6105 |
||||
194.87.13.8 195.128.140.3 8 821 |
||||
194.87.13.8 195.98.162.170 5 699 |
||||
194.87.13.8 195.98.162.155 43 43382 |
||||
194.87.13.8 195.98.162.153 12 8634 |
||||
194.87.13.8 195.98.162.78 57 25228 |
||||
194.87.13.8 195.98.162.9 94 33009 |
||||
194.87.13.8 195.98.161.57 4 6000 |
||||
194.87.13.8 195.98.161.41 52 57725 |
||||
194.87.13.8 195.98.161.32 6 433 |
||||
194.87.13.8 195.96.174.178 17 20989 |
||||
194.87.13.8 195.96.163.66 13 8510 |
||||
194.87.13.8 195.90.188.105 169 68987 |
||||
194.87.13.8 195.90.188.98 13 13679 |
||||
194.87.13.8 195.90.185.38 100 23568 |
||||
194.87.13.8 195.90.162.2 26 9575 |
||||
194.87.13.8 195.90.136.148 25 3160 |
||||
194.87.13.8 195.90.136.143 4 2024 |
||||
194.87.13.8 195.90.132.57 4 1398 |
||||
194.87.13.8 195.54.8.139 33 10681 |
||||
194.87.13.8 195.54.5.129 4 735 |
||||
194.87.13.8 195.46.165.250 5 697 |
||||
194.87.13.8 195.46.165.215 23 10108 |
||||
194.87.13.8 195.46.164.25 25 2325 |
||||
194.87.13.8 195.46.164.17 16 11423 |
||||
194.87.13.8 195.46.164.16 9 6253 |
||||
194.87.13.8 195.46.163.171 50 24920 |
||||
194.87.13.8 195.46.163.158 19 6681 |
||||
194.87.13.8 195.46.163.156 18 19033 |
||||
194.87.13.8 195.46.163.123 11 10683 |
||||
194.87.13.8 195.46.163.89 69 36648 |
||||
194.87.13.8 195.46.163.15 4 353 |
||||
194.87.13.8 195.46.163.7 173 112297 |
||||
194.87.13.8 195.46.162.206 12 2050 |
||||
194.87.13.8 195.46.162.196 30 35369 |
||||
194.87.13.8 195.46.162.184 80 104089 |
||||
194.87.13.8 195.46.162.173 18 16346 |
||||
194.87.13.8 195.46.162.91 306 246711 |
||||
194.87.13.8 195.46.162.55 5 393 |
||||
194.87.13.8 195.46.162.31 9 557 |
||||
194.87.13.8 195.46.162.13 10 1014 |
||||
194.87.13.8 195.46.161.242 44 35502 |
||||
194.87.13.8 195.46.161.210 15 18274 |
||||
194.87.13.8 195.46.161.209 24 15531 |
||||
194.87.13.8 195.46.161.186 31 27219 |
||||
194.87.13.8 195.46.161.170 9 1482 |
||||
194.87.13.8 195.46.161.133 21 24725 |
||||
194.87.13.8 195.46.161.123 11 10683 |
||||
194.87.13.8 195.46.161.111 26 2791 |
||||
194.87.13.8 195.46.161.83 25 10320 |
||||
194.87.13.8 195.46.161.71 124 123406 |
||||
194.87.13.8 195.46.160.69 11 10785 |
||||
194.87.13.8 195.16.101.109 5 393 |
||||
193.125.152.3 158.250.39.28 2 126 |
||||
193.125.152.3 158.250.100.24 2 734 |
||||
193.125.152.3 159.93.17.7 4 234 |
||||
194.87.13.8 195.16.101.101 57 53033 |
||||
194.87.13.8 195.16.98.99 100 68835 |
||||
194.87.13.8 195.16.98.37 24 4428 |
||||
194.87.13.8 195.12.35.2 18 17726 |
||||
194.87.13.8 195.9.103.3 76 32081 |
||||
194.87.13.8 195.9.96.7 22 14498 |
||||
194.87.13.8 194.220.215.111 16 2352 |
||||
194.87.13.8 194.220.215.110 13 1554 |
||||
194.87.13.8 194.220.215.66 5 759 |
||||
194.87.13.8 194.220.53.195 7 797 |
||||
194.87.13.8 194.135.178.214 70 27886 |
||||
194.87.13.8 194.135.111.18 260 289019 |
||||
194.87.13.8 194.85.149.18 6 475 |
||||
194.87.13.8 194.58.72.102 5 703 |
||||
194.87.13.8 193.124.241.239 13 6926 |
||||
194.87.13.8 193.124.241.39 31 18403 |
||||
194.87.13.8 193.124.121.118 17 1675 |
||||
194.87.13.8 193.124.114.33 43 19148 |
||||
194.87.13.6 195.98.162.153 2 120 |
||||
194.87.13.2 212.20.8.250 16 3749 |
||||
194.87.13.2 212.20.8.246 5 1259 |
||||
194.87.13.2 212.20.1.95 33 7367 |
||||
194.87.13.2 195.238.68.234 9 2454 |
||||
194.87.13.2 195.222.138.108 7 1203 |
||||
194.87.13.2 195.222.130.242 21 5860 |
||||
194.87.13.2 195.210.190.19 19 4260 |
||||
194.87.13.2 195.210.189.1 5 1119 |
||||
194.87.13.2 195.210.182.31 35 26895 |
||||
194.87.13.2 195.210.176.170 4 1079 |
||||
194.87.13.2 195.210.174.6 5 1119 |
||||
194.87.13.2 195.210.164.25 5 1119 |
||||
194.87.13.2 195.210.154.164 9 2484 |
||||
194.87.13.2 195.210.154.152 8 1376 |
||||
193.125.152.3 192.188.189.3 2 136 |
||||
194.87.13.2 195.210.154.48 43 28721 |
||||
194.87.13.2 195.210.150.2 31 6855 |
||||
194.87.13.2 195.210.148.242 17 2910 |
||||
194.87.13.2 195.210.143.145 7 2110 |
||||
194.87.13.2 195.210.136.145 20 3862 |
||||
194.87.13.2 195.210.136.135 9 1423 |
||||
194.87.13.2 195.210.136.131 7 1353 |
||||
194.87.13.2 195.210.130.50 16 14690 |
||||
194.87.13.2 195.208.94.133 33 9913 |
||||
194.87.13.2 195.208.93.154 9 1411 |
||||
194.87.13.2 195.208.72.139 4 1079 |
||||
194.87.13.2 195.208.72.47 8 2154 |
||||
194.87.13.2 195.208.67.19 4 1079 |
||||
194.87.13.2 195.208.67.10 8 1376 |
||||
194.87.13.2 195.208.64.152 4 1079 |
||||
194.87.13.2 195.208.64.144 6 2066 |
||||
193.125.152.3 193.124.5.37 11 1336 |
||||
193.125.152.3 193.124.5.50 2 266 |
||||
193.125.152.3 193.124.5.54 4 692 |
||||
193.125.152.3 193.124.22.22 11 2138 |
||||
193.125.152.3 193.124.22.65 141 15806 |
||||
193.125.152.3 193.124.32.129 5 1116 |
||||
193.125.152.3 193.124.57.100 3 197 |
||||
193.125.152.3 193.124.76.86 1 278 |
||||
194.87.13.2 195.208.64.129 6 1167 |
||||
193.125.152.3 193.124.110.130 2 766 |
||||
193.125.152.3 193.124.134.19 4 548 |
||||
194.87.13.2 195.182.129.8 9 3525 |
||||
193.125.152.3 193.124.148.73 9 1408 |
||||
193.125.152.3 193.124.171.67 2 354 |
||||
193.125.152.3 193.124.182.40 2 144 |
||||
193.125.152.3 193.124.241.39 2 356 |
||||
193.125.152.3 193.124.241.83 4 866 |
||||
194.87.13.2 195.182.128.2 39 9020 |
||||
193.125.152.3 193.124.250.22 79 12968 |
||||
193.125.152.3 193.125.80.35 2 300 |
||||
194.87.13.2 195.170.195.70 55 42078 |
||||
194.87.13.2 195.146.71.226 5 1119 |
||||
194.87.13.2 195.146.71.178 53 11410 |
||||
194.87.13.2 195.146.70.100 6 2070 |
||||
194.87.13.2 195.146.70.97 7 1199 |
||||
194.87.13.2 195.144.198.159 44 14597 |
||||
194.87.13.2 195.144.192.198 17 4040 |
||||
194.87.13.2 195.128.144.142 7 2110 |
||||
194.87.13.2 195.128.144.133 6 2342 |
||||
194.87.13.2 195.128.140.71 19 16072 |
||||
194.87.13.2 195.128.140.3 22 5159 |
||||
194.87.13.2 195.128.139.110 13 2642 |
||||
194.87.13.2 195.128.139.94 18 6772 |
||||
193.125.152.3 193.193.193.100 2 132 |
||||
193.125.152.3 193.193.193.107 4 1148 |
||||
193.125.152.3 193.193.226.226 3 489 |
||||
194.87.13.2 195.128.138.136 6 1309 |
||||
194.87.13.2 195.128.136.186 20 4622 |
||||
193.125.152.3 193.232.8.20 5 323 |
||||
193.125.152.3 193.232.68.1 2 120 |
||||
193.125.152.3 193.232.88.17 44 4923 |
||||
193.125.152.3 193.232.88.125 2 388 |
||||
193.125.152.3 193.232.112.1 2 134 |
||||
193.125.152.3 193.232.127.78 20 4237 |
||||
193.125.152.3 193.232.212.12 9 1177 |
||||
193.125.152.3 193.232.232.66 4 1210 |
||||
193.125.152.3 193.233.48.9 7 447 |
||||
193.125.152.3 193.233.48.65 2 130 |
||||
193.125.152.3 193.233.56.200 2 294 |
||||
193.125.152.3 193.233.78.1 2 276 |
||||
193.125.152.3 193.233.86.14 4 240 |
||||
193.125.152.3 193.233.86.33 4 240 |
||||
193.125.152.3 193.233.192.19 2 118 |
||||
193.125.152.3 193.233.208.3 4 238 |
||||
193.125.152.3 193.233.224.1 4 800 |
||||
194.87.13.2 195.128.136.71 6 1159 |
||||
194.87.13.2 195.128.134.99 5 1264 |
||||
194.87.13.2 195.128.132.70 23 6787 |
||||
194.87.13.2 195.128.129.155 4 1079 |
||||
194.87.13.2 195.128.128.98 30 17304 |
||||
193.125.152.3 194.44.157.250 2 134 |
||||
194.87.13.2 195.128.128.70 5 2372 |
||||
194.87.13.2 195.128.128.66 8 2422 |
||||
193.125.152.3 194.58.101.95 12 2368 |
||||
193.125.152.3 194.58.124.24 2 320 |
||||
194.87.13.2 195.128.128.3 5 1187 |
||||
193.125.152.3 194.58.230.249 7 1050 |
||||
194.87.13.2 195.112.226.35 23 956 |
||||
193.125.152.3 194.67.1.154 9 1436 |
||||
193.125.152.3 194.67.2.97 11 1861 |
||||
193.125.152.3 194.67.2.98 12 973 |
||||
193.125.152.3 194.67.66.176 2 122 |
||||
193.125.152.3 194.67.82.228 2 552 |
||||
193.125.152.3 194.67.110.2 4 688 |
||||
193.125.152.3 194.67.114.81 3 198 |
||||
193.125.152.3 194.67.114.193 5 330 |
||||
193.125.152.3 194.67.115.35 5 330 |
||||
193.125.152.3 194.67.115.38 2 412 |
||||
193.125.152.3 194.67.128.130 2 330 |
||||
194.87.13.2 195.98.162.189 11 2282 |
||||
194.87.13.2 195.98.162.182 10 3433 |
||||
194.87.13.2 195.98.162.170 56 55418 |
||||
194.87.13.2 195.98.162.165 12 2318 |
||||
193.125.152.3 194.84.2.73 2 298 |
||||
193.125.152.3 194.84.17.34 17 2183 |
||||
193.125.152.3 194.84.21.18 6 1320 |
||||
193.125.152.3 194.84.23.125 21 1523 |
||||
193.125.152.3 194.84.31.233 11 5316 |
||||
193.125.152.3 194.84.32.67 2 138 |
||||
193.125.152.3 194.84.39.28 7 981 |
||||
193.125.152.3 194.84.48.11 2 130 |
||||
193.125.152.3 194.84.54.130 2 358 |
||||
193.125.152.3 194.84.86.6 1 58 |
||||
193.125.152.3 194.84.96.57 6 387 |
||||
193.125.152.3 194.84.122.1 20 1460 |
||||
193.125.152.3 194.84.132.2 8 2208 |
||||
193.125.152.3 194.84.167.1 2 146 |
||||
193.125.152.3 194.84.168.49 4 670 |
||||
193.125.152.3 194.84.204.131 2 146 |
||||
193.125.152.3 194.84.204.222 2 476 |
||||
193.125.152.3 194.84.206.3 5 305 |
||||
193.125.152.3 194.84.206.193 18 1098 |
||||
193.125.152.3 194.84.223.2 2 148 |
||||
193.125.152.3 194.84.243.71 2 300 |
||||
194.87.13.2 195.98.162.164 9 1287 |
||||
194.87.13.2 195.98.162.160 29 8361 |
||||
194.87.13.2 195.98.162.155 8 2174 |
||||
194.87.13.2 195.98.162.151 15 3499 |
||||
194.87.13.2 195.98.162.147 6 1300 |
||||
193.125.152.3 194.85.128.10 28 1552 |
||||
193.125.152.3 194.85.137.89 76 4180 |
||||
194.87.13.2 195.98.162.141 22 5639 |
||||
194.87.13.2 195.98.162.135 35 10480 |
||||
194.87.13.2 195.98.162.131 31 25682 |
||||
194.87.13.2 195.98.162.118 5 1262 |
||||
194.87.13.2 195.98.162.114 6 1159 |
||||
193.125.152.3 194.85.200.204 6 816 |
||||
193.125.152.3 194.85.224.33 68 4150 |
||||
193.125.152.3 194.85.224.34 64 3904 |
||||
193.125.152.3 194.87.0.8 4 294 |
||||
193.125.152.3 194.87.0.22 50 8498 |
||||
193.125.152.3 194.87.0.242 24 4272 |
||||
193.125.152.3 194.87.37.2 2 308 |
||||
193.125.152.3 194.87.43.111 2 114 |
||||
193.125.152.3 194.87.110.35 2 114 |
||||
193.125.152.3 194.87.157.34 2 318 |
||||
193.125.152.3 194.87.161.7 2 430 |
||||
193.125.152.3 194.87.162.120 2 308 |
||||
193.125.152.3 194.87.186.1 4 692 |
||||
193.125.152.3 194.87.210.41 2 112 |
||||
193.125.152.3 194.87.224.99 5 875 |
||||
193.125.152.3 194.87.233.66 2 238 |
||||
193.125.152.3 194.87.239.39 2 358 |
||||
194.87.13.2 195.98.162.111 5 1119 |
||||
194.87.13.2 195.98.162.102 7 1341 |
||||
194.87.13.2 195.98.162.97 5 2030 |
||||
194.87.13.2 195.98.162.94 13 2362 |
||||
194.87.13.2 195.98.162.78 134 104964 |
||||
194.87.13.2 195.98.162.77 6 1163 |
||||
194.87.13.2 195.98.162.73 15 5512 |
||||
194.87.13.2 195.98.162.72 26 5763 |
||||
194.87.13.2 195.98.162.66 4 1225 |
||||
194.87.13.2 195.98.162.9 231 74902 |
||||
194.87.13.2 195.98.161.71 13 3581 |
||||
193.125.152.3 194.135.2.131 16 3134 |
||||
193.125.152.3 194.135.34.42 3 733 |
||||
193.125.152.3 194.135.34.85 11 2042 |
||||
193.125.152.3 194.135.34.136 6 866 |
||||
194.87.13.2 195.98.161.67 10 2513 |
||||
193.125.152.3 194.135.102.10 8 1490 |
||||
193.125.152.3 194.135.161.11 13 1287 |
||||
193.125.152.3 194.154.82.67 2 304 |
||||
193.125.152.3 194.154.82.122 2 102 |
||||
194.87.13.2 195.98.161.59 20 4472 |
||||
193.125.152.3 194.186.38.34 2 298 |
||||
193.125.152.3 194.186.113.254 5 644 |
||||
193.125.152.3 194.186.170.253 2 476 |
||||
193.125.152.3 194.186.208.51 4 550 |
||||
193.125.152.3 194.186.212.137 2 336 |
||||
193.125.152.3 194.186.254.23 2 360 |
||||
194.87.13.2 195.98.161.57 28 6345 |
||||
193.125.152.3 194.190.105.2 2 232 |
||||
193.125.152.3 194.190.163.127 6 702 |
||||
193.125.152.3 194.190.195.66 4 268 |
||||
193.125.152.3 194.190.199.1 2 430 |
||||
193.125.152.3 194.190.215.113 10 1471 |
||||
193.125.152.3 194.190.216.124 2 448 |
||||
193.125.152.3 194.190.218.2 4 598 |
||||
194.87.13.2 195.98.161.46 8 1387 |
||||
194.87.13.2 195.98.161.40 11 3193 |
||||
194.87.13.2 195.98.161.33 13 3387 |
||||
194.87.13.2 195.98.160.174 5 1119 |
||||
194.87.13.2 195.98.160.148 11 1907 |
||||
194.87.13.2 195.98.160.146 8 428 |
||||
194.87.13.2 195.96.163.66 37 22436 |
||||
194.87.13.2 195.90.188.112 8 2150 |
||||
194.87.13.2 195.90.188.111 5 1237 |
||||
193.125.152.3 194.220.146.79 2 322 |
||||
194.87.13.2 195.90.188.105 27 7280 |
||||
193.125.152.3 194.226.167.195 14 1947 |
||||
194.87.13.2 195.90.188.101 1 1089 |
||||
194.87.13.2 195.90.186.228 7 1332 |
||||
194.87.13.2 195.90.185.38 20 3294 |
||||
194.87.13.2 195.90.183.122 12 3627 |
||||
194.87.13.2 195.90.180.25 22 18568 |
||||
204.58.155.18 144.206.2.1 3 173 |
||||
204.57.67.249 194.58.72.120 4 160 |
||||
204.57.67.150 195.146.67.100 5 200 |
||||
204.57.67.150 194.58.72.120 4 160 |
||||
204.57.67.146 195.146.67.100 5 200 |
||||
204.57.67.146 194.58.72.120 4 160 |
||||
194.87.13.2 195.90.180.12 4 1300 |
||||
194.87.13.2 195.90.162.2 53 15773 |
||||
193.125.152.3 195.5.128.130 4 814 |
||||
193.125.152.3 195.5.141.6 11 1500 |
||||
193.125.152.3 195.5.151.21 5 615 |
||||
194.87.13.2 195.90.158.23 3 1035 |
||||
194.87.13.2 195.90.152.133 3 124 |
||||
193.125.152.3 195.7.179.36 4 744 |
||||
194.87.13.2 195.90.146.80 4 1075 |
||||
194.87.13.2 195.90.145.35 6 2070 |
||||
193.125.152.3 195.9.90.65 66 14486 |
||||
193.125.152.3 195.9.90.70 3 615 |
||||
193.125.152.3 195.9.94.33 2 140 |
||||
193.125.152.3 195.12.66.1 4 250 |
||||
193.125.152.3 195.16.96.2 3 482 |
||||
193.125.152.3 195.16.101.2 2 126 |
||||
193.125.152.3 195.16.114.47 3 192 |
||||
194.87.13.2 195.90.145.1 3 1180 |
||||
193.125.152.3 195.19.160.1 6 1066 |
||||
193.125.152.3 195.19.188.66 4 248 |
||||
194.87.13.2 195.90.142.27 7 2280 |
||||
194.87.13.2 195.90.137.230 4 1075 |
||||
194.87.13.2 195.90.136.148 4 1276 |
||||
194.87.13.2 195.90.136.143 4 1260 |
||||
194.87.13.2 195.90.136.135 6 2066 |
||||
193.125.152.3 195.26.160.48 3 434 |
||||
193.125.152.3 195.34.0.1 4 618 |
||||
193.125.152.3 195.34.17.13 4 843 |
||||
193.125.152.3 195.34.32.11 2 352 |
||||
193.125.152.3 195.34.41.33 3 495 |
||||
193.125.152.3 195.46.160.4 7 1412 |
||||
193.125.152.3 195.46.163.120 42 9840 |
||||
193.125.152.3 195.54.2.1 9 1433 |
||||
193.125.152.3 195.54.192.33 20 2704 |
||||
193.125.152.3 195.54.193.30 2 230 |
||||
194.87.13.2 195.90.136.82 10 2230 |
||||
194.87.13.2 195.90.134.250 7 2387 |
||||
193.125.152.3 195.90.128.103 2 455 |
||||
193.125.152.3 195.90.128.107 3 197 |
||||
193.125.152.3 195.90.136.1 2 286 |
||||
193.125.152.3 195.90.158.139 6 318 |
||||
193.125.152.3 195.90.184.66 15 2690 |
||||
193.125.152.3 195.91.133.54 28 5845 |
||||
193.125.152.3 195.96.65.2 23 5249 |
||||
193.125.152.3 195.98.64.65 2 494 |
||||
193.125.152.3 195.98.162.10 2 520 |
||||
193.125.152.3 195.98.163.16 2 144 |
||||
194.87.13.2 195.90.132.67 7 1199 |
||||
194.87.13.2 195.90.132.57 9 2318 |
||||
193.125.152.3 195.128.128.1 18 1801 |
||||
193.125.152.3 195.133.0.8 6 420 |
||||
193.125.152.3 195.133.103.1 2 274 |
||||
194.87.13.2 195.90.132.10 7 2256 |
||||
193.125.152.3 195.146.64.42 5 736 |
||||
193.125.152.3 195.146.72.34 4 232 |
||||
194.87.13.2 195.90.132.3 9 2190 |
||||
194.87.13.2 195.90.128.103 27 7388 |
||||
193.125.152.3 195.151.16.12 2 288 |
||||
193.125.152.3 195.151.16.13 2 436 |
||||
193.125.152.3 195.151.35.66 9 1339 |
||||
193.125.152.3 195.151.108.130 2 280 |
||||
193.125.152.3 195.151.163.75 3 552 |
||||
193.125.152.3 195.161.0.135 6 543 |
||||
193.125.152.3 195.161.20.33 3 552 |
||||
193.125.152.3 195.161.21.2 3 186 |
||||
193.125.152.3 195.161.21.130 5 291 |
||||
193.125.152.3 195.178.199.130 2 104 |
||||
193.125.152.3 195.208.49.11 2 282 |
||||
193.125.152.3 195.208.72.3 3 363 |
||||
193.125.152.3 195.208.93.132 3 416 |
||||
194.87.13.2 195.72.224.74 16 3667 |
||||
194.87.13.2 195.54.8.139 28 17598 |
||||
193.125.152.3 195.208.248.36 2 512 |
||||
193.125.152.3 195.208.252.2 2 346 |
||||
193.125.152.3 195.208.252.180 2 118 |
||||
193.125.152.3 195.209.0.6 4 236 |
||||
193.125.152.3 195.209.63.161 2 446 |
||||
193.125.152.3 195.210.128.6 2 264 |
||||
194.87.13.2 195.54.6.67 5 1266 |
||||
194.87.13.2 195.54.5.129 60 27325 |
||||
193.125.152.3 195.218.218.37 4 264 |
||||
193.125.152.3 195.222.130.67 3 186 |
||||
193.125.152.3 195.239.46.189 2 706 |
||||
193.125.152.3 195.239.193.64 2 374 |
||||
193.125.152.3 195.239.210.2 1 51 |
||||
194.87.13.2 195.54.2.8 6 1438 |
||||
194.87.13.2 195.46.165.248 16 6178 |
||||
194.87.13.2 195.46.165.239 10 4284 |
||||
194.87.13.2 195.46.165.227 8 2254 |
||||
194.87.13.2 195.46.165.226 11 6825 |
||||
194.87.13.2 195.46.165.204 6 2070 |
||||
194.87.13.2 195.46.165.200 70 42657 |
||||
194.87.13.2 195.46.165.196 10 4963 |
||||
194.87.13.2 195.46.165.194 7 2110 |
||||
194.87.13.2 195.46.165.193 10 5874 |
||||
194.87.13.2 195.46.165.191 7 2400 |
||||
194.87.13.2 195.46.165.172 14 11492 |
||||
194.87.13.2 195.46.165.162 19 11262 |
||||
194.87.13.2 195.46.165.158 7 2382 |
||||
194.87.13.2 195.46.165.151 8 2254 |
||||
194.87.13.2 195.46.165.145 161 74887 |
||||
194.87.13.2 195.46.165.135 26 11996 |
||||
194.87.13.2 195.46.165.133 14 5629 |
||||
194.87.13.2 195.46.164.27 11 2278 |
||||
194.87.13.2 195.46.164.25 64 67188 |
||||
194.87.13.2 195.46.164.17 35 26017 |
||||
194.87.13.2 195.46.164.16 6 1300 |
||||
194.87.13.2 195.46.164.8 14 5798 |
||||
194.87.13.2 195.46.164.6 5 1254 |
||||
194.87.13.2 195.46.164.2 4 1079 |
||||
194.87.13.2 195.46.163.180 5 1187 |
||||
194.87.13.2 195.46.163.178 25 2053 |
||||
194.87.13.2 195.46.163.174 5 1119 |
||||
194.87.13.2 195.46.163.160 8 1365 |
||||
194.87.13.2 195.46.163.159 5 1119 |
||||
194.87.13.2 195.46.163.158 28 17225 |
||||
194.87.13.2 195.46.163.156 16 3397 |
||||
194.87.13.2 195.46.163.147 6 1163 |
||||
194.87.13.2 195.46.163.136 5 1119 |
||||
194.87.13.2 195.46.163.133 10 2370 |
||||
194.87.13.2 195.46.163.132 6 1284 |
||||
194.87.13.2 195.46.163.123 15 3503 |
||||
194.87.13.2 195.46.163.120 14 3613 |
||||
194.87.13.2 195.46.163.105 6 1294 |
||||
194.87.13.2 195.46.163.94 5 1119 |
||||
194.87.13.2 195.46.163.89 132 107364 |
||||
194.87.13.2 195.46.163.76 13 2646 |
||||
194.87.13.2 195.46.163.65 20 4627 |
||||
194.87.13.2 195.46.163.60 8 1239 |
||||
194.87.13.2 195.46.163.47 7 2110 |
||||
194.87.13.2 195.46.163.38 17 3593 |
||||
194.87.13.2 195.46.163.31 9 2378 |
||||
194.87.13.2 195.46.163.30 14 2506 |
||||
194.87.13.2 195.46.163.13 18 3681 |
||||
194.87.13.2 195.46.163.7 21 3885 |
||||
194.87.13.2 195.46.162.243 19 4865 |
||||
194.87.13.2 195.46.162.226 8 2440 |
||||
194.87.13.2 195.46.162.221 21 2981 |
||||
194.87.13.2 195.46.162.218 5 1265 |
||||
194.87.13.2 195.46.162.213 5 1257 |
||||
194.87.13.2 195.46.162.206 59 43287 |
||||
194.87.13.2 195.46.162.203 5 1119 |
||||
194.87.13.2 195.46.162.196 18 14883 |
||||
194.87.13.2 195.46.162.193 5 1119 |
||||
194.87.13.2 195.46.162.184 13 1455 |
||||
194.87.13.2 195.46.162.180 5 1119 |
||||
194.87.13.2 195.46.162.179 9 3109 |
||||
194.87.13.2 195.46.162.177 4 1079 |
||||
194.87.13.2 195.46.162.173 8 2499 |
||||
194.87.13.2 195.46.162.172 6 1159 |
||||
194.87.13.2 195.46.162.169 8 2420 |
||||
194.87.13.2 195.46.162.165 4 1079 |
||||
194.87.13.2 195.46.162.120 5 1119 |
||||
194.87.13.2 195.46.162.119 5 1262 |
||||
194.87.13.2 195.46.162.104 4 1079 |
||||
194.87.13.2 195.46.162.100 6 1290 |
||||
194.87.13.2 195.46.162.72 5 1119 |
||||
194.87.13.2 195.46.162.70 10 2373 |
||||
194.87.13.2 195.46.162.60 14 3601 |
||||
194.87.13.2 195.46.162.55 27 28360 |
||||
194.87.13.2 195.46.162.53 7 1203 |
||||
194.87.13.2 195.46.162.47 21 3887 |
||||
194.87.13.2 195.46.162.42 12 2624 |
||||
194.87.13.2 195.46.162.40 11 2420 |
||||
194.87.13.2 195.46.162.34 11 2411 |
||||
194.87.13.2 195.46.162.30 7 1207 |
||||
194.87.13.2 195.46.162.28 18 3603 |
||||
194.87.13.2 195.46.162.13 42 51477 |
||||
194.87.13.2 195.46.162.8 5 1119 |
||||
194.87.13.2 195.46.162.6 9 2452 |
||||
194.87.13.2 195.46.162.1 14 2562 |
||||
194.87.13.2 195.46.161.252 5 1119 |
||||
194.87.13.2 195.46.161.251 21 4943 |
||||
194.87.13.2 195.46.161.236 5 1260 |
||||
193.125.152.3 212.192.34.200 2 298 |
||||
193.125.152.3 212.248.39.3 3 174 |
||||
194.87.13.2 195.46.161.233 5 1262 |
||||
194.87.13.2 195.46.161.224 11 1508 |
||||
194.87.13.2 195.46.161.217 22 5891 |
||||
194.87.13.2 195.46.161.209 11 2619 |
||||
194.87.13.2 195.46.161.207 20 2351 |
||||
193.125.152.3 62.76.0.1 12 888 |
||||
193.125.152.3 62.76.114.44 4 861 |
||||
194.87.13.2 195.46.161.205 5 1119 |
||||
194.87.13.2 195.46.161.201 5 1262 |
||||
194.87.13.2 195.46.161.199 13 4623 |
||||
194.87.13.2 195.46.161.186 90 82991 |
||||
193.125.152.4 193.124.1.131 20 1742 |
||||
193.125.152.4 193.124.22.81 402 73761 |
||||
193.125.152.4 193.124.36.34 37 8132 |
||||
193.125.152.4 193.124.188.65 101 48405 |
||||
193.125.152.4 193.125.44.76 6 240 |
||||
193.125.152.4 193.125.80.35 37 3336 |
||||
193.125.152.4 193.233.208.3 4 240 |
||||
193.125.152.4 194.58.38.18 36 3384 |
||||
194.87.13.2 195.46.161.184 5 1119 |
||||
193.125.152.4 194.58.124.17 39 3399 |
||||
193.125.152.4 194.58.212.34 25 3742 |
||||
193.125.152.4 194.67.80.42 25 1795 |
||||
193.125.152.4 194.84.44.35 18 1638 |
||||
193.125.152.4 194.87.0.20 82 19845 |
||||
193.125.152.4 194.87.160.195 17 1150 |
||||
193.125.152.4 194.87.206.137 19 1690 |
||||
193.125.152.4 194.87.211.1 103 8898 |
||||
194.87.13.2 195.46.161.177 6 2360 |
||||
194.87.13.2 195.46.161.172 5 1259 |
||||
193.125.152.4 194.154.92.129 31 5655 |
||||
193.125.152.4 194.186.221.251 19 1238 |
||||
193.125.152.4 194.186.254.26 62 31955 |
||||
193.125.152.4 194.190.194.33 16 1534 |
||||
194.87.13.2 195.46.161.171 16 3685 |
||||
204.57.67.27 194.58.72.120 4 160 |
||||
193.125.152.4 195.9.16.2 23 1913 |
||||
193.125.152.4 195.12.66.81 16 1534 |
||||
194.87.13.2 195.46.161.170 32 7476 |
||||
193.125.152.4 195.54.2.7 17 1586 |
||||
193.125.152.4 195.58.1.145 35 7789 |
||||
193.125.152.4 195.90.136.21 94 11466 |
||||
193.125.152.4 195.222.130.67 17 1577 |
||||
193.125.152.4 195.239.88.50 21 1220 |
||||
194.87.13.2 195.46.161.164 7 2364 |
||||
194.87.13.2 195.46.161.156 12 2478 |
||||
194.87.13.2 195.46.161.155 6 1296 |
||||
194.87.13.2 195.46.161.154 11 2282 |
||||
194.87.13.2 195.46.161.153 5 1256 |
||||
194.87.13.2 195.46.161.146 6 252 |
||||
194.87.13.2 195.46.161.113 11 3596 |
||||
194.87.13.2 195.46.161.111 16 3598 |
||||
193.125.152.5 193.124.22.65 18 1368 |
||||
194.87.13.2 195.46.161.109 4 1079 |
||||
194.87.13.2 195.46.161.85 10 1383 |
||||
194.87.13.2 195.46.161.84 21 4799 |
||||
194.87.13.2 195.46.161.83 121 57225 |
||||
194.87.13.2 195.46.161.75 3 124 |
||||
193.125.152.6 193.124.22.22 2 88 |
||||
193.125.152.6 193.124.22.65 15 930 |
||||
193.125.152.6 193.232.119.131 2 80 |
||||
194.87.13.2 195.46.160.69 147 34960 |
||||
193.125.152.6 194.226.235.33 6 254 |
||||
194.87.13.2 195.38.160.38 10 1591 |
||||
194.87.13.2 195.16.108.139 10 9589 |
||||
193.125.152.6 195.91.161.2 4 176 |
||||
193.125.152.6 195.128.140.2 19 5145 |
||||
193.125.152.6 195.161.24.66 23 1283 |
||||
194.87.13.2 195.16.108.135 8 3272 |
||||
194.87.13.2 195.16.102.4 8 2154 |
||||
194.87.13.2 195.16.101.101 4 1280 |
||||
194.87.13.2 195.16.101.67 72 52581 |
||||
193.125.152.6 212.46.3.250 4 176 |
||||
193.125.152.8 193.124.22.65 4 224 |
||||
194.87.13.2 195.16.98.235 22 3020 |
||||
193.125.152.8 193.124.224.35 14 2571 |
||||
194.87.13.2 195.16.98.230 7 1330 |
||||
194.87.13.2 195.16.98.209 10 3463 |
||||
194.87.13.2 195.16.98.204 27 5394 |
||||
194.87.13.2 195.16.98.194 13 3269 |
||||
194.87.13.2 195.16.98.193 14 4507 |
||||
194.87.13.2 195.16.98.99 7 1400 |
||||
194.87.13.2 195.16.98.37 44 49756 |
||||
194.87.13.2 195.16.98.13 14 3317 |
||||
193.125.152.10 158.250.26.145 18 1368 |
||||
194.87.13.2 195.16.96.9 11 2554 |
||||
194.87.13.2 195.12.32.170 8 3451 |
||||
193.125.152.10 193.124.22.65 18 1368 |
||||
193.125.152.10 193.233.11.84 4 304 |
||||
193.125.152.10 194.67.64.33 18 1368 |
||||
193.125.152.10 194.67.65.17 18 1368 |
||||
193.125.152.10 194.67.65.18 18 1368 |
||||
193.125.152.10 194.67.65.130 18 1368 |
||||
193.125.152.10 194.67.106.209 20 1520 |
||||
193.125.152.10 194.84.127.22 12 912 |
||||
194.87.13.2 195.12.32.165 27 4363 |
||||
194.87.13.2 195.12.32.52 5 2138 |
||||
194.87.13.2 195.12.32.7 4 1219 |
||||
193.125.152.10 194.190.105.2 2 152 |
||||
193.125.152.10 194.190.105.4 1 76 |
||||
193.125.152.10 194.190.105.7 2 152 |
||||
193.125.152.10 195.5.128.42 18 1368 |
||||
193.125.152.10 195.5.138.6 18 1368 |
||||
193.125.152.10 195.5.138.44 16 1216 |
||||
193.125.152.10 195.26.160.48 15 1140 |
||||
193.125.152.10 195.26.160.50 18 1368 |
||||
193.125.152.10 195.54.192.1 2 152 |
||||
193.125.152.10 195.54.192.43 2 152 |
||||
193.125.152.10 195.133.94.129 4 336 |
||||
193.125.152.10 195.151.111.45 13 988 |
||||
194.87.13.2 195.9.176.153 18 5299 |
||||
194.87.13.2 195.9.103.3 184 183787 |
||||
194.87.13.2 195.9.96.7 96 66779 |
||||
193.125.152.12 193.124.22.65 2 152 |
||||
193.125.152.15 193.124.22.65 18 1368 |
||||
193.125.152.16 193.124.22.65 15 1140 |
||||
193.125.152.17 193.124.22.22 12 906 |
||||
193.125.152.17 193.124.22.65 12 912 |
||||
193.125.152.18 193.124.22.65 2 152 |
||||
204.57.67.9 195.146.67.100 5 200 |
||||
194.87.13.2 195.9.94.33 11 2544 |
||||
193.125.152.19 193.124.22.65 13 988 |
||||
194.87.13.2 195.9.90.85 139 61939 |
||||
194.87.13.2 195.9.67.45 18 3485 |
||||
193.125.152.23 193.124.22.65 4 246 |
||||
194.87.13.2 195.9.47.230 7 2488 |
||||
193.125.152.23 194.87.0.28 3783 538698 |
||||
193.125.152.23 194.186.254.26 6986 644105 |
||||
194.87.13.2 194.220.215.111 73 61702 |
||||
193.125.152.24 192.124.174.67 5717 2168144 |
||||
194.87.13.2 194.220.215.110 56 45039 |
||||
193.125.152.24 193.124.97.131 504 27627 |
||||
194.87.13.2 194.220.215.66 59 35775 |
||||
194.87.13.2 194.220.169.1 32 14343 |
||||
193.125.152.24 193.125.95.121 1040 572488 |
||||
194.87.13.2 194.220.140.106 6 1159 |
||||
194.87.13.2 194.190.105.4 40 8033 |
||||
194.87.13.2 194.190.82.40 34 24976 |
||||
193.125.152.24 194.58.72.102 2072 1038564 |
||||
193.125.152.24 194.58.110.33 649 310072 |
||||
194.87.13.2 194.190.56.83 11 1499 |
@ -1,71 +0,0 @@ |
||||
-- |
||||
-- A quick test of the IP address code |
||||
-- |
||||
-- $Id: test.sql,v 1.2 1998/06/16 05:35:12 momjian Exp $ |
||||
-- This is original test (it was written before my changes in this class). alex. |
||||
|
||||
-- temporary table: |
||||
create table addresses (address ipaddr); |
||||
|
||||
-- sample data from two subnets: |
||||
insert into addresses values ('158.37.96.15'); |
||||
insert into addresses values ('158.37.96.16'); |
||||
insert into addresses values ('158.37.96.17'); |
||||
insert into addresses values ('158.37.97.15'); |
||||
insert into addresses values ('158.37.97.16'); |
||||
insert into addresses values ('158.37.97.17'); |
||||
insert into addresses values ('158.37.98.15'); |
||||
insert into addresses values ('158.37.98.16'); |
||||
insert into addresses values ('158.37.98.17'); |
||||
insert into addresses values ('158.37.96.150'); |
||||
insert into addresses values ('158.37.96.160'); |
||||
insert into addresses values ('158.37.96.170'); |
||||
insert into addresses values ('158.37.97.150'); |
||||
insert into addresses values ('158.37.97.160'); |
||||
insert into addresses values ('158.37.97.170'); |
||||
insert into addresses values ('158.37.98.150'); |
||||
insert into addresses values ('158.37.98.160'); |
||||
insert into addresses values ('158.37.98.170'); |
||||
|
||||
-- show them all: |
||||
select * from addresses; |
||||
|
||||
-- select the ones in subnet 96: |
||||
select * from addresses where ipaddr_in_net(address, '158.37.96.0/24'); |
||||
|
||||
-- select the ones not in subnet 96: |
||||
select * from addresses where not ipaddr_in_net(address, '158.37.96.0/24'); |
||||
|
||||
-- select the ones in subnet 97: |
||||
select * from addresses where ipaddr_in_net(address, '158.37.97.0/24'); |
||||
|
||||
-- select the ones not in subnet 97: |
||||
select * from addresses where not ipaddr_in_net(address, '158.37.97.0/24'); |
||||
|
||||
-- select the ones in subnet 96 or 97, sorted: |
||||
select * from addresses where ipaddr_in_net(address, '158.37.96.0/23') |
||||
order by address; |
||||
|
||||
-- now some networks: |
||||
create table networks (network ipaddr); |
||||
|
||||
-- now the subnets mentioned above: |
||||
insert into networks values ('158.37.96.0/24'); |
||||
insert into networks values ('158.37.97.0/24'); |
||||
insert into networks values ('158.37.98.0/24'); |
||||
|
||||
-- select the netmasks of the net containing each: |
||||
select address, ipaddr_mask(network) from addresses, networks |
||||
where ipaddr_in_net(address, network); |
||||
|
||||
-- select the broadcast address of the net containing each: |
||||
select address, ipaddr_bcast(network) from addresses, networks |
||||
where ipaddr_in_net(address, network); |
||||
|
||||
-- tidy up: |
||||
drop table addresses; |
||||
drop table networks; |
||||
|
||||
-- |
||||
-- eof |
||||
-- |
@ -1,11 +0,0 @@ |
||||
drop table stat_t; |
||||
create table stat_t(i1 ipaddr, i2 ipaddr, p int4, b int4); |
||||
create index stat_i1 on stat_t using btree (i1 ipaddr_ops); |
||||
create index stat_i2 on stat_t using btree (i2 ipaddr_ops); |
||||
copy stat_t from '/v/noc/src/ip_class/test.DATA' using delimiters ' '; |
||||
-- |
||||
-- Please, check if your test data are not in /v/noc/src/ip_class/test.DATA file, |
||||
-- edit test1.sql file and repeatr it. |
||||
-- |
||||
-- If everything is OK, you should run test2.sql now |
||||
-- |
@ -1,26 +0,0 @@ |
||||
vacuum verbose analyze stat_t (i1,i2); |
||||
-- |
||||
-- |
||||
select i2,sum(b) as b |
||||
into tmp |
||||
from stat_t |
||||
where i1 >= '144.206.0.0' and i1 <= '144.206.255.255' |
||||
group by i2; |
||||
insert into tmp |
||||
select '0.0.0.0' as i2,sum(b) as k |
||||
from tmp |
||||
where b < 10 * 1024; |
||||
delete from tmp |
||||
where b < 10 * 1024 and i2 <> '0.0.0.0'; |
||||
select i2,b / 1024 as k from tmp |
||||
order by k desc; |
||||
select ipaddr_print(i2,'%A/%P'),b from tmp where i2 = '0.0.0.0'; |
||||
drop table tmp; |
||||
explain select i2,sum(b) as b |
||||
into tmp |
||||
from stat_t |
||||
where i1 >= '144.206.0.0' and i1 <= '144.206.255.255' |
||||
group by i2; |
||||
-- ******************************************************** |
||||
-- * Now remove test table by 'drop table stat_t' command * |
||||
-- ******************************************************** |
@ -0,0 +1,74 @@ |
||||
PostgreSQL type extensions for IP and MAC addresses. |
||||
--------------------------------------------------- |
||||
|
||||
$Id: README.ipaddr,v 1.1 1998/10/03 05:40:41 momjian Exp $ |
||||
|
||||
I needed to record IP and MAC level ethernet addresses in a data |
||||
base, and I really didn't want to store them as plain strings, with |
||||
no enforced error checking, so I put together the accompanying code |
||||
as my first experiment with adding a data type to PostgreSQL. I |
||||
then thought that this might be useful to others, both directly and |
||||
as a very simple example of how to do this sort of thing, so I |
||||
submitted it to the PostgreSQL project for inclusion in the contrib |
||||
directory. Since then, that directory has been modified to contain |
||||
Aleksei Roudnev's implementation, which is based on mine. |
||||
|
||||
For those who have seen my previous contribution of these types, note |
||||
that much has changed: I've modified the IP address type to work the |
||||
way Paul Vixie did with his CIDR type. In fact, I've pretty much just |
||||
stolen his solution, modifying it into my framework in such a way as |
||||
to facilitate the addition of IPV6 handling code in the future. I've |
||||
pretty much ignored Aleksei's C code, but I've added his SQL code to |
||||
enter the necessary operators into the various system tables needed to |
||||
make the types indexable. |
||||
|
||||
IP addresses are implemented as a struct of fixed in-memory length, |
||||
but variable on-disk storage size. For IPV4, it contains the address |
||||
family (AF_INET), the CIDR prefix length and four byte address. For |
||||
IPV6, the address family will be different, and the address longer. |
||||
|
||||
The external representation of an IP address generally looks like |
||||
'158.37.96.15/32'. This address happens to be part of a subnet where |
||||
I work; '158.37.96.0/24', which itself is a part of the larger subnet |
||||
allocated to our site, which is '158.37.96.0/21', which again, if you |
||||
go by the old book, is part of the class "B" net '158.37.0.0/16'. |
||||
|
||||
Input and output functions are supplied, along with the "normal" <, |
||||
<=, =, >=, > and <> operators, which all do what you expect. In |
||||
addition, there are operators to check for networks or addresses being |
||||
subnets of or addresses contained within other networks. << tests |
||||
whether the left operand is contained within the right, <<= includes |
||||
equality, >> and >>= do the same things the opposite way. |
||||
|
||||
The input and output functions use routines from Paul Vixie's BIND, |
||||
and I've snarfed the source files inet_net_ntop.c and inet_net_pton.c |
||||
directly from a recent distribution of that code. They are included |
||||
here to avoid the need to fetch and install the BIND libraries to be |
||||
able to use this code. IANAL, but it looks from the copyright |
||||
messages in the files as if this should be acceptable. Read the |
||||
documentation in inet_net_pton.c to see the legal input formats. |
||||
|
||||
MAC level ethernet addresses are implemented as a 6 byte struct that |
||||
contains the address as unsigned chars. Several input forms are |
||||
accepted; the following are all the same address: '08002b:010203', |
||||
'08002b-010203', '0800.2b01.0203', '08-00-2b-01-02-03' and |
||||
'08:00:2b:01:02:03'. Upper and lower case is accepted for the digits |
||||
'a' through 'f'. Output is always in the latter of the given forms. |
||||
|
||||
As with IP addresses, input and output functions are supplied as well |
||||
as the "normal" operators, which do what you expect. As an extra |
||||
feature, a function macaddr_manuf() is defined, which returns the name |
||||
of the manufacturer as a string. This is currently held in a |
||||
hard-coded struct internal to the C module -- it might be smarter to |
||||
put this information into an actual data base table, and look up the |
||||
manufacturer there. |
||||
|
||||
Many thanks to Aleksei Roudnev and Paul Vixie for their fine work! |
||||
|
||||
I don't know what changes are needed to the Makefile for other systems |
||||
than the one I'm running (NetBSD 1.3), but anyway: to install on a BSD |
||||
system: fix the path names in the Makefile if you need to, then make, |
||||
make install, slurp the SQL files into psql or whatever, and you're |
||||
off. Enjoy! |
||||
|
||||
Bergen, Norway, 1998-08-09, Tom Ivar Helbekkmo (tih@nhh.no). |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,137 @@ |
||||
/*
|
||||
* Copyright (c) 1996 by Internet Software Consortium. |
||||
* |
||||
* Permission to use, copy, modify, and distribute this software for any |
||||
* purpose with or without fee is hereby granted, provided that the above |
||||
* copyright notice and this permission notice appear in all copies. |
||||
* |
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS |
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES |
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE |
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS |
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS |
||||
* SOFTWARE. |
||||
*/ |
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint) |
||||
static const char rcsid[] = "$Id: inet_net_ntop.c,v 1.1 1998/10/03 05:40:48 momjian Exp $"; |
||||
|
||||
#endif |
||||
|
||||
#include <sys/types.h> |
||||
#include <sys/socket.h> |
||||
#include <netinet/in.h> |
||||
#include <arpa/inet.h> |
||||
|
||||
#include <errno.h> |
||||
#include <stdio.h> |
||||
#include <string.h> |
||||
#include <stdlib.h> |
||||
|
||||
#ifdef SPRINTF_CHAR |
||||
#define SPRINTF(x) strlen(sprintf/**/x) |
||||
#else |
||||
#define SPRINTF(x) ((size_t)sprintf x) |
||||
#endif |
||||
|
||||
static char *inet_net_ntop_ipv4(const u_char *src, int bits, |
||||
char *dst, size_t size); |
||||
|
||||
/*
|
||||
* char * |
||||
* inet_net_ntop(af, src, bits, dst, size) |
||||
* convert network number from network to presentation format. |
||||
* generates CIDR style result always. |
||||
* return: |
||||
* pointer to dst, or NULL if an error occurred (check errno). |
||||
* author: |
||||
* Paul Vixie (ISC), July 1996 |
||||
*/ |
||||
char * |
||||
inet_net_ntop(int af, const void *src, int bits, char *dst, size_t size) |
||||
{ |
||||
switch (af) |
||||
{ |
||||
case AF_INET: |
||||
return (inet_net_ntop_ipv4(src, bits, dst, size)); |
||||
default: |
||||
errno = EAFNOSUPPORT; |
||||
return (NULL); |
||||
} |
||||
} |
||||
|
||||
/*
|
||||
* static char * |
||||
* inet_net_ntop_ipv4(src, bits, dst, size) |
||||
* convert IPv4 network number from network to presentation format. |
||||
* generates CIDR style result always. |
||||
* return: |
||||
* pointer to dst, or NULL if an error occurred (check errno). |
||||
* note: |
||||
* network byte order assumed. this means 192.5.5.240/28 has |
||||
* 0x11110000 in its fourth octet. |
||||
* author: |
||||
* Paul Vixie (ISC), July 1996 |
||||
*/ |
||||
static char * |
||||
inet_net_ntop_ipv4(const u_char *src, int bits, char *dst, size_t size) |
||||
{ |
||||
char *odst = dst; |
||||
char *t; |
||||
u_int m; |
||||
int b; |
||||
|
||||
if (bits < 0 || bits > 32) |
||||
{ |
||||
errno = EINVAL; |
||||
return (NULL); |
||||
} |
||||
if (bits == 0) |
||||
{ |
||||
if (size < sizeof "0") |
||||
goto emsgsize; |
||||
*dst++ = '0'; |
||||
*dst = '\0'; |
||||
} |
||||
|
||||
/* Format whole octets. */ |
||||
for (b = bits / 8; b > 0; b--) |
||||
{ |
||||
if (size < sizeof "255.") |
||||
goto emsgsize; |
||||
t = dst; |
||||
dst += SPRINTF((dst, "%u", *src++)); |
||||
if (b > 1) |
||||
{ |
||||
*dst++ = '.'; |
||||
*dst = '\0'; |
||||
} |
||||
size -= (size_t) (dst - t); |
||||
} |
||||
|
||||
/* Format partial octet. */ |
||||
b = bits % 8; |
||||
if (b > 0) |
||||
{ |
||||
if (size < sizeof ".255") |
||||
goto emsgsize; |
||||
t = dst; |
||||
if (dst != odst) |
||||
*dst++ = '.'; |
||||
m = ((1 << b) - 1) << (8 - b); |
||||
dst += SPRINTF((dst, "%u", *src & m)); |
||||
size -= (size_t) (dst - t); |
||||
} |
||||
|
||||
/* Format CIDR /width. */ |
||||
if (size < sizeof "/32") |
||||
goto emsgsize; |
||||
dst += SPRINTF((dst, "/%u", bits)); |
||||
return (odst); |
||||
|
||||
emsgsize: |
||||
errno = EMSGSIZE; |
||||
return (NULL); |
||||
} |
@ -0,0 +1,217 @@ |
||||
/*
|
||||
* Copyright (c) 1996 by Internet Software Consortium. |
||||
* |
||||
* Permission to use, copy, modify, and distribute this software for any |
||||
* purpose with or without fee is hereby granted, provided that the above |
||||
* copyright notice and this permission notice appear in all copies. |
||||
* |
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS |
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES |
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE |
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS |
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS |
||||
* SOFTWARE. |
||||
*/ |
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint) |
||||
static const char rcsid[] = "$Id: inet_net_pton.c,v 1.1 1998/10/03 05:40:49 momjian Exp $"; |
||||
|
||||
#endif |
||||
|
||||
#include <sys/types.h> |
||||
#include <sys/socket.h> |
||||
#include <netinet/in.h> |
||||
#include <arpa/inet.h> |
||||
|
||||
#include <assert.h> |
||||
#include <ctype.h> |
||||
#include <errno.h> |
||||
#include <stdio.h> |
||||
#include <string.h> |
||||
#include <stdlib.h> |
||||
|
||||
#ifdef SPRINTF_CHAR |
||||
#define SPRINTF(x) strlen(sprintf/**/x) |
||||
#else |
||||
#define SPRINTF(x) ((size_t)sprintf x) |
||||
#endif |
||||
|
||||
static int inet_net_pton_ipv4(const char *src, u_char *dst, size_t size); |
||||
|
||||
/*
|
||||
* static int |
||||
* inet_net_pton(af, src, dst, size) |
||||
* convert network number from presentation to network format. |
||||
* accepts hex octets, hex strings, decimal octets, and /CIDR. |
||||
* "size" is in bytes and describes "dst". |
||||
* return: |
||||
* number of bits, either imputed classfully or specified with /CIDR, |
||||
* or -1 if some failure occurred (check errno). ENOENT means it was |
||||
* not a valid network specification. |
||||
* author: |
||||
* Paul Vixie (ISC), June 1996 |
||||
*/ |
||||
int |
||||
inet_net_pton(int af, const char *src, void *dst, size_t size) |
||||
{ |
||||
switch (af) |
||||
{ |
||||
case AF_INET: |
||||
return (inet_net_pton_ipv4(src, dst, size)); |
||||
default: |
||||
errno = EAFNOSUPPORT; |
||||
return (-1); |
||||
} |
||||
} |
||||
|
||||
/*
|
||||
* static int |
||||
* inet_net_pton_ipv4(src, dst, size) |
||||
* convert IPv4 network number from presentation to network format. |
||||
* accepts hex octets, hex strings, decimal octets, and /CIDR. |
||||
* "size" is in bytes and describes "dst". |
||||
* return: |
||||
* number of bits, either imputed classfully or specified with /CIDR, |
||||
* or -1 if some failure occurred (check errno). ENOENT means it was |
||||
* not an IPv4 network specification. |
||||
* note: |
||||
* network byte order assumed. this means 192.5.5.240/28 has |
||||
* 0x11110000 in its fourth octet. |
||||
* author: |
||||
* Paul Vixie (ISC), June 1996 |
||||
*/ |
||||
static int |
||||
inet_net_pton_ipv4(const char *src, u_char *dst, size_t size) |
||||
{ |
||||
static const char |
||||
xdigits[] = "0123456789abcdef", |
||||
digits[] = "0123456789"; |
||||
int n, |
||||
ch, |
||||
tmp, |
||||
dirty, |
||||
bits; |
||||
const u_char *odst = dst; |
||||
|
||||
ch = *src++; |
||||
if (ch == '0' && (src[0] == 'x' || src[0] == 'X') |
||||
&& isascii(src[1]) && isxdigit(src[1])) |
||||
{ |
||||
/* Hexadecimal: Eat nybble string. */ |
||||
if (size <= 0) |
||||
goto emsgsize; |
||||
*dst = 0, dirty = 0; |
||||
src++; /* skip x or X. */ |
||||
while ((ch = *src++) != '\0' && |
||||
isascii(ch) && isxdigit(ch)) |
||||
{ |
||||
if (isupper(ch)) |
||||
ch = tolower(ch); |
||||
n = strchr(xdigits, ch) - xdigits; |
||||
assert(n >= 0 && n <= 15); |
||||
*dst |= n; |
||||
if (!dirty++) |
||||
*dst <<= 4; |
||||
else if (size-- > 0) |
||||
*++dst = 0, dirty = 0; |
||||
else |
||||
goto emsgsize; |
||||
} |
||||
if (dirty) |
||||
size--; |
||||
} |
||||
else if (isascii(ch) && isdigit(ch)) |
||||
{ |
||||
/* Decimal: eat dotted digit string. */ |
||||
for (;;) |
||||
{ |
||||
tmp = 0; |
||||
do |
||||
{ |
||||
n = strchr(digits, ch) - digits; |
||||
assert(n >= 0 && n <= 9); |
||||
tmp *= 10; |
||||
tmp += n; |
||||
if (tmp > 255) |
||||
goto enoent; |
||||
} while ((ch = *src++) != '\0' && |
||||
isascii(ch) && isdigit(ch)); |
||||
if (size-- <= 0) |
||||
goto emsgsize; |
||||
*dst++ = (u_char) tmp; |
||||
if (ch == '\0' || ch == '/') |
||||
break; |
||||
if (ch != '.') |
||||
goto enoent; |
||||
ch = *src++; |
||||
if (!isascii(ch) || !isdigit(ch)) |
||||
goto enoent; |
||||
} |
||||
} |
||||
else |
||||
goto enoent; |
||||
|
||||
bits = -1; |
||||
if (ch == '/' && isascii(src[0]) && isdigit(src[0]) && dst > odst) |
||||
{ |
||||
/* CIDR width specifier. Nothing can follow it. */ |
||||
ch = *src++; /* Skip over the /. */ |
||||
bits = 0; |
||||
do |
||||
{ |
||||
n = strchr(digits, ch) - digits; |
||||
assert(n >= 0 && n <= 9); |
||||
bits *= 10; |
||||
bits += n; |
||||
} while ((ch = *src++) != '\0' && |
||||
isascii(ch) && isdigit(ch)); |
||||
if (ch != '\0') |
||||
goto enoent; |
||||
if (bits > 32) |
||||
goto emsgsize; |
||||
} |
||||
|
||||
/* Firey death and destruction unless we prefetched EOS. */ |
||||
if (ch != '\0') |
||||
goto enoent; |
||||
|
||||
/* If nothing was written to the destination, we found no address. */ |
||||
if (dst == odst) |
||||
goto enoent; |
||||
/* If no CIDR spec was given, infer width from net class. */ |
||||
if (bits == -1) |
||||
{ |
||||
if (*odst >= 240) /* Class E */ |
||||
bits = 32; |
||||
else if (*odst >= 224) /* Class D */ |
||||
bits = 4; |
||||
else if (*odst >= 192) /* Class C */ |
||||
bits = 24; |
||||
else if (*odst >= 128) /* Class B */ |
||||
bits = 16; |
||||
else |
||||
/* Class A */ |
||||
bits = 8; |
||||
/* If imputed mask is narrower than specified octets, widen. */ |
||||
if (bits >= 8 && bits < ((dst - odst) * 8)) |
||||
bits = (dst - odst) * 8; |
||||
} |
||||
/* Extend network to cover the actual mask. */ |
||||
while (bits > ((dst - odst) * 8)) |
||||
{ |
||||
if (size-- <= 0) |
||||
goto emsgsize; |
||||
*dst++ = '\0'; |
||||
} |
||||
return (bits); |
||||
|
||||
enoent: |
||||
errno = ENOENT; |
||||
return (-1); |
||||
|
||||
emsgsize: |
||||
errno = EMSGSIZE; |
||||
return (-1); |
||||
} |
@ -0,0 +1,283 @@ |
||||
/*
|
||||
* PostgreSQL type definitions for IP addresses. This |
||||
* is for IP V4 CIDR notation, but prepared for V6: just |
||||
* add the necessary bits where the comments indicate. |
||||
* |
||||
* $Id: ip.c,v 1.1 1998/10/03 05:40:49 momjian Exp $ |
||||
*/ |
||||
|
||||
#include <sys/types.h> |
||||
#include <sys/socket.h> |
||||
|
||||
#include <stdio.h> |
||||
#include <errno.h> |
||||
|
||||
#include <netinet/in.h> |
||||
#include <arpa/inet.h> |
||||
|
||||
#include <postgres.h> |
||||
#include <utils/palloc.h> |
||||
#include <utils/mac.h> |
||||
|
||||
/*
|
||||
* Access macros. Add IPV6 support. |
||||
*/ |
||||
|
||||
#define ip_addrsize(ipaddrptr) \ |
||||
(((ipaddr_struct *)VARDATA(ipaddrptr))->family == AF_INET ? 4 : -1) |
||||
|
||||
#define ip_family(ipaddrptr) \ |
||||
(((ipaddr_struct *)VARDATA(ipaddrptr))->family) |
||||
|
||||
#define ip_bits(ipaddrptr) \ |
||||
(((ipaddr_struct *)VARDATA(ipaddrptr))->bits) |
||||
|
||||
#define ip_v4addr(ipaddrptr) \ |
||||
(((ipaddr_struct *)VARDATA(ipaddrptr))->addr.ipv4_addr) |
||||
|
||||
/*
|
||||
* IP address reader. |
||||
*/ |
||||
|
||||
ipaddr * |
||||
ipaddr_in(char *src) |
||||
{ |
||||
int bits; |
||||
ipaddr *dst; |
||||
|
||||
dst = palloc(VARHDRSZ + sizeof(ipaddr_struct)); |
||||
if (dst == NULL) |
||||
{ |
||||
elog(ERROR, "unable to allocate memory in ipaddr_in()"); |
||||
return (NULL); |
||||
} |
||||
/* First, try for an IP V4 address: */ |
||||
ip_family(dst) = AF_INET; |
||||
bits = inet_net_pton(ip_family(dst), src, &ip_v4addr(dst), ip_addrsize(dst)); |
||||
if ((bits < 0) || (bits > 32)) |
||||
{ |
||||
/* Go for an IPV6 address here, before faulting out: */ |
||||
elog(ERROR, "could not parse \"%s\"", src); |
||||
pfree(dst); |
||||
return (NULL); |
||||
} |
||||
VARSIZE(dst) = VARHDRSZ |
||||
+ ((char *) &ip_v4addr(dst) - (char *) VARDATA(dst)) |
||||
+ ip_addrsize(dst); |
||||
ip_bits(dst) = bits; |
||||
return (dst); |
||||
} |
||||
|
||||
/*
|
||||
* IP address output function. |
||||
*/ |
||||
|
||||
char * |
||||
ipaddr_out(ipaddr *src) |
||||
{ |
||||
char *dst, |
||||
tmp[sizeof("255.255.255.255/32")]; |
||||
|
||||
if (ip_family(src) == AF_INET) |
||||
{ |
||||
/* It's an IP V4 address: */ |
||||
if (inet_net_ntop(AF_INET, &ip_v4addr(src), ip_bits(src), |
||||
tmp, sizeof(tmp)) < 0) |
||||
{ |
||||
elog(ERROR, "unable to print address (%s)", strerror(errno)); |
||||
return (NULL); |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
/* Go for an IPV6 address here, before faulting out: */ |
||||
elog(ERROR, "unknown address family (%d)", ip_family(src)); |
||||
return (NULL); |
||||
} |
||||
dst = palloc(strlen(tmp) + 1); |
||||
if (dst == NULL) |
||||
{ |
||||
elog(ERROR, "unable to allocate memory in ipaddr_out()"); |
||||
return (NULL); |
||||
} |
||||
strcpy(dst, tmp); |
||||
return (dst); |
||||
} |
||||
|
||||
/*
|
||||
* Boolean tests for magnitude. Add V4/V6 testing! |
||||
*/ |
||||
|
||||
bool |
||||
ipaddr_lt(ipaddr *a1, ipaddr *a2) |
||||
{ |
||||
if ((ip_family(a1) == AF_INET) && (ip_family(a2) == AF_INET)) |
||||
{ |
||||
int order = v4bitncmp(ip_v4addr(a1), ip_v4addr(a2), ip_bits(a2)); |
||||
|
||||
return ((order < 0) || ((order == 0) && (ip_bits(a1) < ip_bits(a2)))); |
||||
} |
||||
else |
||||
{ |
||||
/* Go for an IPV6 address here, before faulting out: */ |
||||
elog(ERROR, "cannot compare address families %d and %d", |
||||
ip_family(a1), ip_family(a2)); |
||||
return (FALSE); |
||||
} |
||||
} |
||||
|
||||
bool |
||||
ipaddr_le(ipaddr *a1, ipaddr *a2) |
||||
{ |
||||
return (ipaddr_lt(a1, a2) || ipaddr_eq(a1, a2)); |
||||
} |
||||
|
||||
bool |
||||
ipaddr_eq(ipaddr *a1, ipaddr *a2) |
||||
{ |
||||
if ((ip_family(a1) == AF_INET) && (ip_family(a2) == AF_INET)) |
||||
{ |
||||
return ((ip_bits(a1) == ip_bits(a2)) |
||||
&& (v4bitncmp(ip_v4addr(a1), ip_v4addr(a2), ip_bits(a1)) == 0)); |
||||
} |
||||
else |
||||
{ |
||||
/* Go for an IPV6 address here, before faulting out: */ |
||||
elog(ERROR, "cannot compare address families %d and %d", |
||||
ip_family(a1), ip_family(a2)); |
||||
return (FALSE); |
||||
} |
||||
} |
||||
|
||||
bool |
||||
ipaddr_ge(ipaddr *a1, ipaddr *a2) |
||||
{ |
||||
return (ipaddr_gt(a1, a2) || ipaddr_eq(a1, a2)); |
||||
} |
||||
|
||||
bool |
||||
ipaddr_gt(ipaddr *a1, ipaddr *a2) |
||||
{ |
||||
if ((ip_family(a1) == AF_INET) && (ip_family(a2) == AF_INET)) |
||||
{ |
||||
int order = v4bitncmp(ip_v4addr(a1), ip_v4addr(a2), ip_bits(a2)); |
||||
|
||||
return ((order > 0) || ((order == 0) && (ip_bits(a1) > ip_bits(a2)))); |
||||
} |
||||
else |
||||
{ |
||||
/* Go for an IPV6 address here, before faulting out: */ |
||||
elog(ERROR, "cannot compare address families %d and %d", |
||||
ip_family(a1), ip_family(a2)); |
||||
return (FALSE); |
||||
} |
||||
} |
||||
|
||||
bool |
||||
ipaddr_ne(ipaddr *a1, ipaddr *a2) |
||||
{ |
||||
return (!ipaddr_eq(a1, a2)); |
||||
} |
||||
|
||||
bool |
||||
ipaddr_sub(ipaddr *a1, ipaddr *a2) |
||||
{ |
||||
if ((ip_family(a1) == AF_INET) && (ip_family(a2) == AF_INET)) |
||||
{ |
||||
return ((ip_bits(a1) > ip_bits(a2)) |
||||
&& (v4bitncmp(ip_v4addr(a1), ip_v4addr(a2), ip_bits(a2)) == 0)); |
||||
} |
||||
else |
||||
{ |
||||
/* Go for an IPV6 address here, before faulting out: */ |
||||
elog(ERROR, "cannot compare address families %d and %d", |
||||
ip_family(a1), ip_family(a2)); |
||||
return (FALSE); |
||||
} |
||||
} |
||||
|
||||
bool |
||||
ipaddr_subeq(ipaddr *a1, ipaddr *a2) |
||||
{ |
||||
if ((ip_family(a1) == AF_INET) && (ip_family(a2) == AF_INET)) |
||||
{ |
||||
return ((ip_bits(a1) >= ip_bits(a2)) |
||||
&& (v4bitncmp(ip_v4addr(a1), ip_v4addr(a2), ip_bits(a2)) == 0)); |
||||
} |
||||
else |
||||
{ |
||||
/* Go for an IPV6 address here, before faulting out: */ |
||||
elog(ERROR, "cannot compare address families %d and %d", |
||||
ip_family(a1), ip_family(a2)); |
||||
return (FALSE); |
||||
} |
||||
} |
||||
|
||||
bool |
||||
ipaddr_sup(ipaddr *a1, ipaddr *a2) |
||||
{ |
||||
if ((ip_family(a1) == AF_INET) && (ip_family(a2) == AF_INET)) |
||||
{ |
||||
return ((ip_bits(a1) < ip_bits(a2)) |
||||
&& (v4bitncmp(ip_v4addr(a1), ip_v4addr(a2), ip_bits(a1)) == 0)); |
||||
} |
||||
else |
||||
{ |
||||
/* Go for an IPV6 address here, before faulting out: */ |
||||
elog(ERROR, "cannot compare address families %d and %d", |
||||
ip_family(a1), ip_family(a2)); |
||||
return (FALSE); |
||||
} |
||||
} |
||||
|
||||
bool |
||||
ipaddr_supeq(ipaddr *a1, ipaddr *a2) |
||||
{ |
||||
if ((ip_family(a1) == AF_INET) && (ip_family(a2) == AF_INET)) |
||||
{ |
||||
return ((ip_bits(a1) <= ip_bits(a2)) |
||||
&& (v4bitncmp(ip_v4addr(a1), ip_v4addr(a2), ip_bits(a1)) == 0)); |
||||
} |
||||
else |
||||
{ |
||||
/* Go for an IPV6 address here, before faulting out: */ |
||||
elog(ERROR, "cannot compare address families %d and %d", |
||||
ip_family(a1), ip_family(a2)); |
||||
return (FALSE); |
||||
} |
||||
} |
||||
|
||||
/*
|
||||
* Comparison function for sorting. Add V4/V6 testing! |
||||
*/ |
||||
|
||||
int4 |
||||
ipaddr_cmp(ipaddr *a1, ipaddr *a2) |
||||
{ |
||||
if (ntohl(ip_v4addr(a1)) < ntohl(ip_v4addr(a2))) |
||||
return (-1); |
||||
else if (ntohl(ip_v4addr(a1)) > ntohl(ip_v4addr(a2))) |
||||
return (1); |
||||
return 0; |
||||
} |
||||
|
||||
/*
|
||||
* Bitwise comparison for V4 addresses. Add V6 implementation! |
||||
*/ |
||||
|
||||
int |
||||
v4bitncmp(u_int32_t a1, u_int32_t a2, int bits) |
||||
{ |
||||
unsigned long mask = 0; |
||||
int i; |
||||
|
||||
for (i = 0; i < bits; i++) |
||||
mask = (mask >> 1) | 0x80000000; |
||||
a1 = ntohl(a1); |
||||
a2 = ntohl(a2); |
||||
if ((a1 & mask) < (a2 & mask)) |
||||
return (-1); |
||||
else if ((a1 & mask) > (a2 & mask)) |
||||
return (1); |
||||
return (0); |
||||
} |
@ -0,0 +1,323 @@ |
||||
/*
|
||||
* PostgreSQL type definitions for MAC addresses. |
||||
* |
||||
* $Id: mac.c,v 1.1 1998/10/03 05:40:50 momjian Exp $ |
||||
*/ |
||||
|
||||
#include <stdio.h> |
||||
|
||||
#include <postgres.h> |
||||
#include <utils/palloc.h> |
||||
|
||||
#include <utils/mac.h> |
||||
|
||||
manufacturer manufacturers[] = { |
||||
{0x00, 0x00, 0x0C, "Cisco"}, |
||||
{0x00, 0x00, 0x0E, "Fujitsu"}, |
||||
{0x00, 0x00, 0x0F, "NeXT"}, |
||||
{0x00, 0x00, 0x10, "Sytek"}, |
||||
{0x00, 0x00, 0x1D, "Cabletron"}, |
||||
{0x00, 0x00, 0x20, "DIAB"}, |
||||
{0x00, 0x00, 0x22, "Visual Technology"}, |
||||
{0x00, 0x00, 0x2A, "TRW"}, |
||||
{0x00, 0x00, 0x32, "GPT Limited"}, |
||||
{0x00, 0x00, 0x5A, "S & Koch"}, |
||||
{0x00, 0x00, 0x5E, "IANA"}, |
||||
{0x00, 0x00, 0x65, "Network General"}, |
||||
{0x00, 0x00, 0x6B, "MIPS"}, |
||||
{0x00, 0x00, 0x77, "MIPS"}, |
||||
{0x00, 0x00, 0x7A, "Ardent"}, |
||||
{0x00, 0x00, 0x89, "Cayman Systems"}, |
||||
{0x00, 0x00, 0x93, "Proteon"}, |
||||
{0x00, 0x00, 0x9F, "Ameristar Technology"}, |
||||
{0x00, 0x00, 0xA2, "Wellfleet"}, |
||||
{0x00, 0x00, 0xA3, "Network Application Technology"}, |
||||
{0x00, 0x00, 0xA6, "Network General"}, |
||||
{0x00, 0x00, 0xA7, "NCD"}, |
||||
{0x00, 0x00, 0xA9, "Network Systems"}, |
||||
{0x00, 0x00, 0xAA, "Xerox"}, |
||||
{0x00, 0x00, 0xB3, "CIMLinc"}, |
||||
{0x00, 0x00, 0xB7, "Dove Fastnet"}, |
||||
{0x00, 0x00, 0xBC, "Allen-Bradley"}, |
||||
{0x00, 0x00, 0xC0, "Western Digital"}, |
||||
{0x00, 0x00, 0xC5, "Farallon"}, |
||||
{0x00, 0x00, 0xC6, "Hewlett-Packard"}, |
||||
{0x00, 0x00, 0xC8, "Altos"}, |
||||
{0x00, 0x00, 0xC9, "Emulex"}, |
||||
{0x00, 0x00, 0xD7, "Dartmouth College"}, |
||||
{0x00, 0x00, 0xD8, "3Com (?)"}, |
||||
{0x00, 0x00, 0xDD, "Gould"}, |
||||
{0x00, 0x00, 0xDE, "Unigraph"}, |
||||
{0x00, 0x00, 0xE2, "Acer Counterpoint"}, |
||||
{0x00, 0x00, 0xEF, "Alantec"}, |
||||
{0x00, 0x00, 0xFD, "High Level Hardware"}, |
||||
{0x00, 0x01, 0x02, "BBN internal usage"}, |
||||
{0x00, 0x20, 0xAF, "3Com"}, |
||||
{0x00, 0x17, 0x00, "Kabel"}, |
||||
{0x00, 0x80, 0x64, "Wyse Technology"}, |
||||
{0x00, 0x80, 0x2B, "IMAC (?)"}, |
||||
{0x00, 0x80, 0x2D, "Xylogics, Inc."}, |
||||
{0x00, 0x80, 0x8C, "Frontier Software Development"}, |
||||
{0x00, 0x80, 0xC2, "IEEE 802.1 Committee"}, |
||||
{0x00, 0x80, 0xD3, "Shiva"}, |
||||
{0x00, 0xAA, 0x00, "Intel"}, |
||||
{0x00, 0xDD, 0x00, "Ungermann-Bass"}, |
||||
{0x00, 0xDD, 0x01, "Ungermann-Bass"}, |
||||
{0x02, 0x07, 0x01, "Racal InterLan"}, |
||||
{0x02, 0x04, 0x06, "BBN internal usage"}, |
||||
{0x02, 0x60, 0x86, "Satelcom MegaPac"}, |
||||
{0x02, 0x60, 0x8C, "3Com"}, |
||||
{0x02, 0xCF, 0x1F, "CMC"}, |
||||
{0x08, 0x00, 0x02, "3Com"}, |
||||
{0x08, 0x00, 0x03, "ACC"}, |
||||
{0x08, 0x00, 0x05, "Symbolics"}, |
||||
{0x08, 0x00, 0x08, "BBN"}, |
||||
{0x08, 0x00, 0x09, "Hewlett-Packard"}, |
||||
{0x08, 0x00, 0x0A, "Nestar Systems"}, |
||||
{0x08, 0x00, 0x0B, "Unisys"}, |
||||
{0x08, 0x00, 0x11, "Tektronix"}, |
||||
{0x08, 0x00, 0x14, "Excelan"}, |
||||
{0x08, 0x00, 0x17, "NSC"}, |
||||
{0x08, 0x00, 0x1A, "Data General"}, |
||||
{0x08, 0x00, 0x1B, "Data General"}, |
||||
{0x08, 0x00, 0x1E, "Apollo"}, |
||||
{0x08, 0x00, 0x20, "Sun"}, |
||||
{0x08, 0x00, 0x22, "NBI"}, |
||||
{0x08, 0x00, 0x25, "CDC"}, |
||||
{0x08, 0x00, 0x26, "Norsk Data"}, |
||||
{0x08, 0x00, 0x27, "PCS Computer Systems GmbH"}, |
||||
{0x08, 0x00, 0x28, "Texas Instruments"}, |
||||
{0x08, 0x00, 0x2B, "DEC"}, |
||||
{0x08, 0x00, 0x2E, "Metaphor"}, |
||||
{0x08, 0x00, 0x2F, "Prime Computer"}, |
||||
{0x08, 0x00, 0x36, "Intergraph"}, |
||||
{0x08, 0x00, 0x37, "Fujitsu-Xerox"}, |
||||
{0x08, 0x00, 0x38, "Bull"}, |
||||
{0x08, 0x00, 0x39, "Spider Systems"}, |
||||
{0x08, 0x00, 0x41, "DCA Digital Comm. Assoc."}, |
||||
{0x08, 0x00, 0x45, "Xylogics (?)"}, |
||||
{0x08, 0x00, 0x46, "Sony"}, |
||||
{0x08, 0x00, 0x47, "Sequent"}, |
||||
{0x08, 0x00, 0x49, "Univation"}, |
||||
{0x08, 0x00, 0x4C, "Encore"}, |
||||
{0x08, 0x00, 0x4E, "BICC"}, |
||||
{0x08, 0x00, 0x56, "Stanford University"}, |
||||
{0x08, 0x00, 0x58, "DECsystem 20 (?)"}, |
||||
{0x08, 0x00, 0x5A, "IBM"}, |
||||
{0x08, 0x00, 0x67, "Comdesign"}, |
||||
{0x08, 0x00, 0x68, "Ridge"}, |
||||
{0x08, 0x00, 0x69, "Silicon Graphics"}, |
||||
{0x08, 0x00, 0x6E, "Concurrent"}, |
||||
{0x08, 0x00, 0x75, "DDE"}, |
||||
{0x08, 0x00, 0x7C, "Vitalink"}, |
||||
{0x08, 0x00, 0x80, "XIOS"}, |
||||
{0x08, 0x00, 0x86, "Imagen/QMS"}, |
||||
{0x08, 0x00, 0x87, "Xyplex"}, |
||||
{0x08, 0x00, 0x89, "Kinetics"}, |
||||
{0x08, 0x00, 0x8B, "Pyramid"}, |
||||
{0x08, 0x00, 0x8D, "XyVision"}, |
||||
{0x08, 0x00, 0x90, "Retix Inc"}, |
||||
{0x48, 0x44, 0x53, "HDS (?)"}, |
||||
{0x80, 0x00, 0x10, "AT&T"}, |
||||
{0xAA, 0x00, 0x00, "DEC"}, |
||||
{0xAA, 0x00, 0x01, "DEC"}, |
||||
{0xAA, 0x00, 0x02, "DEC"}, |
||||
{0xAA, 0x00, 0x03, "DEC"}, |
||||
{0xAA, 0x00, 0x04, "DEC"}, |
||||
{0x00, 0x00, 0x00, NULL} |
||||
}; |
||||
|
||||
/*
|
||||
* Utility macros used for sorting and comparing: |
||||
*/ |
||||
|
||||
#define hibits(addr) \ |
||||
((unsigned long)((addr->a<<16)|(addr->b<<8)|(addr->c))) |
||||
|
||||
#define lobits(addr) \ |
||||
((unsigned long)((addr->c<<16)|(addr->e<<8)|(addr->f))) |
||||
|
||||
/*
|
||||
* MAC address reader. Accepts several common notations. |
||||
*/ |
||||
|
||||
macaddr * |
||||
macaddr_in(char *str) |
||||
{ |
||||
int a, |
||||
b, |
||||
c, |
||||
d, |
||||
e, |
||||
f; |
||||
macaddr *result; |
||||
int count; |
||||
|
||||
if (strlen(str) > 0) |
||||
{ |
||||
|
||||
count = sscanf(str, "%x:%x:%x:%x:%x:%x", &a, &b, &c, &d, &e, &f); |
||||
if (count != 6) |
||||
count = sscanf(str, "%x-%x-%x-%x-%x-%x", &a, &b, &c, &d, &e, &f); |
||||
if (count != 6) |
||||
count = sscanf(str, "%2x%2x%2x:%2x%2x%2x", &a, &b, &c, &d, &e, &f); |
||||
if (count != 6) |
||||
count = sscanf(str, "%2x%2x%2x-%2x%2x%2x", &a, &b, &c, &d, &e, &f); |
||||
if (count != 6) |
||||
count = sscanf(str, "%2x%2x.%2x%2x.%2x%2x", &a, &b, &c, &d, &e, &f); |
||||
|
||||
if (count != 6) |
||||
{ |
||||
elog(ERROR, "macaddr_in: error in parsing \"%s\"", str); |
||||
return (NULL); |
||||
} |
||||
|
||||
if ((a < 0) || (a > 255) || (b < 0) || (b > 255) || |
||||
(c < 0) || (c > 255) || (d < 0) || (d > 255) || |
||||
(e < 0) || (e > 255) || (f < 0) || (f > 255)) |
||||
{ |
||||
elog(ERROR, "macaddr_in: illegal address \"%s\"", str); |
||||
return (NULL); |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
a = b = c = d = e = f = 0; /* special case for missing
|
||||
* address */ |
||||
} |
||||
|
||||
result = (macaddr *) palloc(sizeof(macaddr)); |
||||
|
||||
result->a = a; |
||||
result->b = b; |
||||
result->c = c; |
||||
result->d = d; |
||||
result->e = e; |
||||
result->f = f; |
||||
|
||||
return (result); |
||||
} |
||||
|
||||
/*
|
||||
* MAC address output function. Fixed format. |
||||
*/ |
||||
|
||||
char * |
||||
macaddr_out(macaddr *addr) |
||||
{ |
||||
char *result; |
||||
|
||||
if (addr == NULL) |
||||
return (NULL); |
||||
|
||||
result = (char *) palloc(32); |
||||
|
||||
if ((hibits(addr) > 0) || (lobits(addr) > 0)) |
||||
{ |
||||
sprintf(result, "%02x:%02x:%02x:%02x:%02x:%02x", |
||||
addr->a, addr->b, addr->c, addr->d, addr->e, addr->f); |
||||
} |
||||
else |
||||
{ |
||||
result[0] = 0; /* special case for missing address */ |
||||
} |
||||
return (result); |
||||
} |
||||
|
||||
/*
|
||||
* Boolean tests. |
||||
*/ |
||||
|
||||
bool |
||||
macaddr_lt(macaddr *a1, macaddr *a2) |
||||
{ |
||||
return ((hibits(a1) < hibits(a2)) || |
||||
((hibits(a1) == hibits(a2)) && lobits(a1) < lobits(a2))); |
||||
}; |
||||
|
||||
bool |
||||
macaddr_le(macaddr *a1, macaddr *a2) |
||||
{ |
||||
return ((hibits(a1) < hibits(a2)) || |
||||
((hibits(a1) == hibits(a2)) && lobits(a1) <= lobits(a2))); |
||||
}; |
||||
|
||||
bool |
||||
macaddr_eq(macaddr *a1, macaddr *a2) |
||||
{ |
||||
return ((hibits(a1) == hibits(a2)) && (lobits(a1) == lobits(a2))); |
||||
}; |
||||
|
||||
bool |
||||
macaddr_ge(macaddr *a1, macaddr *a2) |
||||
{ |
||||
return ((hibits(a1) > hibits(a2)) || |
||||
((hibits(a1) == hibits(a2)) && lobits(a1) >= lobits(a2))); |
||||
}; |
||||
|
||||
bool |
||||
macaddr_gt(macaddr *a1, macaddr *a2) |
||||
{ |
||||
return ((hibits(a1) > hibits(a2)) || |
||||
((hibits(a1) == hibits(a2)) && lobits(a1) > lobits(a2))); |
||||
}; |
||||
|
||||
bool |
||||
macaddr_ne(macaddr *a1, macaddr *a2) |
||||
{ |
||||
return ((hibits(a1) != hibits(a2)) || (lobits(a1) != lobits(a2))); |
||||
}; |
||||
|
||||
/*
|
||||
* Comparison function for sorting: |
||||
*/ |
||||
|
||||
int4 |
||||
macaddr_cmp(macaddr *a1, macaddr *a2) |
||||
{ |
||||
if (hibits(a1) < hibits(a2)) |
||||
return -1; |
||||
else if (hibits(a1) > hibits(a2)) |
||||
return 1; |
||||
else if (lobits(a1) < lobits(a2)) |
||||
return -1; |
||||
else if (lobits(a1) > lobits(a2)) |
||||
return 1; |
||||
else |
||||
return 0; |
||||
} |
||||
|
||||
/*
|
||||
* The special manufacturer fetching function. See "mac.h". |
||||
*/ |
||||
|
||||
text * |
||||
macaddr_manuf(macaddr *addr) |
||||
{ |
||||
manufacturer *manuf; |
||||
int length; |
||||
text *result; |
||||
|
||||
for (manuf = manufacturers; manuf->name != NULL; manuf++) |
||||
{ |
||||
if ((manuf->a == addr->a) && |
||||
(manuf->b == addr->b) && |
||||
(manuf->c == addr->c)) |
||||
break; |
||||
} |
||||
if (manuf->name == NULL) |
||||
{ |
||||
result = palloc(VARHDRSZ + 1); |
||||
memset(result, 0, VARHDRSZ + 1); |
||||
VARSIZE(result) = VARHDRSZ + 1; |
||||
} |
||||
else |
||||
{ |
||||
length = strlen(manuf->name) + 1; |
||||
result = palloc(length + VARHDRSZ); |
||||
memset(result, 0, length + VARHDRSZ); |
||||
VARSIZE(result) = length + VARHDRSZ; |
||||
memcpy(VARDATA(result), manuf->name, length); |
||||
} |
||||
return result; |
||||
} |
@ -0,0 +1,58 @@ |
||||
/*-------------------------------------------------------------------------
|
||||
* |
||||
* builtins.h-- |
||||
* Declarations for operations on built-in types. |
||||
* |
||||
* |
||||
* Copyright (c) 1994, Regents of the University of California |
||||
* |
||||
* $Id: mac.h,v 1.1 1998/10/03 05:41:01 momjian Exp $ |
||||
* |
||||
*------------------------------------------------------------------------- |
||||
*/ |
||||
#ifndef MAC_H |
||||
#define MAC_H |
||||
|
||||
/*
|
||||
* This is the internal storage format for IP addresses: |
||||
*/ |
||||
|
||||
typedef struct |
||||
{ |
||||
unsigned char family; |
||||
unsigned char bits; |
||||
union |
||||
{ |
||||
u_int32_t ipv4_addr; /* network byte order */ |
||||
/* add IPV6 address type here */ |
||||
} addr; |
||||
} ipaddr_struct; |
||||
|
||||
typedef struct varlena ipaddr; |
||||
|
||||
/*
|
||||
* This is the internal storage format for MAC addresses: |
||||
*/ |
||||
typedef struct macaddr |
||||
{ |
||||
unsigned char a; |
||||
unsigned char b; |
||||
unsigned char c; |
||||
unsigned char d; |
||||
unsigned char e; |
||||
unsigned char f; |
||||
} macaddr; |
||||
|
||||
|
||||
typedef struct manufacturer |
||||
{ |
||||
unsigned char a; |
||||
unsigned char b; |
||||
unsigned char c; |
||||
char *name; |
||||
} manufacturer; |
||||
|
||||
extern manufacturer manufacturers[]; |
||||
|
||||
#endif /* MAC_H */ |
||||
|
Loading…
Reference in new issue