com.ascert.comms.x25
Class X25Message

java.lang.Object
  |
  +--com.ascert.comms.x25.X25Message

public class X25Message
extends java.lang.Object

Provides a common class encapsulating X.25 messages to be sent or received. In addition to containing a data buffer with contents of the message, the class also allows setting or retrieval of message status indicators such as the X.25 M-Bit ot Q-Bit.

Since:
1.00
Version:
1.00, 21 May 2003
Author:
Rob Walker

Field Summary
protected  int len
          Indicates the length of data to be sent or which was received.
protected  boolean mBit
          Indicates status of the X.25 M-bit when this message is sent or received.
protected  byte[] msg
          Buffer containing the message data to be sent or received.
protected  boolean qBit
          Indicates status of the X.25 Q-bit when this message is sent or received.
 
Constructor Summary
X25Message(byte[] msg)
          Constructs an X25Message object, using the supplied buffer for sending and receiving data.
X25Message(byte[] msg, boolean qBit, boolean mBit)
          Constructs an X25Message object, using the supplied buffer for sending and receiving data.
X25Message(byte[] msg, int len, boolean qBit, boolean mBit)
          Constructs an X25Message object, using the supplied buffer for sending and receiving data.
 
Method Summary
 int getLen()
          Gets the length attribute of the X25Message object.
 boolean getMbit()
          Gets the M-bit attribute of the X25Message object
 byte[] getMsg()
          Gets the msg attribute of the X25Message object
 boolean getQbit()
          Gets the Q-bit attribute of the X25Message object
 void setLen(int len)
          Sets the length attribute of the X25Message object
 void setMbit(boolean mBit)
          Sets the M-bit attribute of the X25Message object
 void setQbit(boolean qBit)
          Sets the Q-bit attribute of the X25Message object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

len

protected int len
Indicates the length of data to be sent or which was received.


mBit

protected boolean mBit
Indicates status of the X.25 M-bit when this message is sent or received. The M-bit shows whether more data needs to be sent or received to to complete the message.


msg

protected byte[] msg
Buffer containing the message data to be sent or received.


qBit

protected boolean qBit
Indicates status of the X.25 Q-bit when this message is sent or received.

Constructor Detail

X25Message

public X25Message(byte[] msg)
Constructs an X25Message object, using the supplied buffer for sending and receiving data. The length to send or receive will be set to the length of the supplied buffer. Both the Q-bit and M-bit will be set false

Parameters:
msg - buffer containg data to be sent, or in which received data will be placed

X25Message

public X25Message(byte[] msg,
                  boolean qBit,
                  boolean mBit)
Constructs an X25Message object, using the supplied buffer for sending and receiving data. The length to send or receive will be set to the length of the supplied buffer. The Q-bit and M-bit will be set to the values supplied.

Parameters:
msg - buffer containg data to be sent, or in which received data will be placed
qBit - status of the Q-bit in the constructed message
mBit - status of the M-bit in the constructed message

X25Message

public X25Message(byte[] msg,
                  int len,
                  boolean qBit,
                  boolean mBit)
Constructs an X25Message object, using the supplied buffer for sending and receiving data. The length to send or receive, and the Q-bit and M-bit will be set to the values supplied.

Parameters:
msg - buffer containg data to be sent, or in which received data will be placed
len - length of data to be sent, or maximum length of data to be received
qBit - status of the Q-bit in the constructed message
mBit - status of the M-bit in the constructed message
Method Detail

getLen

public int getLen()
Gets the length attribute of the X25Message object. On initiating a X25Socket.send(com.ascert.comms.x25.X25Message) operation this value should contain the length of the data to be sent from the msg buffer. On initiation of a X25Socket.recv(com.ascert.comms.x25.X25Message) operation this value should contain the maximum length of data to be received. On completion of the X25Socket.recv operation the value will contain the actual number of bytes received.

Returns:
the current length value
See Also:
setLen(int)

getMbit

public boolean getMbit()
Gets the M-bit attribute of the X25Message object

Returns:
The M-bit value
See Also:
setMbit(boolean)

getMsg

public byte[] getMsg()
Gets the msg attribute of the X25Message object

Returns:
reference to the msg buffer supplied when the message was created

getQbit

public boolean getQbit()
Gets the Q-bit attribute of the X25Message object

Returns:
The Q-bit value
See Also:
setQbit(boolean)

setLen

public void setLen(int len)
Sets the length attribute of the X25Message object

Parameters:
len - The new len value
See Also:
getLen()

setMbit

public void setMbit(boolean mBit)
Sets the M-bit attribute of the X25Message object

Parameters:
mBit - The new M-bit value
See Also:
getMbit()

setQbit

public void setQbit(boolean qBit)
Sets the Q-bit attribute of the X25Message object

Parameters:
qBit - The new Q-bit value
See Also:
getQbit()