예제 #1
0
        public IStyxMessage GetMessage()
        {
            IStyxMessage res = null;
            switch (type)
            {
                case MessageType.Twalk:
                case MessageType.Rwalk:
                    res = new StyxWalkMessage();
                    break;
                case MessageType.Tversion:
                case MessageType.Rversion:
                    res = new StyxVersionMessage();
                    break;
                case MessageType.Tclunk:
                case MessageType.Rclunk:
                    res = new StyxClunkMessage();
                    break;
                case MessageType.Tstat:
                case MessageType.Rstat:
                    res = new StyxStatMessage();
                    break;
                case MessageType.Topen:
                case MessageType.Ropen:
                    res = new StyxOpenMessage();
                    break;
                case MessageType.Tread:
                case MessageType.Rread:
                    res = new StyxReadMessage();
                    break;
                case MessageType.Tattach:
                case MessageType.Rattach:
                    res = new StyxAttachMessage();
                    break;

            }
            if (res != null)
            {
                res.SetBinary(data);
            }
            return res;
        }
예제 #2
0
 private IStyxMessage HandleClunk(StyxClunkMessage message)
 {
     if (!fid_list.ContainsKey(message.Fid))
     {
         throw new Exception("Unknown fid "+message.Fid);
     }
     ForgetFID(message.Fid);
     return new StyxClunkMessage(message.Tag);
 }