/// <summary> /// Create and Register a TcpSessionEventsSource. /// </summary> /// <devdoc> /// This should be a Generic when supported. Or use more of the base class (Static?) // BUGBUG AM (later?) /// </devdoc> public static TcpSessionEventsSource Create(string sourceName, uint size, uint storageOptions, // BUGBUG AM: [Flags] enum uint sourceFlags, uint debugFlags) { TcpSessionEventsSource tcpSessionEventsSource = null; EventingStorage eventStorage = EventingStorage.CreateLocalStorage(storageOptions, size); if (eventStorage == null) { DebugStub.WriteLine("Failure to obtain storage for TcpSessionEvents"); DebugStub.Break(); } else { tcpSessionEventsSource = new TcpSessionEventsSource(sourceName, eventStorage, sourceFlags, debugFlags); if (tcpSessionEventsSource == null) { // TODO: Is EventStorage returned here and below if failures occur? DebugStub.WriteLine("Failure to construct TcpSessionEventsSource instance."); DebugStub.Break(); } else { bool registerSucceeded = tcpSessionEventsSource.Register(); if (registerSucceeded == false) { tcpSessionEventsSource = null; DebugStub.WriteLine("Failure to register TcpSessionEventsSource."); DebugStub.Break(); } } } return(tcpSessionEventsSource); }
/// <summary> /// The Static Constructor. It creates the event session for this SIP. /// </summary> static TcpSessionEventsSource() { TcpSessionEventsSource.EventLog = TcpSessionEventsSource.Create(// BUGBUG AM: Why isn't this a normal constructor???? "TcpSessions", TcpSessionEventsSource.EventLogBufferSize, QualityOfService.RecyclableEvents, EventSource.ENABLE_ALL_MASK & ~( // Buffering Mask // BUGBUG: Switch to Positive Logic when system and user masks separated? // TODO //Incl TcpSessionEventsSource.LogStateChanges | /*Omit*/ TcpSessionEventsSource.LogSendingPackets | //Incl TcpSessionEventsSource.LogReceivedPackets | //Incl TcpSessionEventsSource.LogTimeouts | //Incl TcpSessionEventsSource.LogStateChangeContractCalls | /*Omit*/ TcpSessionEventsSource.LogDataTransferContractCalls | /*Omit*/ TcpSessionEventsSource.LogQueryContractCalls | /*Omit*/ TcpSessionEventsSource.LogInfoContractCalls | 0u), EventSource.ENABLE_ALL_MASK & ~( // Debugging Mask // BUGBUG: Same // TODO /*Omit*/ TcpSessionEventsSource.LogStateChanges | /*Omit*/ TcpSessionEventsSource.LogSendingPackets | /*Omit*/ TcpSessionEventsSource.LogReceivedPackets | /*Omit*/ TcpSessionEventsSource.LogTimeouts | /*Omit*/ TcpSessionEventsSource.LogStateChangeContractCalls | /*Omit*/ TcpSessionEventsSource.LogDataTransferContractCalls | /*Omit*/ TcpSessionEventsSource.LogQueryContractCalls | /*Omit*/ TcpSessionEventsSource.LogInfoContractCalls | 0u)); #if false TcpSessionEvents.EventLog = TcpSessionEvents.Create("TcpSession", 4096, QualityOfService.RecyclableEvents, EventSource.ENABLE_ALL_MASK | EventSource.CAPTURE_DEBUG_PRINT); #endif }