forked from mikepultz/netdns2
-
Notifications
You must be signed in to change notification settings - Fork 2
JDWX DNSQuery Network IPTransport
JDW edited this page Jul 17, 2022
·
1 revision
Provides basic transport functionality for IP sockets (both TCP and UDP).
Built on top of the Socket class.
TODO: The distinction between the Socket class and this class is a bit muddled. It could stand some additional refactoring to provide a cleaner, more flexible implementation.
- Class name: IPTransport
- Namespace: \JDWX\DNSQuery\Network
- This is an abstract class
- This class implements: JDWX\DNSQuery\Network\ITransport
protected maxSize
- Visibility: protected
protected nameServer
- Visibility: protected
protected port
- Visibility: protected
protected socket
- Visibility: protected
protected type
- Visibility: protected
mixed JDWX\DNSQuery\Network\IPTransport::__construct(int i_type, string i_nameserver, int i_port, null|string i_localAddress, null|int i_localPort, int i_timeout, int i_maxSize)
Create an IP transport for DNS packets.
- Visibility: public
- i_type int - The type of socket to use (Socket::SOCK_DGRAM or Socket::SOCK_STREAM)
- i_nameserver string - The nameserver to use as an IPv4 or IPv6 address.
- i_port int - The port to use (53 is default).
- i_localAddress null|string - The local address to use (or null for default).
- i_localPort null|int - The local port to use (or null for default).
- i_timeout int - The timeout in seconds to use for the socket.
- i_maxSize int - The maximum size of an incoming packet.
mixed JDWX\DNSQuery\Network\ITransport::getNameServer()
Get the IPv4 or IPv6 address of the name server associated with this transport.
- Visibility: public
- This method is defined by JDWX\DNSQuery\Network\ITransport
mixed JDWX\DNSQuery\Network\ITransport::getPort()
Get the (name server's) port number associated with this transport.
- Visibility: public
- This method is defined by JDWX\DNSQuery\Network\ITransport
int JDWX\DNSQuery\Network\ITransport::getType()
Get the type of the transport.
- Visibility: public
- This method is defined by JDWX\DNSQuery\Network\ITransport
string JDWX\DNSQuery\Network\IPTransport::read(int o_size, ?int i_maxSize)
reads a response from a DNS server
- Visibility: public
- o_size int - (output) Size of the DNS packet read
- i_maxSize ?int - Max data size to be read (if null, use max size from construction).
mixed JDWX\DNSQuery\Network\IPTransport::sendData(string i_data)
- Visibility: public
- i_data string
mixed JDWX\DNSQuery\Network\ITransport::sendRequest(\JDWX\DNSQuery\Packet\RequestPacket i_request)
Send a request over this transport.
- Visibility: public
- This method is defined by JDWX\DNSQuery\Network\ITransport
- i_request JDWX\DNSQuery\Packet\RequestPacket
mixed JDWX\DNSQuery\Network\IPTransport::generateError()
Clean up a failed socket and throw the given exception.
- Visibility: private
\JDWX\DNSQuery\Packet\ResponsePacket JDWX\DNSQuery\Network\ITransport::receiveResponse()
Read a response from this transport.
- Visibility: public
- This method is defined by JDWX\DNSQuery\Network\ITransport