Exemplo n.º 1
0
        public override long Read(Stream stream)
        {
            long bytes = 0;

            if (stream.CanRead)
            {
                EndianBinaryReader reader = new EndianBinaryReader(stream, Endian.Big);
                long start = stream.Position;
                base.Read(stream);
                id        = reader.ReadByte();
                reserved2 = reader.ReadByte();
                reason    = (PCIReason)reader.ReadByte();
                reserved3 = reader.ReadByte();
                byte next = reader.PeekByte();
                while (next == 0x30 || next == 0x40)
                {
                    Item item = new SyntaxItem(next);
                    fields.Add(item);
                    item.Read(stream);
                    if (stream.Position >= stream.Length)
                    {
                        break;
                    }
                    next = reader.PeekByte();
                }
                if (fields.Count < 1)
                {
                    throw new Exception("ill-formed presentation_context");
                }
                bytes = stream.Position - start;
            }
            return(bytes);
        }
Exemplo n.º 2
0
 protected ServiceClass(string uid)
 {
     this.uid      = uid;
     this.id       = 0xff;
     this.reason   = PCIReason.Undefined;
     completeEvent = new System.Threading.AutoResetEvent(false);
     message       = null;
     role          = Role.Scu; // this is only sent in an A_ASSOCIATE_RQ pdu, so this default is OK
 }
Exemplo n.º 3
0
 public PresentationContextItem(byte type)
     : base(type)
 {
     this.id        = 0;
     this.reserved2 = 0;
     this.reason    = 0;
     this.reserved3 = 0;
     fields         = new List <Item>();
 }
Exemplo n.º 4
0
 public PresentationContextItem(byte type, byte id)
     : base(type)
 {
     this.id        = id;
     this.reserved2 = 0;
     this.reason    = PCIReason.Undefined;
     this.reserved3 = 0;
     fields         = new List <Item>();
 }
Exemplo n.º 5
0
 protected ServiceClass(ServiceClass other)
 {
     this.association = null;
     this.uid         = other.uid;
     foreach (string syntax in other.syntaxes)
     {
         this.syntaxes.Add((string)syntax.Clone());
     }
     completeEvent = new System.Threading.AutoResetEvent(false);
     this.id       = 0xff;
     this.reason   = PCIReason.Undefined;
     this.role     = other.role;
 }