Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] CIDR type and functions

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: darcy(at)druid(dot)net (D'Arcy J(dot)M(dot) Cain)
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] CIDR type and functions
Date: 1998-10-09 19:35:37
Message-ID: 199810091935.PAA25363@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
> Thus spake Bruce Momjian
> > Check \df and \fo.  There is a >> and << operators that do subnet
> > testing.
> 
> [I assume you meant \do]
> 
> Cool.  I checked out what other functions as well.  I don't see a couple
> that were discussed early on though.  Specifically, how about functions
> to extract the  host, the network or the netmask from an address?
> 
> Here are the functions I had suggested.
> 
>     netmask('192.3.4.5/24::cidr') == 255.255.255.0
>     masklen('192.3.4.5/24::cidr') == 24
>     host('192.3.4.5/24::cidr') == 192.3.4.5
>     network('192.3.4.5/24::cidr') == 192.3.4.0
> 
> and perhaps;
> 
>     class('192.3.4.5/24::cidr') == C
>     classnet('192.3.4.5/24::cidr') == 192.3.4
> 
> Can I help code up some of this stuff?

Yes, we need those.  Code them up, and I will add them as standard
types.


-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist(at)candle(dot)pha(dot)pa(dot)us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026


In response to

Responses

pgsql-hackers by date

Next:From: Jackson, DeJuanDate: 1998-10-09 19:41:04
Subject: RE: [HACKERS] dynamic libraries
Previous:From: Peter T MountDate: 1998-10-09 18:48:30
Subject: Re: [HACKERS] dynamic libraries

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group