C# Class OpenMetaverse.NetworkManager

NetworkManager is responsible for managing the network layer of OpenMetaverse. It tracks all the server connections, serializes outgoing traffic and deserializes incoming traffic, and provides instances of delegates for network-related events.
显示文件 Open project: 3di/3di-viewer-rei-libs Class Usage Examples

Public Properties

Property Type Description
AssetServerUri String
LoginSeedCapability string
SecureSessionID UUID
Simulators List

Public Methods

Method Description
Begin3DiLogin ( LoginParams loginParams ) : void
BeginLogin ( LoginParams loginParams ) : void
Connect ( IPAddress ip, ushort port, ulong handle, bool setDefault, string seedcaps ) : Simulator

Connect to a simulator

Connect ( IPEndPoint endPoint, ulong handle, bool setDefault, string seedcaps ) : Simulator

Connect to a simulator

DefaultLoginParams ( string firstName, string lastName, string password, string userAgent, string userVersion ) : LoginParams

DisconnectSim ( Simulator sim, bool sendCloseCircuit ) : void

FindSimulator ( IPEndPoint endPoint ) : Simulator

Searches through the list of currently connected simulators to find one attached to the given IPEndPoint

Login ( LoginParams loginParams ) : bool

Login that takes a struct of all the values that will be passed to the login server

Login ( string firstName, string lastName, string password, string userAgent, string userVersion ) : bool

Simplified login that takes the most common and required fields

Login ( string firstName, string lastName, string password, string userAgent, string start, string userVersion ) : bool

Simplified login that takes the most common fields along with a starting location URI, and can accept an MD5 string instead of a plaintext password

Login3Di ( LoginParams loginParams ) : bool
Logout ( ) : void

Initiate a blocking logout request. This will return when the logout handshake has completed or when Settings.LOGOUT_TIMEOUT has expired and the network layer is manually shut down

NetworkManager ( GridClient client ) : System
NetworkManager ( GridClient client, SmartThreadPool threadPool ) : System

Default constructor

RegisterCallback ( PacketType type, PacketCallback callback ) : void

Register an event handler for a packet. This is a low level event interface and should only be used if you are doing something not supported in the library

RegisterEventCallback ( string capsEvent, Caps callback ) : void

Register a CAPS event handler. This is a low level event interface and should only be used if you are doing something not supported in the library

RegisterLoginResponseCallback ( LoginResponseCallback callback ) : void
RegisterLoginResponseCallback ( LoginResponseCallback callback, string options ) : void
RequestLogout ( ) : void

Initiate the logout process. Check if logout succeeded with the OnLogoutReply event, and if this does not fire the Shutdown() function needs to be manually called

SendPacket ( Packet packet ) : void

Send a packet to the simulator the avatar is currently occupying

SendPacket ( Packet packet, Simulator simulator ) : void

Send a packet to a specified simulator

Shutdown ( DisconnectType type ) : void

Shutdown will disconnect all the sims except for the current sim first, and then kill the connection to CurrentSim. This should only be called if the logout process times out on RequestLogout

StartLocation ( string sim, int x, int y, int z ) : string

Build a start location URI for passing to the Login function

UnregisterCallback ( PacketType type, PacketCallback callback ) : void

Unregister an event handler for a packet. This is a low level event interface and should only be used if you are doing something not supported in the library

UnregisterEventCallback ( string capsEvent, Caps callback ) : void

Unregister a CAPS event handler. This is a low level event interface and should only be used if you are doing something not supported in the library

UnregisterLoginResponseCallback ( LoginResponseCallback callback ) : void

Private Methods

Method Description
Begin3DiLogin ( ) : void
BeginLogin ( ) : void
DisableSimulatorHandler ( Packet packet, Simulator simulator ) : void
DisconnectTimer_Elapsed ( object obj ) : void
EnableSimulatorHandler ( string capsKey, OSD osd, Simulator simulator ) : void

Handler for EnableSimulator packet

