import java.util.*;
/**
 * This interface must be implemented by any IGate adjunct.
 * <P>
 * Implemented in javAPRSSrvr 3.5b01 and later.
 * These functions are called from the localIGate classes.
 * <P>
 * Synchronization Note:
 * <P>
 * It is expected that any thread-safe synchronization be done by the IGate adjunct.
 * For instance, it is possible that all methods may be called from different threads.
 * <PRE>
 * Changed from 1.1:
 *  Added byte to getLine() for source indicator
 * Changed from 1.0:
 *  Added portTable comment to getVersion description
 * </PRE>
 * 
 * @author Peter Loveall AE5PL
 * @version 1.2
 */
public interface IGateInterface
{
	/**
	 * Received lines from RF.
	 * 
	 * No cr or lf.  javAPRSSrvr will take care of q enabling.
	 * <P>
	 * The first byte indicates 0=Received from RF, 1=Send to Inet, 2=Send to RF
	 * 
	 * @return full received line
	 */
	public abstract byte[] getLine();

	/**
	 * Returns version info for status pages.
	 * <P>
	 * The format is the same as for portTable in javAPRSSrvr.
	 * 
	 * @return This can be any text string to be displayed on the status pages.
	 */
	public abstract String getVersion();

	/**
	 * Initializes IGate adjunct.
	 * 
	 * May be called multiple times to alert IGate of configuration changes.
	 * 
	 * @param configuration Properties from the configuration file
	 */
	public abstract void init(Properties configuration);

	/**
	 * This provides the IGate adjunct with the parsed packet obtained from getLine().
	 * 
	 * @param fromCall	 Source callSSID.
	 * @param toCall	 Destination callSSID.
	 * @param path		 Via callSSIDs.
	 * @param payload	 Index to all after the colon in orgPacket.
	 * @param orgPacket	 Unmodified original packet.
	 * @param CRC		 String made from the fromCall+" "+toCall+" "+CRC32(payload)
	 * @param packetType Type of packet.  Used to determine what spclCall is.  1 = Message, 2 = Object/Item, 3 = Posit, 4 = Non-APRS-IS 3rd Party, 5 = APRS-IS 3rdParty, 0 = all others
	 * @param spclCall	 packetType=1 -> msgToCall, packetType=2 -> objectName, packetType=0,3,4,5 -> null
	 * @param orgCall    From call if not 3rd Party, otherwise Gate call
	 */
	public abstract void receivedPacket(String fromCall, String toCall, String[] path, int payload, byte[] orgPacket, String CRC, int packetType, String spclCall, String orgCall);

	/**
	 * Network packets from javAPRSSrvr to the IGate adjunct.
	 * 
	 * @param fromCall	 Source callSSID, null if generated by IGate adjunct.
	 * @param toCall	 Destination callSSID.
	 * @param path		 Via callSSIDs.
	 * @param payload	 Index to all after the colon in orgPacket.
	 * @param orgPacket	 Unmodified original packet.
	 * @param CRC		 String made from the fromCall+" "+toCall+" "+CRC32(payload)
	 * @param packetType Type of packet.  Used to determine what spclCall is.  1 = Message, 2 = Object/Item, 3 = Posit, 4 = Non-APRS-IS 3rd Party, 5 = APRS-IS 3rdParty, 0 = all others
	 * @param spclCall	 packetType=1 -> msgToCall, packetType=2 -> objectName, packetType=0,3,4,5 -> null
	 * @param orgCall    From call if not 3rd Party, otherwise Gate call
	 */
	public abstract void sendData(String fromCall, String toCall, String[] path, int payload, byte[] orgPacket, String CRC, int packetType, String spclCall, String orgCall);
}
