Naanou.LookupService
Class Network

Manages the network connection for node

Field Summary
Naanou.LookupService.BroadcastListener broadcastListener
Naanou.LookupService.PeerDiscovery disco
Naanou.Common.ILogger logger
Naanou.LookupService.Node node
Naanou.LookupService.Remoting remoting

Constructor Summary
Network(Naanou.LookupService.Node node, Naanou.Common.ILogger logger)
         Constructor

Property Summary
string Address
         Gets the local IP address of machine (or gateway or user spec)
bool IsInternal
         Is the node on an internal, private address?
string PrimaryUrl
         Gets the primary url for the node

Method Summary
void AbortQueuedDiscovery()
         Aborts a previously queued discovery
bool IsInternalAddress(string address)
         Checks whether the given address is internal/private
bool JoinNetworkAttempt(System.Collections.ArrayList nodes)
         Attempts to join a network using a list of nodes as starting points
Naanou.LookupService.NodeAddress JoinNetworkAttempt(Naanou.LookupService.Discovery node)
         Attempts to join a network using node as the starting point. Returns the verified remote address of the node
void NotifyBootstrap()
         Called when we have joined a network
void OnDiscoveryComplete(object sender, System.EventArgs e)
         Event triggered when the discovery process completes.
void SetPrimaryAddress(string address)
         Sets the local address of machine (or gateway)
bool Start()
         Starts the networking services (remoting)
void StartDiscovery()
         Starts discovery process
void Stop()
         Stops network services (broadcast listener and remoting)
void StopDiscovery()
         Stops discovery process if it needs to be aborted early.

Methods inherited from class System.Object
Equals, Finalize, GetHashCode, GetType, MemberwiseClone, ToString


Field Detail

broadcastListener

private Naanou.LookupService.BroadcastListener broadcastListener


disco

private Naanou.LookupService.PeerDiscovery disco


logger

private Naanou.Common.ILogger logger


node

private Naanou.LookupService.Node node


remoting

private Naanou.LookupService.Remoting remoting

Constructor Detail

Network

internal Network(Naanou.LookupService.Node node,
                 Naanou.Common.ILogger logger)

Constructor

Parameters:
node - Parent node
logger - Logger
Property Detail

Address

public string Address

Gets the local IP address of machine (or gateway or user spec)


IsInternal

public bool IsInternal

Is the node on an internal, private address?


PrimaryUrl

public string PrimaryUrl

Gets the primary url for the node

Method Detail

AbortQueuedDiscovery

internal void AbortQueuedDiscovery()

Aborts a previously queued discovery


IsInternalAddress

public bool IsInternalAddress(string address)

Checks whether the given address is internal/private

Parameters:
address - Address to check
Returns:
True if address is internal

JoinNetworkAttempt

internal bool JoinNetworkAttempt(System.Collections.ArrayList nodes)

Attempts to join a network using a list of nodes as starting points

Parameters:
nodes - ArrayList of Naanou.LookupService.Discovery values
Returns:
True if a boot node was contacted and join process started, or False if no nodes could be contacted in this network

JoinNetworkAttempt

internal Naanou.LookupService.NodeAddress JoinNetworkAttempt(Naanou.LookupService.Discovery node)

Attempts to join a network using node as the starting point. Returns the verified remote address of the node

Parameters:
node - Boot node
Returns:
Node reference if connection was made ok, or null if not

NotifyBootstrap

internal void NotifyBootstrap()

Called when we have joined a network


OnDiscoveryComplete

private void OnDiscoveryComplete(object sender,
                                 System.EventArgs e)

Event triggered when the discovery process completes.

Parameters:
sender - Sender of event
e - Event args

SetPrimaryAddress

public void SetPrimaryAddress(string address)

Sets the local address of machine (or gateway)

Parameters:
address - Address

Start

internal bool Start()

Starts the networking services (remoting)

Returns:
True if everything went ok, False if there was an error

StartDiscovery

internal void StartDiscovery()

Starts discovery process


Stop

internal void Stop()

Stops network services (broadcast listener and remoting)


StopDiscovery

internal void StopDiscovery()

Stops discovery process if it needs to be aborted early.