C# Класс 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.
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
AssetServerUri String
LoginSeedCapability string
SecureSessionID UUID
Simulators List

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
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

Описание методов

Begin3DiLogin() публичный Метод

public Begin3DiLogin ( LoginParams loginParams ) : void
loginParams LoginParams
Результат void

BeginLogin() публичный Метод

public BeginLogin ( LoginParams loginParams ) : void
loginParams LoginParams
Результат void

Connect() публичный Метод

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
Результат Simulator

Connect() публичный Метод

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
Результат Simulator

DefaultLoginParams() публичный Метод

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
Результат LoginParams

DisconnectSim() публичный Метод

public DisconnectSim ( Simulator sim, bool sendCloseCircuit ) : void
sim Simulator
sendCloseCircuit bool
Результат void

FindSimulator() публичный Метод

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
Результат Simulator

Login() публичный Метод

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
Результат bool

Login() публичный Метод

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
Результат bool

Login() публичный Метод

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
Результат bool

Login3Di() публичный Метод

public Login3Di ( LoginParams loginParams ) : bool
loginParams LoginParams
Результат bool

Logout() публичный Метод

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
Результат void

NetworkManager() публичный Метод

public NetworkManager ( GridClient client ) : System
client GridClient
Результат System

NetworkManager() публичный Метод

Default constructor
public NetworkManager ( GridClient client, SmartThreadPool threadPool ) : System
client GridClient Reference to the GridClient object
threadPool SmartThreadPool
Результат System

RegisterCallback() публичный Метод

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
Результат void

RegisterEventCallback() публичный Метод

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
Результат void

RegisterLoginResponseCallback() публичный Метод

public RegisterLoginResponseCallback ( LoginResponseCallback callback ) : void
callback LoginResponseCallback
Результат void

RegisterLoginResponseCallback() публичный Метод

public RegisterLoginResponseCallback ( LoginResponseCallback callback, string options ) : void
callback LoginResponseCallback
options string
Результат void

RequestLogout() публичный Метод

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
Результат void

SendPacket() публичный Метод

Send a packet to the simulator the avatar is currently occupying
public SendPacket ( Packet packet ) : void
packet Packet Packet to send
Результат void

SendPacket() публичный Метод

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
Результат void

Shutdown() публичный Метод

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
Результат void

StartLocation() публичный статический Метод

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
Результат string

UnregisterCallback() публичный Метод

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
Результат void

UnregisterEventCallback() публичный Метод

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
Результат void

UnregisterLoginResponseCallback() публичный Метод

public UnregisterLoginResponseCallback ( LoginResponseCallback callback ) : void
callback LoginResponseCallback
Результат void

Описание свойств

AssetServerUri публичное свойство

public String AssetServerUri
Результат String

LoginSeedCapability публичное свойство

Seed CAPS URL returned from the login server
public string LoginSeedCapability
Результат string

SecureSessionID публичное свойство

public UUID SecureSessionID
Результат UUID

Simulators публичное свойство

All of the simulators we are currently connected to
public List Simulators
Результат List