New cast between inet/cidr and bytea - Mailing list pgsql-hackers

From Zoltan Boszormenyi
Subject New cast between inet/cidr and bytea
Date
Msg-id 465DC595.303@cybertec.at
Whole thread Raw
Responses Re: New cast between inet/cidr and bytea  (Bruce Momjian <bruce@momjian.us>)
Re: New cast between inet/cidr and bytea  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi,

we at Cybertec have developed cast functions in C between
inet/cidr <-> bytea for a client and we would like to submit it.

This is how it works:
- IPv4 inet/cidr value will return 4 bytes if the netmask covers all 32 
bits. It returns 5 bytes if the netmask is shorter than 32 bits.
- Similarly for IPv6, 12[+1] bytes is returned.
- 4, 5, 12 or 13 bytes long bytea values are converted to an inet/cidr value, the 5th or 13th byte is range-checked to
bea valid netmask value.
 

What are the requirements for it to be accepted
as a core cast function or as a contrib module?

-- 
----------------------------------
Zoltán Böszörményi
Cybertec Geschwinde & Schönig GmbH
http://www.postgresql.at/



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Ye olde drop-the-database-you-just-left problem
Next
From: "Joshua D. Drake"
Date:
Subject: Changing checkpoint_timeout to another name?