| AnyEvent::TFTPd::Connection - Represents one connection to TFTPd |
AnyEvent::TFTPd::Connection - Represents one connection to TFTPd
Holds the sockaddr of the remote host.
Holds a human readable version of the address part of peername.
Holds a human readable version of the port part of peername.
A numeric representation of the opcode which initiated the connection.
Either "ascii" or "octet" or empty string if unknown.
A string representing the requested file from client.
The filehandle used to read/write data from/to client.
Contains extra parameters the client has provided. These parameters are stored in a hash ref.
A reference back to the the AnyEvent::TFTPd manpage object.
The time the connection was established. Epoch timestamp.
The current packet number received/sent.
The number of retries left before aborting the transmission.
This method will send a packet of data from filehandle
to client, identified by peername. The packet is calculated
using the MIN_BLKSIZE and packet_number. Returns 1 on
success, 2 if this is the last packet to be sent, 0 if something
went wrong and -1 no more data is available from filehandle.
This method will receive a datagram and unwraps the packet number from
it using unpack("n"). It will increase the packet_number if
the received packet number matches packet_number.
Will always call send_packet and return the value it returns. A return value of -1 indicates that the last ACK was received and the connection can be "shut down".
This method will receive a datagram and unwraps the packet number and
body from it using unpack("na*"). It stores the data in the current
filehandle if the packet number equals packet_number. It returns
1 on success, 0 on failure and -1 if this was the last packet to be
received. The latter indicates that it is safe for this connection to
"shut down".
This method is called inside receive_packet() and is used to tell the peer that a packet is received.
Takes a "name" indicating a type of error, which is looked up from the
%ERROR_CODES variable (see the source for details). Falls back to
"not_defined", if an invalid name was passed on. Packs the data from
%ERROR_CODES and pass it to the remote client. Returns 1 on success
and 1 on failure.
$self->logf($connection_obj, @message);
Receives internal log messages and (maybe) a connection object. Is meant to be overriden when subclassing this module.
| AnyEvent::TFTPd::Connection - Represents one connection to TFTPd |