1
/****************************************************************************
3
| Copyright (c) 2007 Novell, Inc.
6
| This program is free software; you can redistribute it and/or
7
| modify it under the terms of version 2 of the GNU General Public License as
8
| published by the Free Software Foundation.
10
| This program is distributed in the hope that it will be useful,
11
| but WITHOUT ANY WARRANTY; without even the implied warranty of
12
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
| GNU General Public License for more details.
15
| You should have received a copy of the GNU General Public License
16
| along with this program; if not, contact Novell, Inc.
18
| To contact Novell about this file by physical or electronic mail,
19
| you may find current contact information at www.novell.com
22
|***************************************************************************/
27
using System.Collections;
28
using System.Runtime.Remoting.Channels;
29
using System.Runtime.Remoting.Messaging;
34
namespace Simias.Sniffer
37
/// Sniffer Client Channel Sink
39
public class SnifferClientChannelSink : IClientChannelSink
41
private static readonly ISimiasLog log = SimiasLogManager.GetLogger(typeof(SnifferClientChannelSink));
43
private IClientChannelSink nextSink;
48
/// <param name="nextSink">The next sink in the chain.</param>
49
public SnifferClientChannelSink(IClientChannelSink nextSink)
51
this.nextSink = nextSink;
54
#region IClientChannelSink Members
56
void IClientChannelSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, out ITransportHeaders responseHeaders, out Stream responseStream)
58
log.Debug("****** SNIFFER PROCESS [CLIENT] MESSAGE START ******");
60
log.Debug("Initiating Remote Call...{0}{1}", Environment.NewLine, SnifferMessage.ToString(msg));
64
nextSink.ProcessMessage(msg, requestHeaders, requestStream, out responseHeaders, out responseStream);
68
log.Error(e, "Client Sink Process Exception");
74
log.Debug("******* SNIFFER PROCESS [CLIENT] MESSAGE END *******");
79
/// The next sink in the chain.
81
IClientChannelSink IClientChannelSink.NextChannelSink
83
get { return nextSink; }
89
/// <param name="msg"></param>
90
/// <param name="headers"></param>
91
/// <returns></returns>
92
public Stream GetRequestStream(IMessage msg, ITransportHeaders headers)
100
/// <param name="sinkStack"></param>
101
/// <param name="msg"></param>
102
/// <param name="headers"></param>
103
/// <param name="stream"></param>
104
public void AsyncProcessRequest(IClientChannelSinkStack sinkStack, IMessage msg, ITransportHeaders headers, Stream stream)
111
/// <param name="sinkStack"></param>
112
/// <param name="state"></param>
113
/// <param name="headers"></param>
114
/// <param name="stream"></param>
115
void IClientChannelSink.AsyncProcessResponse(IClientResponseChannelSinkStack sinkStack, object state, ITransportHeaders headers, Stream stream)
121
#region IChannelSinkBase Members
124
/// Channel properties
126
public IDictionary Properties