dk.i1.diameter
Class MessageHeader

Object
  extended by dk.i1.diameter.MessageHeader

public class MessageHeader
extends Object

A Diameter message header. See RFC3588 section 3. After you have read that understanding the class is trivial. The only fields and methods you will normally use are:

Note: The default command flags does not include the proxiable bit, meaning that request messages by default cannot be proxied by diameter proxies and other gateways. It is still not determined if this is a reasonable default. You should always call setProxiable() explicitly so it has the value you expect it to be.


Field Summary
 int application_id
           
 int command_code
           
static byte command_flag_error_bit
           
static byte command_flag_proxiable_bit
           
static byte command_flag_request_bit
           
static byte command_flag_retransmit_bit
           
 int end_to_end_identifier
           
 int hop_by_hop_identifier
           
 
Constructor Summary
MessageHeader()
          Default constructor for MessageHeader.
MessageHeader(MessageHeader mh)
          Copy-constructor for MessageHeader.
 
Method Summary
 boolean isError()
           
 boolean isProxiable()
           
 boolean isRequest()
           
 boolean isRetransmit()
           
 void prepareAnswer(MessageHeader request)
          Prepare an answer from the specified request header.
 void prepareResponse(MessageHeader request)
          Prepare a response from the specified request header.
 void setError(boolean b)
          Set error bit.
 void setProxiable(boolean b)
           
 void setRequest(boolean b)
           
 void setRetransmit(boolean b)
          Set retransmit bit
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

command_code

public int command_code

application_id

public int application_id

hop_by_hop_identifier

public int hop_by_hop_identifier

end_to_end_identifier

public int end_to_end_identifier

command_flag_request_bit

public static final byte command_flag_request_bit
See Also:
Constant Field Values

command_flag_proxiable_bit

public static final byte command_flag_proxiable_bit
See Also:
Constant Field Values

command_flag_error_bit

public static final byte command_flag_error_bit
See Also:
Constant Field Values

command_flag_retransmit_bit

public static final byte command_flag_retransmit_bit
See Also:
Constant Field Values
Constructor Detail

MessageHeader

public MessageHeader()
Default constructor for MessageHeader. The command flags are initialized to answer+not-proxiable+not-error+not-retransmit, also known as 0. The command_code, application_id, hop_by_hop_identifier and end_to_end_identifier are initialized to 0.


MessageHeader

public MessageHeader(MessageHeader mh)
Copy-constructor for MessageHeader. Implements a deep copy.

Method Detail

isRequest

public boolean isRequest()

isProxiable

public boolean isProxiable()

isError

public boolean isError()

isRetransmit

public boolean isRetransmit()

setRequest

public void setRequest(boolean b)

setProxiable

public void setProxiable(boolean b)

setError

public void setError(boolean b)
Set error bit. See RFC3588 section 3 page 32 before you set this.


setRetransmit

public void setRetransmit(boolean b)
Set retransmit bit


prepareResponse

public void prepareResponse(MessageHeader request)
Prepare a response from the specified request header. The proxiable flag is copied - the other flags are cleared. The command_code, application_id, hop_by_hop_identifier, end_to_end_identifier and 'proxyable' command flag are copied. The 'request', 'error' and 'retransmit' bits are cleared.


prepareAnswer

public void prepareAnswer(MessageHeader request)
Prepare an answer from the specified request header. This is identical to prepareResponse().

Since:
0.9.3