GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  NET::PACKET::TCP (3)

.ds Aq ’

NAME

Net::Packet::TCP - Transmission Control Protocol layer 4 object

CONTENTS

SYNOPSIS



   use Net::Packet::Consts qw(:tcp);
   require Net::Packet::TCP;

   # Build a layer
   my $layer = Net::Packet::TCP->new(
      dst     => 22,
      options => "\x02\x04\x05\xb4", # MSS=1460
   );
   $layer->pack;

   print RAW: .unpack(H*, $layer->raw)."\n";

   # Read a raw layer
   my $layer = Net::Packet::TCP->new(raw => $raw);

   print $layer->print."\n";
   print PAYLOAD: .unpack(H*, $layer->payload)."\n"
      if $layer->payload;



DESCRIPTION

This modules implements the encoding and decoding of the TCP layer.

RFC: ftp://ftp.rfc-editor.org/in-notes/rfc793.txt

See also <B>Net::Packet::LayerB> and <B>Net::Packet::Layer4B> for other attributes and methods.

ATTRIBUTES

<B>srcB>
<B>dstB> Source and destination ports.
<B>flagsB> TCP flags, see CONSTANTS.
<B>winB> The window size.
<B>seqB>
<B>ackB> Sequence and acknowledgment numbers.
<B>offB> The size in number of words of the TCP header.
<B>x2B> Reserved field.
<B>checksumB> The TCP header checksum.
<B>urpB> Urgent pointer.
<B>optionsB> TCP options, as a hexadecimal string.

METHODS

<B>newB> Object constructor. You can pass attributes that will overwrite default ones. Default values:

src: getRandomHighPort()

dst: 0

seq: getRandom32bitsInt()

ack: 0

x2: 0

off: 0

flags: NP_TCP_FLAG_SYN

win: 0xffff

checksum: 0

urp: 0

options: ""

<B>recvB> Will search for a matching replies in <B>framesSortedB> or <B>framesB> from a <B>Net::Packet::DumpB> object.
<B>packB> Packs all attributes into a raw format, in order to inject to network. Returns 1 on success, undef otherwise.
<B>unpackB> Unpacks raw data from network and stores attributes into the object. Returns 1 on success, undef otherwise.
<B>getHeaderLengthB> Returns the header length in bytes, not including TCP options.
<B>getOptionsLengthB> Returns options length in bytes.
<B>haveFlagFinB>
<B>haveFlagSynB>
<B>haveFlagRstB>
<B>haveFlagPshB>
<B>haveFlagAckB>
<B>haveFlagUrgB>
<B>haveFlagEceB>
<B>haveFlagCwrB> Returns 1 if the specified TCP flag is set in <B>flagsB> attribute, 0 otherwise.

CONSTANTS

Load them: use Net::Packet::Consts qw(:tcp);
<B>NP_TCP_FLAG_FINB>
<B>NP_TCP_FLAG_SYNB>
<B>NP_TCP_FLAG_RSTB>
<B>NP_TCP_FLAG_PSHB>
<B>NP_TCP_FLAG_ACKB>
<B>NP_TCP_FLAG_URGB>
<B>NP_TCP_FLAG_ECEB>
<B>NP_TCP_FLAG_CWRB> TCP flag constants.

AUTHOR

Patrice <GomoR> Auffret

COPYRIGHT AND LICENSE

Copyright (c) 2004-2009, Patrice <GomoR> Auffret

You may distribute this module under the terms of the Artistic license. See LICENSE.Artistic file in the source distribution archive.

RELATED MODULES

NetPacket, Net::RawIP, Net::RawSock

POD ERRORS

Hey! <B>The above document had some coding errors, which are explained below:B>
Around line 309: Non-ASCII character seen before =encoding in ’# Build’. Assuming ISO8859-1
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 NET::PACKET::TCP (3) 2009-11-09

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.