41
41
using RabbitMQ . Client ;
42
42
using RabbitMQ . Client . Impl ;
43
43
using RabbitMQ . Util ;
44
+ using System . Collections . Generic ;
44
45
45
46
namespace RabbitMQ . Client . Framing . Impl . v0_9_1 {
46
- public abstract class ProtocolBase : AbstractProtocolBase {
47
+ public abstract class ProtocolBase : IProtocol {
48
+
49
+ public abstract int MajorVersion { get ; }
50
+ public abstract int MinorVersion { get ; }
51
+ public abstract int Revision { get ; }
52
+ public abstract string ApiName { get ; }
53
+ public abstract int DefaultPort { get ; }
54
+
55
+ public IDictionary < string , bool > Capabilities = new Dictionary < string , bool > ( ) ;
47
56
48
57
public ProtocolBase ( ) {
49
58
Capabilities [ "publisher_confirms" ] = true ;
@@ -54,25 +63,28 @@ public ProtocolBase() {
54
63
Capabilities [ "authentication_failure_close" ] = true ;
55
64
}
56
65
57
- public override IFrameHandler CreateFrameHandler ( AmqpTcpEndpoint endpoint ,
66
+ public abstract MethodBase DecodeMethodFrom ( NetworkBinaryReader reader ) ;
67
+ public abstract ContentHeaderBase DecodeContentHeaderFrom ( NetworkBinaryReader reader ) ;
68
+
69
+ public IFrameHandler CreateFrameHandler ( AmqpTcpEndpoint endpoint ,
58
70
ConnectionFactory . ObtainSocket socketFactory ,
59
71
int timeout )
60
72
{
61
73
return new SocketFrameHandler ( endpoint , socketFactory , timeout ) ;
62
74
}
63
75
64
- public override IModel CreateModel ( ISession session ) {
76
+ public IModel CreateModel ( ISession session ) {
65
77
return new Model ( session ) ;
66
78
}
67
79
68
- public override IConnection CreateConnection ( ConnectionFactory factory ,
80
+ public IConnection CreateConnection ( ConnectionFactory factory ,
69
81
bool insist ,
70
82
IFrameHandler frameHandler )
71
83
{
72
84
return new Connection ( factory , insist , frameHandler ) ;
73
85
}
74
86
75
- public override void CreateConnectionClose ( ushort reasonCode ,
87
+ public void CreateConnectionClose ( ushort reasonCode ,
76
88
string reasonText ,
77
89
out Command request ,
78
90
out int replyClassId ,
@@ -85,7 +97,7 @@ public override void CreateConnectionClose(ushort reasonCode,
85
97
replyMethodId = RabbitMQ . Client . Framing . Impl . v0_9_1 . ConnectionCloseOk . MethodId ;
86
98
}
87
99
88
- public override void CreateChannelClose ( ushort reasonCode ,
100
+ public void CreateChannelClose ( ushort reasonCode ,
89
101
string reasonText ,
90
102
out Command request ,
91
103
out int replyClassId ,
@@ -98,9 +110,27 @@ public override void CreateChannelClose(ushort reasonCode,
98
110
replyMethodId = RabbitMQ . Client . Framing . Impl . v0_9_1 . ChannelCloseOk . MethodId ;
99
111
}
100
112
101
- public override bool CanSendWhileClosed ( Command cmd )
113
+ public bool CanSendWhileClosed ( Command cmd )
102
114
{
103
115
return cmd . m_method is RabbitMQ . Client . Framing . Impl . v0_9_1 . ChannelCloseOk ;
104
116
}
117
+
118
+ public AmqpVersion Version {
119
+ get {
120
+ return new AmqpVersion ( MajorVersion , MinorVersion ) ;
121
+ }
122
+ }
123
+
124
+ public override string ToString ( ) {
125
+ return Version . ToString ( ) ;
126
+ }
127
+
128
+ public override bool Equals ( object obj ) {
129
+ return ( GetType ( ) == obj . GetType ( ) ) ;
130
+ }
131
+
132
+ public override int GetHashCode ( ) {
133
+ return GetType ( ) . GetHashCode ( ) ;
134
+ }
105
135
}
106
136
}
0 commit comments