-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMessage.h
More file actions
46 lines (43 loc) · 1.1 KB
/
Copy pathMessage.h
File metadata and controls
46 lines (43 loc) · 1.1 KB
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
/*
* @Author: HZW ZJM CSS
* @Date: 2021-05-11 10:38:21
* @LastEditTime: 2021-05-13 10:55:03
* @Description:Type of message transmitted
*/
#ifndef _MESSAGE_H_
#define _MESSAGE_H_
#include <iostream>
#include <string>
#include <winsock2.h>
using namespace std;
//the type of message
// Data message:
// message_type is DATA_MESSAGE,
// dest_ip_addr is the ip address of destintation,
// source_ip_addr is the ip address of source,
// dest_port is the receive port of destintation,
// cost is 0,
// data is a short sentence
// DV route control message:
// message_type is ROUTE_CONTROL_MESSAGE,
// the distance from 'source' to 'destination' is 'cost',
// data is empty
// LS route control message:
// message_type is ROUTE_CONTROL_MESSAGE,
// the link cost from 'source' to 'destination' is 'cost',
// data is empty
struct Message
{
enum MessageType
{
DATA_MESSAGE,
ROUTE_CONTROL_MESSAGE
};
MessageType message_type;
long dest_ip_addr;
long source_ip_addr;
u_short dest_port;
int cost;
string data;
};
#endif