ParaScripting::ParaNetwork Class Reference
[ParaNetwork]

List of all members.

Detailed Description

API wrapper for NPL Network Layer functions.


Static Public Member Functions

static bool IsNetworkLayerRunning ()
 whether network layer is running or not.
static void SetNerveCenterAddress (const char *pAddress)
 set the IP and port for the nerve center: call this function before you enable the network (EnableNetwork) for it to take effect.
static void SetNerveReceptorAddress (const char *pAddress)
 set the IP and port for the nerve receptor: call this function before you enable the network (EnableNetwork) for it to take effect.
static void EnableNetwork (bool bEnable, const char *CenterName, const char *password)
 Enable the network, by default the network layer is disabled.
static const char * GetLocalIP ()
 local IP address.
static unsigned short GetLocalNerveCenterPort ()
static unsigned short GetLocalNerveReceptorPort ()
static const char * GetLocalNerveCenterName ()
static const char * GetLocalNerveReceptorAccountName ()
 the current account name by which this computer is connected to a remote server
static const char * GetLocalNerveReceptorConnectWorldName ()
 the server world name that this computer is connected with.
static const char * GetNerveCenterUserMapAsString ()
 Not implemented all connected remote client names separated by ';'.
static const char * GetNerveReceptorUserMapAsString ()
 Not implemented all connected remote server names separated by ';'.
static ParaPacket CreateParaPacket ()
 create a new packet.
static ParaPacketCreateParaPacket_ ()
 only used in API exportation.
static void DestroyParaPacket (ParaPacket &packet)
 destroy a packet.
static void PushPacket (ParaPacket &packet)
 send a packet to network.
static void EnableLog (bool bEnable)
 set whether all network packets are written to net.text log file.
static bool IsLogEnabled ()
 get whether all network packets are written to net.text log file.
static ParaPacket PopPacket ()
 receive or pop a message from the current received message pool.
static ParaPacketPopPacket_ ()
 only used in API exportation.
static __int64 AddNamespaceRecord (const char *name, const char *IP, unsigned short port)
 Insert a new name space binding record.
static int AddNamespaceRecord_s (const char *name, const char *IP, unsigned short port)
 this is only used in the scripting interface, since __int64 is not a valid return type in the scripting interface.
static bool RemoveNamespaceRecord (const char *name)
 Remove name space binding by address.
static __int64 InsertAccountRecord (const char *name, const char *password)
 account functions insert new account record
static bool VerifyAccountRecord (const char *name, const char *password)
 verify account record using the account name and password
static void ConnectToCenter (const char *nameSpaceName)
 establish a connection with a remote NPL runtime center make sure there is a name/IP binding before this function
static void Restart ()
 Close all connections (sending notification messages) and reconnect predefined ones using the current namespace mapping.
static void CloseConnection (const char *name)
 Close the connection to another host (if we initiated the connection it will disconnect, if they did it will kick them out).
static void AddToBanList (const char *IP, unsigned int milliseconds)
 Bans a player from connecting.
static void RemoveFromBanList (const char *IP)
 Allows a previously banned IP to connect.
static void ClearBanList (void)
 Allows all previously banned IPs to connect.
static bool IsBanned (const char *IP)
 Returns true or false indicating if a particular IP is banned.
static const char * GetUserIP (const char *name)
 get the user IP of a user.
static void SetMaximumIncomingConnections (unsigned short numberAllowed)
 Sets how many incoming connections are allowed.
static unsigned short GetMaximumIncomingConnections (void)
 Returns the value passed to SetMaximumIncomingConnections().
static object GetConnectionList (const object &remoteSystems)
 get all the systems we are connected to in a array.
static void SetTimeoutTime (unsigned int timeMS, const char *target)
 Set the time, in MS, to use before considering ourselves disconnected after not being able to deliver a reliable message.
static const char * GetInternalID (void)
 Return the unique address identifier that represents you on the the network and is based on your local IP / port.
static const char * GetExternalID (const char *target)
 Return the unique address identifier that represents you on the the network and is based on your externalIP / port (the IP / port the specified player uses to communicate with you).
static object GetStatistics (const char *target, const object &data)
 get a table containing a large set of network statistics for the specified system.
static object GetReceptorStatistics (const char *target, const object &data)
static const char * GetStatisticsAsString (const char *target, int verbosityLevel)
 Verbosity level currently supports 0 (low), 1 (medium), 2 (high).
static const char * GetReceptorStatisticsAsString (const char *target, int verbosityLevel)


