Exemple #1
0
        public static int EncodeHeader(System.IO.Stream buffer, PacketTypes type, Flags1 flags1, Flags2 flags2, Encodings encoding, UInt16 serial_high_low, Guid object_id, Guid interface_id, Guid activity_id, UInt32 server_boot_time, UInt32 sequence_no, Operations op, UInt16 body_length, UInt16 fragment_no, out long body_length_position)
        {
            int ret = 0;

            ret += DCP.EncodeU8(buffer, 4);             //RPCVersion
            ret += DCP.EncodeU8(buffer, (byte)type);
            ret += DCP.EncodeU8(buffer, (byte)flags1);
            ret += DCP.EncodeU8(buffer, (byte)flags2);
            ret += DCP.EncodeU16(buffer, (ushort)encoding);
            ret += DCP.EncodeU8(buffer, 0);             //pad
            ret += DCP.EncodeU8(buffer, (byte)(serial_high_low >> 8));
            ret += EncodeGuid(buffer, encoding, object_id);
            ret += EncodeGuid(buffer, encoding, interface_id);
            ret += EncodeGuid(buffer, encoding, activity_id);
            ret += EncodeU32(buffer, encoding, server_boot_time);
            ret += EncodeU32(buffer, encoding, 1);               //interface version
            ret += EncodeU32(buffer, encoding, sequence_no);
            ret += EncodeU16(buffer, encoding, (ushort)op);
            ret += EncodeU16(buffer, encoding, 0xFFFF);                 //interface hint
            ret += EncodeU16(buffer, encoding, 0xFFFF);                 //activity hint
            body_length_position = buffer.Position;
            ret += EncodeU16(buffer, encoding, body_length);
            ret += EncodeU16(buffer, encoding, fragment_no);
            ret += DCP.EncodeU8(buffer, 0);             //authentication protocol
            ret += DCP.EncodeU8(buffer, (byte)(serial_high_low & 0xFF));

            return(ret);
        }
Exemple #2
0
        public static int EncodeRTCStatus(System.IO.Stream buffer, UInt16 CycleCounter, DataStatus DataStatus, TransferStatus TransferStatus)
        {
            int ret = 0;

            ret += DCP.EncodeU16(buffer, CycleCounter);
            ret += DCP.EncodeU8(buffer, (byte)DataStatus);
            ret += DCP.EncodeU8(buffer, (byte)TransferStatus);

            return(ret);
        }