public IConnectionStateViewModel CreateConnectionStateViewModel(IConnectionState connectionState) { IConnectionStateViewModel connectionStateViewModel = StaticContainer.Container.Resolve <IConnectionStateViewModel>(); connectionStateViewModel.Model = connectionState; return(connectionStateViewModel); }
private void Initialize(Uri url, int timeout) { _timeout = timeout; Url = url; CurrentState = new DisconnectedState(Url,_webRequesterFactory); _logger.Info("EventSource created for " + url.ToString()); }
public static WritableBuffer WriteExtensionList(WritableBuffer buffer, IConnectionState connection) { var connectionState = (IConnectionStateTls13)connection; if (connectionState.State == StateType.SendServerHello) { if (connectionState.PskIdentity != -1) { buffer.WriteBigEndian(ExtensionType.pre_shared_key); buffer.WriteBigEndian <ushort>(sizeof(ushort)); buffer.WriteBigEndian((ushort)connectionState.PskIdentity); } if (connectionState.KeyShare != null) { WriteServerKeyshare(ref buffer, connectionState); } } if (connectionState.State == StateType.WaitHelloRetry) { WriteRetryKeyshare(ref buffer, connectionState); } if (connectionState.State == StateType.SendClientHello) { WriteSupportedVersion(ref buffer, connectionState); WriteClientKeyshares(ref buffer, connectionState); WriteSignatureSchemes(ref buffer, connectionState); WriteSupportedGroups(ref buffer, connectionState); } if (connectionState.State == StateType.ServerAuthentication) { WriteServerEarlyData(ref buffer, connectionState); } return(buffer); }
private void Initialize(Uri url, int timeout, ITokenService tokenService) { _timeout = timeout; Url = url; CurrentState = new DisconnectedState(Url, _webRequesterFactory, _headers, tokenService, _logger); _logger.LogInformation("EventSource created for {url} \\o/", url); }
public static void WriteSupportedVersion(ref WritableBuffer writer, IConnectionState connectionState) { writer.WriteBigEndian(ExtensionType.supported_versions); writer.WriteBigEndian((ushort)3); writer.WriteBigEndian((byte)2); writer.WriteBigEndian(connectionState.Version); }
void OnEnable() { #if UNITY_2018_3_OR_NEWER if (m_ConsoleAttachToPlayerState == null) { m_ConsoleAttachToPlayerState = new ConsoleAttachToPlayerState(this); } #endif MakeSureConsoleAlwaysOnlyOne(); titleContent = EditorGUIUtility.TextContentWithIcon("Console", "UnityEditor.ConsoleWindow"); titleContent = new GUIContent(titleContent) { text = "ConsoleT" }; ms_ConsoleWindow = this; #if UNITY_2018_1_OR_NEWER m_DevBuild = Unsupported.IsDeveloperMode(); #else m_DevBuild = Unsupported.IsDeveloperBuild(); #endif LogEntries.wrapped.searchHistory = m_SearchHistory; Constants.LogStyleLineCount = EditorPrefs.GetInt("ConsoleWindowLogLineCount", 2); Application.logMessageReceived += DoLogChanged; }
private void OnEnable() { this.titleContent = Styles.TitleContent; this.wantsMouseMove = true; this.autoRepaintOnSceneChange = true; #if ENABLE_PROFILER_STATES m_attachProfilerState = ConnectionUtility.GetAttachToPlayerState(this); #endif if (m_treeViewState == null) { m_treeViewState = new TreeViewState(); } m_hierarchyTreeView = new HierarchyTreeView(m_treeViewState); Reload(); if (m_searchField == null) { m_searchField = new SearchField(); m_searchField.downOrUpArrowKeyPressed += hierarchyTreeView.SetFocusAndEnsureSelectedItem; } }
private void Initialize(Uri url, int timeout) { _timeout = timeout; Url = url; CurrentState = new DisconnectedState(Url, _webRequesterFactory, _headers); _logger.Info("EventSource created for " + url.ToString()); }
public readonly void Process(ILogger logger, IConnectionState connectionState, IServiceProvider serviceProvider) { // ReSharper disable once HeapView.BoxingAllocation connectionState.PacketQueue.Write(new StatusResponse( new StatusResponse.Payload( new StatusResponse.Payload.VersionPayload(MCPacketHandler.VersionName, MCPacketHandler.ProtocolVersion), new StatusResponse.Payload.PlayersPayload(100, 0, null), new ChatBuilder( ).AppendText("This ") .WithColor("blue") .Bold() .WithExtra(builder => builder .AppendText("is ") .WithColor("red") .Bold()) .WithExtra(builder => builder .AppendText("the ") .WithColor("green") .Bold()) .WithExtra(builder => builder .AppendText("MODT") .WithColor("purple") .Bold()) .Build(), null))); serviceProvider.GetRequiredService <IMetrics>().Measure.Meter.Mark(MetricsRegistry.StatusRequests); }
public unsafe KeySchedule13(IConnectionState state, BufferPool pool, ReadableBuffer resumptionSecret) { _pool = pool; _stateData = pool.Rent(0); _state = state; _hashSize = CryptoProvider.HashProvider.HashSize(CipherSuite.HashType); _stateData.Memory.TryGetPointer(out _secret); _clientHandshakeTrafficSecret = ((byte *)_secret) + _hashSize; _serverHandshakeTrafficSecret = _clientHandshakeTrafficSecret + _hashSize; _masterSecret = _serverHandshakeTrafficSecret + _hashSize; _clientApplicationTrafficSecret = _masterSecret + _hashSize; _serverApplicationTrafficSecret = _clientApplicationTrafficSecret + _hashSize; void *resumptionPointer = null; int secretLength = 0; if (resumptionSecret.Length > 0) { var stackSecret = stackalloc byte[resumptionSecret.Length]; resumptionSecret.CopyTo(new Span <byte>(stackSecret, resumptionSecret.Length)); secretLength = resumptionSecret.Length; resumptionPointer = stackSecret; } HkdfFunctions.HkdfExtract(CryptoProvider.HashProvider, CipherSuite.HashType, null, 0, resumptionPointer, secretLength, _secret, _hashSize); }
public static void AttachToPlayerDropdown(Rect rect, IConnectionState state, GUIStyle style = null) { var internalState = state as IConnectionStateInternal; if (internalState?.parentWindow) { if (internalState.notificationMessage != null) { internalState.parentWindow.ShowNotification(internalState.notificationMessage); } else { internalState.parentWindow.RemoveNotification(); } } Styles.dropdownButton.text = state.connectionName; if (style == null) { style = Styles.defaultDropdown; } if (!UnityEditor.EditorGUI.DropdownButton(rect, Styles.dropdownButton, FocusType.Passive, style)) { return; } GenericMenu menu = new GenericMenu(); internalState?.AddItemsToMenu(menu, rect); menu.DropDown(rect); }
// Returns true if repaint is needed public bool DrawToolbar(FrameDebuggerWindow frameDebugger, IConnectionState m_AttachToPlayerState) { GUILayout.BeginHorizontal(EditorStyles.toolbar); Profiler.BeginSample("DrawEnableDisableButton"); DrawEnableDisableButton(frameDebugger, m_AttachToPlayerState, out bool needsRepaint); Profiler.EndSample(); Profiler.BeginSample("DrawConnectionDropdown"); DrawConnectionDropdown(frameDebugger, m_AttachToPlayerState, out bool isEnabled); Profiler.EndSample(); GUI.enabled = isEnabled; Profiler.BeginSample("DrawEventLimitSlider"); DrawEventLimitSlider(frameDebugger, out int newLimit); Profiler.EndSample(); Profiler.BeginSample("DrawPrevNextButtons"); DrawPrevNextButtons(frameDebugger, ref newLimit); Profiler.EndSample(); GUILayout.EndHorizontal(); return(needsRepaint); }
public static void StartHandshakeHash(this IConnectionState state, ReadableBuffer readable) { if (state.HandshakeHash == null) { state.HandshakeHash = state.CryptoProvider.HashProvider.GetHashInstance(state.CipherSuite.HashType); } state.HandshakeHash.HashData(readable); }
public static void WriteServerNameFromServer(ref WritableBuffer buffer, IConnectionState connectionState) { if (!string.IsNullOrWhiteSpace(connectionState.ServerName)) { buffer.WriteBigEndian(ExtensionType.server_name); buffer.WriteBigEndian((ushort)0); } }
protected PeerBase(IRpcProtocol protocol, IPhotonPeer unmanagedPeer) { this.unmanagedPeer = unmanagedPeer; this.connectionState = Photon.SocketServer.PeerConnectionStateMachine.Connected.Instance; this.protocol = protocol; this.requestFiber = new PoolFiber(); this.requestFiber.Start(); }
private static void ReadRenegotiationInfo(ReadableBuffer extensionBuffer, IConnectionState connectionState) { connectionState.SecureRenegotiation = true; if (extensionBuffer.Length != 1) { Alerts.AlertException.ThrowAlert(Alerts.AlertLevel.Fatal, Alerts.AlertDescription.handshake_failure, "We don't support renegotiation so cannot support a secure renegotiation"); } }
public static void WriteServerKeyshare(ref WritableBuffer buffer, IConnectionState connectionState) { buffer.WriteBigEndian(ExtensionType.key_share); BufferExtensions.WriteVector <ushort>(ref buffer, (writer, state) => { WriteKeyShare(ref writer, state.KeyShare); return(writer); }, connectionState); }
void OnDisable() { #if UNITY_2018_1_OR_NEWER attachProfilerState.Dispose(); attachProfilerState = null; #endif EditorConnection.instance.Unregister(UnityMemoryProfilerSupportKunClient.kMsgSendPlayerToEditor, OnMessageEvent); EditorConnection.instance.DisconnectAll(); }
internal void OnDisable() { m_ConsoleAttachToPlayerState?.Dispose(); m_ConsoleAttachToPlayerState = null; if (ms_ConsoleWindow == this) { ms_ConsoleWindow = null; } }
public static void WriteSecureRenegotiation(ref WritableBuffer buffer, IConnectionState connectionState) { if (!connectionState.SecureRenegotiation) { return; } buffer.WriteBigEndian(ExtensionType.renegotiation_info); buffer.WriteBigEndian <ushort>(1); buffer.WriteBigEndian <byte>(0); }
public async Task Connect(Form form) { if (ClientPlayer == null) { State = new ConnectingState(); ClientPlayer = new Player(); HttpResponseMessage response = await client.PostAsJsonAsync(playersData, ClientPlayer); playerCreator = new PlayerFactory().CreatePlayer(); //PlayerCreatorHandler.GetPlayerCreator(); enemyCreator = new EnemyFactory().CreatePlayer(); //PlayerCreatorHandler.GetEnemyCreator(); currentlyOnlinePlayers = new List <Player>(); PlayerPlacedBombs = new List <Bomb>(); enemyPlacedBombs = new List <Bomb>(); enemyPlayerModels = new Dictionary <int, PictureBox>(); PlayerPlacedBombModels = new Dictionary <int, PictureBox>(); enemyPlacedBombModels = new Dictionary <int, PictureBox>(); if (response.IsSuccessStatusCode) { State = new ConnectedState(); #pragma warning disable CS0618 // Type or member is obsolete ClientPlayer = await JsonConvert.DeserializeObjectAsync <Player>(await response.Content.ReadAsStringAsync()); #pragma warning restore CS0618 // Type or member is obsolete ConnectionEstablished = true; ClientPlayerBox = playerCreator.CreatePlayerModel(ClientPlayer); form.Controls.Add(ClientPlayerBox); roomWalls = new List <Wall>(); //response = await client.GetAsync(wallsData); HttpResponseMessage wallsResponse = await client.GetAsync(wallsData); if (wallsResponse.IsSuccessStatusCode) { #pragma warning disable CS0618 // Type or member is obsolete roomWalls = await JsonConvert.DeserializeObjectAsync <List <Wall> >(await wallsResponse.Content.ReadAsStringAsync()); #pragma warning restore CS0618 // Type or member is obsolete if (roomWalls.Count > 0) { await TryTogetMap(form); } else { await TryToCreateMap(form); } } } } }
public void Process(ILogger logger, IConnectionState state, IServiceProvider serviceProvider) { switch (Identifier) { // temporary solution, but this works case "minecraft:brand": logger.LogInformation($"{state.PlayerEntity.Username}'s client: {Encoding.UTF8.GetString(Data.Span)}"); break; } }
public TransactionCompleteSubscription(DeviceContext deviceContext, IConnectionState connectionState, IConnectionStateViewModel connectionStateViewModel, ITypesContainer container, Action onConnectionRetriesCounterOverflow) { _deviceContext = deviceContext; _connectionState = connectionState; _connectionStateViewModel = connectionStateViewModel; _container = container; _onConnectionRetriesCounterOverflow = Result <Action> .Create(onConnectionRetriesCounterOverflow, true); _connectionService = container.Resolve <IConnectionService>(); }
private void DrawConnectionDropdown(FrameDebuggerWindow frameDebugger, IConnectionState m_AttachToPlayerState, out bool isEnabled) { PlayerConnectionGUILayout.ConnectionTargetSelectionDropdown(m_AttachToPlayerState, EditorStyles.toolbarDropDown); isEnabled = FrameDebugger.enabled; if (isEnabled && ProfilerDriver.connectedProfiler != FrameDebuggerUtility.GetRemotePlayerGUID()) { // Switch from local to remote debugger or vice versa FrameDebuggerUtility.SetEnabled(false, FrameDebuggerUtility.GetRemotePlayerGUID()); FrameDebuggerUtility.SetEnabled(true, ProfilerDriver.connectedProfiler); } }
void OnEnable() { #if UNITY_2018_1_OR_NEWER if (attachProfilerState == null) { attachProfilerState = ConnectionUtility.GetAttachToPlayerState(this); } #endif EditorConnection.instance.Initialize(); EditorConnection.instance.Register(UnityMemoryProfilerSupportKunClient.kMsgSendPlayerToEditor, OnMessageEvent); }
public SecurePipelineConnection(IPipeConnection pipeline, PipeFactory factory, SecurePipeListener listener, ILogger <SecurePipelineConnection> logger) { _logger = logger; _listener = listener; _lowerConnection = pipeline; _outputPipe = factory.Create(); _inputPipe = factory.Create(); _handshakePipe = factory.Create(); _state = new ServerStateTls12(_listener, _logger); StartReading(); }
public void Start() { Trace.TraceInformation("Start"); if (connectionParameter.UdpEnabled) { State = new UdpDisconnectedState(this, connectionParameter); } else { State = new TcpDisconnectedState(this, connectionParameter); } }
public static void ReadExtensionListTls(ref ReadableBuffer buffer, IConnectionState connectionState) { var listLength = buffer.ReadBigEndian <ushort>(); ReadableBuffer signatureAlgoBuffer = default(ReadableBuffer); buffer = buffer.Slice(sizeof(ushort)); if (buffer.Length < listLength) { Alerts.AlertException.ThrowAlert(Alerts.AlertLevel.Fatal, Alerts.AlertDescription.decode_error, "The extension list is not as long as the header says"); } var currentbuffer = buffer.Slice(0, listLength); buffer = buffer.Slice(currentbuffer.End); while (currentbuffer.Length > 3) { var extensionType = currentbuffer.ReadBigEndian <ExtensionType>(); var extensionLength = currentbuffer.Slice(sizeof(ExtensionType)).ReadBigEndian <ushort>(); currentbuffer = currentbuffer.Slice(sizeof(ExtensionType) + sizeof(ushort)); if (currentbuffer.Length < extensionLength) { Alerts.AlertException.ThrowAlert(Alerts.AlertLevel.Fatal, Alerts.AlertDescription.decode_error, $"The extension of type {extensionType} is too long for the remaining buffer"); } var extensionBuffer = currentbuffer.Slice(0, extensionLength); currentbuffer = currentbuffer.Slice(extensionLength); switch (extensionType) { case ExtensionType.server_name: ReadServerName(extensionBuffer, connectionState); break; //case ExtensionType.signature_algorithms: // signatureAlgoBuffer = extensionBuffer; // break; case ExtensionType.supported_groups: if (connectionState.CipherSuite.ExchangeType == KeyExchange.KeyExchangeType.Ecdhe) { connectionState.CryptoProvider.GetKeyshareFromNamedGroups(extensionBuffer); } break; case ExtensionType.renegotiation_info: ReadRenegotiationInfo(extensionBuffer, connectionState); break; } } //Wait until the end to check the signature, here we select the //certificate and this could depend on the server name indication //as well as the trusted CA roots. if (signatureAlgoBuffer.Length != 0) { ReadSignatureScheme(signatureAlgoBuffer, connectionState); } }
private void OnEnable() { #if UNITY_2020_1_OR_NEWER m_attachProfilerState = ConnectionUtility.GetConnectionState(this); #else m_attachProfilerState = ConnectionUtility.GetAttachToPlayerState(this); #endif UnityEditor.Networking.PlayerConnection.EditorConnection.instance.Initialize(); UnityEditor.Networking.PlayerConnection.EditorConnection.instance.Register(UnityChoseKun.kMsgSendPlayerToEditor, OnMessageEvent); UnityEditor.Networking.PlayerConnection.EditorConnection.instance.RegisterConnection(OnConnection); UnityEditor.Networking.PlayerConnection.EditorConnection.instance.RegisterDisconnection(OnDisConnection); onGUILayoutFuncDict = new Dictionary <string, Action>() { { "Inspector", inspectorView.OnGUI }, { "Component", objectCounterView.OnGUI }, { "Texture", texturesView.OnGUI }, { "Shader", shaderView.OnGUI }, { "Sprite", spritesView.OnGUI }, { "SortingLayer", sortingLayerView.OnGUI }, { "Screen", screenView.OnGUI }, { "Time", timeView.OnGUI }, { "Application", applicationView.OnGUI }, { "Android", androidView.OnGUI }, { "Quality", qualitySettingsView.OnGUI }, { "OnDemandRendering", onDemandRenderingView.OnGUI }, { "ScalableBuffer", scalableBufferManagerView.OnGUI }, { "SystemInfo", systemInfoView.OnGUI }, // 機能をここに追加していく }; onMessageFuncDict = new Dictionary <UnityChoseKun.MessageID, OnMessageFunc>() { { UnityChoseKun.MessageID.ScreenPull, screenView.OnMessageEvent }, { UnityChoseKun.MessageID.TimePull, timeView.OnMessageEvent }, { UnityChoseKun.MessageID.GameObjectPull, inspectorView.OnMessageEvent }, { UnityChoseKun.MessageID.ShaderPull, shaderView.OnMessageEvent }, { UnityChoseKun.MessageID.TexturePull, texturesView.OnMessageEvent }, { UnityChoseKun.MessageID.ApplicationPull, applicationView.OnMessageEvent }, { UnityChoseKun.MessageID.AndroidPull, androidView.OnMessageEvent }, { UnityChoseKun.MessageID.QualitySettingsPull, qualitySettingsView.OnMessageEvent }, { UnityChoseKun.MessageID.OnDemandRenderingPull, onDemandRenderingView.OnMessageEvent }, { UnityChoseKun.MessageID.ScalableBufferManagerPull, scalableBufferManagerView.OnMessageEvent }, { UnityChoseKun.MessageID.SystemInfoPull, systemInfoView.OnMessageEvent }, { UnityChoseKun.MessageID.SpritePull, spritesView.OnMessageEvent }, { UnityChoseKun.MessageID.SortingLayerPull, sortingLayerView.OnMessageEvent }, // 機能をここに追加していく }; }
public void Dispose() { lock (_lock) { _logger?.LogTrace("Disposed connection"); _lowerConnection?.Dispose(); _state?.Dispose(); _lowerConnection = null; _state = null; GC.SuppressFinalize(this); } }
// private void OnDisable() { attachProfilerState.Dispose(); attachProfilerState = null; UnityEditor.Networking.PlayerConnection.EditorConnection.instance.DisconnectAll(); UnityEditor.Networking.PlayerConnection.EditorConnection.instance.Unregister(PlayerView.kMsgSendPlayerToEditor, OnMessageEvent); UnityEditor.Networking.PlayerConnection.EditorConnection.instance.Unregister(PlayerView.kMsgSendPlayerToEditorHeader, OnMessageEventHeader); UnityEditor.Networking.PlayerConnection.EditorConnection.instance.UnregisterConnection(OnConnection); UnityEditor.Networking.PlayerConnection.EditorConnection.instance.UnregisterDisconnection(OnDisConnection); }
protected void Run() { if (mTokenSource.IsCancellationRequested && CurrentState.State == EventSourceState.CLOSED) return; mCurrentState.Run(this.OnEventReceived, mTokenSource.Token).ContinueWith(cs => { CurrentState = cs.Result; Run(); }); }