diff options
Diffstat (limited to 'CSharp')
-rw-r--r-- | CSharp/Ivy/IvyPPC/IvyTCPStreamV4.cs | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/CSharp/Ivy/IvyPPC/IvyTCPStreamV4.cs b/CSharp/Ivy/IvyPPC/IvyTCPStreamV4.cs index de3651a..5974233 100644 --- a/CSharp/Ivy/IvyPPC/IvyTCPStreamV4.cs +++ b/CSharp/Ivy/IvyPPC/IvyTCPStreamV4.cs @@ -15,7 +15,7 @@ namespace IvyBus {
BinaryReader input;
BinaryWriter output;
- IvyProtocolInterface receiver;
+ IvyProtocol receiver;
/* the protocol magic numbers */
internal enum MessageType : ushort
@@ -36,7 +36,7 @@ namespace IvyBus };
- internal IvyTCPStreamV4(Socket socket, IvyProtocolInterface _receiver) : base( socket )
+ internal IvyTCPStreamV4(Socket socket, IvyProtocol _receiver) : base( socket )
{
input = new BinaryReader(stream, Encoding.ASCII);
@@ -83,65 +83,65 @@ namespace IvyBus output.Flush();
}
- public override void TokenStartRegexp(ushort port, string appName)
+ override internal void TokenStartRegexp(ushort port, string appName)
{
sendMsg(MessageType.StartRegexp, port, appName);
}
- public override void TokenEndRegexp()
+ override internal void TokenEndRegexp()
{
sendMsg(MessageType.EndRegexp, 0, "");
}
- public override void TokenApplicationId(ushort priority, string appId)
+ override internal void TokenApplicationId(ushort priority, string appId)
{
sendMsg(MessageType.ApplicationId, priority, appId);
}
- internal override void TokenAddBinding(IvyBindingBase bind)
+ override internal void TokenAddBinding(Ivy.ApplicationBinding bind)
{
- if (bind)
+ if (bind.type == Ivy.BindingType.BindRegexp)
{
- sendMsg(MessageType.AddRegexp, id, bind); /* perhaps we should perform some checking here */
+ sendMsg(MessageType.AddRegexp, bind.key, bind.expression); /* perhaps we should perform some checking here */
}
else
{
- sendMsg(MessageType.AddBinding, id, bind); /* perhaps we should perform some checking here */
+ sendMsg(MessageType.AddBinding, bind.key, bind.expression); /* perhaps we should perform some checking here */
}
}
- public override void TokenDelBinding(ushort id)
+ override internal void TokenDelBinding(ushort id)
{
sendMsg(MessageType.DelBinding, id, null );
}
- public override void TokenDirectMsg(ushort id, string message)
+ override internal void TokenDirectMsg(ushort id, string message)
{
sendMsg(MessageType.DirectMsg, id, message);
}
- public override void TokenPong(string s)
+ override internal void TokenPong(string s)
{
sendMsg(MessageType.Pong, 0, s);
}
- public override void TokenPing(string s)
+ override internal void TokenPing(string s)
{
sendMsg(MessageType.Ping, 0, s);
}
- public override void TokenBye(ushort id, string message)
+ override internal void TokenBye(ushort id, string message)
{
sendMsg(MessageType.Bye, id, message);
}
- public override void TokenDie(ushort id, string message)
+ override internal void TokenDie(ushort id, string message)
{
sendMsg(MessageType.Die, id, message);
}
- public override void TokenMsg(ushort key, string[] args)
+ override internal void TokenMsg(ushort key, string[] args)
{
sendMsg(MessageType.Msg, key, args );
}
- public override void TokenError(ushort key, string arg)
+ override internal void TokenError(ushort key, string arg)
{
sendMsg(MessageType.Msg, key, arg);
}
@@ -183,8 +183,9 @@ namespace IvyBus }
return arg;
}
- internal override bool receiveMsg()
+ override internal bool receiveMsg()
{
+ Ivy.ApplicationBinding bind = new Ivy.ApplicationBinding();
MessageType msgType = MessageType.Die;
ushort msgId = 0;
string[] msgData = null;
@@ -206,11 +207,17 @@ namespace IvyBus break;
case MessageType.AddRegexp:
- receiver.TokenAddRegexp(msgId, msgData[0]);
+ bind.type = Ivy.BindingType.BindRegexp;
+ bind.key = msgId;
+ bind.expression = msgData[0];
+ receiver.TokenAddBinding(bind);
break;
case MessageType.AddBinding:
- receiver.TokenAddBinding(msgId, msgData[0]);
+ bind.type = Ivy.BindingType.BindSimple;
+ bind.key = msgId;
+ bind.expression = msgData[0];
+ receiver.TokenAddBinding(bind);
break;
case MessageType.DelBinding:
|