I am trying to make a little wrapper for addrinfo (a network programming thing). Basically the structure addrinfo is like a list node
Code:
struct addrinfo
{
... stuff ...
struct addrinfo * ai_next;
}
There is a function getaddrinfo( lpctstr, lpctstr, addrinfo *, addrinfo ** ) which will create a list of addrinfo's for a given host/port. And I need to free the list that is returned using freeaddrinfo( addrinfo * ) So basically, I'm wondering if it's possible for me to do something like:
Code:
struct caddrinfo { addrinfo t; }
class caddrinfolist
{
public:
getAddrInfo() { doin' a little manual work to convert their list to mine }
freeAddrInfo() { freeaddrinfo(m_chain); } // obviously erraneous
private:
caddrinfo * chain;
};
Also, as a little tacked on question, to support unicode, I am just wrapping the structure ADDRINFOT. Should I instead have specializations of my wrapper for both addrinfo and addrinfoW?