[gnet] create inetaddr from in_addr.s_addr



Hey all,

I'm writing a web proxy using gnet.  I'm in the process of adding
transparent proxying support and one of the things this entails is
figuring out where the request was originally destined.  I use the
getsockopt() function to get the original IP and port that this request
was heading towards before netfilter mucked with it.  I get the IP
address as an 'in_addr' structure.  Its only member is 's_addr' which is
the integer representation of the IP address.  I would like to create a
GInetAddr object directly from this integer.  As it is now I convert the
integer to a string representation of the IP address and call
gnet_inetaddr_new().  Is there a better way of doing this that avoids
the conversion to a string?  If not, this might make sense for future
API changes because it seems that libc likes to work with in_addrs.

Thanks,
Mark Drago

Attachment: signature.asc
Description: This is a digitally signed message part



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