The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::EPP::Protocol - Low-level functions useful for both EPP clients and servers.

SYNOPSIS

        #!/usr/bin/perl
        use Net::EPP::Protocol;
        use IO::Socket;
        use strict;

        # create a socket:

        my $socket = IO::Socket::INET->new( ... );

        # send a frame down the socket:

        Net::EPP::Protocol->send_frame($socket, $xml);

        # get a frame from the socket:

        my $xml = Net::EPP::Protocol->get_frame($socket);

DESCRIPTION

This module implements functions that are common to both EPP clients and servers that implement the TCP transport as defined in RFC 4934. The main consumer of this module is currently Net::EPP::Client.

VARIABLES

$Net::EPP::Protocol::THRESHOLD

At least one EPP server implementation sends an unframed plain text error message when a client connects from an unauthorised address. As a result, when the first four bytes of the message are unpacked, the client tries to read and allocate a very large amount of memory.

If the apparent frame length received from a server exceeds the value of $Net::EPP::Protocol::THRESHOLD, the get_frame() method will croak.

The default value is 1GB.

METHODS

        my $xml = Net::EPP::Protocol->get_frame($socket);

This method reads a frame from the socket and returns a scalar containing the XML. $socket must be an IO::Handle or one of its subclasses (ie IO::Socket::*).

If the transmission fails for whatever reason, this method will croak(), so be sure to enclose it in an eval().

        Net::EPP::Protocol->send_frame($socket, $xml);

This method prepares an RFC 4934 compliant EPP frame and transmits it to the remote peer. $socket must be an IO::Handle or one of its subclasses (ie IO::Socket::*).

If the transmission fails for whatever reason, this method will croak(), so be sure to enclose it in an eval(). Otherwise, it will return a true value.

        my $frame = Net::EPP::Protocol->prep_frame($xml);

This method returns the XML frame in "wire format" with the protocol header prepended to it. The return value can be printed directly to an open socket, for example:

        print STDOUT Net::EPP::Protocol->prep_frame($frame->toString);