Package org.onosproject.net.packet
Class DefaultInboundPacket
- java.lang.Object
-
- org.onosproject.net.packet.DefaultInboundPacket
-
- All Implemented Interfaces:
InboundPacket
public final class DefaultInboundPacket extends java.lang.Object implements InboundPacket
Default implementation of an immutable inbound packet.
-
-
Constructor Summary
Constructors Constructor Description DefaultInboundPacket(ConnectPoint receivedFrom, Ethernet parsed, java.nio.ByteBuffer unparsed)
Creates an immutable inbound packet.DefaultInboundPacket(ConnectPoint receivedFrom, Ethernet parsed, java.nio.ByteBuffer unparsed, java.util.Optional<java.lang.Long> cookie)
Creates an immutable inbound packet with cookie.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<java.lang.Long>
cookie()
Returns the cookie in the packet in message.boolean
equals(java.lang.Object obj)
int
hashCode()
Ethernet
parsed()
Returns the parsed form of the packet.ConnectPoint
receivedFrom()
Returns the device and port from where the packet was received.java.lang.String
toString()
java.nio.ByteBuffer
unparsed()
Unparsed packet data.
-
-
-
Constructor Detail
-
DefaultInboundPacket
public DefaultInboundPacket(ConnectPoint receivedFrom, Ethernet parsed, java.nio.ByteBuffer unparsed)
Creates an immutable inbound packet.- Parameters:
receivedFrom
- connection point where receivedparsed
- parsed ethernet frameunparsed
- unparsed raw bytes
-
DefaultInboundPacket
public DefaultInboundPacket(ConnectPoint receivedFrom, Ethernet parsed, java.nio.ByteBuffer unparsed, java.util.Optional<java.lang.Long> cookie)
Creates an immutable inbound packet with cookie.- Parameters:
receivedFrom
- connection point where receivedparsed
- parsed ethernet frameunparsed
- unparsed raw bytescookie
- cookie
-
-
Method Detail
-
receivedFrom
public ConnectPoint receivedFrom()
Description copied from interface:InboundPacket
Returns the device and port from where the packet was received.- Specified by:
receivedFrom
in interfaceInboundPacket
- Returns:
- connection point where received
-
parsed
public Ethernet parsed()
Description copied from interface:InboundPacket
Returns the parsed form of the packet.- Specified by:
parsed
in interfaceInboundPacket
- Returns:
- parsed Ethernet frame; null if the packet is not an Ethernet frame or one for which there is no parser
-
unparsed
public java.nio.ByteBuffer unparsed()
Description copied from interface:InboundPacket
Unparsed packet data.- Specified by:
unparsed
in interfaceInboundPacket
- Returns:
- raw packet bytes
-
cookie
public java.util.Optional<java.lang.Long> cookie()
Description copied from interface:InboundPacket
Returns the cookie in the packet in message.- Specified by:
cookie
in interfaceInboundPacket
- Returns:
- optional flow cookie
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-