123456789101112131415161718192021222324252627282930313233343536373839 |
- using Invercargill;
- namespace Pprf.Messages {
- public class UploadSession : Message {
-
- public uint8[] session_authentication { get; set; }
- public uint32 max_chunk_size { get; set; }
-
- public UploadSession() {
- message_type = MessageType.UPLOAD_SESSION;
- }
-
- public override void deserialise (GLib.DataInputStream stream) throws Error {
- base.deserialise (stream);
-
- var auth_size = stream.read_uint16();
- session_authentication = new uint8[auth_size];
- stream.read(session_authentication);
- max_chunk_size = stream.read_uint32();
- }
-
- public override uint64 calculate_size() {
- return base.calculate_size() +
- 2 + // Auth size field
- session_authentication.length +
- 4; // Chunk size field
- }
-
- public override void serialise(DataOutputStream stream) throws Error {
- base.serialise(stream);
-
- stream.put_uint16((uint16)session_authentication.length);
- stream.write(session_authentication);
- stream.put_uint32(max_chunk_size);
- }
- }
- }
|