Get3DiChallengeCode ( LoginParams loginParams ) : string
GetLoginServerVersion ( string loginServerURI ) : string
GetMAC ( ) : string

Get clients default Mac Address

GetPlatform ( ) : string

Get current OS

IncomingPacketHandler ( object args ) : object
IncomingPacketHandler ( ) : void
KickUserHandler ( Packet packet, Simulator simulator ) : void
LoginReplyHandler ( CapsClient client, OSD result, Exception error ) : void
LogoutReplyHandler ( Packet packet, Simulator simulator ) : void

Called to deal with LogoutReply packet and fires off callback

OutgoingPacketHandler ( object args ) : object
OutgoingPacketHandler ( ) : void
PongHandler ( Packet packet, Simulator simulator ) : void
RaiseConnectedEvent ( Simulator simulator ) : void

Fire an event when an event queue connects for capabilities

RegionHandshakeHandler ( Packet packet, Simulator simulator ) : void
SetCurrentSim ( Simulator simulator, string seedcaps ) : void
SimStatsHandler ( Packet packet, Simulator simulator ) : void
StartPingCheckHandler ( Packet packet, Simulator simulator ) : void
UpdateLoginStatus ( LoginStatus status, string message ) : void
myMD5 ( string input ) : string

Method Details

Begin3DiLogin() public method

public Begin3DiLogin ( LoginParams loginParams ) : void
loginParams LoginParams
return void

BeginLogin() public method

public BeginLogin ( LoginParams loginParams ) : void
loginParams LoginParams
return void

Connect() public method

Connect to a simulator
public Connect ( IPAddress ip, ushort port, ulong handle, bool setDefault, string seedcaps ) : Simulator
ip System.Net.IPAddress IP address to connect to
port ushort Port to connect to
handle ulong Handle for this simulator, to identify its /// location in the grid
setDefault bool Whether to set CurrentSim to this new /// connection, use this if the avatar is moving in to this simulator
seedcaps string URL of the capabilities server to use for /// this sim connection
return Simulator

Connect() public method

Connect to a simulator
public Connect ( IPEndPoint endPoint, ulong handle, bool setDefault, string seedcaps ) : Simulator
endPoint System.Net.IPEndPoint IP address and port to connect to
handle ulong Handle for this simulator, to identify its /// location in the grid
setDefault bool Whether to set CurrentSim to this new /// connection, use this if the avatar is moving in to this simulator
seedcaps string URL of the capabilities server to use for /// this sim connection
return Simulator

DefaultLoginParams() public method

public DefaultLoginParams ( string firstName, string lastName, string password, string userAgent, string userVersion ) : LoginParams
firstName string Account first name
lastName string Account last name
password string Account password
userAgent string Client application name
userVersion string Client application version
return LoginParams

DisconnectSim() public method

public DisconnectSim ( Simulator sim, bool sendCloseCircuit ) : void
sim Simulator
sendCloseCircuit bool
return void

FindSimulator() public method

Searches through the list of currently connected simulators to find one attached to the given IPEndPoint
public FindSimulator ( IPEndPoint endPoint ) : Simulator
endPoint IPEndPoint IPEndPoint of the Simulator to search for
return Simulator

Login() public method

Login that takes a struct of all the values that will be passed to the login server
public Login ( LoginParams loginParams ) : bool
loginParams LoginParams The values that will be passed to the login /// server, all fields must be set even if they are String.Empty
return bool

Login() public method

Simplified login that takes the most common and required fields
public Login ( string firstName, string lastName, string password, string userAgent, string userVersion ) : bool
firstName string Account first name
lastName string Account last name
password string Account password
userAgent string Client application name
userVersion string Client application version
return bool

Login() public method

Simplified login that takes the most common fields along with a starting location URI, and can accept an MD5 string instead of a plaintext password
public Login ( string firstName, string lastName, string password, string userAgent, string start, string userVersion ) : bool
firstName string Account first name
lastName string Account last name
password string Account password or MD5 hash of the password /// such as $1$1682a1e45e9f957dcdf0bb56eb43319c
userAgent string Client application name
start string Starting location URI that can be built with /// StartLocation()
userVersion string Client application version
return bool

