I'm attempting to write a small program to decode OSCAR packets and just
can't get my mind wrapped-around whatever it is that
NetPacket::TCP->decode() is returning when stripping-away the ethernet,
IP, and TCP encapsulation from OSCAR packets. (Maybe it's unicode? Maybe
it's hex? I don't quite understand how to work with anything but ASCII.)

> #!/usr/bin/perl -w
> 
> use Net::PcapUtils;
> use NetPacket::Ethernet qw( :strip );
> use NetPacket::TCP;
> use NetPacket::IP qw( :strip );
> 
> my $pkt_descriptor = Net::PcapUtils::open(
>         FILTER  => 'port 5190',
>         SNAPLEN => 1500,
>         DEV     => 'eth1'
> );
> 
> if (!ref($pkt_descriptor)) {
>         print "Net::PcapUtils::open returned: $pkt_descriptor\n";
>         exit;
> }
> 
> while (1) {
>         my ($packet,%header) = Net::PcapUtils::next($pkt_descriptor);
>         &process($packet);
> }
> 
> sub process() {
>         my $packet = shift;
>         my $tcp = NetPacket::TCP->decode(ip_strip(eth_strip($packet)));
>         # How to check the value of the first byte?
>       # How to remove the first six bytes?
> }

Being new to network programming I'm hoping that somebody can recommend
some tutorials/articles on how to decode the payload of the OSCAR
segment and work with the payload on a byte-by-byte basis. e.g.,
Checking the value of each of the first six bytes?

I'd _really_ appreciate any guidance. TIA!

Eric P.
Sunnyvale, CA


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to