NAME

udp_proxy - Perl binding for udpxy

SYNOPSIS

use udp_proxy;

my $uph = new udp_proxy({
    interface => 'eth0',
    log     => 'udp_proxy.log',     # or \*LOG, or $fh, or *LOG
    handle  => 'stream.ts',         # like log, but default to stdout if not set.
});
$uph->do_relay('rtp', '233.33.210.86', 5050);

DESCRIPTION

This module binds some udpxy functional to perl. It is possible to record or transfer unscrambled multicast traffic.

METHODS

my $uph = new udp_proxy( \%args );

Method new creates object udp_proxy with some parameters: - interface - interface on which object should receive multicast traffic - log - filehandle or filename of log file. - handle - filehandle or filename for writing MPEG-TS packets.

$uph->do_relay( $command, $host, $port );

Method that actualy do the work. Writing data to STDOUT or speciefied handle. $command - possible values 'rtp' or 'udp' $host - multicast host to which object should join $port - port on which transmission is going.

EXPORT

None by default.

EXAMPLE

use udp_proxy;

my $app = sub {
    my $env = shift;

    return sub {
        my $respond = shift;
        my $writer = $respond->([200, ['Content-Type', 'application/octet-stream']]);
        my $uph = new udp_proxy({
            interface => 'en0',
            log       => $env->{'psgi.errors'},
            handle    => $env->{'psgix.io'},
        });
        $uph->do_relay('rtp', '233.33.210.86', 5050);
        $writer->close();
    };
};

SEE ALSO

IO::Socket::Multicast

AUTHOR

Pavel V. Cherenkov, <pcherenkov@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2008-2013 by Pavel V. Cherenkov

This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.