Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / TransactionBridge / Microsoft / Transactions / Wsat / Protocol / ProtocolInformationWriter.cs / 1 / ProtocolInformationWriter.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- // Define the class that knows how to serialize WS-AT protocol information using System; using System.IO; using Microsoft.Transactions.Wsat.Recovery; namespace Microsoft.Transactions.Wsat.Protocol { enum ProtocolInformationMajorVersion : byte { v1 = 0x1 } enum ProtocolInformationMinorVersion : byte { v1 = 0x1, v2 = 0x2, } enum ProtocolInformationFlags : byte { IssuedTokensEnabled = 0x01, NetworkClientAccess = 0x02, NetworkInboundAccess = 0x04, NetworkOutboundAccess = 0x08, IsClustered = 0x10 } class ProtocolInformationWriter { ProtocolState state; public ProtocolInformationWriter(ProtocolState state) { this.state = state; } public byte[] GetProtocolInformation() { MemoryStream mem = new MemoryStream(); WriteProtocolInformation(mem); return mem.ToArray(); } void WriteProtocolInformation(MemoryStream mem) { ProtocolInformationFlags flags = GetProtocolInformationFlags(); // Version mem.WriteByte((byte)ProtocolInformationMajorVersion.v1); mem.WriteByte((byte)ProtocolInformationMinorVersion.v2); // Flags mem.WriteByte((byte)flags); // Https port SerializationUtils.WriteInt(mem, state.Config.PortConfiguration.HttpsPort); // Max timeout SerializationUtils.WriteTimeout(mem, state.Config.MaxTimeout); // Hostname used in addresses SerializationUtils.WriteString(mem, state.Config.PortConfiguration.HostName); // Base path used in addresses SerializationUtils.WriteString(mem, state.Config.PortConfiguration.BasePath); // Local node name SerializationUtils.WriteString(mem, Environment.MachineName); // End of version 1.1 // version 1.2 data // Supported protocols SerializationUtils.WriteUShort(mem, (ushort)(ProtocolVersion.Version10 | ProtocolVersion.Version11)); // End of version 1.2 data } ProtocolInformationFlags GetProtocolInformationFlags() { ProtocolInformationFlags flags = 0; // IssuedTokensEnabled if (state.Config.PortConfiguration.SupportingTokensEnabled) { flags |= ProtocolInformationFlags.IssuedTokensEnabled; } // NetworkInboundAccess if (state.TransactionManager.Settings.NetworkInboundAccess) { flags |= ProtocolInformationFlags.NetworkInboundAccess; } // NetworkOutboundAccess if (state.TransactionManager.Settings.NetworkOutboundAccess) { flags |= ProtocolInformationFlags.NetworkOutboundAccess; } // NetworkClientsAccess if (state.TransactionManager.Settings.NetworkClientAccess) { flags |= ProtocolInformationFlags.NetworkClientAccess; } // IsClustered if (state.TransactionManager.Settings.IsClustered) { flags |= ProtocolInformationFlags.IsClustered; } return flags; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DictionaryEntry.cs
- SimpleTypeResolver.cs
- LineVisual.cs
- ACE.cs
- iisPickupDirectory.cs
- infer.cs
- ConcurrentDictionary.cs
- InfocardClientCredentials.cs
- Resources.Designer.cs
- ColorConvertedBitmapExtension.cs
- XmlWriter.cs
- UniqueTransportManagerRegistration.cs
- HotCommands.cs
- PropertyCondition.cs
- RenderContext.cs
- AttributeExtensions.cs
- AsyncStreamReader.cs
- LocalFileSettingsProvider.cs
- SourceElementsCollection.cs
- ExtensionWindowResizeGrip.cs
- COSERVERINFO.cs
- ReadWriteSpinLock.cs
- _LocalDataStoreMgr.cs
- StreamUpdate.cs
- CustomTypeDescriptor.cs
- IPAddress.cs
- BoundsDrawingContextWalker.cs
- DelegatedStream.cs
- SecurityNegotiationException.cs
- HtmlForm.cs
- BindingMemberInfo.cs
- HtmlElementCollection.cs
- RegexCompilationInfo.cs
- XPathAncestorQuery.cs
- Timer.cs
- CodeStatementCollection.cs
- BindingElementCollection.cs
- TrustLevelCollection.cs
- TransformedBitmap.cs
- AutomationProperty.cs
- GroupBox.cs
- PropertyCondition.cs
- MessageSecurityOverHttp.cs
- XmlDictionaryString.cs
- EventLogWatcher.cs
- LinearGradientBrush.cs
- securitycriticaldata.cs
- AutomationProperties.cs
- D3DImage.cs
- WinFormsUtils.cs
- MethodExpr.cs
- TableProviderWrapper.cs
- TemplateDefinition.cs
- DataGridViewAccessibleObject.cs
- SuppressMergeCheckAttribute.cs
- EventLog.cs
- DataBinder.cs
- SystemIPInterfaceProperties.cs
- RequestCachePolicyConverter.cs
- MaskedTextBox.cs
- SqlInternalConnectionTds.cs
- ModelFunction.cs
- XmlSchemaObjectCollection.cs
- EntryIndex.cs
- ConsoleTraceListener.cs
- SafeNativeMethods.cs
- TypeElementCollection.cs
- ReflectionHelper.cs
- IncrementalCompileAnalyzer.cs
- HttpWebResponse.cs
- TableLayoutSettings.cs
- AnnotationService.cs
- PersonalizationState.cs
- BuildDependencySet.cs
- ThreadInterruptedException.cs
- SqlProviderUtilities.cs
- OutOfProcStateClientManager.cs
- CurrentTimeZone.cs
- SpeechSeg.cs
- TypeTypeConverter.cs
- QuadraticBezierSegment.cs
- InfocardExtendedInformationEntry.cs
- BaseCodeDomTreeGenerator.cs
- HtmlFormParameterReader.cs
- CheckBoxFlatAdapter.cs
- CodeCompileUnit.cs
- UncommonField.cs
- ReadOnlyHierarchicalDataSourceView.cs
- SystemParameters.cs
- SoapSchemaExporter.cs
- HttpProfileBase.cs
- ActivityExecutorDelegateInfo.cs
- PropertyIDSet.cs
- InputManager.cs
- FlowLayout.cs
- EdmMember.cs
- RayMeshGeometry3DHitTestResult.cs
- ManagementOptions.cs
- CorruptingExceptionCommon.cs
- TemplatedControlDesigner.cs