Package-level declarations

Types

Link copied to clipboard

The abstract network service factory is used to build the network service that is used as the entry point to this library, allowing one to bind the network and supply everything necessary network-wise from one spot.

Link copied to clipboard

The channel exception handler is an interface that is invoked whenever Netty catches an exception in the channels. The server is expected to close the connection in any such case, if it is still open, and log the exception behind it.

Link copied to clipboard

The entity info protocols class brings together the relatively complex player and NPC info protocols. This is responsible for registering all the client types that are used by the user.

Link copied to clipboard

A handler interface for any game logins and reconnections.

Link copied to clipboard

An interface for tracking incoming game messages, in order to avoid decoding and consuming too many messages if the client is flooding us with them. This implementation must be thread safe in the sense that the increment and reset functions could be called concurrently from different threads. The default implementation uses an array for tracking the counts and thus does not need such thread safety here.

Link copied to clipboard

Gets the message counter provider for incoming game messages. This is in a provider implementation as one instance is allocated for each session object.

An exception handler for exceptions caught during the invocation of game message consumers for a given session. As the server only calls one function to process all the incoming messages, any one of them could throw an exception half-way through, thus we need a handler to safely deal with exceptions if that were to happen.

Link copied to clipboard

The tracker implementation for INetAddresses. This implementation must be thread safe, as it is triggered by all kinds of Netty threads!

Link copied to clipboard

The validation service for InetAddress. This service is responsible for accepting of rejecting connections based on the number of active connections from said service. It is worth noting that game and JS5 are tracked separately, as each client opened will initiate a request to both. Any connections opened at the very start before either JS5 or game has been decided will not be validated, as it is unclear to which end point they wish to connect. Those sessions will time out after 30 seconds if no decision has been made.

Link copied to clipboard
class LoginChannelInitializer<R>(networkService: NetworkService<R>) : ChannelInitializer<Channel>

The channel initializer for login blocks. This initializer will add the login channel handler as well as an idle state handler to ensure the connections are cut short if they go idle.

Link copied to clipboard

The service behind decoding login blocks. This is needed as the login blocks take a noticeable amount of time to decode, and it may not be ideal to block the Netty threads from doing any work during that time. Most of the time is taken up by the RSA deciphering, which can take around a millisecond for a secure key.

Link copied to clipboard
fun interface MessageQueueProvider<T : Message>

The queue provider for any type of messages. The queue must be thread-safe! The default implementation is a ConcurrentLinkedQueue.

Link copied to clipboard

The primary network service implementation that brings all the necessary components together in a single "god" object.

Link copied to clipboard
class Session<R>(val ctx: ChannelHandlerContext, incomingMessageQueue: Queue<IncomingGameMessage>, outgoingMessageQueueProvider: MessageQueueProvider<OutgoingGameMessage>, counter: GameMessageCounter, consumers: Map<Class<out IncomingGameMessage>, MessageConsumer<R, IncomingGameMessage>>, globalConsumers: List<MessageConsumer<R, IncomingGameMessage>>, val loginBlock: LoginBlock<*>, incomingGameMessageConsumerExceptionHandler: IncomingGameMessageConsumerExceptionHandler<R>)

The session objects are used to link the player instances together with the respective session instances.

Link copied to clipboard

A session id generator for new connections. By default, a secure random implementation is used. This session id is further passed back in the login block, and the library will verify to make sure the session id matches.

Link copied to clipboard
fun interface StreamCipherProvider

A provider for stream ciphers, where a new instance is allocated after each successful login.