Attached are two patches which constitute part of the core developments
for protocol-independent handling of IP addresses in squid3.
The patches apply to lib/ and include/ respectively, and do the following:
- Rollback previous alterations to DNS library code in rfc1035.c
and return it to the pure IPv4 protocol DNS lookups as defined
by RFC1035.
- Fix 0-day bug where base64 code does not provide dependencies
for utils.h properly.
- defines new protocol-independant class IPAddress for IP storage
and handling.
class IPAddress provides:
- protocol independent storage of in_addr, in6_addr, sockaddr_in,
and sockaddr_in6.
- functionality to convert between any of the contained IP formats.
Either the binary struct or string representations.
- defines a macro MAX_IPSTRLEN to indicate the length of buffers
needed to hold string representations of any address string
produced.
- functionality to explicitly check the compatible protocol needed
can be retrieved. Useful for high-level protocols such as WCCP,
ARP and ICMP which are transport-specific to determine if the
IPAddress can be one suitable for that protocol.
The class is built from basic data types and contains no dynamic
memory operations outside its own allocated block and references
no pointers. Meaning it can be safely used as a basic data type in
its own right. With the added abilities of data conversion through
assignments from any of the above mentioned storage types.
The storage of sockaddr_* information implies that both port and
address details are stored, and can be set or retrieved
independently from any IPAdress which contains them.
Functionality is provided to convert from hostent structures, but at
present IPAddress can only hold a single IP. This means the
conversion will ONLY save the first entry in the hostent list of
IPA's. Where an non-first entry of the hostent must be stored it
needs to be explicitly de-referenced and cast from its native char**
stored format inside hostent to the appropriate in_addr or in6_addr
type which can then can be passed to the IPAddress object for
conversion.
Amos Jeffries
This archive was generated by hypermail pre-2.1.9 : Sun Apr 29 2007 - 12:00:03 MDT