81 lines
1.8 KiB
Plaintext
81 lines
1.8 KiB
Plaintext
$Id: lwres,v 1.1 2000/02/29 20:10:49 explorer Exp $
|
|
|
|
General design:
|
|
|
|
The lwres library converts structures into wire-format packets for
|
|
transmission, and unmarshalls them on receive.
|
|
|
|
|
|
Marshalling and unmarshalling:
|
|
|
|
Each structure will have two functions defined, one to take a
|
|
wire-format packet and convert it into a structure, and another to
|
|
take a structure and convert it into a wire-format packet. There
|
|
is a structure cleanup function that will take the unmarshalled
|
|
structure and free any dynamically allocated elements.
|
|
|
|
|
|
Wire formats:
|
|
|
|
All integer values are in network byte order.
|
|
|
|
All addresses are in network byte order. That is, they are directly
|
|
usable and do not need to be byte swapped, at least for ipv4 and ipv6.
|
|
|
|
All character strings are prefixed with a length, and are NUL
|
|
terminated C strings. This is a concession for structure handling on
|
|
the receive side, and allows a mapping structure to point to data
|
|
contained in the actual receive buffer, eliminating copying.
|
|
|
|
|
|
NOOP (aka ping) packet format:
|
|
|
|
lwres_lwpacket_t header;
|
|
isc_uint16_t datalength;
|
|
< datalength bytes >
|
|
|
|
The server simply returns the entire data region in the reply. This
|
|
allows the client to determine if the server is operational.
|
|
|
|
|
|
GETADDRSBYNAME:
|
|
|
|
lwres_lwpacket_t header;
|
|
|
|
isc_uint16_t naliases;
|
|
|
|
isc_uint16_t naddrs;
|
|
|
|
isc_uint16_t real_name_len;
|
|
< real_name_len bytes of name >
|
|
isc_uint8_t \0
|
|
|
|
< naliases of
|
|
isc_uint16_t len;
|
|
< len bytes of name >
|
|
isc_uint8_t \0
|
|
>
|
|
|
|
< naddrs of
|
|
isc_uint32_t family;
|
|
isc_uint16_t len;
|
|
< len bytes of address >
|
|
>
|
|
|
|
|
|
GETNAMEBYADDR:
|
|
|
|
lwres_lwpacket_t header;
|
|
|
|
isc_uint16_t naliases;
|
|
|
|
isc_uint16_t real_name_len;
|
|
< real_name_len bytes of name >
|
|
isc_uint8_t \0
|
|
|
|
< naliases of
|
|
isc_uint16_t len;
|
|
< len bytes of name >
|
|
isc_uint8_t \0
|
|
>
|