Device::Modem::Protocol::Xmodem(3pm) | User Contributed Perl Documentation | Device::Modem::Protocol::Xmodem(3pm) |
Device::Modem::Protocol::Xmodem - XModem protocol implementation
Class that represents a single Xmodem data block.
my $b = Xmodem::Block->new( 1, 'My Data...<until-128-chars>...' ); if( defined $b ) { # Ok, block instanced, verify its checksum if( $b->verify( 'checksum', <my_chksum> ) ) { ... } else { ... } } else { # No block } # Calculate checksum, crc16, 32, ... $crc16 = $b->crc16(); $crc32 = $b->crc32(); $chksm = $b->checksum();
Class that implements an Xmodem receive buffer of data blocks. Every block of data is represented by a "Xmodem::Block" object.
Blocks can be pushed and popped from the buffer. You can retrieve the last block, or the list of blocks from buffer.
my $buf = Xmodem::Buffer->new(); my $b1 = Xmodem::Block->new(1, 'Data...'); $buf->push($b1); my $b2 = Xmodem::Block->new(2, 'More data...'); $buf->push($b2); my $last_block = $buf->last(); print 'now I have ', scalar($buf->blocks()), ' in the buffer'; # TODO document replace() function ???
Package that contains all useful Xmodem protocol constants used in handshaking and data blocks encoding procedures
Xmodem::Constants::soh ........... 'start of header' Xmodem::Constants::eot ........... 'end of trasmission' Xmodem::Constants::ack ........... 'acknowlegded' Xmodem::Constants::nak ........... 'not acknowledged' Xmodem::Constants::can ........... 'cancel' Xmodem::Constants::C ........... `C' ASCII char Xmodem::Constants::XMODEM ........ basic xmodem protocol Xmodem::Constants::XMODEM_1K ..... xmodem protocol with 1k blocks Xmodem::Constants::XMODEM_CRC .... xmodem protocol with CRC checks Xmodem::Constants::CHECKSUM ...... type of block checksum Xmodem::Constants::CRC16 ......... type of block crc16 Xmodem::Constants::CRC32 ......... type of block crc32
Control class to initiate and complete a "X-modem" file transfer in receive mode
my $recv = Xmodem::Receiver->new( modem => {Device::Modem object}, filename => 'name of file', XXX protocol => 'xmodem' | 'xmodem-crc', | 'xmodem-1k' ); $recv->run();
2020-06-20 | perl v5.30.3 |