Skip to content

API Reference

Hagen Siegel edited this page Apr 11, 2021 · 4 revisions

CoreRemoting

Namespace CoreRemoting

CallContext CallContextEntry ClientConfig
ClientRpcContext IRemotingClient IRemotingServer
IServiceProxy ISessionRepository MicosoftDependencyInjectionExtensionMethods
OneWayAttribute RemoteInvocationException RemotingClient
RemotingException RemotingServer RemotingSession
ServerConfig ServerRpcContext ServiceProxy<T>
SessionRepository

Namespace CoreRemoting.Authentication

AuthenticationRequestMessage AuthenticationResponseMessage Credential
IAuthenticationProvider RemotingIdentity

Namespace CoreRemoting.Channels

IClientChannel IRawMessageTransport IServerChannel
NetworkException

Namespace CoreRemoting.Channels.Websocket

RpcWebsocketSharpBehavior WebsocketClientChannel WebsocketServerChannel

Namespace CoreRemoting.ClassicRemotingApi.ConfigSection

RemotingConfiguration RemotingServices
WellKnownServiceTypeEntry

Namespace CoreRemoting.ClassicRemotingApi.ConfigSection

ClientInstanceConfigElement ClientInstanceConfigElementCollection
ConfigSectionExtensionMethods CoreRemotingConfigSection
ServerInstanceConfigElement ServerInstanceConfigElementCollection
WellKnownServiceConfigElement WellKnownServiceConfigElementCollection

Namespace CoreRemoting.DependencyInjection

CastleWindsorDependencyInjectionContainer DependencyInjectionContainerExtensions
IDependencyInjectionContainer MicrosoftDependencyInjectionContainer
ServiceLifetime

Namespace CoreRemoting.Encryption

AesEncryption EncryptedSecret RsaKeyExchange
RsaKeyPair RsaSignature SignedMessageData

Namespace CoreRemoting.RemoteDelegates

ClientDelegateInfo ClientDelegateRegistry DelegateProxy
DelegateProxyFactory IDelegateProxy IDelegateProxyFactory
RemoteDelegateInfo RemoteDelegateInvocationEventAggregator RemoteDelegateInvocationNeededEventHandler

Namespace CoreRemoting.RpcMessaging

GoodbyeMessage IMessageEncryptionManager IMethodCallMessageBuilder
MessageEncryptionManager MessagingExtensionMethods MethodCallMessage
MethodCallMessageBuilder MethodCallOutParameterMessage MethodCallParameterMessage
MethodCallResultMessage RemoteDelegateInvocationMessage WireMessage

Namespace CoreRemoting.Serialization

ISerializerAdapter

Namespace CoreRemoting.Serialization.Binary

BinaryFormatterExtensions BinarySerializerAdapter BinarySerializerConfig
CustomDelegateSerializationHolder DataSetSurrogate DelegateValidator
IDelegateValidator ITypeNameValidator SafeSerializationBinder
SafeSurrogateSelector TypeFullName TypeNameValidator
UnsafeDeserializationException WindowsIdentitySurrogate

Namespace CoreRemoting.Serialization.Bson

BsonSerializerAdapter BsonSerializerConfig Envelope

AuthenticationRequestMessage

Describes an authentication request message.

Credentials

Get or sets an array of credentials for authentication.

AuthenticationResponseMessage

Describes an authentication response message.

AuthenticatedIdentity

Get or sets the authenticated identity.

IsAuthenticated

Gets or sets whether authentication was successful.

Credential

Describes an authentication credential.

Name

Gets or sets the name of the credential (e.g. "password").

Value

Get or sets the value of the credential (e.g. "secret").

IAuthenticationProvider

Interface for authentication providers.

Authenticate(credentials, authenticatedIdentity)

Authenticates the provided credentials and returns the authenticated identity, if successful.

Name Description
credentials CoreRemoting.Authentication.Credential[]
Array of credentials
authenticatedIdentity CoreRemoting.Authentication.RemotingIdentity@
Authenticated Identity

Returns

Indicates whether the authentication was successful.

RemotingIdentity

Identity authenticated by a CoreRemoting server.

AuthenticationType

Gets or sets a string, that describes the authentication type.

Domain

Gets or sets the optional domain or realm name of the identity.

IsAuthenticated

Gets or sets whether the identity was successful authenticated or not.

Name

Gets or sets the name of the identity.

Roles

Gets or sets an array of roles, the identity is member of.

CallContext

Provides a way to set contextual data that flows with the call and async context of a invocation.

GetData(name)

Retrieves an object with the specified name from the CallContext.

Name Description
name System.String
The name of the item in the call context.

Returns

The object in the call context associated with the specified name, or if not found.

GetSnapshot

Gets a serializable snapshot of the current call context.

Returns

Array of call context entries

RestoreFromSnapshot(entries)

Restore the call context from a snapshot.

Name Description
entries System.Collections.Generic.IEnumerable{CoreRemoting.CallContextEntry}
Call context entries

SetData(name, data)

Stores a given object and associates it with the specified name.

Name Description
name System.String
The name with which to associate the new item in the call context.
data System.Object
The object to store in the call context.

CallContextEntry

Describes a single call context entry.

Name

Gets or sets the name of the call context entry.

Value

Gets or sets the value of the call context entry.

IClientChannel

Interface for CoreRemoting client side transport channel.

Connect

Establish a connection with the server.

Disconnect

Closes the connection.

Init(client)

Initializes the channel.

Name Description
client CoreRemoting.IRemotingClient
CoreRemoting client

IsConnected

Gets whether the connection is established or not.

RawMessageTransport

Gets the raw message transport component for this connection.

IRawMessageTransport

Interface to be implemented by raw message transport components.

ErrorOccured

Event: Fires when an error is occurred.

LastException

Gets or sets the last exception.

ReceiveMessage

Event: Fires when a message is received from server.

SendMessage(rawMessage)

Sends a message to the server.

Name Description
rawMessage System.Byte[]
Raw message data

IServerChannel

Interface for CoreRemoting server side transport channel.

Init(server)

Initializes the channel.

Name Description
server CoreRemoting.IRemotingServer
CoreRemoting sever

IsListening

Gets whether the channel is listening or not.

StartListening

Start listening for client requests.

StopListening

Stop listening for client requests.

NetworkException

Exception that is thrown when a network operation is failed.

Constructor(info, context)

Without this constructor, deserialization will fail.

Name Description
info System.Runtime.Serialization.SerializationInfo
Serialization info
context System.Runtime.Serialization.StreamingContext
Streaming context

Constructor(message, innerEx)

Creates a new instance of the NetworkException class.

Name Description
message System.String
Error message
innerEx System.Exception
Optional inner exception

RpcWebsocketSharpBehavior

Executes RPC calls from clients.

Constructor(server)

Initializes the RPC service instance.

Name Description
server CoreRemoting.IRemotingServer
Remoting server instance, which is hosting the service to call

BeforeDisposeSession

Closes the internal websocket session.

Dispose

Frees managed resources.

ErrorOccured

Event: Fires when an error is occurred.

LastException

Gets or sets the last exception.

OnError(e)

Event procedure: Called, if an error occurs at the websocket layer.

Name Description
e WebSocketSharp.ErrorEventArgs
Message and optional Exception info

OnMessage(e)

Called when a message from a client is received.

Name Description
e WebSocketSharp.MessageEventArgs
Metadata and the message from client

ReceiveMessage

Event: Fired when a message is received via websocket.

SendMessage(rawMessage)

Sends a message over the websocket.

Name Description
rawMessage System.Byte[]
Raw data of the message

WebsocketClientChannel

Client side websocket channel implementation.

Connect

Establish a websocket connection with the server.

Disconnect

Closes the websocket connection.

Dispose

Disconnect and free manages resources.

ErrorOccured

Event: Fires when an error is occurred.

Init(client)

Initializes the channel.

Name Description
client CoreRemoting.IRemotingClient
CoreRemoting client

IsConnected

Gets whether the websocket connection is established or not.

LastException

Gets or sets the last exception.

OnError(sender, e)

Event procedure: Called when a error occurs on the websocket layer.

Name Description
sender System.Object
e WebSocketSharp.ErrorEventArgs

OnMessage(sender, e)

Event procedure: Called when a message from server is received.

Name Description
sender System.Object
Sender of the event
e WebSocketSharp.MessageEventArgs
Event arguments containing the message content

RawMessageTransport

Gets the raw message transport component for this connection.

ReceiveMessage

Event: Fires when a message is received from server.

SendMessage(rawMessage)

Sends a message to the server.

Name Description
rawMessage System.Byte[]
Raw message data

WebsocketServerChannel

Server side websocket channel implementation.

Dispose

Stops listening and frees managed resources.

Init(server)

Initializes the channel.

Name Description
server CoreRemoting.IRemotingServer
CoreRemoting sever

IsListening

Gets whether the channel is listening or not.

StartListening

Start listening for client requests.

StopListening

Stop listening for client requests.

ClientInstanceConfigElement

Configuration element for a CoreRemoting client instance.

AuthenticationTimeout

Gets or sets the authentication timeout in seconds (0 means infinite).

Channel

Gets or sets the type of the client channel which should be used for communication.

ConnectionTimeout

Gets or sets the connection timeout in seconds (0 means infinite).

InvocationTimeout

Gets or sets the invocation timeout in seconds (0 means infinite).

IsDefault

Gets or set whether this is the default client.

