|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnachos.machine.Packet
public class Packet
A link-layer packet.
Network
Field Summary | |
---|---|
byte[] |
contents
The contents of this packet, excluding the header. |
int |
dst
The address of the destination of this packet. |
static int |
headerLength
The number of bytes in a packet header. |
static int |
maxContentsLength
The maximum number of content bytes (not including the header). |
static int |
maxNumMach
Upper limit on the number of machines. |
static int |
maxPacketLength
The maximum length, in bytes, of a packet that can be sent or received on the network. |
byte[] |
packetBytes
This packet, as an array of bytes that can be sent on a network. |
int |
src
The address of the source of this packet. |
Constructor Summary | |
---|---|
Packet(byte[] packetBytes)
Allocate a new packet using the specified array of bytes received from the network. |
|
Packet(int dst,
int src,
byte[] contents)
Allocate a new packet to be sent, using the specified parameters. |
Method Summary |
---|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public byte[] packetBytes
public int dst
public int src
public byte[] contents
public static final int headerLength
offset | size | value |
0 | 1 | network ID (for collision detection) |
1 | 1 | destination address |
2 | 1 | source address |
3 | 1 | length of contents |
public static final int maxPacketLength
public static final int maxContentsLength
public static final int maxNumMach
Constructor Detail |
---|
public Packet(int dst, int src, byte[] contents) throws MalformedPacketException
dst
- the destination machine.src
- the source machine.contents
- the contents of the packet.
MalformedPacketException
public Packet(byte[] packetBytes) throws MalformedPacketException
packetBytes
- the bytes making up this packet.
MalformedPacketException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |