Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation
previous class next class | frames no frames

# Engine.Security

00001 00002 00003 00004 00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099

    // ====================================================================
    //  Class:  Engine.Security
    //  Parent: Engine.Info
    //
    //  The security package is spawned and owned by each PlayerController as they
    //  enter the game.  It allows for the server to check various aspects
    //  of the client.
    // ====================================================================

    class Security extends Info
    		Native;

    // When a command is executed, it's stored here in so we always know what the
    // last command was.

    var int LastType;
    var string LastParams[2];

    replication
    {
    	reliable if (Role==ROLE_Authority)
    		ClientPerform, ClientMessage;

    	reliable if (Role<ROLE_Authority)
    		ServerCallback;
    }

    // ====================================================================
    // The security system works as follows.  The Server performs a security command
    // by executing a ClientPerform call.  This will replicate to the client which then passes it
    // nativly using NativePerform.  Native perform nativally replicates the response back to the
    // response handler (ServerCallBack) for this client.
    // ====================================================================

    native function NativePerform(int SecType, string Param1, string Param2);

    simulated function ClientPerform(int SecType, string Param1, string Param2)
    {
    	NativePerform(SecType, Param1, Param2);
    }

    event ServerCallback(int SecType, string Data)	// Should be Subclassed
    {
    	SetTimer(0,false);
    	GotoState('');
    }

    // ====================================================================
    // Perform causes the security system to perform a command, and then
    // wait for a response.

    function Perform(int SecType, string Param1, string Param2, float TimeOut)
    {
    	// Store the command

    	LastType = SecType;
    	LastParams[0] = Param1;
    	LastParams[1] = Param2;

    	ClientPerform(SecType, Param1, Param2);	// Tell the client to perform the command
    	SetTimer(TimeOut,false);				// Setup a timeout for the command
    	GotoState('Probation');					// Client is now on probation while we await the response
    }

    // ====================================================================
    // When the Security actor performs a security command, it enters the probationary state while
    // it awaits a response.  If the TimeOut value is exceeded, the client is removed from the server.

    state Probation
    {
    	function Timer()			// Should be SubClassed
    	{
    		BadClient(LastType,LastParams[0]$","$LastParams[1]);
    	}
    }

    // ====================================================================
    // The Final portion of the security is the communitcation system between
    // the server and the client when something goes wrong.

    function BadClient(int Code, string Data)	// Should be subclassed
    {
    	ClientMessage("The Server has determined that your client is illegal and you have been removed! Code: "$Code$" ["$Data$"]");
    	Owner.Destroy();
    	Destroy();
    }

    simulated function ClientMessage(string s)	// Should be subclassed
    {
    	Log(s,'Security');
    }

    defaultproperties
    {

    }

Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation
previous class next class | frames no frames

Class file time: ne 5.9.2004 16:01:30.000 - Creation time: st 23.5.2018 00:10:46.874 - Created with UnCodeX