Member Function Documentation

static bool ParaScripting::ParaNetwork::IsNetworkLayerRunning (  )  [static]

whether network layer is running or not.

Returns:

static void ParaScripting::ParaNetwork::SetNerveCenterAddress ( const char *  pAddress  )  [static]

set the IP and port for the nerve center: call this function before you enable the network (EnableNetwork) for it to take effect.

Parameters:
pAddress,: such as "127.0.0.1:60001", or ":60001" (if you want to use any available IP on the computer)

static void ParaScripting::ParaNetwork::SetNerveReceptorAddress ( const char *  pAddress  )  [static]

set the IP and port for the nerve receptor: call this function before you enable the network (EnableNetwork) for it to take effect.

Parameters:
pAddress,: such as "127.0.0.1:60000", or ":60000" (if you want to use any available IP on the computer)

static void ParaScripting::ParaNetwork::EnableNetwork ( bool  bEnable,
const char *  CenterName,
const char *  password 
) [static]

Enable the network, by default the network layer is disabled.

calling this function multiple time with different CenterName will restart the network layer with a different center name.

Parameters:
bEnable true to enable, false to disable.If this is false, the CenterName and Password are ignored.
CenterName the local nerve center name. it is also the user name which local receptor will use in the credentials to login in other NPL runtime.
Password 
Returns:
true if succeeded.

static const char* ParaScripting::ParaNetwork::GetLocalIP (  )  [static]

local IP address.

Returns:

static const char* ParaScripting::ParaNetwork::GetLocalNerveReceptorAccountName (  )  [static]

the current account name by which this computer is connected to a remote server

Returns:

static const char* ParaScripting::ParaNetwork::GetLocalNerveReceptorConnectWorldName (  )  [static]

the server world name that this computer is connected with.

Returns:

static const char* ParaScripting::ParaNetwork::GetNerveCenterUserMapAsString (  )  [static]

Not implemented all connected remote client names separated by ';'.

Returns:

static const char* ParaScripting::ParaNetwork::GetNerveReceptorUserMapAsString (  )  [static]

Not implemented all connected remote server names separated by ';'.

Returns:

static ParaPacket ParaScripting::ParaNetwork::CreateParaPacket (  )  [static]

create a new packet.

if a packet is not sent, it must be destroyed manually. using DestroyParaPacket().

static ParaPacket* ParaScripting::ParaNetwork::CreateParaPacket_ (  )  [static]

only used in API exportation.

static void ParaScripting::ParaNetwork::DestroyParaPacket ( ParaPacket packet  )  [static]

destroy a packet.

One must call this function or call a packet's release function if it is a received packet.

static void ParaScripting::ParaNetwork::PushPacket ( ParaPacket packet  )  [static]

send a packet to network.

once a packet is sent, it will be automatically released by the network layer. the packet will be an invalid one upon return.

Parameters:
packet 

static ParaPacket ParaScripting::ParaNetwork::PopPacket (  )  [static]

receive or pop a message from the current received message pool.

Remarks:
: one must manually release the received packet by calling Release() method when it is no longer needed.
Returns:
the returned packet is invalid if there are no longer any waiting packets.

static ParaPacket* ParaScripting::ParaNetwork::PopPacket_ (  )  [static]

only used in API exportation.

static __int64 ParaScripting::ParaNetwork::AddNamespaceRecord ( const char *  name,
const char *  IP,
unsigned short  port 
) [static]

Insert a new name space binding record.

[in] name: name space name, e.g. "Paraworld_Kids" [in] IP: address IP, e.g. "127.0.0.1" [in] port: address Port, e.g. "60000"

Returns:
: the index of the record in database, -1 if fail

static bool ParaScripting::ParaNetwork::RemoveNamespaceRecord ( const char *  name  )  [static]

Remove name space binding by address.

Parameters:
name,: name space name
Returns:
: true if success, false if fail

static void ParaScripting::ParaNetwork::ConnectToCenter ( const char *  nameSpaceName  )  [static]

establish a connection with a remote NPL runtime center make sure there is a name/IP binding before this function

Parameters:
nameSpaceName,: target NPL name space name

static void ParaScripting::ParaNetwork::Restart (  )  [static]

Close all connections (sending notification messages) and reconnect predefined ones using the current namespace mapping.

All user connections and connection with the previous server can not be restored. So call this function, as if restarting the computer.

static void ParaScripting::ParaNetwork::CloseConnection ( const char *  name  )  [static]

Close the connection to another host (if we initiated the connection it will disconnect, if they did it will kick them out).