KeySize

Gets or sets the RSA key size for message encryption.

MessageEncryption

Gets or set whether messages should be encrypted or not.

Serializer

Gets or sets the name of the serializer which should be used by the client instance.

ServerHostName

Gets or sets the server hostname.

ServerPort

Gets or sets the server network port.

UniqueInstanceName

Gets or sets the unique name of the client instance.

ClientInstanceConfigElementCollection

Collection of ClientInstanceConfigElement objects.

CreateNewElement

Creates a new element.

Returns

New ClientInstanceConfigElement object

GetElementKey(element)

Get the unique key of a specified element.

Name Description
element System.Configuration.ConfigurationElement
Configuration element

Returns

Unique key

Item(System.Int32)

Gets an element of the collection by its index.

Name Description
index Unknown type
Numeric index (zero based)

Item(System.String)

Gets an element of the collection by its string key.

Name Description
key Unknown type
Unique string key of the element

ConfigSectionExtensionMethods

Extension methods for XML configuration classes.

CreateClientChannelFromConfigName(channelTypeName)

Creates a client channel from a type string.

Name Description
channelTypeName System.String
String containing a channel type shortcut (e.g. "ws" for websockets) or a type name and assembly name, separated by a comma

Returns

Client channel

CreateSerializerAdapterFromConfigName(serializerName)

Creates a serializer adapter from a type string.

Name Description
serializerName System.String
String containing a serializer (e.g. "binary" for a binary serializer) type shortcut or a type name and assembly name, separated by a comma

Returns

CreateServerChannelFromConfigName(channelTypeName)

Creates a server channel from a type string.

Name Description
channelTypeName System.String
String containing a channel type shortcut (e.g. "ws" for websockets) or a type name and assembly name, separated by a comma

Returns

Server channel

GetTypeFromConfigString(assemblyAndTypeConfigString)

Gets a type from a string that contains type name and assembly name.

Name Description
assemblyAndTypeConfigString System.String
String containing type name and assembly name, separated by a comma

Returns

Type object

System.FormatException: Thrown, if string format is invalid

ToClientConfig(configElement)

Converts a client XML config object into a ClientConfig object.

Name Description
configElement CoreRemoting.ClassicRemotingApi.ConfigSection.ClientInstanceConfigElement
Configuration element

Returns

ClientConfig object

ToServerConfig(configElement)

Converts a server XML config object into a ServerConfig object.

Name Description
configElement CoreRemoting.ClassicRemotingApi.ConfigSection.ServerInstanceConfigElement
Configuration element

Returns

ServerConfig object

ToWellKnownServiceTypeEntry(configElement)

Converts a wellknown service XML config object into a WellknownServiceTypeEntry object.

Name Description
configElement CoreRemoting.ClassicRemotingApi.ConfigSection.WellKnownServiceConfigElement
Service definition from XML config

Returns

WellknownServiceTypeEntry object

CoreRemotingConfigSection

Defines a configuration section for CoreRemoting configuration in a XML config file.

ClientInstances

Gets a collection of configured CoreRemoting client instances.

ServerInstances

Gets a collection of configured CoreRemoting server instances.

Services

Gets a collection of configured CoreRemoting services.

ServerInstanceConfigElement

Configuration element for a CoreRemoting server instance.

AuthenticationProvider

Gets or sets the type of authentication provider which should be used to authenticate client credentials.

AuthenticationRequired

Gets or sets whether authentication is required or not.

Channel

Gets or sets the type of the server channel which should be used for communication.

HostName

Gets or sets the hostname the server instance is bound to.

IsDefault

Gets or set whether this is the default server.

KeySize

Gets or sets the RSA key size for message encryption.

MessageEncryption

Gets or set whether messages should be encrypted or not.

NetworkPort

Gets or sets the network port on which the server instance is listening on.

Serializer

Gets or sets the name of the serializer which should be used by the server instance.

UniqueInstanceName

Gets or sets the unique name of the server instance.

ServerInstanceConfigElementCollection

Collection of ServerInstanceConfigElement objects.

CreateNewElement

Creates a new element.

Returns

New ServerInstanceConfigElement object

GetElementKey(element)

Get the unique key of a specified element.

Name Description
element System.Configuration.ConfigurationElement
Configuration element

Returns

Unique key

Item(System.Int32)

Gets an element of the collection by its index.

Name Description
index Unknown type
Numeric index (zero based)

Item(System.String)

Gets an element of the collection by its string key.

Name Description
key Unknown type
Unique string key of the element

WellKnownServiceConfigElement

Configuration element for a wellknown CoreRemoting service.

ImplementationAssemblyName

Get or sets the assembly of the service's implementation assembly.

ImplementationTypeName

Gets or sets the implementation type of the service.

InterfaceAssemblyName

Get or sets the assembly name of the service’s interface assembly.

InterfaceTypeName

Get or sets the type name of the service interface.

Lifetime

Gets or sets the service's lifetime.

ServiceName

Gets or sets the unique service name.

UniqueServerInstanceName

Gets or sets the unique name of the server hosting this service.

WellKnownServiceConfigElementCollection

Collection of WellKnownServiceConfigElement objects.

CreateNewElement

Creates a new element.

Returns

New WellKnownServiceConfigElement object

GetElementKey(element)

Get the unique key of a specified element.

Name Description
element System.Configuration.ConfigurationElement
Configuration element

Returns

Unique key

Item(System.Int32)

Gets an element of the collection by its index.

Name Description
index Unknown type
Numeric index (zero based)

Item(System.String)

Gets an element of the collection by its string key.

Name Description
key Unknown type
Unique string key of the element

RemotingConfiguration

Provides CoreRemoting configuration in classic .NET Remoting style.

Configure(fileName, credentials)

Applies CoreRemoting server configuration from config file.

Name Description
fileName System.String
Path to XML configuration file (Default EXE configuration file will be used, if empty)
credentials CoreRemoting.Authentication.Credential[]
Optional credentials for authentication

GetRegisteredClient(uniqueClientInstanceName)

Gets a registered client instance by its unique name.

Name Description
uniqueClientInstanceName System.String
Unique client instance name

Returns

CoreRemoting client

GetRegisteredServer(uniqueServerInstanceName)

Gets a registered server instance by its unique name.

Name Description
uniqueServerInstanceName System.String
Unique server instance name

Returns

CoreRemoting server

RegisterClient(config)

Registers a new CoreRemoting client instance and returns it's unique instance name.

Name Description
config CoreRemoting.ClientConfig
Client configuration

Returns

Unique client instance name

RegisteredClientInstances

Gets a list of currently registered CoreRemoting client instances.

RegisteredServerInstances

Gets a list of currently registered CoreRemoting server instances.

RegisterServer(config)

Registers a new CoreRemoting server instance and returns it's unique instance name.

Name Description
config CoreRemoting.ServerConfig
Server configuration

Returns

Unique server instance name

RegisterWellKnownServiceType(entry)

Registers a service.

Name Description
entry CoreRemoting.ClassicRemotingApi.WellKnownServiceTypeEntry
Service configuration data

System.ArgumentNullException: Thrown if parameter 'entry' is null

RegisterWellKnownServiceType(interfaceType, implementationType, lifetime, serviceName, uniqueServerInstanceName)

Registers a service.

Name Description
interfaceType System.Type
Service interface type
implementationType System.Type
Service implementation type
lifetime CoreRemoting.DependencyInjection.ServiceLifetime
LIfetime (SingleCall / Singleton)
serviceName System.String
Unique name of the service (Full name of interface type is used, if left blank)
uniqueServerInstanceName System.String
Unique instance name of the CoreRemoting server that should used for hosting this service

ShutdownAll

Shutdown all registered clients and servers.

UnregisterClient(uniqueClientInstanceName)

Unregisters a CoreRemoting client.

Name Description
uniqueClientInstanceName System.String
Unique name of the client instance

UnregisterServer(uniqueServerInstanceName)

Unregisters a CoreRemoting server.

Name Description
uniqueServerInstanceName System.String
Unique name of the server instance

RemotingServices

Provides several methods for using and publishing remoted objects and proxies.

Connect(interfaceType, serviceName, uniqueClientInstanceName)

Creates a proxy for a remote CoreRemoting service.

Name Description
interfaceType System.Type
Service interface type
serviceName System.String
Optional service name
uniqueClientInstanceName System.String
Unique client instance name (Default client is used if empty)

Returns

Proxy

IsOneWay(method)

Returns a Boolean value that indicates whether the client that called the method specified in the given message is waiting for the server to finish processing the method before continuing execution.

Name Description
method System.Reflection.MethodBase
The method in question

Returns

True if the method is one way; otherwise, false.

IsTransparentProxy(proxy)

Returns a Boolean value that indicates whether the given object is a transparent proxy or a real object.

Name Description
proxy System.Object
The reference to the object to check.

Returns

A Boolean value that indicates whether the object specified in the proxy parameter is a transparent proxy or a real object.

Marshal(serviceInstance, serviceName, interfaceType, uniqueServerInstanceName)

Registers a object as CoreRemoting service.

Name Description
serviceInstance System.Object
Object instance that should be registered as service
serviceName System.String
Unique service name (Interface full type name is used, if left blank)
interfaceType System.Type
Service interface type
uniqueServerInstanceName System.String
Unique server instance name

Returns

Service name

WellKnownServiceTypeEntry

Describes a wellknown service.

