|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.diameter.packet.Avp
public class Avp
The Avp class is used to construct a Diameter Attribute Value Pair (AVP). Diameter AVPs are used in Diameter messages to be the envelopes for individual information elements This Avp class holds an AvpValueUtil which encapsulates the actual data held by this AVP. There are different AvpValueUtil types for each of the Diameter AVP types.
This Avp class is only used by a client application that wishes to use a Raw method for either the Ro or Rf requests. The higher level APIs do not require the usage of the Avp class by the client application.
Field Summary | |
---|---|
protected int |
avpLength
Length of the AVP in number of bytes. |
static byte |
M_BIT
Bit mask for the Mandatory AVP Flag. |
static byte |
P_BIT
Bit mask for the Encryption on end-to-end security AVP Flag (Obsolete). |
static byte |
R_BITS
Bit mask for the Reserved fields in the AVP Flag. |
static byte |
V_BIT
Bit mask for the Vendor Specific AVP Flag. |
static byte |
VOFF_MOFF_POFF
Non vendor specific, non mandatory, no encryption |
static byte |
VOFF_MOFF_PON
Non vendor specific, non mandatory, encryption |
static byte |
VOFF_MON_POFF
Non vendor specific, mandatory, no encryption |
static byte |
VOFF_MON_PON
Non vendor specific, mandatory, encryption |
static byte |
VON_MOFF_POFF
Vendor specific, non mandatory, no encryption |
static byte |
VON_MOFF_PON
Vendor specific, non mandatory, encryption |
static byte |
VON_MON_POFF
Vendor specific, mandatory, no encryption |
static byte |
VON_MON_PON
Vendor specific, mandatory, encryption |
Constructor Summary | |
---|---|
Avp()
Empty constructor for the Avp . |
|
Avp(int avpCode,
byte avpFlags,
AvpValueUtil avpValue)
Creates an instance of Avp . |
|
Avp(int avpCode,
byte avpFlags,
int length,
AvpValueUtil avpValue)
Creates an instance of Avp . |
Method Summary | |
---|---|
int |
getAvpCode()
Returns the AVP code which is used along with the Vendor-Id to uniquely identify this attribute. |
byte |
getAvpFlags()
Returns the AVP flags which include the P Bit, M Bit and V Bit. |
int |
getAvpLength()
Returns the length of the AVP in octets. |
AvpValueUtil |
getAvpValueUtil()
Returns the AvpValueUtil object which is used to read the value of this AVP. |
boolean |
isMBit()
Queries whether the Mandatory bit is set on this AVP. |
boolean |
isPBit()
Queries whether the P bit is set on this AVP. |
boolean |
isValid()
isValid() checks to see if AVP is valid |
boolean |
isVBit()
Queries whether the Vendor-Specific bit is set on this AVP. |
void |
setAvpCode(int avpCode)
Sets the AVP code. |
void |
setAvpFlags(byte avpFlags)
Sets the AVP flags. |
void |
setAvpLength(int avpLength)
Sets the length of the AVP in octets. |
void |
setAvpValueUtil(AvpValueUtil avpValue)
Sets the AvpValueUtil object which is used to read the value of this AVP. |
void |
setMBit(boolean value)
Sets the Mandatory bit on this AVP. |
void |
setPBit(boolean value)
Sets the P bit on this AVP. |
void |
setVBit(boolean value)
Sets the Vendor-Specific bit on this AVP. |
void |
toDataOutputStream(java.io.DataOutputStream out)
Writes the Avp to the DataOutputStream , including the header
information and the value of the AVP contained within the AvpValueUtil instance. |
void |
toDiamWsByteBufferOutputStream(com.ibm.diameter.util.DiamWsByteBufferOutputStream out)
Writes the Avp to the DiamWsByteBufferOutputStream , including the header
information and the value of the AVP contained within the AvpValueUtil instance. |
java.lang.String |
toString()
Returns a String representation of the Avp. |
java.lang.String |
toString2()
Returns a String representation of the Avp. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int avpLength
public static final byte V_BIT
public static final byte M_BIT
public static final byte P_BIT
public static final byte R_BITS
public static final byte VOFF_MOFF_POFF
public static final byte VOFF_MOFF_PON
public static final byte VOFF_MON_POFF
public static final byte VOFF_MON_PON
public static final byte VON_MOFF_POFF
public static final byte VON_MOFF_PON
public static final byte VON_MON_POFF
public static final byte VON_MON_PON
Constructor Detail |
---|
public Avp()
Avp
. This constructor should typically not be used.
public Avp(int avpCode, byte avpFlags, AvpValueUtil avpValue)
Avp
. Note that the length is not included in this constructor.
The length is
calculated by getting the length from the AvpValueUtil
class and adding the
AVP header length to it.
Example:
Avp myAvp = new Avp(AvpConstants.ACCT_APPLICATION_ID, Avp.VOFF_MON_POFF, new AvpValueUtilUnsigned32(0xFFFFFFFF));
avpCode
- Identifier of the AVPavpFlags
- Tells the receiver how the attribute should be handled. It is of the form VMPrrrrr.
The V, or Vendor-Specific, bit indicates whether the Vendor Id field is present in the header. The
M, or Mandatory, bit indicates whether support of this AVP is required or not. The P bit indicates
the need for encryption. The P bit is obsolete, and should not be set to 0.
The r, or reserved, bits are unused in this release and should be set to 0.avpValue
- An instance of the AvpValueUtil
class that contains the value in a form
that the class knows how to interpret.public Avp(int avpCode, byte avpFlags, int length, AvpValueUtil avpValue)
Avp
.
This constructor in not suggested for use as it overrides the length that is provided in the AvpValueUtil. An inconsistent length may cause unexpected results.
avpCode
- Identifier of the AVPavpFlags
- Tells the receiver how the attribute should be handled. It is of the form VMPrrrrr. \
The V, or Vendor-Specific, bit indicates whether the Vendor Id field is present in the header. The \
M, or Mandatory, bit indicates whether support of this AVP is required or not. The P bit indicates \
the need for encryption. The P bit has been made obsolete by the IETF, and should be set to 0.
The r, or reserved, bits are unused in this release and should be set to 0.length
- The length of the Avp
that is being created.avpValue
- An instance of the AvpValueUtil
class that contains the value in a form\
that the class knows how to interpret.Method Detail |
---|
public boolean isVBit()
public boolean isMBit()
public boolean isPBit()
public void setVBit(boolean value)
value
- true if this is a Vendor-Specific AVP, otherwise false.public void setMBit(boolean value)
value
- true if support for this AVP is required, otherwise false.public void setPBit(boolean value)
value
- true if this AVP requires encryption for end-to-end security, otherwise false.public int getAvpCode()
public void setAvpCode(int avpCode)
avpCode
- The IANA defined code for this Diameter Attribute.public byte getAvpFlags()
public void setAvpFlags(byte avpFlags)
avpFlags
- The AVP flags to set.public int getAvpLength()
public void setAvpLength(int avpLength)
avpLength
- The length of the AVP.public AvpValueUtil getAvpValueUtil()
AvpValueUtil
object which is used to read the value of this AVP.
public void setAvpValueUtil(AvpValueUtil avpValue)
AvpValueUtil
object which is used to read the value of this AVP.
avpValue
- an instance of AvpValueUtil that contains the data as well as a method to retrieve the data.public boolean isValid()
Checks include: V_Bit must be off for a generic AVP.
public void toDiamWsByteBufferOutputStream(com.ibm.diameter.util.DiamWsByteBufferOutputStream out)
Avp
to the DiamWsByteBufferOutputStream
, including the header
information and the value of the AVP contained within the AvpValueUtil
instance.
out
- The output stream to write the Avp
to.public void toDataOutputStream(java.io.DataOutputStream out)
Avp
to the DataOutputStream
, including the header
information and the value of the AVP contained within the AvpValueUtil
instance.
out
- The output stream to write the Avp
to.public java.lang.String toString()
If the Avp is recognized as having an entry in the internal Avp dictionary, the name of the Avp will be displayed. However, if the Avp is does not contain an entry in the Avp dictionary, the result will be identical output to toString2().
toString
in class java.lang.Object
public java.lang.String toString2()
This method does not reference any dictionary to produce the string output.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |