blob: b416bfa698b504504b67536fcd3212129132046c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#include "stdafx.h"
#include <iostream>
#include "InputOutputStream.h"
#include "PacketListener.h"
#include "ContainerAckPacket.h"
ContainerAckPacket::ContainerAckPacket()
{
containerId = 0;
uid = 0;
accepted = 0;
}
ContainerAckPacket::ContainerAckPacket(int containerId, short uid, bool accepted)
{
this->containerId = containerId;
this->uid = uid;
this->accepted = accepted;
}
void ContainerAckPacket::handle(PacketListener *listener)
{
listener->handleContainerAck(shared_from_this());
}
void ContainerAckPacket::read(DataInputStream *dis) //throws IOException
{
containerId = dis->readByte();
uid = dis->readShort();
accepted = dis->readByte() != 0;
}
void ContainerAckPacket::write(DataOutputStream *dos) //throws IOException
{
dos->writeByte(containerId);
dos->writeShort(uid);
dos->writeByte(accepted ? 1 : 0);
}
int ContainerAckPacket::getEstimatedSize()
{
return 4;
}
|