12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- package de.tudarmstadt.informatik.hostage.protocol;
- import java.util.List;
- import javax.net.ssl.SSLContext;
- /**
- * Interface for protocols that are used by hostage
- * @param <T> Denotes if the protocol is using Strings or ByteArrays
- */
- public interface Protocol<T> {
- /**
- * Represents who starts the communication once the connection is established
- */
- public static enum TALK_FIRST {
- SERVER, CLIENT
- };
- /**
- * Returns the port on which the protocol is running
- * @return the port used by the protocol (range: 0-65535)
- */
- int getPort();
- /**
- * Returns who starts the communication (server or client)
- * @return TALK_FIRST.server if the server starts or TALK_FIRST.client if the client starts
- */
- TALK_FIRST whoTalksFirst();
- /**
- * Determines the next message that is sent by the server
- * @param message last message that was sent by the client
- * @return next message that will be sent
- */
- List<T> processMessage(T message);
- /**
- * Returns whether the communication is ended and the connection should be closed or not
- * @return true if the connection should be closed, else false
- */
- boolean isClosed();
- /**
- * Returns if the protocol uses SSL/TLS connection or not
- * @return true if SSL/TLS is used, else false
- */
- boolean isSecure();
- /**
- * Returns what type the protocol is using, Strings or ByteArrays
- * @return the class that the protocol is using
- */
- Class<T> getType();
-
- /**
- * Returns the name of the protocol
- * @return name of the protocol
- */
- @Override
- String toString();
- }
|