public class MeterBandFactory extends AbstractFactory
MeterBand
instances.Modifier and Type | Method and Description |
---|---|
static MeterBand |
createBand(ProtocolVersion pv,
MeterBandType type,
long rate,
long burstSize)
Creates a DROP meter band.
|
static MeterBand |
createBand(ProtocolVersion pv,
MeterBandType type,
long rate,
long burstSize,
ExperimenterId eid)
Creates an EXPERIMENTER meter band.
|
static MeterBand |
createBand(ProtocolVersion pv,
MeterBandType type,
long rate,
long burstSize,
int value)
Creates a DSCP_REMARK or EXPERIMENTER meter band.
|
static void |
encodeBandList(List<MeterBand> bands,
OfPacketWriter pkt)
Encodes a list of meter bands, writing them into the supplied buffer.
|
static int |
getLength(MeterBand band)
Returns the length for the given meter band, in bytes.
|
static List<MeterBand> |
parseMeterBandList(int targetRi,
OfPacketReader pkt,
ProtocolVersion pv)
Parses a list of meter band structures from the supplied buffer.
|
protected String |
tag()
Returns an identifying tag for the meter band factory.
|
mpe, mpe, mpe, mpe
protected String tag()
tag
in class AbstractFactory
public static List<MeterBand> parseMeterBandList(int targetRi, OfPacketReader pkt, ProtocolVersion pv) throws MessageParseException
Note that this method causes the reader index of the underlying
PacketBuffer
to be advanced by the length of the list,
which should leave the reader index at targetRi
.
This method delegates to parseMeterBand(com.hp.of.lib.OfPacketReader, com.hp.of.lib.ProtocolVersion)
for each
individual band.
targetRi
- the target reader indexpkt
- the data bufferpv
- the protocol versionMessageParseException
- if unable to parse the structurepublic static MeterBand createBand(ProtocolVersion pv, MeterBandType type, long rate, long burstSize)
pv
- the protocol versiontype
- the meter band type (DROP)rate
- the rate for dropping packets (u32)burstSize
- the size of bursts (u32)VersionNotSupportedException
- if the version is not supportedVersionMismatchException
- if pv < 1.3NullPointerException
- if pv or type is nullIllegalArgumentException
- if any argument is inappropriatepublic static MeterBand createBand(ProtocolVersion pv, MeterBandType type, long rate, long burstSize, int value)
pv
- the protocol versiontype
- the meter band type (DSCP_REMARK or EXPERIMENTER)rate
- the rate (u32)burstSize
- the size of bursts (u32)value
- either the number of precedence levels to subtract
(DSCP_REMARK) or experimenter encoded id (EXPERIMENTER)VersionNotSupportedException
- if the version is not supportedVersionMismatchException
- if pv < 1.3NullPointerException
- if pv or type is nullIllegalArgumentException
- if any argument is inappropriatepublic static MeterBand createBand(ProtocolVersion pv, MeterBandType type, long rate, long burstSize, ExperimenterId eid)
pv
- the protocol versiontype
- the meter band type (EXPERIMENTER)rate
- the rate (u32)burstSize
- the size of bursts (u32)eid
- the experimenter idVersionNotSupportedException
- if the version is not supportedVersionMismatchException
- if pv < 1.3NullPointerException
- if pv, type or eid is nullIllegalArgumentException
- if any argument is inappropriatepublic static void encodeBandList(List<MeterBand> bands, OfPacketWriter pkt)
PacketBuffer
to be advanced by the length of the written bands.bands
- the list of meter bandspkt
- the buffer into which the bands are to be writtenpublic static int getLength(MeterBand band)
band
- the target bandNullPointerException
- if the band is nullCopyright © 2015. All Rights Reserved.