public class AX25Stack extends java.lang.Object implements FrameListener, java.lang.Runnable, DebugCtl.DbgListener
| Modifier and Type | Field and Description |
|---|---|
static int |
WAIT_FOR_ACK_T1_TIMER
Time interval (in milliseconds) to wait for an acknowledgement from the
other end of a AX.25 connection.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAX25FrameListener(AX25FrameListener l)
Add a listener for incoming AX.25 frames.
|
static void |
addConnStateChangeListener(ConnStateChangeListener l)
Register a listener to be informed when AX.25 connected-mode session state
changes.
|
void |
addParsedAX25MessageListener(ParsedAX25MessageListener listener)
Register an ParsedAX25MessageListener to be notified of incoming parsed level 3 protocol
messages (other than APRS).
|
static void |
clearAllState()
This is provided solely to support unit tests, and should not be called from anywhere else.
|
void |
consumeFrame(AX25Frame frame)
Queue one AX.25 frame (containing some sort of message) for parsing and processing.
|
void |
consumeFrameNow(Connector connector,
AX25Frame frame)
Process an incoming AX.25 frame.
|
static AX25Callsign[] |
dupUnuseDigipeaters(AX25Callsign[] srcRelays)
Create a duplicate digipeater list from a source packet, but ensure all the
has-been-repeated flags are cleared.
|
void |
fireConsumeAX25Frame(AX25Frame frame,
Connector connector)
Send the specified incoming frame to all registered AX25FrameListeners.
|
java.util.Map<AX25Callsign,java.util.Map<AX25Callsign,ConnState>> |
getConnectionMap()
Get the map of all outstanding I-frame connected sessions observed by or end-pointed at this
station.
|
ConnectionRequestListener |
getConnectionRequestListener()
Test if a plugin has already set the ConnectionRequestListener.
|
static ConnState |
getConnState(AX25Callsign src,
AX25Callsign dst,
boolean createIfNotPresent)
Get the connection state of an I-frame connection session between the specified two
callsigns, optionally creating the state object if it did not previously exist.
|
int |
getCurrentBacklog()
Return the current number of backlogged frames to be processed by the AX25Stack thread.
|
static java.lang.String[] |
getDigipeaters()
Get the default list of digipeaters for this stack.
|
static AX25Stack |
getInstance()
Get a handle to the AX25Stack singleton.
|
int |
getMaxBacklog()
Return the maximum backlog ever incurred by the AX25Stack parser thread.
|
int |
getMaxQueueCapacity()
Return the maximum allowed size of the queue.
|
int |
getNumConsumedMsgs()
Return the number of AX.25 messages consumed by the AX25Stack.
|
AX25Parser |
getParser(byte pid)
Get the protocol parsing handler for the specified protocol.
|
static ReschedulableTimer |
getRetransTimer()
Get the retransmit timer for outbound AX.25 frames.
|
static ConnState.ConnType |
getStateOf(AX25Callsign src,
AX25Callsign dst)
Get the connection state of an I-frame connection session between the specified two
callsigns.
|
static java.lang.String |
getToCall()
Get the destination callsign (tocall) that should be used for messages originated
by this station.
|
static Transmitting |
getTransmitting()
Get the Transmitting object that this AX25Stack will use for implicit but unrouted
transmissions.
|
static boolean |
isAllowInboundConnectedMode()
Indicate whether this system accepts inbound connected-mode connection requests.
|
boolean |
isFrozen()
Report if parser thread is frozen.
|
static boolean |
isLocalDest(AX25Callsign dest)
Test if this callsign is addressed to the local station.
|
static boolean |
isLocalDest(java.lang.String destCallsign)
Test if this callsign is addressed to the local station.
|
boolean |
processIBody(AX25Frame frame,
boolean isUI,
Connector connector,
long rcvTimestamp)
This method consumes one information frame.
|
void |
processParsedAX25Message(AX25Frame frame,
AX25Message parsedMsg)
Dispatch an AX.25 frame that was parsed into a higher-level protocol to all
registered listeners.
|
void |
registerProtocolParser(byte pid,
AX25Parser parser)
Register another protocol parsing handler for a particular AX.25 UI/I message PID.
|
void |
removeAX25FrameListener(AX25FrameListener l)
Remove a listener for incoming AX.25 frames.
|
static void |
removeConnState(ConnState connState)
Remove the specified ConnState object from the map of ConnState maps.
|
static void |
removeConnStateChangeListener(ConnStateChangeListener l)
Unregister a listener to be informed when AX.25 connected-mode session state
changes.
|
void |
removeParsedAX25MessageListener(ParsedAX25MessageListener listener)
Unregister an ParsedAX25MessageListener to be notified of incoming parsed level 3 protocol
messages (other than APRS).
|
static AX25Callsign[] |
reverseDigipeaters(AX25Callsign[] srcRelays)
Reverse the order of a sequence of digipeaters (explicit and APRS aliases).
|
void |
run()
Private method to asynchronously consume AX25Frame objects for parsing.
|
static void |
setAllowInboundConnectedMode(boolean allowInboundConnects)
Specify whether this system accepts inbound connected-mode connection requests.
|
void |
setConnectionRequestListener(ConnectionRequestListener l)
Set the handler for inbound connection requests.
|
void |
setDebug(java.lang.String categoryName,
boolean setting)
Specify if a specific category of debug messages should be printed out.
|
static void |
setDigipeaters(java.lang.String[] digipeaters)
Set the default list of digipeaters for this stack.
|
void |
setFrozen(boolean frozen)
Specify whether the AX.25 parser thread should be paused (frozen) to allow the user to view
the output without it moving constantly.
|
static void |
setToCall(java.lang.String toCall)
Set the destination callsign (tocall) that should be used for messages originated
by this station.
|
static void |
setTransmitting(Transmitting transmitting)
Set the Transmitting object that this AX25Stack will use for implicit but unrouted
transmissions.
|
public static final int WAIT_FOR_ACK_T1_TIMER
public static AX25Stack getInstance()
public static java.lang.String[] getDigipeaters()
public static void setDigipeaters(java.lang.String[] digipeaters)
digipeaters - array of String digipeater aliasespublic static java.lang.String getToCall()
public static void setToCall(java.lang.String toCall)
toCall - destination callsign (tocall)public void setDebug(java.lang.String categoryName,
boolean setting)
setDebug in interface DebugCtl.DbgListenercategoryName - String name of category to enable debug logging forsetting - boolean true or false to enable or disable debugging this categorypublic static Transmitting getTransmitting()
public static void setTransmitting(Transmitting transmitting)
transmitting - Transmitting objectpublic static ReschedulableTimer getRetransTimer()
public static boolean isAllowInboundConnectedMode()
public static void setAllowInboundConnectedMode(boolean allowInboundConnects)
allowInboundConnects - boolean true if inbound connection requests should be acceptedpublic void addAX25FrameListener(AX25FrameListener l)
l - AX25FrameListener to registerpublic void removeAX25FrameListener(AX25FrameListener l)
l - AX25FrameListener to unregisterpublic ConnectionRequestListener getConnectionRequestListener()
public void setConnectionRequestListener(ConnectionRequestListener l)
l - ConnectionRequestListener to registerpublic void registerProtocolParser(byte pid,
AX25Parser parser)
pid - pid byte code for this protocolparser - AX25Parser to handle receiving this protocolpublic AX25Parser getParser(byte pid)
pid - level 3 protocol ID byte (as defined by the AX.25 protocol specification)public void fireConsumeAX25Frame(AX25Frame frame, Connector connector)
frame - AX25Frame to dispatchconnector - Connector that received the framepublic void consumeFrame(AX25Frame frame)
consumeFrame in interface FrameListenerframe - the AX25Frame to be processedpublic int getCurrentBacklog()
public int getMaxBacklog()
public int getMaxQueueCapacity()
public int getNumConsumedMsgs()
public void run()
run in interface java.lang.Runnablepublic boolean isFrozen()
public void setFrozen(boolean frozen)
frozen - boolean true to freeze the parser thread, or false to resume executionpublic void consumeFrameNow(Connector connector, AX25Frame frame)
connector - Connector that received the frameframe - AX25Frame to processpublic java.util.Map<AX25Callsign,java.util.Map<AX25Callsign,ConnState>> getConnectionMap()
public static ConnState.ConnType getStateOf(AX25Callsign src, AX25Callsign dst)
src - AX25Callsign of originating end of sessiondst - AX25Callsign of receiving end of sessionpublic static ConnState getConnState(AX25Callsign src, AX25Callsign dst, boolean createIfNotPresent)
src - AX25Callsign of originating end of sessiondst - AX25Callsign of receiving end of sessioncreateIfNotPresent - boolean true if a new ConnState object should be created and
registered if it does not already existpublic static void removeConnState(ConnState connState)
connState - ConnState object to remove from mappublic static void clearAllState()
public static AX25Callsign[] dupUnuseDigipeaters(AX25Callsign[] srcRelays)
srcRelays - array of digipeater callsign-SSID's to clone, or null if nonepublic static AX25Callsign[] reverseDigipeaters(AX25Callsign[] srcRelays)
srcRelays - array of AX25Callsign indicating the path used to get from sender to recipientpublic boolean processIBody(AX25Frame frame, boolean isUI, Connector connector, long rcvTimestamp)
frame - AX25Frame to be decodedisUI - where frame was received in a UI AX.25 frame instead of an I frameconnector - PortConnector over which message arrived, or null for file playbackrcvTimestamp - time (in Java-standard milliseconds since Jan 1 1970 UTC) that message was receivedpublic void processParsedAX25Message(AX25Frame frame, AX25Message parsedMsg)
frame - AX25Frame of incoming messageparsedMsg - AX25Message subclass containing protocol decoding of messagepublic void addParsedAX25MessageListener(ParsedAX25MessageListener listener)
listener - ParsedAX25MessageListener to registerpublic void removeParsedAX25MessageListener(ParsedAX25MessageListener listener)
listener - ParsedAX25MessageListener to unregisterpublic static boolean isLocalDest(AX25Callsign dest)
dest - AX25Callsign to test as a destinationpublic static boolean isLocalDest(java.lang.String destCallsign)
destCallsign - String of AX.25 callsign-SSID to test as a destinationpublic static void addConnStateChangeListener(ConnStateChangeListener l)
l - ConnStateChangeListener to registerpublic static void removeConnStateChangeListener(ConnStateChangeListener l)
l - ConnStateChangeListener to unregister