Constructor(interfaceAssemblyName, interfaceTypeName, implementationAssemblyName, implementationTypeName, lifetime, serviceName, uniqueServerInstanceName)

Creates a new instance of the WellKnownServiceTypeEntry class.

Name Description
interfaceAssemblyName System.String
Interface assembly name of the service
interfaceTypeName System.String
Interface type name of the service
implementationAssemblyName System.String
Implementation assembly name of the service
implementationTypeName System.String
Implementation type name of the service
lifetime CoreRemoting.DependencyInjection.ServiceLifetime
Lifetime of the service (Singleton / SingleCall)
serviceName System.String
Unique service name (Full name of the interface type is used, when left blank)
uniqueServerInstanceName System.String
Unique instance name of the host server (default server is used, if left blank)

ImplementationAssemblyName

Gets or sets the implementation assembly name.

ImplementationTypeName

Gets or sets the implementation type name.

InterfaceAssemblyName

Gets or sets the interface assembly name.

InterfaceTypeName

Gets or sets the interface type name.

Lifetime

Gets or sets the service's lifetime.

ServiceName

Gets or sets the unique service name (Full name of interface type is used, if left blank).

UniqueServerInstanceName

Gets or sets the unique instance name of the host server.

ClientConfig

Provides configuration settings for a CoreRemoting client instance.

Constructor

Creates a new instance of the ClientConfig class.

AuthenticationTimeout

Gets or sets the authentication timeout in seconds (0 means infinite).

Channel

Gets or sets the client channel to be used for transport of messages over the wire (WebsocketClientChannel is used, if set to null).

ConnectionTimeout

Gets or sets the connection timeout in seconds (0 means infinite).

Credentials

Gets or sets an array of credentials for authentication (depends on the authentication provider used on server side).

InvocationTimeout

Gets or sets the invocation timeout in seconds (0 means infinite).

IsDefault

Gets or set whether this is the default client.

KeepSessionAliveInterval

Gets or sets an interval in seconds to keep session alive, even on idle (session is not kept alive if set to 0).

KeySize

Gets or sets the key size for asymmetric encryption (only relevant, if message encryption is enabled).

MessageEncryption

Gets or sets whether messages should be encrypted or not.

Serializer

Gets or sets the serializer to be used (BSON serializer is used, if set to null).

ServerHostName

Gets or sets the host name of the CoreRemoting server to be connected to.

ServerPort

Gets or sets the network port of the CoreRemoting server to be connected to.

UniqueClientInstanceName

Gets or sets the unqiue name of the configured client instance.

ClientRpcContext

Describes the client side context of a RPC call.

Constructor

Creates a new instance of the ClientRpcContext class.

Dispose

Frees managed resources.

Error

Gets or sets whether this RPC call is in error state.

RemoteException

Gets or sets an exception that describes an error that occurred on server side RPC invocation.

ResultMessage

Gets or sets the result message, that was received from server after the call was invoked on server side.

UniqueCallKey

Gets the unique key of RPC call.

WaitHandle

Gets a wait handle that is set, when the response of this RPC call is received from server.

CastleWindsorDependencyInjectionContainer

Castle Windsor DI-Container-Wrapper.

Constructor

Creates a new instance of the CastleWindsorDependencyInjectionContainer class.

Dispose

Frees managed resources.

GetAllRegisteredTypes

Gets all registered types.

Returns

Enumerable list of registered types

GetService(serviceName)

Gets a service instance by service name.

Name Description
serviceName System.String
Unique service name

Returns

Service instance

GetService``1(serviceName)

Gets a service instance of a specified interface type.

Name Description
serviceName System.String
Optional unique service name (Full name of interface type is used, if left blank)

Type Parameters

  • TServiceInterface - Service interface type

Returns

Service instance

GetServiceInterfaceType(serviceName)

Gets the service interface type of a specified service.

Name Description
serviceName System.String
Unique service name

Returns

Service interface type

IsRegistered``1(serviceName)

Gets whether the specified service is registered or not.

Name Description
serviceName System.String
Unique service name (Full service interface type name is used, if left blank)

Type Parameters

  • TServiceInterface - Service interface type

Returns

True, if the service is registered, otherwise false

RegisterService``1(factoryDelegate, lifetime, serviceName)

Registers a service.

Name Description
factoryDelegate System.Func{``0}
Factory delegate, which is called to create service instances
lifetime CoreRemoting.DependencyInjection.ServiceLifetime
Service lifetime (Singleton / SingleCall)
serviceName System.String
Optional unique service name

Type Parameters

  • TServiceInterface - Service interface type

RegisterService``2(lifetime, serviceName)

Registers a service.

Name Description
lifetime CoreRemoting.DependencyInjection.ServiceLifetime
Service lifetime (Singleton / SingleCall)
serviceName System.String
Optional unique service name

Type Parameters

  • TServiceInterface - Service interface type
  • TServiceImpl - Service implementation type

DependencyInjectionContainerExtensions

Provides extension methods for dependency injection containers.

GetRegisterServiceMethodForServiceInstance(container, interfaceType, serviceInstance)

Gets the method info of the RegisterService method to register an object as service..

Name Description
container CoreRemoting.DependencyInjection.IDependencyInjectionContainer
DI container
interfaceType System.Type
Service interface type
serviceInstance System.Object
Service instance

Returns

Method info of the RegisterService method

System.ArgumentNullException: Thrown if container is set to null

GetRegisterServiceMethodForWellknownServiceType(container, interfaceType, implementationType)

Gets the method info of the RegisterService method.

Name Description
container CoreRemoting.DependencyInjection.IDependencyInjectionContainer
DI container
interfaceType System.Type
Service interface type
implementationType System.Type
Service implementation type

Returns

Method info of the RegisterService method

System.ArgumentNullException: Thrown if container is set to null

IDependencyInjectionContainer

Interface to be implemented by dependency injection container integration classes.

GetAllRegisteredTypes

Gets all registered types.

Returns

Enumerable list of registered types

GetService(serviceName)

Gets a service instance by service name.

Name Description
serviceName System.String
Unique service name

Returns

Service instance

GetService``1(serviceName)

Gets a service instance of a specified interface type.

Name Description
serviceName System.String
Optional unique service name (Full name of interface type is used, if left blank)

Type Parameters

  • TServiceInterface - Service interface type

Returns

Service instance

GetServiceInterfaceType(serviceName)

Gets the service interface type of a specified service.

Name Description
serviceName System.String
Unique service name

Returns

Service interface type

IsRegistered``1(serviceName)

Gets whether the specified service is registered or not.

Name Description
serviceName System.String
Unique service name (Full service interface type name is used, if left blank)

Type Parameters

  • TServiceInterface - Service interface type

Returns

True, if the service is registered, otherwise false

RegisterService``1(factoryDelegate, lifetime, serviceName)

Registers a service.

Name Description
factoryDelegate System.Func{``0}
Factory delegate, which is called to create service instances
lifetime CoreRemoting.DependencyInjection.ServiceLifetime
Service lifetime (Singleton / SingleCall)
serviceName System.String
Optional unique service name

Type Parameters

  • TServiceInterface - Service interface type

RegisterService``2(lifetime, serviceName)

Registers a service.

Name Description
lifetime CoreRemoting.DependencyInjection.ServiceLifetime
Service lifetime (Singleton / SingleCall)
serviceName System.String
Optional unique service name

Type Parameters

  • TServiceInterface - Service interface type
  • TServiceImpl - Service implementation type

MicrosoftDependencyInjectionContainer

Microsoft Dependency Injection DI-Container-Wrapper.

Constructor(serviceCollection)

Creates a new instance of the MicrosoftDependencyInjectionContainer class.

Name Description
serviceCollection Microsoft.Extensions.DependencyInjection.IServiceCollection
Service collection

Dispose

Frees managed resources.

GetAllRegisteredTypes

Gets all registered types.

Returns

Enumerable list of registered types

GetService(serviceName)

Gets a service instance by service name.

Name Description
serviceName System.String
Unique service name

Returns

Service instance

GetService``1(serviceName)

Gets a service instance of a specified interface type.

Name Description
serviceName System.String
Optional unique service name (Full name of interface type is used, if left blank)

Type Parameters

  • TServiceInterface - Service interface type

Returns

Service instance

GetServiceInterfaceType(serviceName)

Gets the service interface type of a specified service.

Name Description
serviceName System.String
Unique service name

Returns

Service interface type

IsRegistered``1(serviceName)

Gets whether the specified service is registered or not.

Name Description
serviceName System.String
Unique service name (Full service interface type name is used, if left blank)

Type Parameters

  • TServiceInterface - Service interface type

Returns

True, if the service is registered, otherwise false

RegisterService``1(factoryDelegate, lifetime, serviceName)

Registers a service.

Name Description
factoryDelegate System.Func{``0}
Factory delegate, which is called to create service instances
lifetime CoreRemoting.DependencyInjection.ServiceLifetime
Service lifetime (Singleton / SingleCall)
serviceName System.String
Optional unique service name

Type Parameters

  • TServiceInterface - Service interface type

RegisterService``2(lifetime, serviceName)

Registers a service.

Name Description
lifetime CoreRemoting.DependencyInjection.ServiceLifetime
Service lifetime (Singleton / SingleCall)
serviceName System.String
Optional unique service name

Type Parameters

  • TServiceInterface - Service interface type
  • TServiceImpl - Service implementation type

ServiceLifetime

