|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ka2ddo.ax25.AX25Frame
public class AX25Frame
This class defines 1 AX.25 packet, as defined by the AX.25 Link Level Protocol specification, version 2.2. Note that the Comparable interface is simply sorting by rcptTime.
Field Summary | |
---|---|
byte[] |
body
Byte array containing the higher-level protocol payload for I and UI frames. |
byte |
ctl
Bitmask identifying the frame type and subtype, and windowing position for connection-oriented I and S frames. |
byte |
ctl2
Extension of ctl when using 128-segment windowing. |
AX25Callsign |
dest
Callsign of the destination station, or some broadcast code with an alternate meaning (such as APRS tocalls and Mic-E encoded latitude and status values). |
AX25Callsign[] |
digipeaters
Optional array of digipeater callsigns and aliases, if this frame should be digipeated. |
static int |
FRAMETYPE_I
Numeric code for information (I) frame type. |
static int |
FRAMETYPE_S
Numeric code for supervisory (S) frame type. |
static int |
FRAMETYPE_U
Numeric code for unnumbered (U) frame type. |
static int |
MASK_FRAMETYPE
The bitmask to extract the frametype bits from the ctl byte of the frame. |
static int |
MASK_STYPE
Bitmask to extract supervisory (S) frame subtype from the ctl byte. |
static int |
MASK_U_P
Bitmask to extract poll/final bit from unnumbered (U) frame ctl byte. |
static int |
MASK_UTYPE
Bitmask to extract unnumbered (U) frame subtype from the ctl byte. |
boolean |
mod128
Indicates whether 128-segment windowing is used for I frame connections. |
AX25Message |
parsedAX25Msg
The decoded APRS (or other protocol) message (if the AX25Frame contains a higher-level protocol). |
byte |
pid
The one-byte code identifying how to interpret the body of I and UI frames. |
static byte |
PID_AARP
Protocol ID for Appletalk Address Resolution Protocol (ARP). |
static byte |
PID_ATALK
Protocol ID for Appletalk. |
static byte |
PID_ESCAPE
Protocol ID for escape code indicating second byte of PID (not supported). |
static byte |
PID_FLEXNET
Protocol ID for FlexNet. |
static byte |
PID_IARP
Protocol ID for ARPS Internet Address Resolution Protocol (ARP). |
static byte |
PID_IP
Protocol ID for ARPA Internet Protocol. |
static byte |
PID_LQP
Protocol ID for Link Quality Protocol. |
static byte |
PID_NETROM
Protocol ID for NET/ROM. |
static byte |
PID_NOLVL3
Protocol ID for no level 3 protocol (also used for APRS). |
static byte |
PID_OPENTRAC
Protocol ID for OpenTRAC. |
static byte |
PID_SEG_FRAG
Protocol ID for AX.25 segmentation fragment. |
static byte |
PID_TEXNET
Protocol ID for TEXNET datagram. |
static byte |
PID_VJC_TCPIP
Protocol ID for Van Jacobson compressed TCP/IP packet, per RFC 1144. |
static byte |
PID_VJUC_TCPIP
Protocol ID for Van Jacobson uncompressed TCP/IP packet, per RFC 1144. |
static byte |
PID_X25_PLP
Protocol ID for CCITT X.25 PLP (also used by the ROSE network). |
static java.util.Map<java.lang.Byte,java.lang.String> |
PTYPES_S
Hashmap of Information (I) or Unnumbered Information (UI) frame protocol ID to protocol name strings. |
long |
rcptTime
The time when this message was received in Java milliseconds since midnight, Jan 1 1970 UTC.. |
AX25Callsign |
sender
Callsign of the transmitting station (not of any intermediate digipeaters). |
static int |
SHIFT_STYPE
Bit shift to get least significant bit of S frame subtype into least significant bit of integer. |
static int |
SHIFT_UTYPE
Bit shift to get least significant bit of U frame subtype into least significant bit of integer. |
Connector |
sourcePort
Pointer to the I/O port from which this frame was received. |
static int |
STYPE_REJ
Unshifted S frame subtype for Reject frame. |
static int |
STYPE_RNR
Unshifted S frame subtype for Receive Not Ready frame. |
static int |
STYPE_RR
Unshifted S frame subtype for Receive Ready frame. |
static int |
STYPE_SREJ
Unshifted S frame subtype for Selective Reject frame. |
static int |
UTYPE_DISC
Unshifted U frame subtype for Disconnect (DISC). |
static int |
UTYPE_DM
Unshifted U frame subtype for Disconnected Mode (DM). |
static int |
UTYPE_FRMR
Deprecated. 2.0 |
static int |
UTYPE_SABM
Unshifted U frame subtype for Set Asynchronous Balanced Mode (SABM). |
static int |
UTYPE_SABME
Unshifted U frame subtype for Set Asynchronous Balanced Mode Extended (SABME). |
static int |
UTYPE_TEST
Unshifted U frame subtype for Test (TEST). |
static int |
UTYPE_UA
Unshifted U frame subtype for Unnumbered Acknowledge (UA). |
static int |
UTYPE_UI
Unshifted U frame subtype for Unnumbered Information (UI). |
static int |
UTYPE_XID
Unshifted U frame subtype for Exchange Identification (XID). |
Constructor Summary | |
---|---|
AX25Frame()
Create an empty AX25Frame initialized for a UI frame containing an APRS packet. |
Method Summary | |
---|---|
int |
compareTo(AX25Frame o)
Compares this object with the specified object for order. |
static AX25Frame |
decodeFrame(byte[] buf,
int offset,
int length)
Create a AX25Frame from a byte array presumed to contain an AX.25 protocol sequence. |
AX25Frame |
dup()
Create a deep copy of this frame. |
AX25Frame |
dupOnlyHeader()
Create a deep copy of this frame, excluding the body. |
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one. |
java.lang.String |
getAsciiFrame()
Produce an ASCIIfied version of frame body. |
int |
getChecksum()
Compute a checksum for this frame to allow efficiently identifying duplicate frames. |
Connector |
getConnector()
Specify the Connector this message should be transmitted through. |
int |
getEstimatedBitCount()
Estimate the number of bits needed to transmit this frame over RF in AX.25 standard physical layer (HDLC). |
static java.lang.String |
getFirstDigi(AX25Callsign[] digipeaters)
Get the first actual digipeated digipeater station callsign in the digipeater sequence. |
AX25Frame[] |
getFrames(boolean incrementXmtCount,
byte protocolId,
java.lang.String senderCallsign)
Get the frames associated with this FrameSource (in this case, itself). |
int |
getFrameType()
Get the type of this frame, as stored in the ctl byte. |
java.lang.String |
getFrameTypeString()
Generate a string describing the type of the frame. |
static java.lang.String |
getLastDigi(AX25Callsign[] digipeaters)
Find the last callsign through which a frame has been digipeated. |
int |
getNR()
Get the reception sequence number. |
int |
getNS()
Get the transmission sequence number. |
int |
getNumTransmitsBeforeDecay()
Get number of times frame will be retransmitted before inter-packet delay is increased. |
boolean |
getP()
Get poll bit. |
int |
getSType()
Get the Supervisory frame subtype. |
int |
getUType()
Get Unordered frame subtype. |
int |
hashCode()
Returns a hash code value for the object. |
boolean |
isDuplicate(AX25Frame other)
Test if this frame has the same contents (at least as regards duplicate checking) as the provided older frame. |
static boolean |
isRealCallsign(java.lang.String callsign)
Test if a callsign looks like a real callsign (at least one digit somewhere other than the last character, all letters uppercase). |
void |
setCmd(boolean isCmd)
Set the command bits in the sender and destination fields. |
java.lang.String |
toString()
Return a String representing this AX25Frame object. |
void |
write(java.io.OutputStream os)
Transmit this AX25Frame to an output byte stream. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public AX25Callsign sender
public AX25Callsign dest
public AX25Callsign[] digipeaters
public transient Connector sourcePort
public byte ctl
getFrameType()
,
getUType()
,
getSType()
public byte ctl2
ctl
,
mod128
public byte pid
PID_X25_PLP
,
PID_VJC_TCPIP
,
PID_VJUC_TCPIP
,
PID_SEG_FRAG
,
PID_OPENTRAC
,
PID_TEXNET
,
PID_LQP
,
PID_ATALK
,
PID_AARP
,
PID_IP
,
PID_IARP
,
PID_FLEXNET
,
PID_NETROM
,
PID_NOLVL3
,
PID_ESCAPE
public byte[] body
public boolean mod128
public long rcptTime
public transient AX25Message parsedAX25Msg
public static final int MASK_FRAMETYPE
ctl
,
Constant Field Valuespublic static final int FRAMETYPE_I
public static final int FRAMETYPE_S
public static final int FRAMETYPE_U
public static final int MASK_STYPE
ctl
,
Constant Field Valuespublic static final int SHIFT_STYPE
public static final int STYPE_RR
MASK_STYPE
,
Constant Field Valuespublic static final int STYPE_RNR
MASK_STYPE
,
Constant Field Valuespublic static final int STYPE_REJ
MASK_STYPE
,
Constant Field Valuespublic static final int STYPE_SREJ
MASK_STYPE
,
Constant Field Valuespublic static final int MASK_UTYPE
ctl
,
Constant Field Valuespublic static final int MASK_U_P
ctl
,
Constant Field Valuespublic static final int SHIFT_UTYPE
public static final int UTYPE_UI
public static final int UTYPE_DM
public static final int UTYPE_SABM
public static final int UTYPE_DISC
public static final int UTYPE_UA
public static final int UTYPE_SABME
public static final int UTYPE_FRMR
public static final int UTYPE_XID
public static final int UTYPE_TEST
public static final byte PID_X25_PLP
public static final byte PID_VJC_TCPIP
public static final byte PID_VJUC_TCPIP
public static final byte PID_SEG_FRAG
public static final byte PID_OPENTRAC
public static final byte PID_TEXNET
public static final byte PID_LQP
public static final byte PID_ATALK
public static final byte PID_AARP
public static final byte PID_IP
public static final byte PID_IARP
public static final byte PID_FLEXNET
public static final byte PID_NETROM
public static final byte PID_NOLVL3
public static final byte PID_ESCAPE
public static final java.util.Map<java.lang.Byte,java.lang.String> PTYPES_S
pid
Constructor Detail |
---|
public AX25Frame()
Method Detail |
---|
public static AX25Frame decodeFrame(byte[] buf, int offset, int length)
buf
- byte array to read frame fromoffset
- zero-based index into the array where the frame startslength
- number of bytes making up the frame
public java.lang.String getFrameTypeString()
public int getFrameType()
FRAMETYPE_I
,
FRAMETYPE_S
,
FRAMETYPE_U
public int getNS()
java.lang.IllegalStateException
- if this is not an I framepublic int getNR()
java.lang.IllegalStateException
- if this is not an I framepublic int getSType()
STYPE_RR
,
STYPE_RNR
,
STYPE_REJ
,
STYPE_SREJ
public boolean getP()
public int getUType()
UTYPE_UI
,
UTYPE_DM
,
UTYPE_SABM
,
UTYPE_DISC
,
UTYPE_UA
,
UTYPE_SABME
,
UTYPE_FRMR
,
UTYPE_XID
,
UTYPE_TEST
public void write(java.io.OutputStream os) throws java.io.IOException
os
- OutputStream to write the frame to
java.io.IOException
- if writing failspublic AX25Frame dup()
public AX25Frame dupOnlyHeader()
public AX25Frame[] getFrames(boolean incrementXmtCount, byte protocolId, java.lang.String senderCallsign)
getFrames
in interface AX25FrameSource
incrementXmtCount
- indicate whether the transmit counter (used to cycle through
proportional pathing) should be incrementedprotocolId
- indicate the protocol to generate this frame for (not relevant for
digipeated frames); zero to indicate current protocolsenderCallsign
- local sending callsign (ignored if frame already has
the callsign filled in)
public int getNumTransmitsBeforeDecay()
getNumTransmitsBeforeDecay
in interface AX25FrameSource
public Connector getConnector()
getConnector
in interface AX25FrameSource
Connector.CAP_XMT_PACKET_DATA
public static boolean isRealCallsign(java.lang.String callsign)
callsign
- String callsign to test
public static java.lang.String getFirstDigi(AX25Callsign[] digipeaters)
digipeaters
- array of AX25Callsigns for digipeating a message
public static java.lang.String getLastDigi(AX25Callsign[] digipeaters)
digipeaters
- array of digipeater callsigns
public void setCmd(boolean isCmd)
isCmd
- boolean true if this is a command frame, false if a responsepublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getAsciiFrame()
public int getChecksum()
public int compareTo(AX25Frame o)
compareTo
in interface java.lang.Comparable<AX25Frame>
o
- the object to be compared.
java.lang.ClassCastException
- if the specified object's type prevents it
from being compared to this object.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the reference object with which to compare.
true
if this object is the same as the obj
argument; false
otherwise.public int hashCode()
hashCode
in class java.lang.Object
equals(Object)
public boolean isDuplicate(AX25Frame other)
other
- AX25Frame to compare payloads with
public int getEstimatedBitCount()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |