public class Layer2Frame
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
BCAST_ADDRESS |
Constructor and Description |
---|
Layer2Frame(int destAddr,
int srcAddr,
int vlanId,
java.lang.String payload)
Create a new Layer2Frame, given values for many fields, and deriving
the values for the other fields.
|
Layer2Frame(java.lang.String bits)
Given a string of bits which should be a legal Layer2Frame, parse it into its
component pieces.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
computeParity(java.lang.String bits,
int modValue)
Compute the parity of the string of bits, by counting the number of 1
bits in the string and modding by the modValue.
|
int |
getDestAddr() |
int |
getLength() |
int |
getParity() |
java.lang.String |
getPayload() |
int |
getSrcAddr() |
int |
getVlanId() |
static java.lang.String |
toBinary(int val,
int length)
Convert the integer value val to a string of 0s and 1s of the
given length.
|
static int |
toDecimal(java.lang.String bits) |
java.lang.String |
toString()
Create the String of 0s and 1s representing the whole frame, with the
parity field on the end, and the 0 pre-amble field on the front.
|
public Layer2Frame(int destAddr, int srcAddr, int vlanId, java.lang.String payload)
public Layer2Frame(java.lang.String bits)
public int getDestAddr()
public int getSrcAddr()
public int getLength()
public int getVlanId()
public java.lang.String getPayload()
public int getParity()
public static java.lang.String toBinary(int val, int length)
public static java.lang.String computeParity(java.lang.String bits, int modValue)
public static int toDecimal(java.lang.String bits)
public java.lang.String toString()
toString
in class java.lang.Object