private static Guid MessageIdToGuid(NativeMsmqMessage.BufferProperty messageId) { int length = messageId.Buffer.Length; byte[] dst = new byte[0x10]; Buffer.BlockCopy(messageId.Buffer, 4, dst, 0, 0x10); return(new Guid(dst)); }
public static void SessiongramSent(string sessionId, NativeMsmqMessage.BufferProperty messageId, int numberOfMessages) { if (DiagnosticUtility.ShouldTraceVerbose) { Dictionary <string, string> dictionary = new Dictionary <string, string>(3); dictionary["SessionId"] = sessionId; dictionary["MSMQMessageId"] = MsmqMessageId.ToString(messageId.Buffer); dictionary["NumberOfMessages"] = Convert.ToString(numberOfMessages, CultureInfo.InvariantCulture); TraceUtility.TraceEvent(TraceEventType.Verbose, 0x4006a, System.ServiceModel.SR.GetString("TraceCodeMsmqSessiongramSent"), new DictionaryTraceRecord(dictionary), null, null); } }
static Guid MessageIdToGuid(NativeMsmqMessage.BufferProperty messageId) { if (UnsafeNativeMethods.PROPID_M_MSGID_SIZE != messageId.Buffer.Length) { Fx.Assert(String.Format("Unexpected messageId size: {0}", messageId.Buffer.Length)); } byte[] buffer = new byte[16]; Buffer.BlockCopy(messageId.Buffer, 4, buffer, 0, 16); return(new Guid(buffer)); }
protected MsmqInputMessage(int additionalPropertyCount, SizeQuota bufferSizeQuota) : base(12 + additionalPropertyCount) { this.maxBufferSize = bufferSizeQuota.MaxSize; this.body = new NativeMsmqMessage.BufferProperty(this, 9, bufferSizeQuota.AllocIfAvailable(0x1000)); this.bodyLength = new NativeMsmqMessage.IntProperty(this, 10); this.messageId = new NativeMsmqMessage.BufferProperty(this, 2, 20); this.lookupId = new NativeMsmqMessage.LongProperty(this, 60); this.cls = new NativeMsmqMessage.ShortProperty(this, 1); this.senderId = new NativeMsmqMessage.BufferProperty(this, 20, 0x100); this.senderIdLength = new NativeMsmqMessage.IntProperty(this, 0x15); this.senderCertificate = new NativeMsmqMessage.BufferProperty(this, 0x1c, bufferSizeQuota.AllocIfAvailable(0x1000)); this.senderCertificateLength = new NativeMsmqMessage.IntProperty(this, 0x1d); if (Msmq.IsAdvancedPoisonHandlingSupported) { this.lastMovedTime = new NativeMsmqMessage.IntProperty(this, 0x4b); this.abortCount = new NativeMsmqMessage.IntProperty(this, 0x45); this.moveCount = new NativeMsmqMessage.IntProperty(this, 70); } }
private static void DatagramSentOrReceived(NativeMsmqMessage.BufferProperty messageId, Message message, int traceCode, string traceDescription) { if (DiagnosticUtility.ShouldTraceVerbose) { Guid guid = MessageIdToGuid(messageId); UniqueId id = message.Headers.MessageId; TraceRecord extendedData = null; if (null == id) { extendedData = new StringTraceRecord("MSMQMessageId", guid.ToString()); } else { Dictionary <string, string> dictionary2 = new Dictionary <string, string>(2); dictionary2.Add("MSMQMessageId", guid.ToString()); dictionary2.Add("WCFMessageId", id.ToString()); Dictionary <string, string> dictionary = dictionary2; extendedData = new DictionaryTraceRecord(dictionary); } TraceUtility.TraceEvent(TraceEventType.Verbose, traceCode, traceDescription, extendedData, null, null); } }
static void DatagramSentOrReceived(NativeMsmqMessage.BufferProperty messageId, Message message, int traceCode, string traceDescription) { if (DiagnosticUtility.ShouldTraceVerbose) { Guid msmqId = MessageIdToGuid(messageId); UniqueId indigoId = message.Headers.MessageId; TraceRecord record = null; if (null == indigoId) { record = new StringTraceRecord("MSMQMessageId", msmqId.ToString()); } else { Dictionary <string, string> dictionary = new Dictionary <string, string>(2) { { "MSMQMessageId", msmqId.ToString() }, { "WCFMessageId", indigoId.ToString() } }; record = new DictionaryTraceRecord(dictionary); } TraceUtility.TraceEvent(TraceEventType.Verbose, traceCode, traceDescription, record, null, null); } }
protected MsmqIntegrationInputMessage(MsmqInputMessage.SizeQuota bufferSizeQuota) : base(0x16, bufferSizeQuota) { this.acknowledge = new NativeMsmqMessage.ByteProperty(this, 6); this.adminQueue = new NativeMsmqMessage.StringProperty(this, 0x11, 0x100); this.adminQueueLength = new NativeMsmqMessage.IntProperty(this, 0x12, 0x100); this.appSpecific = new NativeMsmqMessage.IntProperty(this, 8); this.arrivedTime = new NativeMsmqMessage.IntProperty(this, 0x20); this.senderIdType = new NativeMsmqMessage.IntProperty(this, 0x16); this.authenticated = new NativeMsmqMessage.ByteProperty(this, 0x19); this.bodyType = new NativeMsmqMessage.IntProperty(this, 0x2a); this.correlationId = new NativeMsmqMessage.BufferProperty(this, 3, 20); this.destinationQueue = new NativeMsmqMessage.StringProperty(this, 0x3a, 0x100); this.destinationQueueLength = new NativeMsmqMessage.IntProperty(this, 0x3b, 0x100); this.extension = new NativeMsmqMessage.BufferProperty(this, 0x23, bufferSizeQuota.AllocIfAvailable(0)); this.extensionLength = new NativeMsmqMessage.IntProperty(this, 0x24, 0); this.label = new NativeMsmqMessage.StringProperty(this, 11, 0x80); this.labelLength = new NativeMsmqMessage.IntProperty(this, 12, 0x80); this.priority = new NativeMsmqMessage.ByteProperty(this, 4); this.responseFormatName = new NativeMsmqMessage.StringProperty(this, 0x36, 0x100); this.responseFormatNameLength = new NativeMsmqMessage.IntProperty(this, 0x37, 0x100); this.sentTime = new NativeMsmqMessage.IntProperty(this, 0x1f); this.timeToReachQueue = new NativeMsmqMessage.IntProperty(this, 13); this.privacyLevel = new NativeMsmqMessage.IntProperty(this, 0x17); }
public static void DatagramSent(NativeMsmqMessage.BufferProperty messageId, Message message) { DatagramSentOrReceived(messageId, message, 0x40054, System.ServiceModel.SR.GetString("TraceCodeMsmqDatagramSent")); }
protected MsmqOutputMessage(MsmqChannelFactoryBase <TChannel> factory, int bodySize, EndpointAddress remoteAddress, int additionalPropertyCount) : base(15 + additionalPropertyCount) { this.body = new NativeMsmqMessage.BufferProperty(this, 9, bodySize); this.messageId = new NativeMsmqMessage.BufferProperty(this, 2, 20); this.EnsureBodyTypeProperty(0x1011); this.EnsureJournalProperty(2, factory.UseSourceJournal); this.delivery = new NativeMsmqMessage.ByteProperty(this, 5); if (factory.Durable) { this.delivery.Value = 1; } else { this.delivery.Value = 0; } if (factory.TimeToLive != TimeSpan.MaxValue) { int num = MsmqDuration.FromTimeSpan(factory.TimeToLive); this.EnsureTimeToReachQueueProperty(num); this.timeToBeReceived = new NativeMsmqMessage.IntProperty(this, 14, num); } switch (factory.DeadLetterQueue) { case DeadLetterQueue.None: this.EnsureJournalProperty(1, false); break; case DeadLetterQueue.System: this.EnsureJournalProperty(1, true); break; case DeadLetterQueue.Custom: this.EnsureJournalProperty(1, true); this.EnsureDeadLetterQueueProperty(factory.DeadLetterQueuePathName); break; } if (MsmqAuthenticationMode.WindowsDomain == factory.MsmqTransportSecurity.MsmqAuthenticationMode) { this.EnsureSenderIdTypeProperty(1); this.authLevel = new NativeMsmqMessage.IntProperty(this, 0x18, 1); this.hashAlgorithm = new NativeMsmqMessage.IntProperty(this, 0x1a, MsmqSecureHashAlgorithmHelper.ToInt32(factory.MsmqTransportSecurity.MsmqSecureHashAlgorithm)); if (ProtectionLevel.EncryptAndSign == factory.MsmqTransportSecurity.MsmqProtectionLevel) { this.privLevel = new NativeMsmqMessage.IntProperty(this, 0x17, 3); this.encryptionAlgorithm = new NativeMsmqMessage.IntProperty(this, 0x1b, MsmqEncryptionAlgorithmHelper.ToInt32(factory.MsmqTransportSecurity.MsmqEncryptionAlgorithm)); } } else if (MsmqAuthenticationMode.Certificate == factory.MsmqTransportSecurity.MsmqAuthenticationMode) { this.authLevel = new NativeMsmqMessage.IntProperty(this, 0x18, 1); this.hashAlgorithm = new NativeMsmqMessage.IntProperty(this, 0x1a, MsmqSecureHashAlgorithmHelper.ToInt32(factory.MsmqTransportSecurity.MsmqSecureHashAlgorithm)); if (ProtectionLevel.EncryptAndSign == factory.MsmqTransportSecurity.MsmqProtectionLevel) { this.privLevel = new NativeMsmqMessage.IntProperty(this, 0x17, 3); this.encryptionAlgorithm = new NativeMsmqMessage.IntProperty(this, 0x1b, MsmqEncryptionAlgorithmHelper.ToInt32(factory.MsmqTransportSecurity.MsmqEncryptionAlgorithm)); } this.EnsureSenderIdTypeProperty(0); this.senderCert = new NativeMsmqMessage.BufferProperty(this, 0x1c); } else { this.authLevel = new NativeMsmqMessage.IntProperty(this, 0x18, 0); this.EnsureSenderIdTypeProperty(0); } this.trace = new NativeMsmqMessage.ByteProperty(this, 0x29, factory.UseMsmqTracing ? ((byte)1) : ((byte)0)); }
public static void DatagramSent(NativeMsmqMessage.BufferProperty messageId, Message message) { DatagramSentOrReceived(messageId, message, TraceCode.MsmqDatagramSent, SR.GetString(SR.TraceCodeMsmqDatagramSent)); }