Ejemplo n.º 1
0
 public byte[] synReply(Int32 flag, Int32 streamID, Dictionary<string, string> name_Value)
 {
     Namevalue name = new Namevalue(name_Value);
     byte [] nameValue = name.Make(name_Value);
     byte[] pack = new byte[12+nameValue.Length];
     UInt32 temp = 0x80000002 + (UInt32)(this.version<<16);
     System.Buffer.BlockCopy(BitConverter.GetBytes(temp), 0, pack, 0, 4);
     flag = flag << 24;
     flag = 4+flag+nameValue.Length;
     System.Buffer.BlockCopy(BitConverter.GetBytes(flag), 0, pack, 4, 4);
     System.Buffer.BlockCopy(BitConverter.GetBytes(streamID&0x7fffffff), 0, pack, 8, 4);
     Buffer.BlockCopy(nameValue, 0, pack, 12, nameValue.Length);
     return pack;
 }
Ejemplo n.º 2
0
 public byte[] synStream(UInt32 flag, UInt32 streamID, UInt32 associate, UInt32 priority, Dictionary<string, string>name_Value)
 {
     Namevalue namevalue = new Namevalue(name_Value);
     byte [] nameValue = namevalue.Make(name_Value);//compacta dicionario
     byte [] pack = new byte[18+nameValue.Length];
     UInt32 temp = (UInt32) this.version << 16;
     temp += 0x80000001;
     byte [] tem = BitConverter.GetBytes(temp);
     System.Buffer.BlockCopy(tem, 0, pack, 0, sizeof(UInt32));//inicia o segundo hearder
     flag = flag << 24;
     flag = (UInt32)nameValue.Length+14+flag;
     System.Buffer.BlockCopy(BitConverter.GetBytes(flag), 0, pack, 4, sizeof(UInt32));//inicia o segundo hearder
     System.Buffer.BlockCopy(BitConverter.GetBytes(streamID), 0, pack, 8, sizeof(UInt32));
     System.Buffer.BlockCopy(BitConverter.GetBytes(associate), 0, pack, 12, 4);
     priority *=  8192;//A mesma coisa que priority << 13
     System.Buffer.BlockCopy(BitConverter.GetBytes(priority), 0, pack, 16, 2);
     Buffer.BlockCopy(nameValue, 0, pack, 18, nameValue.Length);
     return pack;
 }
Ejemplo n.º 3
0
 public byte[] header(UInt32 Flag, UInt32 streamID, Dictionary<string, string> name_Value)
 {
     Namevalue name = new Namevalue(name_Value);
     byte [] nameValue = name.Make(name_Value);
     byte[] pack = new byte[12+nameValue.Length];
     UInt32 temp = 0x80000008+ (UInt32) (this.version<<16);
     System.Buffer.BlockCopy(BitConverter.GetBytes(temp), 0, pack, 0, 4);
     Flag = Flag << 24;
     Flag = 4+Flag + (UInt32)nameValue.Length;
     System.Buffer.BlockCopy(BitConverter.GetBytes(Flag), 0, pack, 4, 4);
     System.Buffer.BlockCopy(BitConverter.GetBytes(streamID), 0, pack, 8, 4);
     Buffer.BlockCopy(nameValue, 0, pack, 12, nameValue.Length);
     return pack;
 }