org.jnetpcap.packet
Interface JPayloadAccessor

All Known Implementing Classes:
AbstractMessageHeader, Ethernet, Html, Http, Icmp, Icmp.DestinationUnreachable, Icmp.Echo, Icmp.EchoReply, Icmp.EchoRequest, Icmp.ParamProblem, Icmp.Redirect, Icmp.Reserved, Icmp.SourceQuench, IEEE802dot1q, IEEE802dot2, IEEE802dot3, IEEESnap, Ip4, Ip4.IpOption, Ip4.LooseSourceRoute, Ip4.NoOp, Ip4.RecordRoute, Ip4.Routing, Ip4.Security, Ip4.StreamId, Ip4.StrictSourceRoute, Ip4.Timestamp, Ip6, JHeader, JHeaderMap, JMappedHeader, JSubHeader, L2TP, Payload, PPP, Tcp, Udp

public interface JPayloadAccessor

Interface which provides access to payload portion of the packet data. When considered from a header's perspective, each header has a raw payload portion, which may be other headers. The remaining, undecoded data at the end of the packet is simply payload of the last header.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Method Summary
 byte[] getPayload()
          Retrieves the playload data portion of the packet right after the current header.
 JBuffer peerPayloadTo(JBuffer buffer)
          Peers, without copy, the user supplied buffer with payload data portion of the packet right after the current header.
 byte[] transferPayloadTo(byte[] buffer)
          Copies the payload data portion of the packet right after the current header to user supplied buffer.
 java.nio.ByteBuffer transferPayloadTo(java.nio.ByteBuffer buffer)
          Copies into the user supplied buffer, the payload data portion of the packet right after the current header.
 JBuffer transferPayloadTo(JBuffer buffer)
          Copies into the user supplied buffer, the payload data portion of the packet right after the current header.
 

Method Detail

getPayload

byte[] getPayload()
Retrieves the playload data portion of the packet right after the current header.

Returns:
newly allocated byte array containing copy of the contents of the header's payload from the packet.

transferPayloadTo

byte[] transferPayloadTo(byte[] buffer)
Copies the payload data portion of the packet right after the current header to user supplied buffer.

Parameters:
buffer - buffer where the data will be written to
Returns:
the same buffer that was passed in

peerPayloadTo

JBuffer peerPayloadTo(JBuffer buffer)
Peers, without copy, the user supplied buffer with payload data portion of the packet right after the current header.

Parameters:
buffer - buffer to peer the data with
Returns:
the same buffer that was passed in

transferPayloadTo

JBuffer transferPayloadTo(JBuffer buffer)
Copies into the user supplied buffer, the payload data portion of the packet right after the current header.

Parameters:
buffer - buffer to copy the data to
Returns:
the same buffer that was passed in

transferPayloadTo

java.nio.ByteBuffer transferPayloadTo(java.nio.ByteBuffer buffer)
Copies into the user supplied buffer, the payload data portion of the packet right after the current header. The copy will start at the current ByteBuffer position property.

Parameters:
buffer - buffer to copy the data to
Returns:
the same buffer that was passed in