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
- GlyphCache.cs
- OdbcStatementHandle.cs
- AppDomainFactory.cs
- XmlBinaryReader.cs
- DesignerAutoFormatStyle.cs
- ToolStripArrowRenderEventArgs.cs
- DataRowIndexBuffer.cs
- CloseCryptoHandleRequest.cs
- UserControl.cs
- OleDbConnectionFactory.cs
- ComponentConverter.cs
- XmlSchemaComplexType.cs
- HttpValueCollection.cs
- DeviceContext.cs
- ImageFormatConverter.cs
- ConfigurationSectionGroupCollection.cs
- EdmItemError.cs
- VirtualPathProvider.cs
- XmlCodeExporter.cs
- Brushes.cs
- Vector3DConverter.cs
- AuthorizationRule.cs
- Math.cs
- WebPartDescriptionCollection.cs
- CompressEmulationStream.cs
- ExpressionBuilder.cs
- InheritedPropertyDescriptor.cs
- SqlClientPermission.cs
- DataPager.cs
- WebPartAuthorizationEventArgs.cs
- GacUtil.cs
- PrintPreviewDialog.cs
- IxmlLineInfo.cs
- IERequestCache.cs
- FacetEnabledSchemaElement.cs
- WebPartConnectionsEventArgs.cs
- Error.cs
- HostSecurityManager.cs
- CacheMode.cs
- EncoderExceptionFallback.cs
- DeviceContexts.cs
- WebPartTransformerAttribute.cs
- QueuedDeliveryRequirementsMode.cs
- CharacterShapingProperties.cs
- LogExtentCollection.cs
- VisualTreeUtils.cs
- DocumentPageViewAutomationPeer.cs
- XmlSchemaInfo.cs
- SchemaSetCompiler.cs
- XmlTextEncoder.cs
- CompatibleComparer.cs
- MsmqIntegrationBinding.cs
- SmtpMail.cs
- ToolStripItemEventArgs.cs
- GlyphRun.cs
- TextEditor.cs
- RectAnimationBase.cs
- DependencyPropertyValueSerializer.cs
- RuntimeEnvironment.cs
- BitVec.cs
- SecurityValidationBehavior.cs
- DataGridViewButtonColumn.cs
- IIS7UserPrincipal.cs
- WebDisplayNameAttribute.cs
- ClientBuildManagerCallback.cs
- EnvironmentPermission.cs
- HierarchicalDataBoundControl.cs
- RbTree.cs
- OneWayBindingElement.cs
- XmlDocumentSchema.cs
- DataGridCheckBoxColumn.cs
- SHA384.cs
- baseaxisquery.cs
- SqlInternalConnectionSmi.cs
- CurrentChangingEventManager.cs
- X509CertificateStore.cs
- SqlConnectionString.cs
- XamlLoadErrorInfo.cs
- MimeFormReflector.cs
- _emptywebproxy.cs
- ToolStripRendererSwitcher.cs
- SystemResourceKey.cs
- PropertyTab.cs
- TypedDatasetGenerator.cs
- SerializationInfo.cs
- PreparingEnlistment.cs
- SvcMapFile.cs
- BufferedGraphics.cs
- UTF8Encoding.cs
- EventPrivateKey.cs
- DefaultBinder.cs
- StylusEditingBehavior.cs
- TileBrush.cs
- SafeReversePInvokeHandle.cs
- TreeViewItemAutomationPeer.cs
- SimpleBitVector32.cs
- RegistrySecurity.cs
- BulletedList.cs
- SqlConnection.cs
- DescendentsWalkerBase.cs