Prajna


NetworkConnections

A set of NetworkCommandQueue that are established via the Connect call Each connect is reference counted, so that the connect will shutdown when the reference reaches 0

Constructors

ConstructorDescription
new()
Signature: unit -> NetworkConnections

Instance members

Instance memberDescription
AddConnect(addr, port)
Signature: (addr:IPAddress * port:int) -> NetworkCommandQueue

Given a IP address and port, create socket and connect, then create a NetworkCommandQueue and add it to collection The IP address to connect to The port to connect to The NetworkCommandQueue created from the socket

AddConnect(machineName, port)
Signature: (machineName:string * port:int) -> NetworkCommandQueue

Given a machine name and port, create socket and connect, then create a NetworkCommandQueue and add it to collection The machine to connect to The port to connect to The NetworkCommandQueue created from the socket

AddConnect(socket)
Signature: socket:Socket -> NetworkCommandQueue

Given a socket, create a NetworkCommandQueue and add it to collection The socket from which to create NetworkCommandQueue The NetworkCommandQueue created from the socket

AddLoopbackConnect(...)
Signature: (port:int * requireAuth:bool option * guid:Guid option * rsaParam:(byte [] * byte []) option * pwd:string option) -> NetworkCommandQueue

Add a loopback connection to specified port, with optional security parameters specified The port for loopback connection to connect to Optional - specifies if authentication required Optional - own GUID for loopback Optional - byte array for RSA information blob Optional - password for decrypting RSA information blob The NetworkCommandQueue for the channel being added

AddToCollection(newChannel)
Signature: newChannel:NetworkCommandQueue -> unit

Add a channel to collection - this is only needed in case a class inherits NetworkCommandQueue The channel to add to collection The channel in collection

ChannelsCollection
Signature: ConcurrentDictionary<int64,NetworkCommandQueue>

Get the current channel collection

GetAllChannels()
Signature: unit -> seq<NetworkCommandQueue>

Get all channels in the collection as a sequence

GetAuthParam()
Signature: unit -> bool * Guid * (byte [] * byte []) * string

Get the authentication parameters The authentication parameters as (RequireAuth, MyGUID, PrivateKey, KeyFilePassword) RequireAuth - whether authentication is currently required MyGUID - my own GUID PrivateKey - my own private key KeyFilePassword - password for the key file

Initialize()
Signature: unit -> unit

Initialize the object

InitializeAuthentication(...)
Signature: (keyInfo:byte [] * keyfilepwd:string) -> unit

Initialize authentication / security information from key information obtained in buffer The password used to decrypt the encrypted private key information

InitializeAuthentication(...)
Signature: (pwd:string * keyfile:string * keyfilePwd:string) -> unit

Initialize authentication / security information from keyfile (encrypted with keyfilePwd) while also allowing for shared secret (password) to be used for authentication. A shared secret password which can be used for authentication The base key file, other guids are obtained from other files in same directory Own key information is stored in a file with the name "keyfilemykey.txt" which has following format - 16 byte GUID - Length of authentication key blob (4 bytes) - A private key blob which has been encrypted and contains information to initialize RSA - Length of encryption key blob (4 bytes) - A private key blob which has been encrypted and contains information to initialize RSA Other key information is stored in files "keyfile.txt" where is guid of connection and has following format - 16 byte GUID - Key blob (unencrypted) with length containing authentication public key - Key blob (unencrypted) with length containing encryption public key The password used to decrypt the encrypted private key information

InitializeAuthentication(pwd)
Signature: pwd:string -> unit

Initialize authentication using a shared secret password

LookforConnect(endPoint)
Signature: endPoint:IPEndPoint -> NetworkCommandQueue

Search for connection in collection by endpoint The endpoint to search for The channel if found, else null

LookforConnectBySignature(signature)
Signature: signature:int64 -> NetworkCommandQueue

Search for connection in collection by signature The signature of the endpoint to search for The channel if found, else null

RemoveConnect(channel)
Signature: channel:NetworkCommandQueue -> unit

Remove a channel from collection The channel to remove

TotalCmdRecvSize
Signature: int64 ref
TotalCmdSendSize
Signature: int64 ref
TotalSARecvSize
Signature: int64 ref
TotalSASendSize
Signature: int64 ref

Static members

Static memberDescription
Current
Signature: NetworkConnections

The current NetworkConnections - only one instantiation exists

ObtainKeyInfoFromFiles(keyfile)
Signature: keyfile:string -> byte []

Obtain key information for security (authentication / encryption) from files and load in memory The base key file, other guids are obtained from other files in same directory Own key information is stored in a file with the name "keyfilemykey.txt" which has following format - 16 byte GUID - Length of authentication key blob (4 bytes) - A private key blob which has been encrypted and contains information to initialize RSA - Length of encryption key blob (4 bytes) - A private key blob which has been encrypted and contains information to initialize RSA Other key information is stored in files "keyfile.txt" where is guid of connection and has following format - 16 byte GUID - Key blob (unencrypted) with length containing authentication public key - Key blob (unencrypted) with length containing encryption public key

Fork me on GitHub