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

New cast between inet/cidr and bytea

From: Zoltan Boszormenyi <zb(at)cybertec(dot)at>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: New cast between inet/cidr and bytea
Date: 2007-05-30 18:42:29
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers

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 
  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 be a 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


pgsql-hackers by date

Next:From: Joshua D. DrakeDate: 2007-05-30 18:48:55
Subject: Changing checkpoint_timeout to another name?
Previous:From: Tom LaneDate: 2007-05-30 18:01:44
Subject: Re: Ye olde drop-the-database-you-just-left problem

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