Date: Mon, 04 Dec 2006 17:21:14 +0000 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: freebsd-questions@freebsd.org Subject: Re: Is there a standard function for converting IP address to number? Message-ID: <4574590A.1010901@infracaninophile.co.uk> In-Reply-To: <20061204124550.GA1766@host.my.domain> References: <20061204124550.GA1766@host.my.domain>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigAF6B2FEF42681479B939134D Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable a@zeos.net wrote: > Is there a standard function converting four numbers to one 32-bit=20 > IP address? >=20 > I mean a function like >=20 > f(i, j, k, l) { > return (((((i << 8) | j) << 8) | k) << 8) | l; > } Not exactly. inet_ntoa() and inet_aton() are about the closest I can think of. There's a range of similar functions described in the inet(3) man page for converting from struct in_addr (essentially an IPv4 address expressed as a 32bit int) to a textual representation of an IPv4 number, and vice versa.=20 Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW --------------enigAF6B2FEF42681479B939134D Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFdFkP8Mjk52CukIwRCAOjAJ9pwLTgSdjhcPf0aSBHFOPFLqxfhQCfSpiH LsCJIcIbLDhScIl+Mp5wpEQ= =eJjJ -----END PGP SIGNATURE----- --------------enigAF6B2FEF42681479B939134D--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4574590A.1010901>