Re: Efficiently searching for CIDRs containing an IP address

Поиск
Список
Период
Сортировка
От Alan McKay
Тема Re: Efficiently searching for CIDRs containing an IP address
Дата
Msg-id 844129e80905311814o4ab50ad8jb41172010ce612b4@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Efficiently searching for CIDRs containing an IP address  ("David F. Skoll" <dfs@roaringpenguin.com>)
Ответы Re: Efficiently searching for CIDRs containing an IP address
Список pgsql-admin
Hmmm, I've never done this quite that way, but IPs - especially CIDRs
- are far easier to work with in binary format than in human-readable
format.  At my old workplace about 5 years ago I wrote an IP
management system (PHP/MySQL) that stored the IP in binary and
human-readable formats, but all of the computations and comparisons
and other such stuff always took place with the binary values (binary
stored as a string of 0s and 1s as I recall).

So is this not simply easier to implement with a library of functions
to convert a string to binary and back?  I recall in my implementation
I had only 4 or 5 functions including converting back-and-forth from
binary to human-readable, binary-AND, binary-OR and maybe one or two
others.


--
“Mother Nature doesn’t do bailouts.”
         - Glenn Prickett

В списке pgsql-admin по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: PostgreSQL crashes
Следующее
От: "David F. Skoll"
Дата:
Сообщение: Re: Efficiently searching for CIDRs containing an IP address