com.camelspotting.jotl.udp
Enum PacketType

java.lang.Object
  extended by java.lang.Enum<PacketType>
      extended by com.camelspotting.jotl.udp.PacketType
All Implemented Interfaces:
Serializable, Comparable<PacketType>

public enum PacketType
extends Enum<PacketType>

This enum is for enumerating the different types of UDP packets that the OpenTTD server will understand and aknowledge.

Version:
1.0
Author:
Eivind Brandth Smedseng, Mats Andreassen
See Also:
RecievablePacketType

Nested Class Summary
static class PacketType.PacketOrigin
           
 
Enum Constant Summary
CLIENT_DETAIL_INFO
          Queries a game server about details of the game, such as companies
CLIENT_FIND_SERVER
          Queries a game server for game information
CLIENT_GET_LIST
          Request for serverlist from master server
CLIENT_GET_NEWGRFS
          Requests the names for a list of GRFs (GRF_ID and MD5)
MASTER_ACK_REGISTER
          Packet indicating registration has succedeed
MASTER_RESPONSE_LIST
          Response from master server with server ip's + port's
SERVER_DETAIL_INFO
          Reply from the game server about details of the game, such as companies
SERVER_NEWGRFS
          Sends the list of NewGRF's requested.
SERVER_REGISTER
          Packet to register itself to the master server
SERVER_RESPONSE
          Reply of the game server with game information
SERVER_UNREGISTER
          Request to be removed from the server-list
 
Method Summary
 DatagramPacket createPacket(InetAddress address, int destPort)
          This method constructs a DatagramPacket ready for send-off to the OpenTTD-server.
static PacketType fromInt(int value)
           
 PacketType.PacketOrigin getPacketOrigin()
          Where does this packet type come from?
static PacketType valueOf(String name)
          Returns the enum constant of this type with the specified name.
static PacketType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

CLIENT_FIND_SERVER

public static final PacketType CLIENT_FIND_SERVER
Queries a game server for game information


SERVER_RESPONSE

public static final PacketType SERVER_RESPONSE
Reply of the game server with game information


CLIENT_DETAIL_INFO

public static final PacketType CLIENT_DETAIL_INFO
Queries a game server about details of the game, such as companies


SERVER_DETAIL_INFO

public static final PacketType SERVER_DETAIL_INFO
Reply from the game server about details of the game, such as companies


SERVER_REGISTER

public static final PacketType SERVER_REGISTER
Packet to register itself to the master server


MASTER_ACK_REGISTER

public static final PacketType MASTER_ACK_REGISTER
Packet indicating registration has succedeed


CLIENT_GET_LIST

public static final PacketType CLIENT_GET_LIST
Request for serverlist from master server


MASTER_RESPONSE_LIST

public static final PacketType MASTER_RESPONSE_LIST
Response from master server with server ip's + port's


SERVER_UNREGISTER

public static final PacketType SERVER_UNREGISTER
Request to be removed from the server-list


CLIENT_GET_NEWGRFS

public static final PacketType CLIENT_GET_NEWGRFS
Requests the names for a list of GRFs (GRF_ID and MD5)


SERVER_NEWGRFS

public static final PacketType SERVER_NEWGRFS
Sends the list of NewGRF's requested.

Method Detail

values

public static PacketType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (PacketType c : PacketType.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static PacketType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getPacketOrigin

public PacketType.PacketOrigin getPacketOrigin()
Where does this packet type come from?

Returns:

createPacket

public DatagramPacket createPacket(InetAddress address,
                                   int destPort)
This method constructs a DatagramPacket ready for send-off to the OpenTTD-server. NOTE: This method is not utilized in the case of the GET_NEWGRFS-packet.

Parameters:
address - where to send it
destPort - which port to contact
Returns:
the ready DatagramPacket

fromInt

public static PacketType fromInt(int value)


Copyright © 2013. All Rights Reserved.