Describes the available service lifetime modes.

SingleCall

Every call is served by its own service instance.

Singleton

On service instance serves all calls.

AesEncryption

Provides methods to implement symmetric AES encryption.

CreateHash(value)

Creates a SHA-256 hash of a specified value.

Name Description
value System.Byte[]
Value to be hashed

Returns

SHA-256 hash

Decrypt(encryptedData, sharedSecret, iv)

Decrypts raw data with AES.

Name Description
encryptedData System.Byte[]
Encrypted raw data
sharedSecret System.Byte[]
Shared secret
iv System.Byte[]
Initialization vector

Returns

Decrypted raw data

System.NotSupportedException: Thrown if AES is not supported by the current system environment

Encrypt(dataToEncrypt, sharedSecret, iv)

Encrypts raw data with AES.

Name Description
dataToEncrypt System.Byte[]
Raw data to encrypt
sharedSecret System.Byte[]
Shared secret
iv System.Byte[]
Initialization vector

Returns

Encrypted data

System.NotSupportedException: Thrown if AES is not supported by the current system environment

GenerateIv

Generates an initialization vector.

Returns

Initialization vector

System.NotSupportedException: Thrown if AES is not supported by the current system environment

EncryptedSecret

Describes an encrypted secret.

Constructor(encryptedSessionKey, iv, encryptedMessage, sendersPublicKeyBlob)

Creates a new instance of the EncryptedSecret class.

Name Description
encryptedSessionKey System.Byte[]
Encrypted session key
iv System.Byte[]
Initialization vector
encryptedMessage System.Byte[]
Encrypted message
sendersPublicKeyBlob System.Byte[]
Public key of the sender

EncryptedMessage

Gets the encrypted message.

EncryptedSessionKey

Gets the encrypted session key.

Iv

Gets the initialization vector.

SendersPublicKeyBlob

Gets the public key of the sender.

RsaKeyExchange

Provides methods to perform a RSA key exchange.

DecrpytSecret(keySize, receiversPrivateKeyBlob, encryptedSecret)

Decrypts a secret with asymmetric RSA algorithm.

Name Description
keySize System.Int32
Key size (1024, 2048, 4096, ...)
receiversPrivateKeyBlob System.Byte[]
Private key of the receiver
encryptedSecret CoreRemoting.Encryption.EncryptedSecret
Encrypted secret

Returns

Decrypted secret

EncryptSecret(keySize, receiversPublicKeyBlob, secretToEncrypt, sendersPublicKeyBlob)

Encrypts a secret with asymmetric RSA algorithm.

Name Description
keySize System.Int32
Key size (1024, 2048, 4096, ...)
receiversPublicKeyBlob System.Byte[]
Public key of the receiver
secretToEncrypt System.Byte[]
Secret to encrypt
sendersPublicKeyBlob System.Byte[]
Public key of the sender (It's not needed to encrypt the secret, but to transfer the sender's public key to the receiver)

Returns

Encrypted secret

RsaKeyPair

Describes an RSA key pair.

Constructor(keySize, privateKey)

Creates a new instance of the RsaKeyPair.

Name Description
keySize System.Int32
Key size
privateKey System.Byte[]
Private key to import

Constructor(keySize)

Creates a new instance of the RsaKeyPair.

Name Description
keySize System.Int32
Key size

Dispose

Frees managed resources.

KeySize

Gets the key size.

PrivateKey

Gets the private RSA key.

PublicKey

Gets the public RSA key.

RsaSignature

Provides methods to create and verify RSA signatures.

CreateSignature(keySize, sendersPrivateKeyBlob, rawData)

Creates a signature from the SHA256 hash value of the specified raw data. The private key of the provided key pair is used to create the signature.

Name Description
keySize System.Int32
Key size (1024, 2048, 4096, ...)
sendersPrivateKeyBlob System.Byte[]
Private key of the sender
rawData System.Byte[]
Raw data to create a signature of

Returns

Signature

VerifySignature(keySize, sendersPublicKeyBlob, rawData, signature)

Verifies a signature with the public key of the sender for the provided raw data.

Name Description
keySize System.Int32
Key size (1024, 2048, 4096, ...)
sendersPublicKeyBlob System.Byte[]
Public key of the sender
rawData System.Byte[]
Raw data which signature of should be verified
signature System.Byte[]
The signature to verify

Returns

True is the signature is valid, otherwise false

SignedMessageData

Container for raw message data and its RSA signature.

MessageRawData

Gets or sets the unencrypted raw message data.

Signature

Get or sets the RSA signature.

IRemotingClient

Interface of a CoreRemoting client.

Config

Gets the configuration settings used by the CoreRemoting client instance.

Connect

Connects this CoreRemoting client instance to the configured CoreRemoting server.

CreateProxy(serviceInterfaceType, serviceName)

Creates a proxy object to provide access to a remote service.

Name Description
serviceInterfaceType System.Type
Interface type of the remote service
serviceName System.String
Unique name of the remote service

Returns

Proxy object

CreateProxy``1(serviceName)

Creates a proxy object to provide access to a remote service.

Type Parameters

  • T - Type of the shared interface of the remote service
Name Description
serviceName System.String
Unique name of the remote service

Returns

Proxy object

Disconnect

Disconnects from the server. The server is actively notified about disconnection.

HasSession

Gets whether this CoreRemoting client instance has a session or not.

InvocationTimeout

Gets or sets the invocation timeout in milliseconds.

IsConnected

Gets whether the connection to the server is established or not.

MessageEncryption

Gets or sets whether messages should be encrypted or not.

PublicKey

Gets the public key of this CoreRemoting client instance.

ShutdownProxy(serviceProxy)

Shuts a specified service proxy down and frees resources.

Name Description
serviceProxy System.Object

IRemotingServer

Interface of a CoreRemoting server.

AfterCall

Event: Fires after an RPC call is invoked.

Authenticate(credentials, authenticatedIdentity)

Authenticates the specified credentials and returns whether the authentication was successful or not.

Name Description
credentials CoreRemoting.Authentication.Credential[]
Credentials to be used for authentication
authenticatedIdentity CoreRemoting.Authentication.RemotingIdentity@
Authenticated identity (null when authentication fails)

Returns

True when authentication was successful, otherwise false

BeforeCall

Event: Fires before an RPC call is invoked.

Config

Gets the configuration settings.

Error

Event: Fires if an error occurs.

MessageEncryptionManager

Gets the component for encryption and decryption of messages.

MethodCallMessageBuilder

Gets the component for easy building of method call messages.

Serializer

Gets the configured serializer.

ServiceRegistry

Gets the dependency injection container that is used a service registry.

SessionRepository

Gets the session repository to perform session management tasks.

Start

Starts listening for client requests.

Stop

Stops listening for client requests and close all open client connections.

UniqueServerInstanceName

Gets the unique name of this server instance.

IServiceProxy

Interface to be implemented by service proxy classes.

Shutdown

Shuts the proxy object down. This is called from proxy objects finalizer because the proxy mimics its proxied interface.

ISessionRepository

Interface to be implemented by CoreRemoting session repository classes.

CreateSession(clientPublicKey, server, rawMessageTransport)

Creates a new session.

Name Description
clientPublicKey System.Byte[]
Client's public key
server CoreRemoting.IRemotingServer
Server instance
rawMessageTransport CoreRemoting.Channels.IRawMessageTransport
Component that does the raw message transport

Returns

The newly created session

GetSession(sessionId)

Gets a specified session by its ID.

Name Description
sessionId System.Guid
Session ID

Returns

The session correlating to the specified session ID

KeySize

Gets the key size for asymmetric encryption. Should be 3072 or better in 2021 ;)

RemoveSession(sessionId)

Removes a specified session by its ID.

Name Description
sessionId System.Guid
Session ID

Sessions

Gets a list of all sessions.

MicosoftDependencyInjectionExtensionMethods

Provides extension methods for adding CoreRemoting as service to Microsoft dependency injection container.

AddCoreRemotingClient(services, config, remoteServiceInterfaceTypes)

Adds a CoreRemoting client as singleton to the service collection of a Microsoft dependency injection container.

Name Description
services Microsoft.Extensions.DependencyInjection.IServiceCollection
Service collection to which the client should be added
config CoreRemoting.ClientConfig
Configuration settings for the CoreRemoting client
remoteServiceInterfaceTypes System.Type[]
Array of remote service interface types for which proxy objects are to be added

AddCoreRemotingServer(services, config)

Adds a CoreRemoting server as singleton to the service collection of a Microsoft dependency injection container.

Name Description
services Microsoft.Extensions.DependencyInjection.IServiceCollection
Service collection to which the server should be added
config CoreRemoting.ServerConfig
Configuration settings for the CoreRemoting server

AddCoreRemotingServer(services, networkPort)

Adds a CoreRemoting server with default config but a specified network port as singleton to the service collection of a Microsoft dependency injection container.

Name Description
services Microsoft.Extensions.DependencyInjection.IServiceCollection
Service collection to which the server should be added
networkPort System.Int32
Network port on which the server should be listening for client requests

OneWayAttribute

Marks an method as one way method. This means that CoreRemoting client will not wait for result and CoreRemoting server will not send any result message (even in case of an error). One way methods are treated a fire-and-forget.

ClientDelegateInfo

Pairs a client delegate with a service proxy instance.

Constructor(clientDelegate, serviceProxy)

