-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataStructure.h
More file actions
55 lines (39 loc) · 854 Bytes
/
DataStructure.h
File metadata and controls
55 lines (39 loc) · 854 Bytes
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
46
47
48
49
50
51
52
53
54
#ifndef DATA_STRUCTURE_H
#define DATA_STRUCTURE_H
struct Configuration {
/**
定义各层协议Payload数据的大小(字节为单位)
*/
static const int PAYLOAD_SIZE = 21;
/**
定时器时间
*/
static const int TIME_OUT = 10;
};
/**
第五层应用层的消息
*/
struct Message {
char data[Configuration::PAYLOAD_SIZE]; //payload
Message();
Message(const Message& msg);
virtual Message& operator=(const Message& msg);
virtual ~Message();
virtual void print();
};
/**
第四层运输层报文段
*/
struct Packet {
int seqnum; //序号
int acknum; //确认号
int checksum; //校验和
char payload[Configuration::PAYLOAD_SIZE]; //payload
Packet();
Packet(const Packet& pkt);
virtual Packet& operator=(const Packet& pkt);
virtual bool operator==(const Packet& pkt) const;
virtual ~Packet();
virtual void print();
};
#endif