Login3Di() public method

public Login3Di ( LoginParams loginParams ) : bool
loginParams LoginParams
return bool

Logout() public method

Initiate a blocking logout request. This will return when the logout handshake has completed or when Settings.LOGOUT_TIMEOUT has expired and the network layer is manually shut down
public Logout ( ) : void
return void

NetworkManager() public method

public NetworkManager ( GridClient client ) : System
client GridClient
return System

NetworkManager() public method

Default constructor
public NetworkManager ( GridClient client, SmartThreadPool threadPool ) : System
client GridClient Reference to the GridClient object
threadPool SmartThreadPool
return System

RegisterCallback() public method

Register an event handler for a packet. This is a low level event interface and should only be used if you are doing something not supported in the library
public RegisterCallback ( PacketType type, PacketCallback callback ) : void
type PacketType Packet type to trigger events for
callback PacketCallback Callback to fire when a packet of this type /// is received
return void

RegisterEventCallback() public method

Register a CAPS event handler. This is a low level event interface and should only be used if you are doing something not supported in the library
public RegisterEventCallback ( string capsEvent, Caps callback ) : void
capsEvent string Name of the CAPS event to register a handler for
callback Caps Callback to fire when a CAPS event is received
return void

RegisterLoginResponseCallback() public method

public RegisterLoginResponseCallback ( LoginResponseCallback callback ) : void
callback LoginResponseCallback
return void

RegisterLoginResponseCallback() public method

public RegisterLoginResponseCallback ( LoginResponseCallback callback, string options ) : void
callback LoginResponseCallback
options string
return void

RequestLogout() public method

Initiate the logout process. Check if logout succeeded with the OnLogoutReply event, and if this does not fire the Shutdown() function needs to be manually called
public RequestLogout ( ) : void
return void

SendPacket() public method

Send a packet to the simulator the avatar is currently occupying
public SendPacket ( Packet packet ) : void
packet Packet Packet to send
return void

SendPacket() public method

Send a packet to a specified simulator
public SendPacket ( Packet packet, Simulator simulator ) : void
packet Packet Packet to send
simulator Simulator Simulator to send the packet to
return void

Shutdown() public method

Shutdown will disconnect all the sims except for the current sim first, and then kill the connection to CurrentSim. This should only be called if the logout process times out on RequestLogout
public Shutdown ( DisconnectType type ) : void
type DisconnectType
return void

StartLocation() public static method

Build a start location URI for passing to the Login function
public static StartLocation ( string sim, int x, int y, int z ) : string
sim string Name of the simulator to start in
x int X coordinate to start at
y int Y coordinate to start at
z int Z coordinate to start at
return string

UnregisterCallback() public method

Unregister an event handler for a packet. This is a low level event interface and should only be used if you are doing something not supported in the library
public UnregisterCallback ( PacketType type, PacketCallback callback ) : void
type PacketType Packet type this callback is registered with
callback PacketCallback Callback to stop firing events for
return void

UnregisterEventCallback() public method

Unregister a CAPS event handler. This is a low level event interface and should only be used if you are doing something not supported in the library
public UnregisterEventCallback ( string capsEvent, Caps callback ) : void
capsEvent string Name of the CAPS event this callback is /// registered with
callback Caps Callback to stop firing events for
return void

UnregisterLoginResponseCallback() public method

public UnregisterLoginResponseCallback ( LoginResponseCallback callback ) : void
callback LoginResponseCallback
return void

Property Details

AssetServerUri public_oe property

public String AssetServerUri
return String

LoginSeedCapability public_oe property

Seed CAPS URL returned from the login server
public string LoginSeedCapability
return string

SecureSessionID public_oe property

public UUID SecureSessionID
return UUID

Simulators public_oe property

All of the simulators we are currently connected to
public List Simulators
return List