Creates a new instance of the ClientDelegateInfo class.

Name Description
clientDelegate System.Delegate
Client delegate
serviceProxy System.Object
Proxy object of the remote service, which invokes the client delegate as callback

ClientDelegate

Gets the client delegate.

ServiceProxy

Gets the service proxy.

ClientDelegateRegistry

Registry for client delegates paired with service proxies.

Constructor

Creates a new instance of the ClientDelegateRegistry class.

Clear

Clear the entire client delegate registry.

FindDelegate(delegate)

Finds a specified registered client delegate and returns its unique handler key.

Name Description
delegate System.Delegate
Client delegate

Returns

Unique handler key

GetDelegateByHandlerKey(handlerKey)

Gets a registered client delegate by its handler key.

Name Description
handlerKey System.Guid
Unique handler key

Returns

Client delegate

RegisterClientDelegate(clientDelegate, serviceProxy)

Registers a client delegate as callback target for remote delegate invocation.

Name Description
clientDelegate System.Delegate
Client delegate
serviceProxy System.Object
Service proxy of the remote service

Returns

Unique handler key

System.ArgumentNullException: Thrown an argument is null

System.ApplicationException: Thrown, if a race condition occurs while adding the client delegate to the registry

UnregisterClientDelegate(clientDelegate)

Unregister a specified client delegate.

Name Description
clientDelegate System.Delegate
Client delegate

UnregisterClientDelegate(handlerKey)

Unregisters a specified client delegate by its handler key.

Name Description
handlerKey System.Guid
Unique handler key

UnregisterClientDelegatesOfServiceProxy(serviceProxy)

Unregisters all client delegates that are paired withe a specified service proxy.

Name Description
serviceProxy System.Object
Service proxy

DelegateProxy

Proxy for intercepting calls on a specified delegate type.

Constructor(delegateType, callInterceptionHandler)

Creates a new instance of the DelegateProxy class.

Name Description
delegateType System.Type
Delegate type to be proxied
callInterceptionHandler System.Func{System.Object[],System.Object}
Function to be called when intercepting calls on the delegate

CreateProxiedDelegate(delegateType, interceptMethod, interceptor)

Creates a delegate for intercepting calls on a specified delegate type.

Name Description
delegateType System.Type
The delegate type to proxy
interceptMethod System.Reflection.MethodInfo
Method to call when intercepting calls on the proxied delegate
interceptor System.Object
Object on which the intercept method is called

Returns

Proxied delegate

System.ArgumentNullException: Thrown if any argument is null

System.NotSupportedException: Thrown if delegate type has no 'Invoke' method

System.ArgumentException: Thrown if argument 'delegateType' is not a delegate

Dispose

Frees managed resources.

Intercept(args)

Method called by delegate proxy, when the proxies delegate is called.

Name Description
args System.Object[]
Arguments passed to the proxied delegate by caller

Returns

Return value provided by call interception handler

ProxiedDelegate

Gets the proxied delegate.

DelegateProxyFactory

Factory component to create delegate proxy instances.

Create(delegateType, callInterceptionHandler)

Creates a proxy for the specified delegate type.

Name Description
delegateType System.Type
Delegate type to be proxied
callInterceptionHandler System.Func{System.Object[],System.Object}
Function to be called when intercepting calls on the delegate

Returns

Delegate proxy

IDelegateProxy

Interface to be implemented by delegate proxies.

ProxiedDelegate

Gets the proxied delegate.

IDelegateProxyFactory

Interface to be implemented by delegate proxy factory components.

Create(delegateType, callInterceptionHandler)

Creates a proxy for the specified delegate type.

Name Description
delegateType System.Type
Delegate type to be proxied
callInterceptionHandler System.Func{System.Object[],System.Object}
Function to be called when intercepting calls on the delegate

Returns

Delegate proxy

RemoteDelegateInfo

Describes a remote delegate.

Constructor(handlerKey, delegateTypeName)

Creates a new instance of the RemoteDelegateInfo class.

Name Description
handlerKey System.Guid
Unique handler key of the client delegate
delegateTypeName System.String
Type name of the client delegate

DelegateTypeName

Gets the type name of the client delegate.

HandlerKey

Gets the handler key of the client delegate.

RemoteDelegateInvocationEventAggregator

Event aggregator to fire event if remote delegate is invoked.

InvokeRemoteDelegate(delegateType, handlerKey, remoteDelegateArguments)

To be called on server side to invoke a remote delegate, which will callback the correlating client delegate.

Name Description
delegateType System.Type
Delegate type
handlerKey System.Guid
Unique handle key of the client delegate
remoteDelegateArguments System.Object[]
Arguments of remote delegate invocation

Returns

Return value provided by the client side callback

RemoteDelegateInvocationNeeded

Event: Fired on client side, when a remote delegate is invoked.

RemoteDelegateInvocationNeededEventHandler

Creates a new instance of the RemoteDelegateInvocationEventAggregator class.

Name Description
delgateType Unknown type
Delegate type
uniqueCallKey Unknown type
Unique key to correlate the RPC call
handlerKey System.Guid
Unique handler key to correlate the client delegate to be called, when remote delegate is invoked
remoteDelegateArguments System.Object[]
Arguments of remote delegate invocation

RemoteInvocationException

Exception to be thrown, if remote method invocation has been failed.

Constructor(info, context)

Without this constructor, deserialization will fail.

Name Description
info System.Runtime.Serialization.SerializationInfo
Serialization info
context System.Runtime.Serialization.StreamingContext
Streaming context

Constructor(message, innerEx)

Creates a new instance of the RemoteInvocationException class.

Name Description
message System.String
Error message
innerEx System.Exception
Optional inner exception

RemotingClient

Provides remoting functionality on client side.

Constructor(config)

Creates a new instance of the RemotingClient class.

Name Description
config CoreRemoting.ClientConfig
Configuration settings

ActiveClientInstances

Gets a list of active client instances.

Authenticate

Authenticates this CoreRemoting client instance with the specified credentials.

System.Security.SecurityException: Thrown, if authentication failed or timed out

ClientDelegateRegistry

Gets the local client delegate registry.

Config

Gets the configuration settings used by the CoreRemoting client instance.

Connect

Connects this CoreRemoting client instance to the configured CoreRemoting server.

RemotingException: Thrown, if no channel is configured.

Channels.NetworkException: Thrown, if handshake with server failed.

CreateProxy(serviceInterfaceType, serviceName)

Creates a proxy object to provide access to a remote service.

Name Description
serviceInterfaceType System.Type
Interface type of the remote service
serviceName System.String
Unique name of the remote service

Returns

Proxy object

CreateProxy``1(serviceName)

Creates a proxy object to provide access to a remote service.

Type Parameters

  • T - Type of the shared interface of the remote service
Name Description
serviceName System.String
Unique name of the remote service

Returns

Proxy object

DefaultRemotingClient

Gets or sets the default CoreRemoting client.

Disconnect

Disconnects from the server. The server is actively notified about disconnection.

Dispose

Frees managed resources.

GetActiveClientInstance(uniqueClientInstanceName)

Gets a active client instance by its unqiue instance name.

Name Description
uniqueClientInstanceName System.String
Unique client instance name

Returns

Active CoreRemoting client

HasSession

Gets whether this CoreRemoting client instance has a session or not.

Identity

Gets the authenticated identity. May be null if authentication failed or if authentication is not configured.

InvocationTimeout

Gets or sets the invocation timeout in milliseconds.

InvokeRemoteMethod(methodCallMessage, oneWay)

Calls a method on a remote service synchronously.

Name Description
methodCallMessage CoreRemoting.RpcMessaging.MethodCallMessage
Details of the remote method to be invoked
oneWay System.Boolean
Invoke method without waiting for or processing result.

Returns

Results of the remote method invocation

IsConnected

Gets whether the connection to the server is established or not.

KeepSessionAliveTimerOnElapsed(sender, e)

Event procedure: Called when the keep session alive timer elapses.

Name Description
sender System.Object
Event sender
e System.Timers.ElapsedEventArgs
Event arguments

MessageEncryption

Gets or sets whether messages should be encrypted or not.

MessageEncryptionManager

Gets a utility object to provide encryption of remoting messages.

MethodCallMessageBuilder

Gets a utility object for building remoting messages.

OnMessage(rawMessage)

Called when a message is received from server.

Name Description
rawMessage System.Byte[]
Raw message data

ProcessAuthenticationResponseMessage(message)

Processes a authentication response message from server.

Name Description
message CoreRemoting.RpcMessaging.WireMessage
Deserialized WireMessage that contains a AuthenticationResponseMessage

ProcessCompleteHandshakeMessage(message)

Processes a complete handshake message from server.

Name Description
message CoreRemoting.RpcMessaging.WireMessage
Deserialized WireMessage that contains a plain or encrypted Session ID

ProcessRemoteDelegateInvocationMessage(message)

Processes a remote delegate invocation message from server.

Name Description
message CoreRemoting.RpcMessaging.WireMessage
Deserialized WireMessage that contains a RemoteDelegateInvocationMessage

ProcessRpcResultMessage(message)

Processes a RPC result message from server.

Name Description
message CoreRemoting.RpcMessaging.WireMessage
Deserialized WireMessage that contains a MethodCallResultMessage or a RemoteInvocationException

System.Collections.Generic.KeyNotFoundException: Thrown, when the received result is of a unknown call

PublicKey

Gets the public key of this CoreRemoting client instance.