Parameters:
[in] name Which system to close the connection to.

static void ParaScripting::ParaNetwork::AddToBanList ( const char *  IP,
unsigned int  milliseconds 
) [static]

Bans a player from connecting.

Banned players persist between connections but are not saved on shutdown nor loaded on startup.

Parameters:
[in] IP Dotted IP address. Can use * as a wildcard, such as 128.0.0.* will ban all IP addresses starting with 128.0.0
[in] milliseconds how many ms for a temporary ban. Use 0 for a permanent ban

static void ParaScripting::ParaNetwork::RemoveFromBanList ( const char *  IP  )  [static]

Allows a previously banned IP to connect.

Parameters:
[in] Dotted IP address. Can use * as a wildcard, such as 128.0.0.* will banAll IP addresses starting with 128.0.0

static void ParaScripting::ParaNetwork::ClearBanList ( void   )  [static]

Allows all previously banned IPs to connect.

static bool ParaScripting::ParaNetwork::IsBanned ( const char *  IP  )  [static]

Returns true or false indicating if a particular IP is banned.

Parameters:
[in] IP - Dotted IP address.
Returns:
true if IP matches any IPs in the ban list, accounting for any wildcards. False otherwise.

static const char* ParaScripting::ParaNetwork::GetUserIP ( const char *  name  )  [static]

get the user IP of a user.

Remarks:
: not thread-safe.
Parameters:
name 
Returns:
IP address without port. Not thread-safe

static void ParaScripting::ParaNetwork::SetMaximumIncomingConnections ( unsigned short  numberAllowed  )  [static]

Sets how many incoming connections are allowed.

If this is less than the number of players currently connected, no more players will be allowed to connect. If this is greater than the maximum number of peers allowed, it will be reduced to the maximum number of peers allowed. Defaults to 0.

Parameters:
[in] numberAllowed Maximum number of incoming connections allowed.

static unsigned short ParaScripting::ParaNetwork::GetMaximumIncomingConnections ( void   )  [static]

Returns the value passed to SetMaximumIncomingConnections().

Returns:
the maximum number of incoming connections, which is always <= maxConnections

static object ParaScripting::ParaNetwork::GetConnectionList ( const object &  remoteSystems  )  [static]

get all the systems we are connected to in a array.

in the following format {name="IP"} e.g. local con_list = ParaNetwork.GetConnectionList({}); or local num = ParaNetwork.GetConnectionList(0)

Parameters:
remoteSystems,: an empty table or 0. If it is 0, the number of remote systems that are currently connected to the current nerve center server.

static void ParaScripting::ParaNetwork::SetTimeoutTime ( unsigned int  timeMS,
const char *  target 
) [static]

Set the time, in MS, to use before considering ourselves disconnected after not being able to deliver a reliable message.

Default time is 10,000 or 10 seconds in release and 30,000 or 30 seconds in debug.

Parameters:
[in] timeMS Time, in MS
[in] target Which system to do this for

static const char* ParaScripting::ParaNetwork::GetInternalID ( void   )  [static]

Return the unique address identifier that represents you on the the network and is based on your local IP / port.

Returns:
the identifier of your system internally, which may not be how other systems see if you if you are behind a NAT or proxy this is not thread-safe.

static const char* ParaScripting::ParaNetwork::GetExternalID ( const char *  target  )  [static]

Return the unique address identifier that represents you on the the network and is based on your externalIP / port (the IP / port the specified player uses to communicate with you).

Parameters:
[in] target Which remote system you are referring to for your external ID. Usually the same for all systems, unless you have two or more network cards. this is not thread-safe.

static object ParaScripting::ParaNetwork::GetStatistics ( const char *  target,
const object &  data 
) [static]

get a table containing a large set of network statistics for the specified system.

this is useful for monitoring the system. e.g. local data = ParaNetwork.GetStatistics("LXZ",{});

static const char* ParaScripting::ParaNetwork::GetStatisticsAsString ( const char *  target,
int  verbosityLevel 
) [static]

Verbosity level currently supports 0 (low), 1 (medium), 2 (high).

Parameters:
[in] target remote or local system name. it can be "" or nil.
[in] verbosityLevel 0 low 1 medium 2 high
Note:
: function is not thread safe, the returned string is in a static buffer. Use it immediately, but do not preserve it.
Returns:
: it may return nil.


Generated on Mon Dec 1 14:34:47 2008 for NPL Scripting Reference for ParaEngine by  doxygen 1.5.2