[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Adding ipv6 support.



  Hi Ron,

Le Mon, Feb 07, 2011 at 12:58:47PM +0100, Ron Arts ecrivait :
> I have an application where I need to add ipv6 support.
> Does a recipe exist, or example code how to convert
> an existing libevent application?

  Libevent does support IPv6 for a long time, possibly since the very
first public release.

  In order to make sure that your application is IPv6-ready, you need
to double-check that you aren't using IPv4-only structures like
sockaddr_in and functions like gethostbyaddr() / gethostbyname().

  Use sockaddr_storage, getaddrinfo() and getnameinfo().
  
  Libevent provides a bunch of portable wrappers, namely:
  
- evutil_inet_pton(), evutil_inet_ntop()
- evutil_addrinfo(), evutil_getaddrinfo(), evutil_freeaddrinfo(),
evutil_gai_strerror(),

  Plus some helpers functions:
  
- evutil_sockaddr_cmp()
- evutil_parse_sockaddr_port()

  And some macros and types, see utils.h.
  
  Try to use libevent-provided wrappers as much as you can. They
provide both portability and IPv6-readiness.

-- 
Frank Denis - j [at] pureftpd.org - http://00f.net - Twitter: @jedisct1
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.