Serializer

Gets the configured serializer.

ShutdownProxy(serviceProxy)

Shuts a specified service proxy down and frees resources.

Name Description
serviceProxy System.Object
Proxy object that should be shut down

StartKeepSessionAliveTimer

Starts the keep session alive timer.

RemotingException

Exception to be thrown, if a remoting operation has been failed.

Constructor(info, context)

Without this constructor, deserialization will fail.

Name Description
info System.Runtime.Serialization.SerializationInfo
Serialization info
context System.Runtime.Serialization.StreamingContext
Streaming context

Constructor(message, innerEx)

Creates a new instance of the RemotingException class.

Name Description
message System.String
Error message
innerEx System.Exception
Optional inner exception

RemotingServer

CoreRemoting server implementation.

Constructor(config)

Creates a new instance of the RemotingServer class.

Name Description
config CoreRemoting.ServerConfig
Configuration settings to be used (Default configuration is used, if left null)

ActiveServerInstances

Gets a list of active server instances.

AfterCall

Event: Fires after an RPC call is invoked.

Authenticate(credentials, authenticatedIdentity)

Authenticates the specified credentials and returns whether the authentication was successful or not.

Name Description
credentials CoreRemoting.Authentication.Credential[]
Credentials to be used for authentication
authenticatedIdentity CoreRemoting.Authentication.RemotingIdentity@
Authenticated identity (null when authentication fails)

Returns

True when authentication was successful, otherwise false

BeforeCall

Event: Fires before an RPC call is invoked.

Channel

Gets the channel used to do the raw network transport.

Config

Gets the configuration settings.

DefaultRemotingServer

Gets or sets the default CoreRemoting server.

Dispose

Frees managed resources.

Error

Event: Fires if an error occurs.

GetActiveServerInstance(uniqueServerInstanceName)

Gets a active server instance by its unqiue instance name.

Name Description
uniqueServerInstanceName System.String
Unique server instance name

Returns

Active CoreRemoting server

MessageEncryptionManager

Gets the component for encryption and decryption of messages.

MethodCallMessageBuilder

Gets the component for easy building of method call messages.

OnAfterCall(serverRpcContext)

Fires the OnAfterCall event.

Name Description
serverRpcContext CoreRemoting.ServerRpcContext
Server side RPC call context

OnBeforeCall(serverRpcContext)

Fires the OnBeforeCall event.

Name Description
serverRpcContext CoreRemoting.ServerRpcContext
Server side RPC call context

OnError(ex)

Fires the OnError event.

Name Description
ex System.Exception
Exception that describes the occurred error

Serializer

Gets the configured serializer.

ServiceRegistry

Gets the dependency injection container that is used a service registry.

SessionRepository

Gets the session repository to perform session management tasks.

Start

Starts listening for client requests.

Stop

Stops listening for client requests and close all open client connections.

UniqueServerInstanceName

Gets the unique name of this server instance.

RemotingSession

Implements a CoreRemoting session, which controls the CoreRemoting protocol on application layer at server side. This is doing the RPC magic of CoreRemoting at server side.

Constructor(keySize, clientPublicKey, server, rawMessageTransport)

Creates a new instance of the RemotingSession class.

Name Description
keySize System.Int32
Key size of the RSA keys for asymmetric encryption
clientPublicKey System.Byte[]
Public key of this session's client
server CoreRemoting.IRemotingServer
Server instance, that hosts this session
rawMessageTransport CoreRemoting.Channels.IRawMessageTransport
Component, that does the raw message transport (send and receive)

BeforeDispose

Event: Fired before the session is disposed to do some clean up.

CreatedOn

Gets the timestamp when this session was created.

Dispose

Frees managed resources.

Identity

Gets the authenticated identity of this session.

IsAuthenticated

Gets whether authentication was successful.

KeyPair

Gets the server side RSA key pair of this session.

LastActivityTimestamp

Gets the timestamp of the last activity of this session.

MapDelegateArguments(parameterValues)

Maps delegate arguments into delegate proxies.

Name Description
parameterValues System.Object[]
Array of parameter values

Returns

Array of parameter values where delegate values are mapped into delegate proxies

System.ArgumentNullException: Thrown if no session is provided

MessageEncryption

Gets whether message encryption is enabled for this session.

Messaging

Gets component that does the raw message transport (send and receive).

OnErrorOccured(errorMessage, ex)

Event procedure: Called if the ErrorOccured event is fired on the raw message transport component.

Name Description
errorMessage System.String
Error message
ex System.Exception
Optional exception from the transport infrastructure

OnReceiveMessage(rawMessage)

Event procedure: Called when the ReceiveMessage event is fired on the raw message transport component.

Name Description
rawMessage System.Byte[]
Raw message data that has been received

ProcessAuthenticationRequestMessage(request)

Processes a wire message that contains a authentication request message, which is sent from a client to request authentication of a set of credentials.

Name Description
request CoreRemoting.RpcMessaging.WireMessage
Wire message from client

ProcessGoodbyeMessage(request)

Processes a wire message that contains a goodbye message, which is sent from a client to close the session.

Name Description
request CoreRemoting.RpcMessaging.WireMessage
Wire message from client

ProcessRpcMessage(request)

Calls a method on a server side service.

Name Description
request CoreRemoting.RpcMessaging.WireMessage
RPC message from client

Returns

Task which provides the serialized response message containing the method result asynchronously

System.MissingMethodException: Thrown if specified method in request doesn't exist

RemoteDelegateInvocation

Gets the remote delegate invocation event aggregator.

SessionId

Gets this session's unique session ID.

GoodbyeMessage

Describes a good bye message, which must be send from client to server in order to end a session.

SessionId

Gets or sets the session ID of the session that should be ended.

IMessageEncryptionManager

Interface of message encryption manager component.

CreateWireMessage(messageType, serializedMessage, serializer, keyPair, sharedSecret, error, uniqueCallKey)

Creates a new wire message.

Name Description
messageType System.String
Message type name
serializedMessage System.Byte[]
Serialized message
serializer CoreRemoting.Serialization.ISerializerAdapter
Serializer used to serialize the signed content
keyPair CoreRemoting.Encryption.RsaKeyPair
RSA key pair to be used for creating a RSA signature for the message data
sharedSecret System.Byte[]
Shared secret (wire message will be not encrypted, if null)
error System.Boolean
Species whether the wire message is in error state
uniqueCallKey System.Byte[]
Unique key to correlate RPC call

Returns

The created wire message

System.ArgumentException: Thrown if the message type is left empty.

GetDecryptedMessageData(message, serializer, sharedSecret, sendersPublicKeyBlob, sendersPublicKeySize)

Gets decrypted data from a wire message.

Name Description
message CoreRemoting.RpcMessaging.WireMessage
Wire message
serializer CoreRemoting.Serialization.ISerializerAdapter
Serializer used to deserialized the signed content
sharedSecret System.Byte[]
Shared secret (null, if the wire message is not encrypted)
sendersPublicKeyBlob System.Byte[]
Public key of the sender used for RSA signature verification
sendersPublicKeySize System.Int32
Sender's public key size

Returns

Decrypted raw data

IMethodCallMessageBuilder

Interface for message builder component.

BuildMethodCallMessage(serializer, remoteServiceName, targetMethod, args)

Builds a new method call message.

Name Description
serializer CoreRemoting.Serialization.ISerializerAdapter
Serializer adapter used to serialize argument values
remoteServiceName System.String
Unique name of the remote service that should be called
targetMethod System.Reflection.MethodInfo
Target method information
args System.Object[]
Array of arguments, which should passed a parameters

Returns

The created method call message

BuildMethodCallResultMessage(serializer, uniqueCallKey, method, args, returnValue)

Builds a new method call result message.

Name Description
serializer CoreRemoting.Serialization.ISerializerAdapter
Serializer adapter used to serialize argument values
uniqueCallKey System.Guid
Unique key to correlate RPC call
method System.Reflection.MethodInfo
Method information of the called method
args System.Object[]
Arguments
returnValue System.Object
Returned return value

Returns

Method call result message

BuildMethodParameterInfos(serializer, targetMethod, args)

Builds method call parameter messages from arguments for a specified target method.

Name Description
serializer CoreRemoting.Serialization.ISerializerAdapter
Serializer adapter used to serialize argument values
targetMethod System.Reflection.MethodInfo
Target method information
args System.Object[]
Array of arguments, which should passed a parameters

Returns

Enumerable of method call parameter messages

MessageEncryptionManager

Provides tools for wire message creation an encryption.

CreateWireMessage(messageType, serializedMessage, serializer, keyPair, sharedSecret, error, uniqueCallKey)

Creates a new wire message.

Name Description
messageType System.String
Message type name
serializedMessage System.Byte[]
Serialized message
serializer CoreRemoting.Serialization.ISerializerAdapter
Serializer used to serialize the signed content
keyPair CoreRemoting.Encryption.RsaKeyPair
RSA key pair to be used for creating a RSA signature for the message data
sharedSecret System.Byte[]
Shared secret (wire message will be not encrypted, if null)
error System.Boolean
Species whether the wire message is in error state
uniqueCallKey System.Byte[]
Unique key to correlate RPC call

Returns

The created wire message

System.ArgumentException: Thrown if the message type is left empty.

GetDecryptedMessageData(message, serializer, sharedSecret, sendersPublicKeyBlob, sendersPublicKeySize)

