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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DesignerSerializerAttribute.cs
- DataBindingValueUIHandler.cs
- DeferredTextReference.cs
- ToolTip.cs
- DescendantQuery.cs
- ComponentSerializationService.cs
- ThreadAttributes.cs
- RadioButtonFlatAdapter.cs
- LiteralTextParser.cs
- WebProxyScriptElement.cs
- SqlProcedureAttribute.cs
- Parameter.cs
- TextEffect.cs
- CodeMemberProperty.cs
- RegistryPermission.cs
- StateFinalizationActivity.cs
- SingleAnimation.cs
- HttpEncoder.cs
- FormViewDeleteEventArgs.cs
- NotFiniteNumberException.cs
- Site.cs
- InputScopeNameConverter.cs
- PenLineJoinValidation.cs
- Context.cs
- AutomationPatternInfo.cs
- NavigationPropertyEmitter.cs
- DefinitionUpdate.cs
- PropertyBuilder.cs
- FlowPosition.cs
- DesignTimeVisibleAttribute.cs
- UserControlAutomationPeer.cs
- MsmqChannelListenerBase.cs
- EntityDataSourceView.cs
- ControlPropertyNameConverter.cs
- ExpressionConverter.cs
- Rule.cs
- HtmlMobileTextWriter.cs
- Scripts.cs
- ListViewUpdatedEventArgs.cs
- PropertyInformationCollection.cs
- CacheMode.cs
- HttpsHostedTransportConfiguration.cs
- EmptyCollection.cs
- OdbcConnectionOpen.cs
- StrokeNodeData.cs
- OleDbParameter.cs
- ToolBar.cs
- EdmRelationshipRoleAttribute.cs
- FontSourceCollection.cs
- KeyInfo.cs
- FeatureAttribute.cs
- ProcessInputEventArgs.cs
- ManagedIStream.cs
- FlowDocumentReader.cs
- ResXResourceReader.cs
- StatusBarDesigner.cs
- ClusterSafeNativeMethods.cs
- _RequestCacheProtocol.cs
- ParserOptions.cs
- SiteOfOriginContainer.cs
- UnSafeCharBuffer.cs
- LedgerEntry.cs
- ExpressionPrinter.cs
- ModelItemImpl.cs
- DetailsViewModeEventArgs.cs
- IntSecurity.cs
- SizeChangedEventArgs.cs
- CharUnicodeInfo.cs
- TaskExceptionHolder.cs
- TextServicesCompartmentContext.cs
- WindowsImpersonationContext.cs
- StateMachineAction.cs
- LoginCancelEventArgs.cs
- EntityProviderFactory.cs
- DialogWindow.cs
- ResourcesGenerator.cs
- NumberFormatInfo.cs
- DynamicRendererThreadManager.cs
- TextTrailingWordEllipsis.cs
- RulePatternOps.cs
- TextModifier.cs
- CodeConstructor.cs
- RuntimeConfigLKG.cs
- XmlSchemaInfo.cs
- SoapIgnoreAttribute.cs
- BaseComponentEditor.cs
- KeyPullup.cs
- CompareValidator.cs
- DataControlButton.cs
- SynchronousSendBindingElement.cs
- SiteMapPath.cs
- ThemeDirectoryCompiler.cs
- XmlSerializerAssemblyAttribute.cs
- ColorConverter.cs
- EntityDataSourceViewSchema.cs
- TextShapeableCharacters.cs
- StylusPlugInCollection.cs
- XmlEventCache.cs
- TransformProviderWrapper.cs
- UpdateCommand.cs