/// <summary> /// Creates a new socket end point that (optionally) is bound to the given /// P2P name, if PNRP is available, otherwise the name is only used for debugging. /// </summary> /// <param name="type">The type of endpoint to create</param> /// <param name="name"> /// The name of this socket, used to publish it via PNRP as well as to refer to this endpoint in /// diagnostic output /// </param> /// <param name="clientAuthenticator"> /// The authenticator, if any, to authenticate a client against a server (both need to /// use the same authenticator) /// </param> /// <param name="serverAuthenticator"> /// The authenticator, if any, to authenticate a server against a client (both need to /// use the same authenticator) /// </param> /// <param name="networkServiceDiscoverer">The discoverer used to find services by name within the local network</param> /// <param name="codeGenerator">The code generator to create proxy and servant types</param> /// <param name="heartbeatSettings"> /// The settings for heartbeat mechanism, if none are specified, then default settings are /// used /// </param> /// <param name="latencySettings"> /// The settings for latency measurements, if none are specified, then default settings are /// used /// </param> /// <param name="endPointSettings">The settings for the endpoint itself (max. number of concurrent calls, etc...)</param> public SocketEndPoint(EndPointType type, string name = null, IAuthenticator clientAuthenticator = null, IAuthenticator serverAuthenticator = null, INetworkServiceDiscoverer networkServiceDiscoverer = null, ICodeGenerator codeGenerator = null, HeartbeatSettings heartbeatSettings = null, LatencySettings latencySettings = null, EndPointSettings endPointSettings = null) : base(new GrainIdGenerator(type), name, type, clientAuthenticator, serverAuthenticator, codeGenerator, heartbeatSettings, latencySettings, endPointSettings) { _networkServiceDiscoverer = networkServiceDiscoverer; }
public NodeServer(string serviceName, INetworkServiceDiscoverer networkServiceDiscoverer, IEnumerable <string> allowedMachineNames) { LogAllowedHosts(allowedMachineNames); _socket = new SocketEndPoint(EndPointType.Server, serviceName, clientAuthenticator: MachineNameAuthenticator.CreateForServer(allowedMachineNames.ToArray()), networkServiceDiscoverer: networkServiceDiscoverer, heartbeatSettings: new HeartbeatSettings { AllowRemoteHeartbeatDisable = true }); _socket.OnDisconnected += SocketOnOnDisconnected; _taskScheduler = new DefaultTaskScheduler(); _filesystem = new Filesystem(_taskScheduler); _interfaces = new Interfaces(); _socket.CreateServant <IInterfaces>(ObjectIds.Interface, _interfaces); _files = new Files(_filesystem); _socket.CreateServant <IFiles>(ObjectIds.File, _files); _shell = new Shell(); _socket.CreateServant <IShell>(ObjectIds.Shell, _shell); _services = new Services(); _socket.CreateServant <IServices>(ObjectIds.Services, _services); _processes = new Processes(); _socket.CreateServant <IProcesses>(ObjectIds.Processes, _processes); _network = new Network(); _socket.CreateServant <INetwork>(ObjectIds.Network, _network); _registry = new Registry(); _socket.CreateServant <IRegistry>(ObjectIds.Registry, _registry); }
/// <summary> /// </summary> /// <param name="name"></param> /// <param name="serverAuthenticator"></param> /// <param name="networkServiceDiscoverer"></param> /// <param name="clientAuthenticator"></param> /// <param name="codeGenerator"></param> /// <param name="heartbeatSettings"></param> /// <param name="latencySettings"></param> /// <param name="endPointSettings"></param> public SocketServer(string name = null, IAuthenticator clientAuthenticator = null, IAuthenticator serverAuthenticator = null, INetworkServiceDiscoverer networkServiceDiscoverer = null, ICodeGenerator codeGenerator = null, HeartbeatSettings heartbeatSettings = null, LatencySettings latencySettings = null, EndPointSettings endPointSettings = null) { _name = name ?? "<Unnamed>"; _clientAuthenticator = clientAuthenticator; _serverAuthenticator = serverAuthenticator; _networkServiceDiscoverer = networkServiceDiscoverer; _codeGenerator = codeGenerator ?? CodeGenerator.Default; _heartbeatSettings = heartbeatSettings; _latencySettings = latencySettings; _endPointSettings = endPointSettings; _syncRoot = new object(); _subjects = new Dictionary <ulong, ISubjectRegistration>(); _internalEndPoints = new HashSet <ISocketEndPoint>(); _connectedEndPoints = new HashSet <ISocketEndPoint>(); }