Gets decrypted data from a wire message.

Name Description
message CoreRemoting.RpcMessaging.WireMessage
Wire message
serializer CoreRemoting.Serialization.ISerializerAdapter
Serializer used to deserialized the signed content
sharedSecret System.Byte[]
Shared secret (null, if the wire message is not encrypted)
sendersPublicKeyBlob System.Byte[]
Public key of the sender used for RSA signature verification
sendersPublicKeySize System.Int32
Sender's public key size

Returns

Decrypted raw data

MessagingExtensionMethods

Extension methods for messaging.

ParseNameValuePairTextMessage(message, entrySeperator, pairSeperator)

Parses a text message that contains name value pairs.

Name Description
message System.String
Text message
entrySeperator System.Char
Char used to separate entries
pairSeperator System.Char
Char used to separate pairs

Returns

Dictionary with parsed name value pairs

UnwrapParametersFromDeserializedMethodCallMessage(callMessage, parameterValues, parameterTypes)

Unwraps parameter values and parameter types from a deserialized MethodCallMessage.

Name Description
callMessage CoreRemoting.RpcMessaging.MethodCallMessage
MethodCallMessage object
parameterValues System.Object[]@
Out: Unwrapped parameter values
parameterTypes System.Type[]@
Out: Unwrapped parameter types

MethodCallMessage

Describes a method call as serializable message.

CallContextSnapshot

Gets or sets an array of call context entries that should be send to the server.

MethodName

Gets or sets the name of the remote method that should be called.

Parameters

Gets or sets an array of messages that describes the parameters that should be passed to the remote method.

ServiceName

Gets or sets the name of the remote service that should be called.

MethodCallMessageBuilder

Method call message builder component.

BuildMethodCallMessage(serializer, remoteServiceName, targetMethod, args)

Builds a new method call message.

Name Description
serializer CoreRemoting.Serialization.ISerializerAdapter
Serializer adapter used to serialize argument values
remoteServiceName System.String
Unique name of the remote service that should be called
targetMethod System.Reflection.MethodInfo
Target method information
args System.Object[]
Array of arguments, which should passed a parameters

Returns

The created method call message

BuildMethodCallResultMessage(serializer, uniqueCallKey, method, args, returnValue)

Builds a new method call result message.

Name Description
serializer CoreRemoting.Serialization.ISerializerAdapter
Serializer adapter used to serialize argument values
uniqueCallKey System.Guid
Unique key to correlate RPC call
method System.Reflection.MethodInfo
Method information of the called method
args System.Object[]
Arguments
returnValue System.Object
Returned return value

Returns

Method call result message

BuildMethodParameterInfos(serializer, targetMethod, args)

Builds method call parameter messages from arguments for a specified target method.

Name Description
serializer CoreRemoting.Serialization.ISerializerAdapter
Serializer adapter used to serialize argument values
targetMethod System.Reflection.MethodInfo
Target method information
args System.Object[]
Array of arguments, which should passed a parameters

Returns

Enumerable of method call parameter messages

MethodCallOutParameterMessage

Serializable message that describes an out parameter.

IsOutValueNull

Gets or sets whether the out value is null.

OutValue

Gets or sets the out value of the parameter.

ParameterName

Gets or sets the name of the parameter.

MethodCallParameterMessage

Serializable message that describes a parameter of an remote method call.

IsOut

Gets or sets whether the parameter is an out parameter or not.

IsValueNull

Gets or sets whether the parameter is null or not.

ParameterName

Gets or sets the name of the parameter.

ParameterTypeName

Gets or sets the type name of the parameter.

Value

Gets or sets the parameter value.

MethodCallResultMessage

Serializable message that describes the result of a remote method call.

CallContextSnapshot

Gets or sets a snapshot of the call context that flows from server back to the client.

IsReturnValueNull

Gets or sets whether the return value is null or not.

OutParameters

Gets or sets an array of out parameters.

ReturnValue

Gets or sets the return value of the invoked method.

RemoteDelegateInvocationMessage

Serializable message that describes the invocation of a remote delegate.

DelegateArguments

Gets or sets an array of arguments that should be passed as parameters to the remote delegate.

HandlerKey

Gets or sets a unique handler key to identify the remote delegate.

UniqueCallKey

Gets or sets an unique key to correlate RPC calls.

WireMessage

Serializable message to transport RPC invocation details and their results over the wire.

Data

Gets or sets the raw data of the message content and its RSA signatures (only if message encryption is enabled).

Error

Gets or sets whether this message contains error data.

Iv

Gets or sets the initialization vector as byte array (only needed if message encryption is enabled).

MessageType

Gets or sets the type of the message.

UniqueCallKey

Gets or sets an unique key to correlate RPC calls.

BinaryFormatterExtensions

Extension methods for binary serialization.

DeserializeSafe(formatter, rawData)

Deserializes raw data back into an object.

Name Description
formatter System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
Binary formatter instance
rawData System.Byte[]
Raw data that should be deserialized

Returns

Deserialized object

Safe(formatter)

Makes the System.Runtime.Serialization.Formatters.Binary.BinaryFormatter safe.

Name Description
formatter System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
The System.Runtime.Serialization.Formatters.Binary.BinaryFormatter to guard.

Returns

The safe version of the System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.

SerializeByteArray(formatter, objectToSerialize)

Serializes the specified object into a byte array.

Name Description
formatter System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
Binary formatter instance
objectToSerialize System.Object
Object to serialize

Returns

Serialized data

BinarySerializerAdapter

Serializer adapter to allow binary serialization.

Constructor(config)

Creates a new instance of the BinarySerializerAdapter class.

Name Description
config CoreRemoting.Serialization.Binary.BinarySerializerConfig
Configuration settings

Deserialize(type, rawData)

Deserializes raw data back into an object graph.

Name Description
type System.Type
Object type
rawData System.Byte[]
Raw data that should be deserialized

Returns

Deserialized object graph

Deserialize``1(rawData)

Deserializes raw data back into an object graph.

Name Description
rawData System.Byte[]
Raw data that should be deserialized

Type Parameters

  • T - Object type

Returns

Deserialized object graph

EnvelopeNeededForParameterSerialization

Gets whether parameter values must be put in an envelope object for proper deserialization, or not.

GetFormatter

Gets a formatter instance. The instance is reused for further calls.

Returns

Binary formatter instance

Serialize(type, graph)

Serializes an object graph.

Name Description
type System.Type
Object type
graph System.Object
Object graph to be serialized

Returns

Serialized data

Serialize``1(graph)

Serializes an object graph.

Name Description
graph ``0
Object graph to be serialized

Type Parameters

  • T - Object type

Returns

Serialized data

BinarySerializerConfig

Describes binary serialization settings.

Constructor

Creates a new instance of the BinarySerializerConfig class.

FilterLevel

Gets or sets the type filter level for security reasons.

SerializeAssemblyVersions

Gets or sets whether assembly versions should be serialized or not.

TypeFormat

Gets or sets the style how types should be formatted.

CustomDelegateSerializationHolder

Custom replacement for the DelegateSerializationHolder featuring delegate validation.

Constructor(info, context)

Initializes a new instance of the CustomDelegateSerializationHolder class.

Name Description
info System.Runtime.Serialization.SerializationInfo
Serialization info.
context System.Runtime.Serialization.StreamingContext
Streaming context

GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)

GetRealObject(System.Runtime.Serialization.StreamingContext)

DataSetSurrogate

Deserialization surrogate for the DataSet class.

GetObjectData(System.Object,System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)

SetObjectData(System.Object,System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext,System.Runtime.Serialization.ISurrogateSelector)

DelegateValidator

Blacklist-based delegate validator.

Constructor(blacklistedNamespaces)

Initializes a new instance of the DelegateValidator class.

Name Description
blacklistedNamespaces System.String[]
Namespace blacklist.

Default

Gets or sets the default IDelegateValidator instance.

DefaultBlacklistedNamespaces

The default blacklist of the namespaces.

ValidateDelegate(del)

Validates the given delegates. Throws exceptions for methods defined in the blacklisted namespaces.

Name Description
del System.Delegate
The delegate to validate.

IDelegateValidator

Interface for validating the deserialized delegates.

ValidateDelegate(del)

Validates the given delegate. Throws exceptions for the unsafe delegates found in the invocation list.

Name Description
del System.Delegate
The delegate to validate.

ITypeNameValidator

Interface for validating type names before loading types for deserialization.

ValidateTypeName(assemblyName, typeName)

Validates the given type name before loading. Throws exceptions for the types not safe for deserialization.

Name Description
assemblyName System.String
The name of the assembly.
typeName System.String
The name of the type.

SafeSerializationBinder

Constructor(nextBinder)

Initializes a new instance of the SafeSerializationBinder class.

Name Description
nextBinder System.Runtime.Serialization.SerializationBinder
Next serialization binder in chain.

BindToType(System.String,System.String)

CORE_LIBRARY_ASSEMBLY_NAME

Core library assembly name.

DELEGATE_SERIALIZATION_HOLDER_TYPE_NAME

System.DelegateSerializationHolder type name.

SafeSurrogateSelector

Safe surrogate selector provides surrogates for DataSet and WindowsIdentity classes.

Constructor(nextSelector)

Initializes a new instance of the SafeSurrogateSelector class.

Name Description
nextSelector System.Runtime.Serialization.ISurrogateSelector
Next System.Runtime.Serialization.ISurrogateSelector, optional.

