|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object dk.i1.diameter.Utils
public final class Utils
A mishmash of handy methods
Nested Class Summary | |
---|---|
static class |
Utils.ABNFComponent
A component in a message ABNF |
static class |
Utils.CheckABNFFailure
Result from checkABNF(dk.i1.diameter.Message, dk.i1.diameter.Utils.ABNFComponent[]) |
Field Summary | |
---|---|
static Utils.ABNFComponent[] |
abnf_asa
ABNF for ASA (section 8.5.2) |
static Utils.ABNFComponent[] |
abnf_asr
ABNF for ASR (section 8.5.1) |
static Utils.ABNFComponent[] |
abnf_cea
ABNF for CEA (section 5.3.2) |
static Utils.ABNFComponent[] |
abnf_cer
ABNF for CER (section 5.3.1) |
static Utils.ABNFComponent[] |
abnf_dpa
ABNF for DPA (section 5.4.2) |
static Utils.ABNFComponent[] |
abnf_dpr
ABNF for DPR (section 5.4.1) |
static Utils.ABNFComponent[] |
abnf_dwa
ABNF for DWA (section 5.5.2) |
static Utils.ABNFComponent[] |
abnf_dwr
ABNF for DWR (section 5.5.1) |
static Utils.ABNFComponent[] |
abnf_raa
ABNF for RAA (section 8.3.2) |
static Utils.ABNFComponent[] |
abnf_rar
ABNF for RAR (section 8.3.1) |
static Utils.ABNFComponent[] |
abnf_sta
ABNF for STA (section 8.4.1) |
static Utils.ABNFComponent[] |
abnf_str
ABNF for STR (section 8.4.1) |
static int[] |
rfc3588_grouped_avps
List of AVPs that are grouped according to RFC3588 section 4.5 |
static int[] |
rfc3588_mandatory_codes
The AVP codes of the AVPs listen in RFC3588 section 4.5 that must be mandatory |
static int[] |
rfc4006_grouped_avps
List of AVPs that are grouped according to RFC4006 section 8 |
static int[] |
rfc4006_mandatory_codes
The AVP codes of the AVPs listen in RFC4006 section 8 that must be mandatory |
Method Summary | |
---|---|
static Utils.CheckABNFFailure |
checkABNF(Message msg,
Utils.ABNFComponent[] abnf)
Check that a message conforms to an ABNF. |
static void |
copyProxyInfo(Message from,
Message to)
Copies any Proxy-Info AVPs from one message to another. |
static void |
setMandatory_RFC3588(Iterable<AVP> avps)
Sets the M-bit on the AVPs that should have the M bit set according to RFC3588 |
static void |
setMandatory_RFC3588(Message msg)
Sets the M-bit on the AVPs that should have the M bit set according to RFC3588 |
static void |
setMandatory_RFC4006(Iterable<AVP> avps)
Sets the M-bit on the AVPs that must have the M bit set according to RFC4006 |
static void |
setMandatory_RFC4006(Message msg)
Sets the M-bit on the AVPs that must have the M bit set according to RFC4006 |
static void |
setMandatory(Iterable<AVP> avps,
java.util.Collection<Integer> codes)
Sets the M-bit on the avps with the specified codes. |
static void |
setMandatory(Iterable<AVP> avps,
int[] codes)
Sets the M-bit on the avps with the specified codes. |
static void |
setMandatory(Iterable<AVP> avps,
int[] codes,
int[] grouped_avp_codes)
Sets the M-bit on the avps with the specified codes. |
static void |
setMandatory(Message msg,
int[] codes)
Sets the M-bit on the avps with the specified codes. |
static void |
setMandatory(Message msg,
int[] codes,
int[] grouped_avp_codes)
Sets the M-bit on the avps with the specified codes. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int[] rfc3588_mandatory_codes
public static final int[] rfc3588_grouped_avps
public static final int[] rfc4006_mandatory_codes
public static final int[] rfc4006_grouped_avps
public static final Utils.ABNFComponent[] abnf_cer
public static final Utils.ABNFComponent[] abnf_cea
public static final Utils.ABNFComponent[] abnf_dpr
public static final Utils.ABNFComponent[] abnf_dpa
public static final Utils.ABNFComponent[] abnf_dwr
public static final Utils.ABNFComponent[] abnf_dwa
public static final Utils.ABNFComponent[] abnf_rar
public static final Utils.ABNFComponent[] abnf_raa
public static final Utils.ABNFComponent[] abnf_str
public static final Utils.ABNFComponent[] abnf_sta
public static final Utils.ABNFComponent[] abnf_asr
public static final Utils.ABNFComponent[] abnf_asa
Method Detail |
---|
public static final void setMandatory(Iterable<AVP> avps, int[] codes, int[] grouped_avp_codes)
avps
- The AVPs to examine and possibly set the M-bit on.codes
- Array of codesgrouped_avp_codes
- Array of AVP codes for AVPs that are grouped and should be examined deeper for other mandatory AVPspublic static final void setMandatory(Iterable<AVP> avps, int[] codes)
avps
- The AVPs to examine and possibly set the M-bit on.codes
- Array of codespublic static final void setMandatory(Iterable<AVP> avps, java.util.Collection<Integer> codes)
avps
- The AVPs to examine and possibly set the M-bit on.codes
- Array of codespublic static final void setMandatory(Message msg, int[] codes)
msg
- The message AVPs to examine and possibly set the M-bit on.codes
- Array of codespublic static final void setMandatory(Message msg, int[] codes, int[] grouped_avp_codes)
msg
- The message AVPs to examine and possibly set the M-bit on.codes
- Array of codesgrouped_avp_codes
- Array of AVP codes for AVPs that are grouped and should be examined deeper for other mandatory AVPspublic static final void setMandatory_RFC3588(Iterable<AVP> avps)
New behaviour since 0.9.5: Also traverses grouped AVPs mentioned in rfc4006 and handles the M-bit properly.
public static final void setMandatory_RFC3588(Message msg)
New behaviour since 0.9.5: Also traverses grouped AVPs mentioned in rfc4006 and handles the M-bit properly.
public static final void setMandatory_RFC4006(Iterable<AVP> avps)
New behaviour since 0.9.5: Also traverses grouped AVPs mentioned in rfc4006 and handles the M-bit properly.
public static final void setMandatory_RFC4006(Message msg)
New behaviour since 0.9.5: Also traverses grouped AVPs mentioned in rfc4006 and handles the M-bit properly.
public static final void copyProxyInfo(Message from, Message to)
from
- The source message.to
- The destination message.public static final Utils.CheckABNFFailure checkABNF(Message msg, Utils.ABNFComponent[] abnf)
public static final ABNFComponent abnf_my_message[] = { new ABNFComponent(true, 1, 1, ProtocolConstants.DI_SESSION_ID), new ABNFComponent(false, 1, 1, ProtocolConstants.DI_ORIGIN_HOST), new ABNFComponent(false, 1, 1, ProtocolConstants.DI_ORIGIN_REALM), new ABNFComponent(false, 1, 1, ProtocolConstants.DI_USER_NAME), ... new ABNFComponent(false, 0, -1, -1), //special marker for arbitrary AVPs }; CheckABNFFailure caf = Utils.checkABNF(msg,abnf_my_message); if(caf!=null) { //The message did not conform to the ABNF Message response = new Message(); response.prepareResponse(msg); ... if(caf.failed_avp!=null) msg.add(caf.failed_avp); msg.add(new AVP_Unsigned32(ProtocolConstants.DI_RESULT_CODE,caf.result_code)); if(caf.error_message!=null) msg.add(new AVP_UTF8String(ProtocolConstants.DI_ERROR_MESSAGE,caf.error_message)); ... }
msg
- The message to be checked.abnf
- An array of ABNFComponents. You can use on of the predefined ones.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |