Skip to content
This repository was archived by the owner on Jun 1, 2019. It is now read-only.

Network documentation

Maxime Cauvin edited this page Nov 26, 2017 · 1 revision

Network

Client AddTokensAccessEvent
AddTreeEvent AddUserEvent
Event GetAvailableServicesEvent
HttpEventAnswer HttpEventSource
HttpEventStatus HttpEventType
TriggerReactionEvent InfosClient
Locker LockManager
ANode ANodeData
AreaTree ATreeRoot
EventContent IService
Packet PacketCommand
Point ReactionRegisterContent
Service ServiceActionContent
ServiceReactionContent ServiceType
User Server

Client

Client class for the Network library. This class allow the user to start a transmission in order to receive and send requests to a single Server.

CallBackFct

Static callback method for the server request

Channel

Static name for the communication channel

Finalize

Destructor of the Client. When called, it'll shutdown all the transmissions

Instance

Getter for the singleton instance of a Client

SendDataToServer(data)

Send an object to the server (you will minimum need "public string name" in your object

Name Description
data System.Object

ServerRequest(header, connection, data)

Trigered function when the server want to communicate with the Monitor

Name Description
header NetworkCommsDotNet.PacketHeader
connection NetworkCommsDotNet.Connections.Connection
data System.String
Data send by the server

Start(channel, callBackFct, serverIP, serverPort)

Launch the ClientNetwork

Name Description
channel System.String
Name of the channel which will be used for the communication
callBackFct System.Func{Network.NetTools.Packet,System.Int32}
Function called when the client receive a message from the server
serverIP System.String
Ip of the server you want to connect to
serverPort System.Int32
Port of the server you want to connect to

AddTokensAccessEvent

Event add token

Constructor(source_, type_, owner_, data_)

Event add tree

Name Description
source_ Network.Events.HttpEventSource
type_ Network.Events.HttpEventType
owner_ Network.NetTools.User
data_ System.Object

AddTreeEvent

Event add tree

Constructor(source_, type_, owner_, data_)

Event add tree

Name Description
source_ Network.Events.HttpEventSource
type_ Network.Events.HttpEventType
owner_ Network.NetTools.User
data_ System.Object

AddUserEvent

Event add user

Constructor(source_, type_, owner_, data_)

Event add user

Name Description
source_ Network.Events.HttpEventSource
type_ Network.Events.HttpEventType
owner_ Network.NetTools.User
data_ System.Object

Event

Abstract class used to represent the body of an event in the AREA app

Constructor(source_, type_, owner_, data_)

Main constructor for Event objects

Name Description
source_ Network.Events.HttpEventSource
The source type (HttpEventSource)
type_ Network.Events.HttpEventType
The event type (HttpEventType)
owner_ Network.NetTools.User
Some basics informations about the event's owner
data_ System.Object
Some basics informations about the event's data

CreationDate

Defines the date of the creation for the event

Data

Indicate some basics informations about the event's owner

OwnerInfos

Indicate some basics informations about the event's owner

Source

Defines the source type of the event

Type

Defines the type of the event

GetAvailableServicesEvent

Event for recuperation of available services

Constructor(source_, type_, owner_, data_)

Get available services

Name Description
source_ Network.Events.HttpEventSource
type_ Network.Events.HttpEventType
owner_ Network.NetTools.User
data_ System.Object

HttpEventAnswer

Defines the basic object used for handling answer from the server

Data

Represent the answer as a data

Error(e, code, message)

Creates a specific HttpEventAnswer with a predefined pattern used for errors.

Name Description
e Network.Events.Event
The source event used for generating the answer
code System.Int32
The error code
message System.String
The error message

Returns

Parent

Defines the source event used for generating the answer

Status

Http status with a code and a message

Success(e, message)

Creates a specific HttpEventAnswer with a predefined pattern used for success status.

Name Description
e Network.Events.Event
The source event used for generating the answer
message System.String
The error message

Returns

HttpEventSource

Defines the differents sources which can be used to create an Event

APP

Represent an internal source

BUS

Event instanciate in the message bus

EXT

Represent an external client

SERVICE

Represent an event created in a service

HttpEventStatus

Defines a data model used to store an http status

Code

Code of the status

Message

Message of the status

HttpEventType

Defines the differents type which can be used to create an Event

COMMAND

Can be assimilated to a POST method

QUERY

Can be assimilated to a GET method

SYS

Used to manipulate integrity of instances

TriggerReactionEvent

Constructor(source_, type_, owner_, data_)

Event add user

Name Description
source_ Network.Events.HttpEventSource
type_ Network.Events.HttpEventType
owner_ Network.NetTools.User
data_ System.Object

InfosClient

Defines the network information for a server's client.

_ip

A System.String for the IP of the client

_port

An System.Int32 for the port of the client

Locker

Class designed to lock and unlock asynchronous event. Usually managed by a LockManager.

Constructor(key_, username_, duration_)

Second constructor of the Locker, allowing the user to customize the timeout duration.

Name Description
key_ System.UInt32
The unique key code of the Locker
username_ System.String
The username of the Locker's owner
duration_ System.Int32
The duration of the lock period timeout.

Constructor(key_, username_)

Main constructor of the Locker

Name Description
key_ System.UInt32
The unique key code of the Locker
username_ System.String
The username of the Locker's owner

Duration

Getter and Setter for the timeout duration of the Locker

Key

Getter and Setter for the Locker key

State

Getter and Setter for the current State of the Locker

Username

Getter and Setter for the Username of the owner of the Locker

LockManager

Class used to store, delete, lock and unlock Locker

Add(username, duration)

Add a new Locker in the manager

Name Description
username System.String
The owner of the Locker
duration System.Int32
A duration

Returns

This method return the generated key of the Locker

Add(username)

Add a new Locker in the manager. This method set the duration to infinite (-1)

Name Description
username System.String
The owner of the Locker

Returns

This method return the generated key of the Locker

Delete(key)

Delete the locker associated to the key given in parameter

Name Description
key System.UInt32
The key of the Locker

Returns

True if the Locker has been successfully deleted, false otherwise.

Lock(key)

Lock the Locker linked to the key given in parameter and wait for a call to LockManager.Unlock(System.UInt32)

Name Description
key System.UInt32
The key of the Locker

Returns

False if no Locker has been found with this key, true otherwise

Locks

Getter and Setter for the Dictionnary of Lockers, which assign an System.UInt32 key to its Locker

Unlock(key)

Unlock the Locker linked to the key given in parameter.

Name Description
key System.UInt32
The key of the Locker

Returns

False if the manager does not contain a Locker with this key, true otherwise

ANode

Defines a node in the AREA's tree structure

Constructor

Constructor of ANode

children

A list of the ANode children

data

The data contained in the ANode

ANodeData

Defines the data stored in an ANode

Constructor

Constructor of the ANodeData

eventName

The ANode's event name

name

The ANode's name

pos

The ANode's position in the canvas

serviceName

The ANode's service name

type

The ANode's type ("action" or "reaction")

AreaTree

Defines all AREAs for an User

Constructor(email)

Constructor of AreaTree

Name Description
email System.String
The User's email

AreasList

The list of all AREAs for the User

Email

The User's email

Id

The MongoDB.Bson.ObjectIdUser's identifier

ATreeRoot

Defines an AREA

Constructor(name)

Constructor of ATreeRoot

Name Description
name System.String
The ATreeRoot's name

Name

The ATreeRoot's name

root

The root for the tree structure

EventContent

The content of an Event

Content

The content of the Event

Name

The name of the Event

Type

The type of the Event

IService

The interface for a service

APIName

Return the name of the API

Returns

GetActionList

Get the list of actions

Returns

A list of actions

GetCallback

Get the callback

Returns

A Callback

GetReactionList

Get the list of reactions

Returns

A list of reactions

GetUsersListByAction(action)

Get the users list by action

Name Description
action System.String
An action

Returns

A list of users

GetUsersListByReaction(reaction)

Get the users list by reaction

Name Description
reaction System.String
An reaction

Returns

A list of users

Packet

Class used to transfer data across the network.

Constructor

Default constructor for a Packet

Constructor(name_, command_, data_)

Main constructor for client side. The key is initialized to 0 and the registration state to false.

Name Description
name_ System.String
The name of the emitter.
command_ Network.NetTools.PacketCommand
The command associated to data_
data_ System.Object
The System.Object which contain the data

Constructor(name_, key_, command_, data_)

Main constructor for server side, the key must be initialized with a value.

Name Description
name_ System.String
The name of the emitter. For server side, it will be "root"
key_ System.UInt32
The value of the Locker key
command_ Network.NetTools.PacketCommand
The command associated to data_
data_ System.Object
The System.Object which contain the data

Data

Access the Data of the Packet

Key

Access the Network.Lock.Locker's key of the Packet

Name

Access the name of the packet's author

PacketCommand

Enum used to defined the type of the Packet's System.Object

ACTION

Communication direction: Server => Client. Ask the client to execute an action. The object associated to the command must be an Network.Events.Event (which is the action to execute and his paramaters).

C_REGISTER

Communication direction: Client => Server. Request a register from a Client to the Server. The object associated to the command must be a System.String (which is the server's password).

ERROR

Communication direction: Both. Inform a network entity about an error that occured. The object associated to the command must be a System.String.

REACTION

Communication direction: Client => Server. Send to the message bus the fact that an reaction has been triggered. The object associated to the command must be an ReactionRegisterContent (which is the reaction and the user link to a reaction).

REACTION_REGISTER

Communication direction: Server => Client. Ask the client to link a reaction to an user. The object associated to the command must be an Network.Events.Event (which is the reaction to launch and his paramaters).

Point

A basic structure defining a 2D Position with System.Int32 variables

Constructor

Constructor of Point

x

The X position

y

The X position

ReactionRegisterContent

The content of an reaction register

Owner

The owner of the ReactionRegisterContent

ReactionName

The reaction's name

ServiceName

The service's name

Service

Service like (Facebook, Twitter, Slack...)

Constructor(name_, accessTokenSecret_, actions_, reactions_, infos_)

Constructor for a Service

Name Description
name_ System.String
The Service's name
accessTokenSecret_ System.Boolean
The Service needs an AccessTokenSecret
actions_ System.Collections.Generic.Dictionary{System.String,Network.NetTools.ServiceType}
The Service's actions
reactions_ System.Collections.Generic.Dictionary{System.String,Network.NetTools.ServiceType}
The Service's reactions
infos_ Network.InfosClient
The Service's infos client

AccessTokenSecret

The Service needs an AccessTokenSecret

Actions

The Service's actions

Infos

The Service's infos client

Name

The Service's name

Reactions

The Service's reactions

ServiceActionContent

This class is used by the server to ask a service to execute an action, or link a reaction.

Constructor(name, user, args)

Constructor of the ServiceActionContent class.

Name Description
name System.String
The name of the ServiceActionContent
user Network.NetTools.User
An user
args System.Object
The ServiceActionContent's arguments

Args

Return the args needed to the launch the action function.

Name

Return the name of the action to execute.

User

ServiceReactionContent

This class is used by a service to inform the Server that an action has been triggered and that a reaction has been created.

Constructor(name, user, reactionContent, service)

Constructor of the ServiceActionContent class.

Name Description
name System.String
The name of the reaction.
user Network.NetTools.User
Informations about the user.
reactionContent System.Object
Contents about the reaction.
service System.String
The name of the service.

Name

Return the name of the action to execute.

ReactionContent

Return an object containing some content about the reaction.

Service

Return the name of the service.

User

Return the args needed to the launch the action function.

ServiceType

An System.Enum defining a service type

ACTION

The service is an action

REACTION

The service is an reaction

User

User information

Constructor(email, pwd)

Constructor for User

Name Description
email System.String
The User's email
pwd System.String
The User's password

AccessToken

The User's standard tokens

AccessTokenSecret

The User's secret tokens

AreTokensExpired

Check if User's tokens are expired

Returns

A System.Boolean if tokens are expired or not

Email

The User's email

Id

The MongoDB.Bson.ObjectIdUser's identifier

LastUpdated

The last updated System.DateTime for the User's tokens

Pwd

The User's password

Server

Defines a Server class for the Nexus Network library.

DeleteMonitor(name)

Remove a monitor from the connected users by it's name

Name Description
name System.String
The name of the monitor which will be removed

Returns

DeleteService(name)

Remove a monitor from the connected users by it's name

Name Description
name System.String
The name of the service which will be removed

Returns

EventFlow

A list of EventContent defining an event flow

Finalize

Destructor for the Server class. It will shutdwon the connection.

GetIpAddr

Get ip of the pc

Returns

Instance

A getter and a setter for the server singleton instance

Lock_m

A getter and a setter for the stored LockerManager wich will manage all the synchronous network operations

MessageBusNotification(header, connection, data)

Callback called when the messagebus got a new message

Name Description
header NetworkCommsDotNet.PacketHeader
connection NetworkCommsDotNet.Connections.Connection
data System.String

MessageBusNotificationCallback

Callback used for the communication with the message bus

MonitorRequest(header, connection, data)

Callback called when a monitor send some data

Name Description
header NetworkCommsDotNet.PacketHeader
connection NetworkCommsDotNet.Connections.Connection
data System.String

MonitorRequestCallback

Callback used for the communication with the monitors

Monitors

The list of monitors

NewServices

List of monitors currently connected to the server

OldServices

The list of old services

SendDataToMonitor(data)

Send some data to a monitor

Name Description
data Network.NetTools.Packet
Data sent to the monitor

SendDataToMonitor(name, data)

Send some data (as NetTools.Packet to a monitor by its name

Name Description
name System.String
Name of the monitor
data Network.NetTools.Packet
Data sent to the monitor

SendDataToMonitor(ip, port, data)

Send some data (as NetTools.Packet to a monitor by its ip and port

Name Description
ip System.String
IP address of the monitor
port System.Int32
Port of the monitor
data Network.NetTools.Packet
Data sent to the monitor

SendMessageBusEvent(data)

Send some data to the services through the message bus channel

Name Description
data Network.NetTools.Packet
Dqtq sent to the services

Returns

SendMessageBusEventCore(data, ip, port)

Send a Message Bus Event Core

Name Description
data Network.NetTools.Packet
Data sent to the monitor
ip System.String
IP address of the monitor
port System.Int32
Port of the monitor

Returns

SendMessageBusEventToService(data, serviceName)

Send a message bus event to a NetTools.Service

Name Description
data Network.NetTools.Packet
Data sent to the monitor
serviceName System.String
A NetTools.Service name

Returns

SERVER_PASS

Server password used for monitors and services registration

Services

The list of services

Start(mrcb, mbncb, pass)

Init and start the server

Name Description
mrcb System.Func{Network.NetTools.Packet,System.Int32}
Callback used for monitors requests
mbncb System.Func{Network.NetTools.Packet,System.Int32}
Callback used for message bus requests
pass System.String
Password of the server

Returns

Stop

Stop the server by closing all packet handlers and stop the request listening. It also delete all the client's infos

Clone this wiki locally