ChainSelector(System.Runtime.Serialization.ISurrogateSelector)

GetNextSelector

GetSurrogate(System.Type,System.Runtime.Serialization.StreamingContext,System.Runtime.Serialization.ISurrogateSelector@)

TypeFullName

Represents the name of a .NET type.

Remarks

AssemblyName doesn't contain Version part.

AssemblyName

Gets or sets the name of the assembly.

Equals(CoreRemoting.Serialization.Binary.TypeFullName)

GetHashCode

Parse(typeName)

Parses the given type name and returns the TypeFullName instance.

Name Description
typeName System.String
Assembly-qualified type name.

Returns

A parsed TypeFullName instance.

TypeName

Gets or sets the name of the type.

TypeNameValidator

Validates the type names before loading them for deserialization.

Constructor(blacklistedTypes)

Initializes a new instance of the TypeNameValidator class.

Name Description
blacklistedTypes System.String[]
The list of the blacklisted types.

Default

Gets or sets the default ITypeNameValidator instance.

DefaultBlacklistedTypes

The default blacklist of the types.

ValidateTypeName(System.String,System.String)

UnsafeDeserializationException

Exception to be thrown when possible deserialization vulnerability is detected.

Constructor

Initializes a new instance of the UnsafeDeserializationException class.

Constructor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)

Constructor(message)

Initializes a new instance of the UnsafeDeserializationException class.

Name Description
message System.String
Exception message.

GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)

WindowsIdentitySurrogate

Deserialization surrogate for the WindowsIdentity class.

GetObjectData(System.Object,System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)

SetObjectData(System.Object,System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext,System.Runtime.Serialization.ISurrogateSelector)

BsonSerializerAdapter

Serializer adapter to allow BSON serialization.

Constructor(config)

Creates a new instance of the BsonSerializerAdapter class.

Name Description
config CoreRemoting.Serialization.Bson.BsonSerializerConfig
Optional configuration settings

Deserialize(type, rawData)

Deserializes raw data back into an object graph.

Name Description
type System.Type
Object type
rawData System.Byte[]
Raw data that should be deserialized

Returns

Deserialized object graph

Deserialize``1(rawData)

Deserializes raw data back into an object graph.

Name Description
rawData System.Byte[]
Raw data that should be deserialized

Type Parameters

  • T - Object type

Returns

Deserialized object graph

EnvelopeNeededForParameterSerialization

Gets whether parameter values must be put in an envelope object for proper deserialization, or not.

Serialize(type, graph)

Serializes an object graph.

Name Description
type System.Type
Object type
graph System.Object
Object graph to be serialized

Returns

Serialized data

Serialize``1(graph)

Serializes an object graph.

Name Description
graph ``0
Object graph to be serialized

Type Parameters

  • T - Object type

Returns

Serialized data

BsonSerializerConfig

Describes BSON serializer settings.

Constructor(jsonConverters)

Creates a new instance of the BsonSerializerConfig class.

Name Description
jsonConverters System.Collections.Generic.IEnumerable{Newtonsoft.Json.JsonConverter}
Optional list of JSON converters

JsonConverters

Gets a list of JSON converters to customize BSON serialization.

Envelope

Wraps values and preserve their types for serialization.

Constructor

Creates a new instance of the Envelope class.

Constructor(value)

Creates a new instance of the Envelope class.

Name Description
value System.Object
Value to wrap

Type

Gets the type of the wrapped value.

Value

Gets the wrapped value.

ISerializerAdapter

Interface that serializer adapter components must implement.

Deserialize(type, rawData)

Deserializes raw data back into an object graph.

Name Description
type System.Type
Object type
rawData System.Byte[]
Raw data that should be deserialized

Returns

Deserialized object graph

Deserialize``1(rawData)

Deserializes raw data back into an object graph.

Name Description
rawData System.Byte[]
Raw data that should be deserialized

Type Parameters

  • T - Object type

Returns

Deserialized object graph

EnvelopeNeededForParameterSerialization

Gets whether parameter values must be put in an envelope object for proper deserialization, or not.

Serialize(type, graph)

Serializes an object graph.

Name Description
type System.Type
Object type
graph System.Object
Object graph to be serialized

Returns

Serialized data

Serialize``1(graph)

Serializes an object graph.

Name Description
graph ``0
Object graph to be serialized

Type Parameters

  • T - Object type

Returns

Serialized data

ServerConfig

Describes the configuration settings of a CoreRemoting service instance.

Constructor

Creates new new instance of the ServerConfig class.

AuthenticationProvider

Gets or sets the authentication provider that should be used to handle authentication requests.

AuthenticationRequired

Gets or sets whether authentication is required in order to establish a new session.

Channel

Gets or sets the server channel to be used for transport of messages over the wire (WebsocketServerChannel is used, if set to null).

DependencyInjectionContainer

Gets or sets the dependency injection container to be used for service registration. Castle Windsor Container is used, if set to null.

HostName

Gets or sets the host name.

InactiveSessionSweepInterval

Gets or sets the sweep interval for inactive sessions in seconds (No session sweeping if set to 0).

IsDefault

Gets or set whether this is the default server.

KeySize

Gets or sets the key size for asymmetric encryption (only relevant, if message encryption is enabled).

MaximumSessionInactivityTime

Gets or sets the maximum session inactivity time in minutes.

MessageEncryption

Gets or sets whether messages should be encrypted or not.

NetworkPort

Gets or sets the network port on which the server should be listening for requests.

RegisterServicesAction

Gets or sets an optional action which should be called on server startup to register services.

Serializer

Gets or sets the serializer to be used (BSON serializer is used, if set to null).

SessionRepository

Gets or sets the session repository to be used to manage sessions.

UniqueServerInstanceName

Gets or sets the unique name of this server instance.

ServerRpcContext

Describes the server side context of a RPC call.

Exception

Gets or sets the last exception that is occurred.

MethodCallMessage

Gets the message that describes the remote method call.

MethodCallResultMessage

Gets or sets the message that contains the results of a remote method call.

ServiceInstance

Gets or sets the instance of the service, on which the method is called.

Session

Gets or sets the CoreRemoting session that is used to handle the RPC.

UniqueCallKey

Gets or sets the unique key of RPC call.

ServiceProxy_T

Implements a proxy of a remote service that is hosted on a CoreRemoting server.. This is doing the RPC magic of CoreRemoting at client side.

Type Parameters

  • TServiceInterface - Type of the remote service's interface (also known as contract of the service)

Constructor(client, serviceName)

Creates a new instance of the ServiceProxy class.

Name Description
client CoreRemoting.RemotingClient
CoreRemoting client to be used for client/server communication
serviceName System.String
Unique name of the remote service

Castle#DynamicProxy#IInterceptor#Intercept(invocation)

Intercepts a call of a member on the proxy object.

Name Description
invocation Castle.DynamicProxy.IInvocation
Intercepted invocation details

RemotingException: Thrown if a remoting operation has been failed

System.NotSupportedException: Thrown if a member of a type marked as OneWay is intercepted, that has another return type than void

RemoteInvocationException: Thrown if an exception occurred when the remote method was invoked

CoreRemoting#IServiceProxy#Shutdown

Shutdown service proxy and free resources.

Finalize

Finalizer.

Interface

Gets or sets the interface type of the proxied remote service.

MapDelegateArguments(invocation)

Maps delegate arguments into serializable RemoteDelegateInfo objects.

Name Description
invocation Castle.DynamicProxy.IInvocation
Invocation details

Returns

Array of arguments (includes mapped ones)

System.NotSupportedException:

SessionRepository

Default in-memory session repository.

Constructor(keySize, inactiveSessionSweepInterval, maximumSessionInactivityTime)

Creates a new instance of the SessionRepository class.

Name Description
keySize System.Int32
Key size for asymmetric encryption. Should be 3072 or better in 2021 (Please use steps of 1024).
inactiveSessionSweepInterval System.Int32
Sweep interval for inactive sessions in seconds (No session sweeping, if set to 0)
maximumSessionInactivityTime System.Int32
Maximum session inactivity time in minutes

CreateSession(clientPublicKey, server, rawMessageTransport)

Creates a new session.

Name Description
clientPublicKey System.Byte[]
Client's public key
server CoreRemoting.IRemotingServer
Server instance
rawMessageTransport CoreRemoting.Channels.IRawMessageTransport
Component that does the raw message transport

Returns

The newly created session

Dispose

Frees managed resources.

GetSession(sessionId)

Gets a specified session by its ID.

Name Description
sessionId System.Guid
Session ID

Returns

The session correlating to the specified session ID

System.Collections.Generic.KeyNotFoundException: Thrown, if no session with the specified session ID is found

InactiveSessionSweepTimerOnElapsed(sender, e)

Event procedure: Called when the inactive session sweep timer elapses.

Name Description
sender System.Object
Event sender
e System.Timers.ElapsedEventArgs
Event arguments

KeySize

Gets the key size for asymmetric encryption. Should be 3072 or better in 2021 ;)

RemoveSession(sessionId)

Removes a specified session by its ID.

Name Description
sessionId System.Guid
Session ID

Sessions

Gets a list of all sessions.

StartInactiveSessionSweepTimer(inactiveSessionSweepInterval)

Starts the inactive session sweep timer.

Name Description
inactiveSessionSweepInterval System.Int32
Sweep interval for inactive sessions in seconds
Clone this wiki locally