├── README.md
├── documents
├── lab10设计文档.pdf
├── lab11设计文档.pdf
├── lab2设计文档.md
├── lab4设计文档.md
├── lab5设计文档.md
├── lab6设计文档.md
└── lab9设计文档.pdf
├── lab2
└── socket_dump.c
├── net_lab
├── CMakeLists.txt
├── FAQs.md
├── NET_ProPlusMax.md
├── build
│ ├── CMakeCache.txt
│ ├── CMakeFiles
│ │ ├── 3.10.2
│ │ │ ├── CMakeCCompiler.cmake
│ │ │ ├── CMakeCXXCompiler.cmake
│ │ │ ├── CMakeDetermineCompilerABI_C.bin
│ │ │ ├── CMakeDetermineCompilerABI_CXX.bin
│ │ │ ├── CMakeSystem.cmake
│ │ │ ├── CompilerIdC
│ │ │ │ ├── CMakeCCompilerId.c
│ │ │ │ └── a.out
│ │ │ └── CompilerIdCXX
│ │ │ │ ├── CMakeCXXCompilerId.cpp
│ │ │ │ └── a.out
│ │ ├── CMakeDirectoryInformation.cmake
│ │ ├── CMakeOutput.log
│ │ ├── Makefile.cmake
│ │ ├── Makefile2
│ │ ├── TargetDirectories.txt
│ │ ├── cmake.check_cache
│ │ ├── ctest_arp.dir
│ │ │ ├── C.includecache
│ │ │ ├── DependInfo.cmake
│ │ │ ├── build.make
│ │ │ ├── cmake_clean.cmake
│ │ │ ├── depend.internal
│ │ │ ├── depend.make
│ │ │ ├── flags.make
│ │ │ ├── link.txt
│ │ │ ├── progress.make
│ │ │ ├── src
│ │ │ │ ├── arp.c.o
│ │ │ │ ├── ethernet.c.o
│ │ │ │ └── utils.c.o
│ │ │ └── test
│ │ │ │ ├── arp_test.c.o
│ │ │ │ ├── faker
│ │ │ │ ├── driver.c.o
│ │ │ │ └── ip.c.o
│ │ │ │ └── global.c.o
│ │ ├── ctest_eth_in.dir
│ │ │ ├── C.includecache
│ │ │ ├── DependInfo.cmake
│ │ │ ├── build.make
│ │ │ ├── cmake_clean.cmake
│ │ │ ├── depend.internal
│ │ │ ├── depend.make
│ │ │ ├── flags.make
│ │ │ ├── link.txt
│ │ │ ├── progress.make
│ │ │ ├── src
│ │ │ │ ├── ethernet.c.o
│ │ │ │ └── utils.c.o
│ │ │ └── test
│ │ │ │ ├── eth_in_test.c.o
│ │ │ │ ├── faker
│ │ │ │ ├── arp.c.o
│ │ │ │ ├── driver.c.o
│ │ │ │ └── ip.c.o
│ │ │ │ └── global.c.o
│ │ ├── ctest_eth_out.dir
│ │ │ ├── C.includecache
│ │ │ ├── DependInfo.cmake
│ │ │ ├── build.make
│ │ │ ├── cmake_clean.cmake
│ │ │ ├── depend.internal
│ │ │ ├── depend.make
│ │ │ ├── flags.make
│ │ │ ├── link.txt
│ │ │ ├── progress.make
│ │ │ ├── src
│ │ │ │ ├── ethernet.c.o
│ │ │ │ └── utils.c.o
│ │ │ └── test
│ │ │ │ ├── eth_out_test.c.o
│ │ │ │ ├── faker
│ │ │ │ ├── arp.c.o
│ │ │ │ ├── driver.c.o
│ │ │ │ └── ip.c.o
│ │ │ │ └── global.c.o
│ │ ├── ctest_icmp.dir
│ │ │ ├── C.includecache
│ │ │ ├── DependInfo.cmake
│ │ │ ├── build.make
│ │ │ ├── cmake_clean.cmake
│ │ │ ├── depend.internal
│ │ │ ├── depend.make
│ │ │ ├── flags.make
│ │ │ ├── link.txt
│ │ │ ├── progress.make
│ │ │ ├── src
│ │ │ │ ├── arp.c.o
│ │ │ │ ├── ethernet.c.o
│ │ │ │ ├── icmp.c.o
│ │ │ │ ├── ip.c.o
│ │ │ │ └── utils.c.o
│ │ │ └── test
│ │ │ │ ├── faker
│ │ │ │ ├── driver.c.o
│ │ │ │ └── udp.c.o
│ │ │ │ ├── global.c.o
│ │ │ │ └── icmp_test.c.o
│ │ ├── ctest_ip.dir
│ │ │ ├── C.includecache
│ │ │ ├── DependInfo.cmake
│ │ │ ├── build.make
│ │ │ ├── cmake_clean.cmake
│ │ │ ├── depend.internal
│ │ │ ├── depend.make
│ │ │ ├── flags.make
│ │ │ ├── link.txt
│ │ │ ├── progress.make
│ │ │ ├── src
│ │ │ │ ├── arp.c.o
│ │ │ │ ├── ethernet.c.o
│ │ │ │ ├── ip.c.o
│ │ │ │ └── utils.c.o
│ │ │ └── test
│ │ │ │ ├── faker
│ │ │ │ ├── driver.c.o
│ │ │ │ ├── icmp.c.o
│ │ │ │ └── udp.c.o
│ │ │ │ ├── global.c.o
│ │ │ │ └── ip_test.c.o
│ │ ├── ctest_ip_frag.dir
│ │ │ ├── C.includecache
│ │ │ ├── DependInfo.cmake
│ │ │ ├── build.make
│ │ │ ├── cmake_clean.cmake
│ │ │ ├── depend.internal
│ │ │ ├── depend.make
│ │ │ ├── flags.make
│ │ │ ├── link.txt
│ │ │ ├── progress.make
│ │ │ ├── src
│ │ │ │ ├── ip.c.o
│ │ │ │ └── utils.c.o
│ │ │ └── test
│ │ │ │ ├── faker
│ │ │ │ ├── arp.c.o
│ │ │ │ ├── icmp.c.o
│ │ │ │ └── udp.c.o
│ │ │ │ ├── global.c.o
│ │ │ │ └── ip_frag_test.c.o
│ │ ├── feature_tests.bin
│ │ ├── feature_tests.c
│ │ ├── feature_tests.cxx
│ │ ├── main.dir
│ │ │ ├── C.includecache
│ │ │ ├── DependInfo.cmake
│ │ │ ├── build.make
│ │ │ ├── cmake_clean.cmake
│ │ │ ├── depend.internal
│ │ │ ├── depend.make
│ │ │ ├── flags.make
│ │ │ ├── link.txt
│ │ │ ├── progress.make
│ │ │ └── src
│ │ │ │ ├── arp.c.o
│ │ │ │ ├── driver.c.o
│ │ │ │ ├── ethernet.c.o
│ │ │ │ ├── icmp.c.o
│ │ │ │ ├── ip.c.o
│ │ │ │ ├── main.c.o
│ │ │ │ ├── net.c.o
│ │ │ │ ├── udp.c.o
│ │ │ │ └── utils.c.o
│ │ └── progress.marks
│ ├── Makefile
│ ├── cmake_install.cmake
│ └── compile_commands.json
├── include
│ ├── arp.h
│ ├── config.h
│ ├── driver.h
│ ├── ethernet.h
│ ├── icmp.h
│ ├── ip.h
│ ├── net.h
│ ├── udp.h
│ └── utils.h
├── src
│ ├── arp.c
│ ├── driver.c
│ ├── ethernet.c
│ ├── icmp.c
│ ├── ip.c
│ ├── main.c
│ ├── net.c
│ ├── udp.c
│ └── utils.c
└── test
│ ├── .gitignore
│ ├── Makefile
│ ├── arp_test.c
│ ├── ctest_arp
│ ├── ctest_eth_in
│ ├── ctest_eth_out
│ ├── ctest_icmp
│ ├── ctest_ip
│ ├── ctest_ip_frag
│ ├── data
│ ├── arp_test
│ │ ├── demo_log
│ │ ├── demo_out.pcap
│ │ ├── in.pcap
│ │ ├── log
│ │ └── out.pcap
│ ├── eth_in
│ │ ├── demo_log
│ │ ├── demo_out.pcap
│ │ ├── in.pcap
│ │ ├── log
│ │ └── out.pcap
│ ├── eth_out
│ │ ├── demo_log
│ │ ├── demo_out.pcap
│ │ ├── in.pcap
│ │ ├── log
│ │ └── out.pcap
│ ├── icmp_test
│ │ ├── demo_log
│ │ ├── demo_out.pcap
│ │ ├── in.pcap
│ │ ├── log
│ │ └── out.pcap
│ ├── ip_frag_test
│ │ ├── demo_log
│ │ ├── in.txt
│ │ └── log
│ └── ip_test
│ │ ├── demo_log
│ │ ├── demo_out.pcap
│ │ ├── in.pcap
│ │ ├── log
│ │ └── out.pcap
│ ├── driver_test.c
│ ├── eth_in_test.c
│ ├── eth_out_test.c
│ ├── faker
│ ├── arp.c
│ ├── driver.c
│ ├── icmp.c
│ ├── ip.c
│ └── udp.c
│ ├── global.c
│ ├── icmp_test.c
│ ├── ip_frag_test.c
│ ├── ip_test.c
│ └── main
├── net_lab10
├── .idea
│ ├── misc.xml
│ ├── modules.xml
│ ├── net_lab10.iml
│ └── workspace.xml
├── net_lab10_client
│ ├── .idea
│ │ ├── misc.xml
│ │ ├── modules.xml
│ │ ├── net_lab10_client.iml
│ │ └── workspace.xml
│ ├── Goodbye.txt
│ ├── Hello.txt
│ ├── __pycache__
│ │ └── client.cpython-38.pyc
│ ├── client.py
│ └── main.py
└── net_lab10_server
│ ├── .idea
│ ├── misc.xml
│ ├── modules.xml
│ ├── net_lab10_server.iml
│ └── workspace.xml
│ ├── Goodbye.txt
│ ├── Hello.txt
│ └── server.py
└── net_lab11
├── .idea
├── misc.xml
├── modules.xml
├── net_lab11.iml
└── workspace.xml
├── image.py
├── networks.jpg
└── text.py
/README.md:
--------------------------------------------------------------------------------
1 | # HITsz-Computer-Network-Project
2 | 哈工大(深圳)计算机网络实验及设计文档
3 |
--------------------------------------------------------------------------------
/documents/lab10设计文档.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/documents/lab10设计文档.pdf
--------------------------------------------------------------------------------
/documents/lab11设计文档.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/documents/lab11设计文档.pdf
--------------------------------------------------------------------------------
/documents/lab2设计文档.md:
--------------------------------------------------------------------------------
1 | # 实验二设计文档
2 |
3 | ## 实验分析
4 |
5 | ### ICMP
6 |
7 | 1. 当MAC帧的类型字段=0x0800时,说明本帧的数据部分为IPv4类型。IPv4头部中的proto字段=1时,说明为ICMP报文格式。
8 |
9 | ```c
10 | ip_head = ethernet_head + 14;
11 | p = ip_head + 12;
12 | proto = (ip_head + 9)[0];
13 | ```
14 |
15 | 2. 32-39为ICMP头部
16 |
17 | * 32 :Type字段,说明 ICMP 报文的作用及格式。
18 |
19 | * 33 :Code字段,说明某种 ICMP 报文的类型。
20 |
21 | 
22 |
23 | 根据Type和Code的值分析ICMP的消息类型。
24 |
25 | * 34-35 :校验和
26 |
27 | * 36-37 :标识符
28 |
29 | ```c
30 | int be = (p[0] << 8) + p[1];
31 | printf("Identifier(BE):%d(0x%02x%02x)\n",be,p[0],p[1]);
32 | int le = (p[1] << 8) + p[0];
33 | printf("Identifier(LE):%d(0x%02x%02x)\n",le,p[1],p[0]);
34 | ```
35 |
36 | * 38-39 :序列号
37 |
38 | ```c
39 | be = (p[0] << 8) + p[1];
40 | printf("Sequence number(BE):%d(0x%02x%02x)\n",be,p[0],p[1]);
41 | le = (p[1] << 8) + p[0];
42 | printf("Sequence number(LE):%d(0x%02x%02x)\n\n",le,p[1],p[0]);
43 | ```
44 |
45 |
46 |
47 | ### ARP
48 |
49 | 1. 当MAC帧的类型字段=0x0806时,说明本帧的数据部分为ARP报文,然后对MAC帧进行解析。
50 |
51 | * 0-5字节为目的MAC地址。
52 | * 6-11字节为源MAC地址。
53 | * 12-13字节为帧类型,等于ARP的协议号0x0806。
54 |
55 | 2. 14-41字节为ARP报文,确定为ARP请求帧之后,对该部分报文做进一步解析。其中14-21为ARP报头。
56 |
57 | * 14-15 :硬件类型。表示 ARP 报文可以在哪种类型的网络上传输,值为1时表示 为以太网地址。(在代码中体现为hardware_type指针)
58 | * 16-17 :上层协议类型。表示硬件地址要映射的协议地址类型,映射 IP 地址时的 值为 0x0800。(在代码中体现为protocol_type指针)
59 | * 18 :标识 MAC 地址长度,为6。
60 | * 19 :标识 IP 地址长度,为4。
61 | * 20-21 :操作类型,指定本次 ARP 报文类型。2标识 ARP 请求报文,2标识 ARP 应答报文。(在代码中体现为temp = protocol_type + 4)
62 |
63 | 3. 剩下的是源MAC和源IP与目的MAC和目的IP的解析
64 |
65 | * 22-27 :源 MAC 地址,标识发送设备的硬件地址。
66 | * 28-31 :源 IP 地址,标识发送方设备的 IP 地址。
67 | * 32-37 :目的 MAC 地址,表示接收方设备的硬件地址,在请求报文中该字段值全为0,表示任意地址。
68 | * 38-41 :目的 IP 地址,表示接受方的 IP 地址。
69 |
70 | ## 程序运行截图
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/documents/lab6设计文档.md:
--------------------------------------------------------------------------------
1 | # 实验六设计文档
2 |
3 | ## 1. icmp_in 函数
4 |
5 | 函数功能:处理一个收到的数据包buf
6 |
7 | 1. 报文检查。
8 |
9 | * 报文长度:如果该数据包的长度小于icmp头部长度(8字节),则不处理。
10 | * 报文类型:报文是否为回显请求(type为8,code为0),若不是,则不处理。
11 | * 头部校验和字段:先缓存头部校验和,然后将该数据的校验和字段清零,再调用checksum16计算校验和**(注意:这里的计算长度为整个数据包的长度**),看是否和之前缓存的头部校验和相等。若不相等,则不处理。
12 |
13 | 以上检查均通过之后,转2。
14 |
15 | 2. 回送一个回显应答(ping应答)
16 |
17 | * 调用buf_init()函数初始化txbuf,初始化长度为收到的数据包buf的长度。将buf的数据拷贝到txbuf中(因为数据部分可以拷贝来自接收到的回显请求报文中的数据,之后再替换icmp头部)。
18 |
19 | * 填写icmp头部。type为0,code为0,校验和字段为0,标识和序列号和收到的回显请求报头的值相同。然后调用checksum16计算校验和(这里的计算长度为整个数据包的长度),得到的结果填入校验和字段。
20 |
21 | 填写完头部之后复制到txbuf的的前8个字节。
22 |
23 | * 调用ip_out()将封装好的ICMP报文发送到IP层,传入参数上层协议为icmp协议。
24 |
25 | ```c
26 | void icmp_in(buf_t *buf, uint8_t *src_ip)
27 | {
28 | if (buf->len < 8)
29 | {// 如果buf长度小于icmp头部长度(8字节),不处理
30 | return;
31 | }
32 | // 报文检查正确,继续
33 | icmp_hdr_t *icmp = (icmp_hdr_t *)buf->data;
34 | if ((icmp->type == ICMP_TYPE_ECHO_REQUEST) && (icmp->code == 0))
35 | {// 如果该报文的ICMP类型为回显请求
36 | // 检测校验和
37 | uint16_t hdr_checksum = swap16(icmp->checksum); // 缓存头部校验和字段(注意大小端转换)
38 | icmp->checksum = 0; // 将校验和字段清零
39 | if (hdr_checksum != checksum16((uint16_t *)buf->data, buf->len)) // 整个icmp数据报都需要检测
40 | {// 计算的结果与之前缓存的校验和不一致, 不处理
41 | return;
42 | }
43 |
44 | // 校验和正确,继续
45 | buf_init(&txbuf, buf->len); // 调用buf_init()函数初始化txbuf
46 | memcpy(txbuf.data, buf->data, buf->len); // 数据部分拷贝来自接收到的回显请求报文中的数据
47 |
48 | // 填写icmp头部
49 | icmp_hdr_t header;
50 | header.type = ICMP_TYPE_ECHO_REPLY;
51 | header.code = 0;
52 | header.checksum = swap16(0);
53 | header.id = icmp->id;
54 | header.seq = icmp->seq;
55 |
56 | // 添加icmp头部
57 | memcpy(txbuf.data, &header, sizeof(icmp_hdr_t));
58 | // 计算校验和
59 | header.checksum = swap16(checksum16((uint16_t *)txbuf.data, txbuf.len));
60 | memcpy(txbuf.data, &header, sizeof(icmp_hdr_t));
61 |
62 | // 将封装好的ICMP报文发送到IP层
63 | ip_out(&txbuf, src_ip, NET_PROTOCOL_ICMP);
64 | return;
65 | }
66 |
67 | }
68 | ```
69 |
70 |
71 |
72 | ## 2. icmp_unreachable 函数
73 |
74 | 函数功能:发送icmp不可达报文。
75 |
76 | 1. 调用buf_init()函数初始化一个buf,初始化长度为IP头部 + 原始IP数据报中的前8字节的buf。然后将IP头部和原始IP数据报中的前8字节拷贝到buf中。
77 |
78 | ```c
79 | buf_t buf;
80 | // 先初始化长度为IP头部 + 原始IP数据报中的前8字节的buf
81 | buf_init(&buf, sizeof(ip_hdr_t) + 8);
82 | // 将IP头部和原始IP数据报中的前8字节拷贝到buf中
83 | memcpy(buf.data, recv_buf->data, sizeof(ip_hdr_t) + 8);
84 | ```
85 |
86 | 2. 填写ICMP报头首部。type为3表示目的不可达;code为传入参数;**标识和序列号必须为0。**
87 |
88 | 将校验和字段填写为0。然后调用buf_add_header()对buf增加icmp头部缓存空间。将填写完的ICMP报头首部赋值到buf中。然后调用checksum16计算校验和(这里的计算长度为整个数据包的长度),将得到的结果填入ICMP报头的校验和字段。
89 |
90 | ```c
91 | // 增加icmp头部缓存空间
92 | buf_add_header(&buf, sizeof(icmp_hdr_t));
93 | icmp_hdr_t header;
94 | header.type = ICMP_TYPE_UNREACH;
95 | header.code = code;
96 | header.id = swap16(0); // 必须为0
97 | header.seq = swap16(0); // 必须为0
98 | // 填写校验和
99 | header.checksum = swap16(0);
100 | memcpy(buf.data, &header, sizeof(icmp_hdr_t));
101 | header.checksum = swap16(checksum16((uint16_t *)buf.data, buf.len));
102 | memcpy(buf.data, &header, sizeof(icmp_hdr_t));
103 | ```
104 |
105 | 3. 调用ip_out()将封装好的ICMP报文发送到IP层,传入参数上层协议为icmp协议。
106 |
107 | ```c
108 | ip_out(&buf, src_ip, NET_PROTOCOL_ICMP);
109 | ```
110 |
111 | ## 3. 运行截图
112 |
113 | 
114 |
115 |
--------------------------------------------------------------------------------
/documents/lab9设计文档.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/documents/lab9设计文档.pdf
--------------------------------------------------------------------------------
/net_lab/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0.0)
2 | project(net VERSION 0.1.0)
3 |
4 | include_directories(./include ./pcap)
5 | aux_source_directory(./src DIR_SRCS)
6 | add_executable(main ${DIR_SRCS})
7 | target_link_libraries(main pcap)
8 |
9 |
10 | SET(EXECUTABLE_OUTPUT_PATH ../test)
11 | add_executable(ctest_icmp ./test/icmp_test.c ./src/ethernet.c ./src/arp.c ./src/ip.c ./src/icmp.c ./test/faker/udp.c ./test/faker/driver.c ./test/global.c ./src/utils.c)
12 | target_link_libraries(ctest_icmp pcap)
13 |
14 | add_executable(ctest_ip_frag ./test/ip_frag_test.c ./test/faker/arp.c ./src/ip.c ./test/faker/icmp.c ./test/faker/udp.c ./test/global.c ./src/utils.c)
15 | target_link_libraries(ctest_ip_frag pcap)
16 |
17 | add_executable(ctest_ip ./test/ip_test.c ./src/ethernet.c ./src/arp.c ./src/ip.c ./test/faker/icmp.c ./test/faker/udp.c ./test/faker/driver.c ./test/global.c ./src/utils.c)
18 | target_link_libraries(ctest_ip pcap)
19 |
20 | add_executable(ctest_arp ./test/arp_test.c ./src/ethernet.c ./src/arp.c ./test/faker/ip.c ./test/faker/driver.c ./test/global.c ./src/utils.c)
21 | target_link_libraries(ctest_arp pcap)
22 |
23 | add_executable(ctest_eth_out ./test/eth_out_test.c ./src/ethernet.c ./test/faker/arp.c ./test/faker/ip.c ./test/faker/driver.c ./test/global.c ./src/utils.c)
24 | target_link_libraries(ctest_eth_out pcap)
25 |
26 | add_executable(ctest_eth_in ./test/eth_in_test.c ./src/ethernet.c ./test/faker/arp.c ./test/faker/ip.c ./test/faker/driver.c ./test/global.c ./src/utils.c)
27 | target_link_libraries(ctest_eth_in pcap)
28 |
29 |
--------------------------------------------------------------------------------
/net_lab/FAQs.md:
--------------------------------------------------------------------------------
1 | # 常见问题
2 |
3 | ## 自测CMake调试方法
4 |
5 | CMake版本需不低于3.7.1。
6 | 如配置后无显示,使用*cmake --version*命令查看版本是否过低。如过低自行升级CMake
7 |
8 | 1. 首次运行需点击*Configure*按钮配置工程
9 | 2. 右键点击相应的测试,如*ctest_arp*
10 | 3. 在右键菜单里点击*Debug*调试,或点击*Run In Terminal*在终端中运行
11 |
12 | ## 自测wireshark调试方法
13 |
14 | *./test*的相应自测目录下有两个*pcap*文件 其中*demo*是标准样例包 另一个是自己协议栈发送的包 可用wireshark打开对比 利用其强大的分析功能很容易定位错误。
15 |
16 | ## wireshark校验和
17 |
18 | wireshark看着一切正常但是自测就是不过,或者UDP调试工具就是收不到大概率是校验和写错了,wireshark默认不校验所有协议的校验和。
19 | 如何打开wireshark的校验和功能自行百度。
20 |
21 | ## 填包
22 |
23 | 很多同学没有使用头文件里提供的数据包结构体 直接像写汇编一样操作字节流了 这种方法编写效率低 容易出错 可读性差,建议将字节数组转为相应的结构体指针后使用结构体语法进行操作,正常的网络编程也都是这么做的
24 |
25 | ## 检包
26 |
27 | 收到包之后包头的每个字段都要检查是否有误 如ip版本是否是ipv4 不能只看chksum
28 |
29 | ## 设计文档
30 |
31 | 文档里设计思路会纳入评分(虽然不多) 设计思路也是证明实验是独立完成的重要依据 有分数追求的大佬(juanwang)们不要只放代码和指导书的截图。
32 |
33 | ## UDP实验段错误
34 |
35 | 大概率没sudo。
36 |
37 | ## UDP实验IP
38 |
39 | udp实验 必须确保虚拟机linux系统的ip和自己协议栈config.h的ip**不一样** 否则我们可能会给你零分 因为没人能确认到底是你自己的协议栈在工作还是系统协议栈在工作
40 |
41 | ## 收到包长度变长
42 |
43 | 以太网最小传输单元46字节,小于则网卡自动填充到46。再加上14字节以太网头部,共60字节。
44 |
45 | ## udp奇数字节校验和
46 |
47 | checksum16函数本来就应该能够处理奇数字节,没必要真的去填充0,但是测试用例并没有奇数的 所以写不写都可。
48 |
49 | ## 拷贝buf
50 |
51 | 两个buf之间拷贝需要使用*buf_copy*函数,不能直接memcpy。具体原因可自己思考。
52 |
53 | ## 段错误怎么调试,结构体怎么操作,函数指针是什么???
54 |
55 | 可以去旁听大一C语言课程找答案。
56 |
--------------------------------------------------------------------------------
/net_lab/NET_ProPlusMax.md:
--------------------------------------------------------------------------------
1 | # 附加实验
2 |
3 | 为了让**学有余力**的同学对计算机网络协议栈有更深入的了解,我们设计了以下的附加实验。
4 |
5 | 附加实验仅针对学有余力的同学,没有标准程序作参考,只需要达到实验要求即可;而相应的,实验团队将仅给予**有限的技术支持**。
6 | 附加实验需要提交代码及详细的说明文档,文档需要阐述设计思路,展示测试结果,并对具体实验要求进行**逐点说明**。
7 |
8 | 附加实验将执行**严格的反作弊机制**,对于侦测到的雷同代码不仅不予加分,还可能会影响到基础实验的分数。
9 |
10 | ## PING
11 |
12 | 在完成本实验所有实验要求的情况下,实验分加1分(不会超过20分满分)。
13 |
14 | 在基础实验中,我们实现了ICMP协议的回复和不可达。
15 | 在附加实验中,我们希望同学们实现一个主动发起ICMP请求并监听回复的程序,就像PING一样(但是不需要实现PING的DNS解析功能)。
16 | 具体实验要求为:
17 |
18 | 1. 你需要在icmp.h,icmp.c中添加相应的ICMP请求函数,该函数接收一个IP地址作为参数,发起ICMP请求。
19 | 2. 你需要在main.c中每隔一秒调用一次ICMP请求函数,至少四次(不要使用sleep,因为这会阻塞主循环,你需要像ARP协议一样判断时间戳)
20 | 3. 你需要记录每个ICMP请求的ID和时间戳,并在icmp_in函数中添加对ICMP应答的处理,按照PING的格式进行打印
21 | 4. 你需要为每个ICMP请求维护一个生存时间(仿照ARP协议),在超过生存时间后不再继续等待回复,认为其已经超时
22 | 5. 你需要在PING执行结束后打印统计信息,报告最小,最大和平均响应时间,及丢包率。
23 |
24 | ## IP重组
25 |
26 | 在完成本实验所有实验要求的情况下,实验分加1分(不会超过20分满分)。
27 |
28 | 在基础实验的网络层,我们实现了IP大包的分片,这是很容易的事情。
29 | 但是由于网络环境的复杂性,不同IP包的不同分片可能以乱序到达,同一个IP包的分片可能不等长,部分分片可能丢包。
30 | 所以,IP重组是一个复杂的工作,具体的实验要求为:
31 |
32 | 1. 你可以直接在ip.c的ip_in函数中修改代码,并添加你认为需要添加的其他函数,就像ip_out和ip_fragment_out的关系一样
33 | 2. 你需要设计一个数据结构,其可以快速定位并乱序插入单个IP包的不同分片,也能够判断是否已经重组完成
34 | 3. 你需要为每个IP包维护一个生存时间(仿照ARP协议),在每次分片到达时更新该时间,在超过生存时间后丢弃整个未完成的IP包,以避免丢包导致的内存泄露
35 | 4. 你需要处理多个IP包的分片乱序到达的情况,如A,B两个IP包,各分为两片,到达顺序为A1->B2->B1->A2
36 | 5. 你需要处理同一个IP包的分片不等长的情况,这在链路聚合等复杂网络情况下是可能的
37 |
38 | ## 简易TCP协议
39 |
40 | 在完成本实验所有实验要求,并且此前完成了所有基础实验的情况下,实验分给予20分满分。
41 |
42 | 在基础实验的传输层,我们实现了完整的UDP协议,这并不困难。
43 | 而另一个在传输层被广泛使用的TCP协议,其完整实现的难度不亚于目前基础实验的整个协议栈。
44 | 为了降低难度,我们希望学有余力的同学实现一个简单的TCP协议。
45 | 这个简易的协议只需要实现TCP状态转换图中的一个常用的子图,并且不需要实现流量控制机制。
46 | 具体的实验要求为:
47 |
48 | 1. 你需要修改协议栈的结构,添加tcp.c和tcp.h文件,修改net.c的net_init函数(如果你的tcp需要初始化)
49 | 2. 你需要实现TCP的双向连接,你的协议既可以作为服务器被动接受连接,也可以作为客户端主动发起连接
50 | 3. 你需要实现与上层处理程序交互的过程,可以仿照UDP协议,也可以另辟蹊径
51 | 4. 你需要实现TCP三次握手,四次挥手的流程,但错误处理不是必须的,你只需要实现正常的流程
52 | 5. 你需要实现拥塞窗口,为了简化实验,其固定大小为4;但注意,实际的发送窗口还需要取决于接收方通告的接收窗口大小
53 | 6. 你需要实现接收窗口,并向发送端进行通告,大小也可以为固定的4(在缓冲区未满的情况下)
54 | 7. 你需要实现完整的可靠交付机制,包括流式传输,数据包确认,超时重传,这是TCP协议的基础
55 | 8. 你的协议至少需要与我们提供的TCP/UDP调试工具在内网中稳定通信,就像UDP协议一样
56 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/3.10.2/CMakeCCompiler.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_C_COMPILER "/usr/bin/x86_64-linux-gnu-gcc-7")
2 | set(CMAKE_C_COMPILER_ARG1 "")
3 | set(CMAKE_C_COMPILER_ID "GNU")
4 | set(CMAKE_C_COMPILER_VERSION "7.5.0")
5 | set(CMAKE_C_COMPILER_VERSION_INTERNAL "")
6 | set(CMAKE_C_COMPILER_WRAPPER "")
7 | set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "11")
8 | set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert")
9 | set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes")
10 | set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros")
11 | set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert")
12 |
13 | set(CMAKE_C_PLATFORM_ID "Linux")
14 | set(CMAKE_C_SIMULATE_ID "")
15 | set(CMAKE_C_SIMULATE_VERSION "")
16 |
17 |
18 |
19 | set(CMAKE_AR "/usr/bin/ar")
20 | set(CMAKE_C_COMPILER_AR "/usr/bin/gcc-ar-7")
21 | set(CMAKE_RANLIB "/usr/bin/ranlib")
22 | set(CMAKE_C_COMPILER_RANLIB "/usr/bin/gcc-ranlib-7")
23 | set(CMAKE_LINKER "/usr/bin/ld")
24 | set(CMAKE_COMPILER_IS_GNUCC 1)
25 | set(CMAKE_C_COMPILER_LOADED 1)
26 | set(CMAKE_C_COMPILER_WORKS TRUE)
27 | set(CMAKE_C_ABI_COMPILED TRUE)
28 | set(CMAKE_COMPILER_IS_MINGW )
29 | set(CMAKE_COMPILER_IS_CYGWIN )
30 | if(CMAKE_COMPILER_IS_CYGWIN)
31 | set(CYGWIN 1)
32 | set(UNIX 1)
33 | endif()
34 |
35 | set(CMAKE_C_COMPILER_ENV_VAR "CC")
36 |
37 | if(CMAKE_COMPILER_IS_MINGW)
38 | set(MINGW 1)
39 | endif()
40 | set(CMAKE_C_COMPILER_ID_RUN 1)
41 | set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m)
42 | set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
43 | set(CMAKE_C_LINKER_PREFERENCE 10)
44 |
45 | # Save compiler ABI information.
46 | set(CMAKE_C_SIZEOF_DATA_PTR "8")
47 | set(CMAKE_C_COMPILER_ABI "ELF")
48 | set(CMAKE_C_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
49 |
50 | if(CMAKE_C_SIZEOF_DATA_PTR)
51 | set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}")
52 | endif()
53 |
54 | if(CMAKE_C_COMPILER_ABI)
55 | set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}")
56 | endif()
57 |
58 | if(CMAKE_C_LIBRARY_ARCHITECTURE)
59 | set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
60 | endif()
61 |
62 | set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "")
63 | if(CMAKE_C_CL_SHOWINCLUDES_PREFIX)
64 | set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}")
65 | endif()
66 |
67 |
68 |
69 |
70 |
71 | set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;gcc_s;c;gcc;gcc_s")
72 | set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/7;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib")
73 | set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
74 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/3.10.2/CMakeDetermineCompilerABI_C.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/3.10.2/CMakeDetermineCompilerABI_C.bin
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/3.10.2/CMakeDetermineCompilerABI_CXX.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/3.10.2/CMakeDetermineCompilerABI_CXX.bin
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/3.10.2/CMakeSystem.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_HOST_SYSTEM "Linux-4.15.0-34-generic")
2 | set(CMAKE_HOST_SYSTEM_NAME "Linux")
3 | set(CMAKE_HOST_SYSTEM_VERSION "4.15.0-34-generic")
4 | set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
5 |
6 |
7 |
8 | set(CMAKE_SYSTEM "Linux-4.15.0-34-generic")
9 | set(CMAKE_SYSTEM_NAME "Linux")
10 | set(CMAKE_SYSTEM_VERSION "4.15.0-34-generic")
11 | set(CMAKE_SYSTEM_PROCESSOR "x86_64")
12 |
13 | set(CMAKE_CROSSCOMPILING "FALSE")
14 |
15 | set(CMAKE_SYSTEM_LOADED 1)
16 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/3.10.2/CompilerIdC/a.out:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/3.10.2/CompilerIdC/a.out
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/3.10.2/CompilerIdCXX/a.out:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/3.10.2/CompilerIdCXX/a.out
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/CMakeDirectoryInformation.cmake:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10
3 |
4 | # Relative path conversion top directories.
5 | set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/parallels/Desktop/net_lab")
6 | set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/parallels/Desktop/net_lab/build")
7 |
8 | # Force unix paths in dependencies.
9 | set(CMAKE_FORCE_UNIX_PATHS 1)
10 |
11 |
12 | # The C and CXX include file regular expressions for this directory.
13 | set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$")
14 | set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$")
15 | set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})
16 | set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN})
17 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/Makefile.cmake:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10
3 |
4 | # The generator used is:
5 | set(CMAKE_DEPENDS_GENERATOR "Unix Makefiles")
6 |
7 | # The top level Makefile was generated from the following files:
8 | set(CMAKE_MAKEFILE_DEPENDS
9 | "CMakeCache.txt"
10 | "../CMakeLists.txt"
11 | "CMakeFiles/3.10.2/CMakeCCompiler.cmake"
12 | "CMakeFiles/3.10.2/CMakeCXXCompiler.cmake"
13 | "CMakeFiles/3.10.2/CMakeSystem.cmake"
14 | "/usr/share/cmake-3.10/Modules/CMakeCInformation.cmake"
15 | "/usr/share/cmake-3.10/Modules/CMakeCXXInformation.cmake"
16 | "/usr/share/cmake-3.10/Modules/CMakeCommonLanguageInclude.cmake"
17 | "/usr/share/cmake-3.10/Modules/CMakeGenericSystem.cmake"
18 | "/usr/share/cmake-3.10/Modules/CMakeLanguageInformation.cmake"
19 | "/usr/share/cmake-3.10/Modules/CMakeSystemSpecificInformation.cmake"
20 | "/usr/share/cmake-3.10/Modules/CMakeSystemSpecificInitialize.cmake"
21 | "/usr/share/cmake-3.10/Modules/Compiler/CMakeCommonCompilerMacros.cmake"
22 | "/usr/share/cmake-3.10/Modules/Compiler/GNU-C.cmake"
23 | "/usr/share/cmake-3.10/Modules/Compiler/GNU-CXX.cmake"
24 | "/usr/share/cmake-3.10/Modules/Compiler/GNU.cmake"
25 | "/usr/share/cmake-3.10/Modules/Platform/Linux-GNU-C.cmake"
26 | "/usr/share/cmake-3.10/Modules/Platform/Linux-GNU-CXX.cmake"
27 | "/usr/share/cmake-3.10/Modules/Platform/Linux-GNU.cmake"
28 | "/usr/share/cmake-3.10/Modules/Platform/Linux.cmake"
29 | "/usr/share/cmake-3.10/Modules/Platform/UnixPaths.cmake"
30 | )
31 |
32 | # The corresponding makefile is:
33 | set(CMAKE_MAKEFILE_OUTPUTS
34 | "Makefile"
35 | "CMakeFiles/cmake.check_cache"
36 | )
37 |
38 | # Byproducts of CMake generate step:
39 | set(CMAKE_MAKEFILE_PRODUCTS
40 | "CMakeFiles/CMakeDirectoryInformation.cmake"
41 | )
42 |
43 | # Dependency information for all targets:
44 | set(CMAKE_DEPEND_INFO_FILES
45 | "CMakeFiles/ctest_eth_in.dir/DependInfo.cmake"
46 | "CMakeFiles/ctest_icmp.dir/DependInfo.cmake"
47 | "CMakeFiles/main.dir/DependInfo.cmake"
48 | "CMakeFiles/ctest_ip.dir/DependInfo.cmake"
49 | "CMakeFiles/ctest_eth_out.dir/DependInfo.cmake"
50 | "CMakeFiles/ctest_ip_frag.dir/DependInfo.cmake"
51 | "CMakeFiles/ctest_arp.dir/DependInfo.cmake"
52 | )
53 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/TargetDirectories.txt:
--------------------------------------------------------------------------------
1 | /home/parallels/Desktop/net_lab/build/CMakeFiles/rebuild_cache.dir
2 | /home/parallels/Desktop/net_lab/build/CMakeFiles/edit_cache.dir
3 | /home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_eth_in.dir
4 | /home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_icmp.dir
5 | /home/parallels/Desktop/net_lab/build/CMakeFiles/main.dir
6 | /home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_ip.dir
7 | /home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_eth_out.dir
8 | /home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_ip_frag.dir
9 | /home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_arp.dir
10 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/cmake.check_cache:
--------------------------------------------------------------------------------
1 | # This file is generated by cmake for dependency checking of the CMakeCache.txt file
2 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_arp.dir/C.includecache:
--------------------------------------------------------------------------------
1 | #IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">])
2 |
3 | #IncludeRegexScan: ^.*$
4 |
5 | #IncludeRegexComplain: ^$
6 |
7 | #IncludeRegexTransform:
8 |
9 | .././include/arp.h
10 | stdint.h
11 | -
12 | time.h
13 | -
14 | config.h
15 | .././include/config.h
16 | net.h
17 | .././include/net.h
18 | utils.h
19 | .././include/utils.h
20 |
21 | .././include/config.h
22 |
23 | .././include/driver.h
24 | utils.h
25 | .././include/utils.h
26 |
27 | .././include/ethernet.h
28 | stdint.h
29 | -
30 | net.h
31 | .././include/net.h
32 | utils.h
33 | .././include/utils.h
34 |
35 | .././include/icmp.h
36 | stdint.h
37 | -
38 | utils.h
39 | .././include/utils.h
40 |
41 | .././include/ip.h
42 | stdint.h
43 | -
44 | net.h
45 | .././include/net.h
46 | utils.h
47 | .././include/utils.h
48 |
49 | .././include/net.h
50 | config.h
51 | .././include/config.h
52 | stdint.h
53 | -
54 |
55 | .././include/udp.h
56 | stdint.h
57 | -
58 | utils.h
59 | .././include/utils.h
60 |
61 | .././include/utils.h
62 | stdint.h
63 | -
64 | config.h
65 | .././include/config.h
66 |
67 | /home/parallels/Desktop/net_lab/src/arp.c
68 | arp.h
69 | /home/parallels/Desktop/net_lab/src/arp.h
70 | utils.h
71 | /home/parallels/Desktop/net_lab/src/utils.h
72 | ethernet.h
73 | /home/parallels/Desktop/net_lab/src/ethernet.h
74 | config.h
75 | /home/parallels/Desktop/net_lab/src/config.h
76 | string.h
77 | -
78 | stdio.h
79 | -
80 |
81 | /home/parallels/Desktop/net_lab/src/ethernet.c
82 | ethernet.h
83 | /home/parallels/Desktop/net_lab/src/ethernet.h
84 | utils.h
85 | /home/parallels/Desktop/net_lab/src/utils.h
86 | driver.h
87 | /home/parallels/Desktop/net_lab/src/driver.h
88 | arp.h
89 | /home/parallels/Desktop/net_lab/src/arp.h
90 | ip.h
91 | /home/parallels/Desktop/net_lab/src/ip.h
92 | string.h
93 | -
94 | stdio.h
95 | -
96 |
97 | /home/parallels/Desktop/net_lab/src/utils.c
98 | utils.h
99 | /home/parallels/Desktop/net_lab/src/utils.h
100 | stdio.h
101 | -
102 | stdlib.h
103 | -
104 | string.h
105 | -
106 |
107 | /home/parallels/Desktop/net_lab/test/arp_test.c
108 | stdio.h
109 | -
110 | string.h
111 | -
112 | driver.h
113 | /home/parallels/Desktop/net_lab/test/driver.h
114 | ethernet.h
115 | /home/parallels/Desktop/net_lab/test/ethernet.h
116 | arp.h
117 | /home/parallels/Desktop/net_lab/test/arp.h
118 |
119 | /home/parallels/Desktop/net_lab/test/faker/driver.c
120 | pcap.h
121 | -
122 | string.h
123 | -
124 | utils.h
125 | -
126 | config.h
127 | /home/parallels/Desktop/net_lab/test/faker/config.h
128 |
129 | /home/parallels/Desktop/net_lab/test/faker/ip.c
130 | ip.h
131 | /home/parallels/Desktop/net_lab/test/faker/ip.h
132 | arp.h
133 | /home/parallels/Desktop/net_lab/test/faker/arp.h
134 | icmp.h
135 | /home/parallels/Desktop/net_lab/test/faker/icmp.h
136 | udp.h
137 | /home/parallels/Desktop/net_lab/test/faker/udp.h
138 | string.h
139 | -
140 | stdio.h
141 | -
142 |
143 | /home/parallels/Desktop/net_lab/test/global.c
144 | stdio.h
145 | -
146 | stdlib.h
147 | -
148 | stdint.h
149 | -
150 | string.h
151 | -
152 | pcap.h
153 | -
154 | arp.h
155 | /home/parallels/Desktop/net_lab/test/arp.h
156 | utils.h
157 | /home/parallels/Desktop/net_lab/test/utils.h
158 |
159 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_arp.dir/DependInfo.cmake:
--------------------------------------------------------------------------------
1 | # The set of languages for which implicit dependencies are needed:
2 | set(CMAKE_DEPENDS_LANGUAGES
3 | "C"
4 | )
5 | # The set of files for implicit dependencies of each language:
6 | set(CMAKE_DEPENDS_CHECK_C
7 | "/home/parallels/Desktop/net_lab/src/arp.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_arp.dir/src/arp.c.o"
8 | "/home/parallels/Desktop/net_lab/src/ethernet.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_arp.dir/src/ethernet.c.o"
9 | "/home/parallels/Desktop/net_lab/src/utils.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_arp.dir/src/utils.c.o"
10 | "/home/parallels/Desktop/net_lab/test/arp_test.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_arp.dir/test/arp_test.c.o"
11 | "/home/parallels/Desktop/net_lab/test/faker/driver.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_arp.dir/test/faker/driver.c.o"
12 | "/home/parallels/Desktop/net_lab/test/faker/ip.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_arp.dir/test/faker/ip.c.o"
13 | "/home/parallels/Desktop/net_lab/test/global.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_arp.dir/test/global.c.o"
14 | )
15 | set(CMAKE_C_COMPILER_ID "GNU")
16 |
17 | # The include file search paths:
18 | set(CMAKE_C_TARGET_INCLUDE_PATH
19 | ".././include"
20 | ".././pcap"
21 | )
22 |
23 | # Targets to which this target links.
24 | set(CMAKE_TARGET_LINKED_INFO_FILES
25 | )
26 |
27 | # Fortran module output directory.
28 | set(CMAKE_Fortran_TARGET_MODULE_DIR "")
29 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_arp.dir/cmake_clean.cmake:
--------------------------------------------------------------------------------
1 | file(REMOVE_RECURSE
2 | "CMakeFiles/ctest_arp.dir/test/arp_test.c.o"
3 | "CMakeFiles/ctest_arp.dir/src/ethernet.c.o"
4 | "CMakeFiles/ctest_arp.dir/src/arp.c.o"
5 | "CMakeFiles/ctest_arp.dir/test/faker/ip.c.o"
6 | "CMakeFiles/ctest_arp.dir/test/faker/driver.c.o"
7 | "CMakeFiles/ctest_arp.dir/test/global.c.o"
8 | "CMakeFiles/ctest_arp.dir/src/utils.c.o"
9 | "../test/ctest_arp.pdb"
10 | "../test/ctest_arp"
11 | )
12 |
13 | # Per-language clean rules from dependency scanning.
14 | foreach(lang C)
15 | include(CMakeFiles/ctest_arp.dir/cmake_clean_${lang}.cmake OPTIONAL)
16 | endforeach()
17 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_arp.dir/depend.internal:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10
3 |
4 | CMakeFiles/ctest_arp.dir/src/arp.c.o
5 | .././include/arp.h
6 | .././include/config.h
7 | .././include/ethernet.h
8 | .././include/net.h
9 | .././include/utils.h
10 | /home/parallels/Desktop/net_lab/src/arp.c
11 | CMakeFiles/ctest_arp.dir/src/ethernet.c.o
12 | .././include/arp.h
13 | .././include/config.h
14 | .././include/driver.h
15 | .././include/ethernet.h
16 | .././include/ip.h
17 | .././include/net.h
18 | .././include/utils.h
19 | /home/parallels/Desktop/net_lab/src/ethernet.c
20 | CMakeFiles/ctest_arp.dir/src/utils.c.o
21 | .././include/config.h
22 | .././include/utils.h
23 | /home/parallels/Desktop/net_lab/src/utils.c
24 | CMakeFiles/ctest_arp.dir/test/arp_test.c.o
25 | .././include/arp.h
26 | .././include/config.h
27 | .././include/driver.h
28 | .././include/ethernet.h
29 | .././include/net.h
30 | .././include/utils.h
31 | /home/parallels/Desktop/net_lab/test/arp_test.c
32 | CMakeFiles/ctest_arp.dir/test/faker/driver.c.o
33 | .././include/config.h
34 | .././include/utils.h
35 | /home/parallels/Desktop/net_lab/test/faker/driver.c
36 | CMakeFiles/ctest_arp.dir/test/faker/ip.c.o
37 | .././include/arp.h
38 | .././include/config.h
39 | .././include/icmp.h
40 | .././include/ip.h
41 | .././include/net.h
42 | .././include/udp.h
43 | .././include/utils.h
44 | /home/parallels/Desktop/net_lab/test/faker/ip.c
45 | CMakeFiles/ctest_arp.dir/test/global.c.o
46 | .././include/arp.h
47 | .././include/config.h
48 | .././include/net.h
49 | .././include/utils.h
50 | /home/parallels/Desktop/net_lab/test/global.c
51 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_arp.dir/depend.make:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10
3 |
4 | CMakeFiles/ctest_arp.dir/src/arp.c.o: .././include/arp.h
5 | CMakeFiles/ctest_arp.dir/src/arp.c.o: .././include/config.h
6 | CMakeFiles/ctest_arp.dir/src/arp.c.o: .././include/ethernet.h
7 | CMakeFiles/ctest_arp.dir/src/arp.c.o: .././include/net.h
8 | CMakeFiles/ctest_arp.dir/src/arp.c.o: .././include/utils.h
9 | CMakeFiles/ctest_arp.dir/src/arp.c.o: ../src/arp.c
10 |
11 | CMakeFiles/ctest_arp.dir/src/ethernet.c.o: .././include/arp.h
12 | CMakeFiles/ctest_arp.dir/src/ethernet.c.o: .././include/config.h
13 | CMakeFiles/ctest_arp.dir/src/ethernet.c.o: .././include/driver.h
14 | CMakeFiles/ctest_arp.dir/src/ethernet.c.o: .././include/ethernet.h
15 | CMakeFiles/ctest_arp.dir/src/ethernet.c.o: .././include/ip.h
16 | CMakeFiles/ctest_arp.dir/src/ethernet.c.o: .././include/net.h
17 | CMakeFiles/ctest_arp.dir/src/ethernet.c.o: .././include/utils.h
18 | CMakeFiles/ctest_arp.dir/src/ethernet.c.o: ../src/ethernet.c
19 |
20 | CMakeFiles/ctest_arp.dir/src/utils.c.o: .././include/config.h
21 | CMakeFiles/ctest_arp.dir/src/utils.c.o: .././include/utils.h
22 | CMakeFiles/ctest_arp.dir/src/utils.c.o: ../src/utils.c
23 |
24 | CMakeFiles/ctest_arp.dir/test/arp_test.c.o: .././include/arp.h
25 | CMakeFiles/ctest_arp.dir/test/arp_test.c.o: .././include/config.h
26 | CMakeFiles/ctest_arp.dir/test/arp_test.c.o: .././include/driver.h
27 | CMakeFiles/ctest_arp.dir/test/arp_test.c.o: .././include/ethernet.h
28 | CMakeFiles/ctest_arp.dir/test/arp_test.c.o: .././include/net.h
29 | CMakeFiles/ctest_arp.dir/test/arp_test.c.o: .././include/utils.h
30 | CMakeFiles/ctest_arp.dir/test/arp_test.c.o: ../test/arp_test.c
31 |
32 | CMakeFiles/ctest_arp.dir/test/faker/driver.c.o: .././include/config.h
33 | CMakeFiles/ctest_arp.dir/test/faker/driver.c.o: .././include/utils.h
34 | CMakeFiles/ctest_arp.dir/test/faker/driver.c.o: ../test/faker/driver.c
35 |
36 | CMakeFiles/ctest_arp.dir/test/faker/ip.c.o: .././include/arp.h
37 | CMakeFiles/ctest_arp.dir/test/faker/ip.c.o: .././include/config.h
38 | CMakeFiles/ctest_arp.dir/test/faker/ip.c.o: .././include/icmp.h
39 | CMakeFiles/ctest_arp.dir/test/faker/ip.c.o: .././include/ip.h
40 | CMakeFiles/ctest_arp.dir/test/faker/ip.c.o: .././include/net.h
41 | CMakeFiles/ctest_arp.dir/test/faker/ip.c.o: .././include/udp.h
42 | CMakeFiles/ctest_arp.dir/test/faker/ip.c.o: .././include/utils.h
43 | CMakeFiles/ctest_arp.dir/test/faker/ip.c.o: ../test/faker/ip.c
44 |
45 | CMakeFiles/ctest_arp.dir/test/global.c.o: .././include/arp.h
46 | CMakeFiles/ctest_arp.dir/test/global.c.o: .././include/config.h
47 | CMakeFiles/ctest_arp.dir/test/global.c.o: .././include/net.h
48 | CMakeFiles/ctest_arp.dir/test/global.c.o: .././include/utils.h
49 | CMakeFiles/ctest_arp.dir/test/global.c.o: ../test/global.c
50 |
51 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_arp.dir/flags.make:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10
3 |
4 | # compile C with /usr/bin/x86_64-linux-gnu-gcc-7
5 | C_FLAGS = -g
6 |
7 | C_DEFINES =
8 |
9 | C_INCLUDES = -I/home/parallels/Desktop/net_lab/./include -I/home/parallels/Desktop/net_lab/./pcap
10 |
11 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_arp.dir/link.txt:
--------------------------------------------------------------------------------
1 | /usr/bin/x86_64-linux-gnu-gcc-7 -g -rdynamic CMakeFiles/ctest_arp.dir/test/arp_test.c.o CMakeFiles/ctest_arp.dir/src/ethernet.c.o CMakeFiles/ctest_arp.dir/src/arp.c.o CMakeFiles/ctest_arp.dir/test/faker/ip.c.o CMakeFiles/ctest_arp.dir/test/faker/driver.c.o CMakeFiles/ctest_arp.dir/test/global.c.o CMakeFiles/ctest_arp.dir/src/utils.c.o -o ../test/ctest_arp -lpcap
2 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_arp.dir/progress.make:
--------------------------------------------------------------------------------
1 | CMAKE_PROGRESS_1 = 1
2 | CMAKE_PROGRESS_2 = 2
3 | CMAKE_PROGRESS_3 = 3
4 | CMAKE_PROGRESS_4 = 4
5 | CMAKE_PROGRESS_5 = 5
6 | CMAKE_PROGRESS_6 = 6
7 | CMAKE_PROGRESS_7 = 7
8 | CMAKE_PROGRESS_8 = 8
9 |
10 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_arp.dir/src/arp.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_arp.dir/src/arp.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_arp.dir/src/ethernet.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_arp.dir/src/ethernet.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_arp.dir/src/utils.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_arp.dir/src/utils.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_arp.dir/test/arp_test.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_arp.dir/test/arp_test.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_arp.dir/test/faker/driver.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_arp.dir/test/faker/driver.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_arp.dir/test/faker/ip.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_arp.dir/test/faker/ip.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_arp.dir/test/global.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_arp.dir/test/global.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_in.dir/C.includecache:
--------------------------------------------------------------------------------
1 | #IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">])
2 |
3 | #IncludeRegexScan: ^.*$
4 |
5 | #IncludeRegexComplain: ^$
6 |
7 | #IncludeRegexTransform:
8 |
9 | .././include/arp.h
10 | stdint.h
11 | -
12 | time.h
13 | -
14 | config.h
15 | .././include/config.h
16 | net.h
17 | .././include/net.h
18 | utils.h
19 | .././include/utils.h
20 |
21 | .././include/config.h
22 |
23 | .././include/driver.h
24 | utils.h
25 | .././include/utils.h
26 |
27 | .././include/ethernet.h
28 | stdint.h
29 | -
30 | net.h
31 | .././include/net.h
32 | utils.h
33 | .././include/utils.h
34 |
35 | .././include/icmp.h
36 | stdint.h
37 | -
38 | utils.h
39 | .././include/utils.h
40 |
41 | .././include/ip.h
42 | stdint.h
43 | -
44 | net.h
45 | .././include/net.h
46 | utils.h
47 | .././include/utils.h
48 |
49 | .././include/net.h
50 | config.h
51 | .././include/config.h
52 | stdint.h
53 | -
54 |
55 | .././include/udp.h
56 | stdint.h
57 | -
58 | utils.h
59 | .././include/utils.h
60 |
61 | .././include/utils.h
62 | stdint.h
63 | -
64 | config.h
65 | .././include/config.h
66 |
67 | /home/parallels/Desktop/net_lab/src/ethernet.c
68 | ethernet.h
69 | /home/parallels/Desktop/net_lab/src/ethernet.h
70 | utils.h
71 | /home/parallels/Desktop/net_lab/src/utils.h
72 | driver.h
73 | /home/parallels/Desktop/net_lab/src/driver.h
74 | arp.h
75 | /home/parallels/Desktop/net_lab/src/arp.h
76 | ip.h
77 | /home/parallels/Desktop/net_lab/src/ip.h
78 | string.h
79 | -
80 | stdio.h
81 | -
82 |
83 | /home/parallels/Desktop/net_lab/src/utils.c
84 | utils.h
85 | /home/parallels/Desktop/net_lab/src/utils.h
86 | stdio.h
87 | -
88 | stdlib.h
89 | -
90 | string.h
91 | -
92 |
93 | /home/parallels/Desktop/net_lab/test/eth_in_test.c
94 | stdio.h
95 | -
96 | driver.h
97 | /home/parallels/Desktop/net_lab/test/driver.h
98 | ethernet.h
99 | /home/parallels/Desktop/net_lab/test/ethernet.h
100 |
101 | /home/parallels/Desktop/net_lab/test/faker/arp.c
102 | arp.h
103 | /home/parallels/Desktop/net_lab/test/faker/arp.h
104 | utils.h
105 | /home/parallels/Desktop/net_lab/test/faker/utils.h
106 | ethernet.h
107 | /home/parallels/Desktop/net_lab/test/faker/ethernet.h
108 | config.h
109 | /home/parallels/Desktop/net_lab/test/faker/config.h
110 | string.h
111 | -
112 | stdio.h
113 | -
114 |
115 | /home/parallels/Desktop/net_lab/test/faker/driver.c
116 | pcap.h
117 | -
118 | string.h
119 | -
120 | utils.h
121 | -
122 | config.h
123 | /home/parallels/Desktop/net_lab/test/faker/config.h
124 |
125 | /home/parallels/Desktop/net_lab/test/faker/ip.c
126 | ip.h
127 | /home/parallels/Desktop/net_lab/test/faker/ip.h
128 | arp.h
129 | /home/parallels/Desktop/net_lab/test/faker/arp.h
130 | icmp.h
131 | /home/parallels/Desktop/net_lab/test/faker/icmp.h
132 | udp.h
133 | /home/parallels/Desktop/net_lab/test/faker/udp.h
134 | string.h
135 | -
136 | stdio.h
137 | -
138 |
139 | /home/parallels/Desktop/net_lab/test/global.c
140 | stdio.h
141 | -
142 | stdlib.h
143 | -
144 | stdint.h
145 | -
146 | string.h
147 | -
148 | pcap.h
149 | -
150 | arp.h
151 | /home/parallels/Desktop/net_lab/test/arp.h
152 | utils.h
153 | /home/parallels/Desktop/net_lab/test/utils.h
154 |
155 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_in.dir/DependInfo.cmake:
--------------------------------------------------------------------------------
1 | # The set of languages for which implicit dependencies are needed:
2 | set(CMAKE_DEPENDS_LANGUAGES
3 | "C"
4 | )
5 | # The set of files for implicit dependencies of each language:
6 | set(CMAKE_DEPENDS_CHECK_C
7 | "/home/parallels/Desktop/net_lab/src/ethernet.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_eth_in.dir/src/ethernet.c.o"
8 | "/home/parallels/Desktop/net_lab/src/utils.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_eth_in.dir/src/utils.c.o"
9 | "/home/parallels/Desktop/net_lab/test/eth_in_test.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_eth_in.dir/test/eth_in_test.c.o"
10 | "/home/parallels/Desktop/net_lab/test/faker/arp.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_eth_in.dir/test/faker/arp.c.o"
11 | "/home/parallels/Desktop/net_lab/test/faker/driver.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_eth_in.dir/test/faker/driver.c.o"
12 | "/home/parallels/Desktop/net_lab/test/faker/ip.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_eth_in.dir/test/faker/ip.c.o"
13 | "/home/parallels/Desktop/net_lab/test/global.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_eth_in.dir/test/global.c.o"
14 | )
15 | set(CMAKE_C_COMPILER_ID "GNU")
16 |
17 | # The include file search paths:
18 | set(CMAKE_C_TARGET_INCLUDE_PATH
19 | ".././include"
20 | ".././pcap"
21 | )
22 |
23 | # Targets to which this target links.
24 | set(CMAKE_TARGET_LINKED_INFO_FILES
25 | )
26 |
27 | # Fortran module output directory.
28 | set(CMAKE_Fortran_TARGET_MODULE_DIR "")
29 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_in.dir/cmake_clean.cmake:
--------------------------------------------------------------------------------
1 | file(REMOVE_RECURSE
2 | "CMakeFiles/ctest_eth_in.dir/test/eth_in_test.c.o"
3 | "CMakeFiles/ctest_eth_in.dir/src/ethernet.c.o"
4 | "CMakeFiles/ctest_eth_in.dir/test/faker/arp.c.o"
5 | "CMakeFiles/ctest_eth_in.dir/test/faker/ip.c.o"
6 | "CMakeFiles/ctest_eth_in.dir/test/faker/driver.c.o"
7 | "CMakeFiles/ctest_eth_in.dir/test/global.c.o"
8 | "CMakeFiles/ctest_eth_in.dir/src/utils.c.o"
9 | "../test/ctest_eth_in.pdb"
10 | "../test/ctest_eth_in"
11 | )
12 |
13 | # Per-language clean rules from dependency scanning.
14 | foreach(lang C)
15 | include(CMakeFiles/ctest_eth_in.dir/cmake_clean_${lang}.cmake OPTIONAL)
16 | endforeach()
17 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_in.dir/depend.internal:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10
3 |
4 | CMakeFiles/ctest_eth_in.dir/src/ethernet.c.o
5 | .././include/arp.h
6 | .././include/config.h
7 | .././include/driver.h
8 | .././include/ethernet.h
9 | .././include/ip.h
10 | .././include/net.h
11 | .././include/utils.h
12 | /home/parallels/Desktop/net_lab/src/ethernet.c
13 | CMakeFiles/ctest_eth_in.dir/src/utils.c.o
14 | .././include/config.h
15 | .././include/utils.h
16 | /home/parallels/Desktop/net_lab/src/utils.c
17 | CMakeFiles/ctest_eth_in.dir/test/eth_in_test.c.o
18 | .././include/config.h
19 | .././include/driver.h
20 | .././include/ethernet.h
21 | .././include/net.h
22 | .././include/utils.h
23 | /home/parallels/Desktop/net_lab/test/eth_in_test.c
24 | CMakeFiles/ctest_eth_in.dir/test/faker/arp.c.o
25 | .././include/arp.h
26 | .././include/config.h
27 | .././include/ethernet.h
28 | .././include/net.h
29 | .././include/utils.h
30 | /home/parallels/Desktop/net_lab/test/faker/arp.c
31 | CMakeFiles/ctest_eth_in.dir/test/faker/driver.c.o
32 | .././include/config.h
33 | .././include/utils.h
34 | /home/parallels/Desktop/net_lab/test/faker/driver.c
35 | CMakeFiles/ctest_eth_in.dir/test/faker/ip.c.o
36 | .././include/arp.h
37 | .././include/config.h
38 | .././include/icmp.h
39 | .././include/ip.h
40 | .././include/net.h
41 | .././include/udp.h
42 | .././include/utils.h
43 | /home/parallels/Desktop/net_lab/test/faker/ip.c
44 | CMakeFiles/ctest_eth_in.dir/test/global.c.o
45 | .././include/arp.h
46 | .././include/config.h
47 | .././include/net.h
48 | .././include/utils.h
49 | /home/parallels/Desktop/net_lab/test/global.c
50 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_in.dir/depend.make:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10
3 |
4 | CMakeFiles/ctest_eth_in.dir/src/ethernet.c.o: .././include/arp.h
5 | CMakeFiles/ctest_eth_in.dir/src/ethernet.c.o: .././include/config.h
6 | CMakeFiles/ctest_eth_in.dir/src/ethernet.c.o: .././include/driver.h
7 | CMakeFiles/ctest_eth_in.dir/src/ethernet.c.o: .././include/ethernet.h
8 | CMakeFiles/ctest_eth_in.dir/src/ethernet.c.o: .././include/ip.h
9 | CMakeFiles/ctest_eth_in.dir/src/ethernet.c.o: .././include/net.h
10 | CMakeFiles/ctest_eth_in.dir/src/ethernet.c.o: .././include/utils.h
11 | CMakeFiles/ctest_eth_in.dir/src/ethernet.c.o: ../src/ethernet.c
12 |
13 | CMakeFiles/ctest_eth_in.dir/src/utils.c.o: .././include/config.h
14 | CMakeFiles/ctest_eth_in.dir/src/utils.c.o: .././include/utils.h
15 | CMakeFiles/ctest_eth_in.dir/src/utils.c.o: ../src/utils.c
16 |
17 | CMakeFiles/ctest_eth_in.dir/test/eth_in_test.c.o: .././include/config.h
18 | CMakeFiles/ctest_eth_in.dir/test/eth_in_test.c.o: .././include/driver.h
19 | CMakeFiles/ctest_eth_in.dir/test/eth_in_test.c.o: .././include/ethernet.h
20 | CMakeFiles/ctest_eth_in.dir/test/eth_in_test.c.o: .././include/net.h
21 | CMakeFiles/ctest_eth_in.dir/test/eth_in_test.c.o: .././include/utils.h
22 | CMakeFiles/ctest_eth_in.dir/test/eth_in_test.c.o: ../test/eth_in_test.c
23 |
24 | CMakeFiles/ctest_eth_in.dir/test/faker/arp.c.o: .././include/arp.h
25 | CMakeFiles/ctest_eth_in.dir/test/faker/arp.c.o: .././include/config.h
26 | CMakeFiles/ctest_eth_in.dir/test/faker/arp.c.o: .././include/ethernet.h
27 | CMakeFiles/ctest_eth_in.dir/test/faker/arp.c.o: .././include/net.h
28 | CMakeFiles/ctest_eth_in.dir/test/faker/arp.c.o: .././include/utils.h
29 | CMakeFiles/ctest_eth_in.dir/test/faker/arp.c.o: ../test/faker/arp.c
30 |
31 | CMakeFiles/ctest_eth_in.dir/test/faker/driver.c.o: .././include/config.h
32 | CMakeFiles/ctest_eth_in.dir/test/faker/driver.c.o: .././include/utils.h
33 | CMakeFiles/ctest_eth_in.dir/test/faker/driver.c.o: ../test/faker/driver.c
34 |
35 | CMakeFiles/ctest_eth_in.dir/test/faker/ip.c.o: .././include/arp.h
36 | CMakeFiles/ctest_eth_in.dir/test/faker/ip.c.o: .././include/config.h
37 | CMakeFiles/ctest_eth_in.dir/test/faker/ip.c.o: .././include/icmp.h
38 | CMakeFiles/ctest_eth_in.dir/test/faker/ip.c.o: .././include/ip.h
39 | CMakeFiles/ctest_eth_in.dir/test/faker/ip.c.o: .././include/net.h
40 | CMakeFiles/ctest_eth_in.dir/test/faker/ip.c.o: .././include/udp.h
41 | CMakeFiles/ctest_eth_in.dir/test/faker/ip.c.o: .././include/utils.h
42 | CMakeFiles/ctest_eth_in.dir/test/faker/ip.c.o: ../test/faker/ip.c
43 |
44 | CMakeFiles/ctest_eth_in.dir/test/global.c.o: .././include/arp.h
45 | CMakeFiles/ctest_eth_in.dir/test/global.c.o: .././include/config.h
46 | CMakeFiles/ctest_eth_in.dir/test/global.c.o: .././include/net.h
47 | CMakeFiles/ctest_eth_in.dir/test/global.c.o: .././include/utils.h
48 | CMakeFiles/ctest_eth_in.dir/test/global.c.o: ../test/global.c
49 |
50 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_in.dir/flags.make:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10
3 |
4 | # compile C with /usr/bin/x86_64-linux-gnu-gcc-7
5 | C_FLAGS = -g
6 |
7 | C_DEFINES =
8 |
9 | C_INCLUDES = -I/home/parallels/Desktop/net_lab/./include -I/home/parallels/Desktop/net_lab/./pcap
10 |
11 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_in.dir/link.txt:
--------------------------------------------------------------------------------
1 | /usr/bin/x86_64-linux-gnu-gcc-7 -g -rdynamic CMakeFiles/ctest_eth_in.dir/test/eth_in_test.c.o CMakeFiles/ctest_eth_in.dir/src/ethernet.c.o CMakeFiles/ctest_eth_in.dir/test/faker/arp.c.o CMakeFiles/ctest_eth_in.dir/test/faker/ip.c.o CMakeFiles/ctest_eth_in.dir/test/faker/driver.c.o CMakeFiles/ctest_eth_in.dir/test/global.c.o CMakeFiles/ctest_eth_in.dir/src/utils.c.o -o ../test/ctest_eth_in -lpcap
2 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_in.dir/progress.make:
--------------------------------------------------------------------------------
1 | CMAKE_PROGRESS_1 = 9
2 | CMAKE_PROGRESS_2 = 10
3 | CMAKE_PROGRESS_3 = 11
4 | CMAKE_PROGRESS_4 = 12
5 | CMAKE_PROGRESS_5 = 13
6 | CMAKE_PROGRESS_6 = 14
7 | CMAKE_PROGRESS_7 = 15
8 | CMAKE_PROGRESS_8 = 16
9 |
10 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_in.dir/src/ethernet.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_eth_in.dir/src/ethernet.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_in.dir/src/utils.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_eth_in.dir/src/utils.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_in.dir/test/eth_in_test.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_eth_in.dir/test/eth_in_test.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_in.dir/test/faker/arp.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_eth_in.dir/test/faker/arp.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_in.dir/test/faker/driver.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_eth_in.dir/test/faker/driver.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_in.dir/test/faker/ip.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_eth_in.dir/test/faker/ip.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_in.dir/test/global.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_eth_in.dir/test/global.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_out.dir/C.includecache:
--------------------------------------------------------------------------------
1 | #IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">])
2 |
3 | #IncludeRegexScan: ^.*$
4 |
5 | #IncludeRegexComplain: ^$
6 |
7 | #IncludeRegexTransform:
8 |
9 | .././include/arp.h
10 | stdint.h
11 | -
12 | time.h
13 | -
14 | config.h
15 | .././include/config.h
16 | net.h
17 | .././include/net.h
18 | utils.h
19 | .././include/utils.h
20 |
21 | .././include/config.h
22 |
23 | .././include/driver.h
24 | utils.h
25 | .././include/utils.h
26 |
27 | .././include/ethernet.h
28 | stdint.h
29 | -
30 | net.h
31 | .././include/net.h
32 | utils.h
33 | .././include/utils.h
34 |
35 | .././include/icmp.h
36 | stdint.h
37 | -
38 | utils.h
39 | .././include/utils.h
40 |
41 | .././include/ip.h
42 | stdint.h
43 | -
44 | net.h
45 | .././include/net.h
46 | utils.h
47 | .././include/utils.h
48 |
49 | .././include/net.h
50 | config.h
51 | .././include/config.h
52 | stdint.h
53 | -
54 |
55 | .././include/udp.h
56 | stdint.h
57 | -
58 | utils.h
59 | .././include/utils.h
60 |
61 | .././include/utils.h
62 | stdint.h
63 | -
64 | config.h
65 | .././include/config.h
66 |
67 | /home/parallels/Desktop/net_lab/src/ethernet.c
68 | ethernet.h
69 | /home/parallels/Desktop/net_lab/src/ethernet.h
70 | utils.h
71 | /home/parallels/Desktop/net_lab/src/utils.h
72 | driver.h
73 | /home/parallels/Desktop/net_lab/src/driver.h
74 | arp.h
75 | /home/parallels/Desktop/net_lab/src/arp.h
76 | ip.h
77 | /home/parallels/Desktop/net_lab/src/ip.h
78 | string.h
79 | -
80 | stdio.h
81 | -
82 |
83 | /home/parallels/Desktop/net_lab/src/utils.c
84 | utils.h
85 | /home/parallels/Desktop/net_lab/src/utils.h
86 | stdio.h
87 | -
88 | stdlib.h
89 | -
90 | string.h
91 | -
92 |
93 | /home/parallels/Desktop/net_lab/test/eth_out_test.c
94 | stdio.h
95 | -
96 | string.h
97 | -
98 | driver.h
99 | /home/parallels/Desktop/net_lab/test/driver.h
100 | ethernet.h
101 | /home/parallels/Desktop/net_lab/test/ethernet.h
102 |
103 | /home/parallels/Desktop/net_lab/test/faker/arp.c
104 | arp.h
105 | /home/parallels/Desktop/net_lab/test/faker/arp.h
106 | utils.h
107 | /home/parallels/Desktop/net_lab/test/faker/utils.h
108 | ethernet.h
109 | /home/parallels/Desktop/net_lab/test/faker/ethernet.h
110 | config.h
111 | /home/parallels/Desktop/net_lab/test/faker/config.h
112 | string.h
113 | -
114 | stdio.h
115 | -
116 |
117 | /home/parallels/Desktop/net_lab/test/faker/driver.c
118 | pcap.h
119 | -
120 | string.h
121 | -
122 | utils.h
123 | -
124 | config.h
125 | /home/parallels/Desktop/net_lab/test/faker/config.h
126 |
127 | /home/parallels/Desktop/net_lab/test/faker/ip.c
128 | ip.h
129 | /home/parallels/Desktop/net_lab/test/faker/ip.h
130 | arp.h
131 | /home/parallels/Desktop/net_lab/test/faker/arp.h
132 | icmp.h
133 | /home/parallels/Desktop/net_lab/test/faker/icmp.h
134 | udp.h
135 | /home/parallels/Desktop/net_lab/test/faker/udp.h
136 | string.h
137 | -
138 | stdio.h
139 | -
140 |
141 | /home/parallels/Desktop/net_lab/test/global.c
142 | stdio.h
143 | -
144 | stdlib.h
145 | -
146 | stdint.h
147 | -
148 | string.h
149 | -
150 | pcap.h
151 | -
152 | arp.h
153 | /home/parallels/Desktop/net_lab/test/arp.h
154 | utils.h
155 | /home/parallels/Desktop/net_lab/test/utils.h
156 |
157 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_out.dir/DependInfo.cmake:
--------------------------------------------------------------------------------
1 | # The set of languages for which implicit dependencies are needed:
2 | set(CMAKE_DEPENDS_LANGUAGES
3 | "C"
4 | )
5 | # The set of files for implicit dependencies of each language:
6 | set(CMAKE_DEPENDS_CHECK_C
7 | "/home/parallels/Desktop/net_lab/src/ethernet.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_eth_out.dir/src/ethernet.c.o"
8 | "/home/parallels/Desktop/net_lab/src/utils.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_eth_out.dir/src/utils.c.o"
9 | "/home/parallels/Desktop/net_lab/test/eth_out_test.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_eth_out.dir/test/eth_out_test.c.o"
10 | "/home/parallels/Desktop/net_lab/test/faker/arp.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_eth_out.dir/test/faker/arp.c.o"
11 | "/home/parallels/Desktop/net_lab/test/faker/driver.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_eth_out.dir/test/faker/driver.c.o"
12 | "/home/parallels/Desktop/net_lab/test/faker/ip.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_eth_out.dir/test/faker/ip.c.o"
13 | "/home/parallels/Desktop/net_lab/test/global.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_eth_out.dir/test/global.c.o"
14 | )
15 | set(CMAKE_C_COMPILER_ID "GNU")
16 |
17 | # The include file search paths:
18 | set(CMAKE_C_TARGET_INCLUDE_PATH
19 | ".././include"
20 | ".././pcap"
21 | )
22 |
23 | # Targets to which this target links.
24 | set(CMAKE_TARGET_LINKED_INFO_FILES
25 | )
26 |
27 | # Fortran module output directory.
28 | set(CMAKE_Fortran_TARGET_MODULE_DIR "")
29 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_out.dir/cmake_clean.cmake:
--------------------------------------------------------------------------------
1 | file(REMOVE_RECURSE
2 | "CMakeFiles/ctest_eth_out.dir/test/eth_out_test.c.o"
3 | "CMakeFiles/ctest_eth_out.dir/src/ethernet.c.o"
4 | "CMakeFiles/ctest_eth_out.dir/test/faker/arp.c.o"
5 | "CMakeFiles/ctest_eth_out.dir/test/faker/ip.c.o"
6 | "CMakeFiles/ctest_eth_out.dir/test/faker/driver.c.o"
7 | "CMakeFiles/ctest_eth_out.dir/test/global.c.o"
8 | "CMakeFiles/ctest_eth_out.dir/src/utils.c.o"
9 | "../test/ctest_eth_out.pdb"
10 | "../test/ctest_eth_out"
11 | )
12 |
13 | # Per-language clean rules from dependency scanning.
14 | foreach(lang C)
15 | include(CMakeFiles/ctest_eth_out.dir/cmake_clean_${lang}.cmake OPTIONAL)
16 | endforeach()
17 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_out.dir/depend.internal:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10
3 |
4 | CMakeFiles/ctest_eth_out.dir/src/ethernet.c.o
5 | .././include/arp.h
6 | .././include/config.h
7 | .././include/driver.h
8 | .././include/ethernet.h
9 | .././include/ip.h
10 | .././include/net.h
11 | .././include/utils.h
12 | /home/parallels/Desktop/net_lab/src/ethernet.c
13 | CMakeFiles/ctest_eth_out.dir/src/utils.c.o
14 | .././include/config.h
15 | .././include/utils.h
16 | /home/parallels/Desktop/net_lab/src/utils.c
17 | CMakeFiles/ctest_eth_out.dir/test/eth_out_test.c.o
18 | .././include/config.h
19 | .././include/driver.h
20 | .././include/ethernet.h
21 | .././include/net.h
22 | .././include/utils.h
23 | /home/parallels/Desktop/net_lab/test/eth_out_test.c
24 | CMakeFiles/ctest_eth_out.dir/test/faker/arp.c.o
25 | .././include/arp.h
26 | .././include/config.h
27 | .././include/ethernet.h
28 | .././include/net.h
29 | .././include/utils.h
30 | /home/parallels/Desktop/net_lab/test/faker/arp.c
31 | CMakeFiles/ctest_eth_out.dir/test/faker/driver.c.o
32 | .././include/config.h
33 | .././include/utils.h
34 | /home/parallels/Desktop/net_lab/test/faker/driver.c
35 | CMakeFiles/ctest_eth_out.dir/test/faker/ip.c.o
36 | .././include/arp.h
37 | .././include/config.h
38 | .././include/icmp.h
39 | .././include/ip.h
40 | .././include/net.h
41 | .././include/udp.h
42 | .././include/utils.h
43 | /home/parallels/Desktop/net_lab/test/faker/ip.c
44 | CMakeFiles/ctest_eth_out.dir/test/global.c.o
45 | .././include/arp.h
46 | .././include/config.h
47 | .././include/net.h
48 | .././include/utils.h
49 | /home/parallels/Desktop/net_lab/test/global.c
50 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_out.dir/depend.make:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10
3 |
4 | CMakeFiles/ctest_eth_out.dir/src/ethernet.c.o: .././include/arp.h
5 | CMakeFiles/ctest_eth_out.dir/src/ethernet.c.o: .././include/config.h
6 | CMakeFiles/ctest_eth_out.dir/src/ethernet.c.o: .././include/driver.h
7 | CMakeFiles/ctest_eth_out.dir/src/ethernet.c.o: .././include/ethernet.h
8 | CMakeFiles/ctest_eth_out.dir/src/ethernet.c.o: .././include/ip.h
9 | CMakeFiles/ctest_eth_out.dir/src/ethernet.c.o: .././include/net.h
10 | CMakeFiles/ctest_eth_out.dir/src/ethernet.c.o: .././include/utils.h
11 | CMakeFiles/ctest_eth_out.dir/src/ethernet.c.o: ../src/ethernet.c
12 |
13 | CMakeFiles/ctest_eth_out.dir/src/utils.c.o: .././include/config.h
14 | CMakeFiles/ctest_eth_out.dir/src/utils.c.o: .././include/utils.h
15 | CMakeFiles/ctest_eth_out.dir/src/utils.c.o: ../src/utils.c
16 |
17 | CMakeFiles/ctest_eth_out.dir/test/eth_out_test.c.o: .././include/config.h
18 | CMakeFiles/ctest_eth_out.dir/test/eth_out_test.c.o: .././include/driver.h
19 | CMakeFiles/ctest_eth_out.dir/test/eth_out_test.c.o: .././include/ethernet.h
20 | CMakeFiles/ctest_eth_out.dir/test/eth_out_test.c.o: .././include/net.h
21 | CMakeFiles/ctest_eth_out.dir/test/eth_out_test.c.o: .././include/utils.h
22 | CMakeFiles/ctest_eth_out.dir/test/eth_out_test.c.o: ../test/eth_out_test.c
23 |
24 | CMakeFiles/ctest_eth_out.dir/test/faker/arp.c.o: .././include/arp.h
25 | CMakeFiles/ctest_eth_out.dir/test/faker/arp.c.o: .././include/config.h
26 | CMakeFiles/ctest_eth_out.dir/test/faker/arp.c.o: .././include/ethernet.h
27 | CMakeFiles/ctest_eth_out.dir/test/faker/arp.c.o: .././include/net.h
28 | CMakeFiles/ctest_eth_out.dir/test/faker/arp.c.o: .././include/utils.h
29 | CMakeFiles/ctest_eth_out.dir/test/faker/arp.c.o: ../test/faker/arp.c
30 |
31 | CMakeFiles/ctest_eth_out.dir/test/faker/driver.c.o: .././include/config.h
32 | CMakeFiles/ctest_eth_out.dir/test/faker/driver.c.o: .././include/utils.h
33 | CMakeFiles/ctest_eth_out.dir/test/faker/driver.c.o: ../test/faker/driver.c
34 |
35 | CMakeFiles/ctest_eth_out.dir/test/faker/ip.c.o: .././include/arp.h
36 | CMakeFiles/ctest_eth_out.dir/test/faker/ip.c.o: .././include/config.h
37 | CMakeFiles/ctest_eth_out.dir/test/faker/ip.c.o: .././include/icmp.h
38 | CMakeFiles/ctest_eth_out.dir/test/faker/ip.c.o: .././include/ip.h
39 | CMakeFiles/ctest_eth_out.dir/test/faker/ip.c.o: .././include/net.h
40 | CMakeFiles/ctest_eth_out.dir/test/faker/ip.c.o: .././include/udp.h
41 | CMakeFiles/ctest_eth_out.dir/test/faker/ip.c.o: .././include/utils.h
42 | CMakeFiles/ctest_eth_out.dir/test/faker/ip.c.o: ../test/faker/ip.c
43 |
44 | CMakeFiles/ctest_eth_out.dir/test/global.c.o: .././include/arp.h
45 | CMakeFiles/ctest_eth_out.dir/test/global.c.o: .././include/config.h
46 | CMakeFiles/ctest_eth_out.dir/test/global.c.o: .././include/net.h
47 | CMakeFiles/ctest_eth_out.dir/test/global.c.o: .././include/utils.h
48 | CMakeFiles/ctest_eth_out.dir/test/global.c.o: ../test/global.c
49 |
50 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_out.dir/flags.make:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10
3 |
4 | # compile C with /usr/bin/x86_64-linux-gnu-gcc-7
5 | C_FLAGS = -g
6 |
7 | C_DEFINES =
8 |
9 | C_INCLUDES = -I/home/parallels/Desktop/net_lab/./include -I/home/parallels/Desktop/net_lab/./pcap
10 |
11 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_out.dir/link.txt:
--------------------------------------------------------------------------------
1 | /usr/bin/x86_64-linux-gnu-gcc-7 -g -rdynamic CMakeFiles/ctest_eth_out.dir/test/eth_out_test.c.o CMakeFiles/ctest_eth_out.dir/src/ethernet.c.o CMakeFiles/ctest_eth_out.dir/test/faker/arp.c.o CMakeFiles/ctest_eth_out.dir/test/faker/ip.c.o CMakeFiles/ctest_eth_out.dir/test/faker/driver.c.o CMakeFiles/ctest_eth_out.dir/test/global.c.o CMakeFiles/ctest_eth_out.dir/src/utils.c.o -o ../test/ctest_eth_out -lpcap
2 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_out.dir/progress.make:
--------------------------------------------------------------------------------
1 | CMAKE_PROGRESS_1 = 17
2 | CMAKE_PROGRESS_2 = 18
3 | CMAKE_PROGRESS_3 = 19
4 | CMAKE_PROGRESS_4 = 20
5 | CMAKE_PROGRESS_5 = 21
6 | CMAKE_PROGRESS_6 = 22
7 | CMAKE_PROGRESS_7 = 23
8 | CMAKE_PROGRESS_8 = 24
9 |
10 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_out.dir/src/ethernet.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_eth_out.dir/src/ethernet.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_out.dir/src/utils.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_eth_out.dir/src/utils.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_out.dir/test/eth_out_test.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_eth_out.dir/test/eth_out_test.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_out.dir/test/faker/arp.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_eth_out.dir/test/faker/arp.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_out.dir/test/faker/driver.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_eth_out.dir/test/faker/driver.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_out.dir/test/faker/ip.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_eth_out.dir/test/faker/ip.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_eth_out.dir/test/global.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_eth_out.dir/test/global.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_icmp.dir/C.includecache:
--------------------------------------------------------------------------------
1 | #IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">])
2 |
3 | #IncludeRegexScan: ^.*$
4 |
5 | #IncludeRegexComplain: ^$
6 |
7 | #IncludeRegexTransform:
8 |
9 | .././include/arp.h
10 | stdint.h
11 | -
12 | time.h
13 | -
14 | config.h
15 | .././include/config.h
16 | net.h
17 | .././include/net.h
18 | utils.h
19 | .././include/utils.h
20 |
21 | .././include/config.h
22 |
23 | .././include/driver.h
24 | utils.h
25 | .././include/utils.h
26 |
27 | .././include/ethernet.h
28 | stdint.h
29 | -
30 | net.h
31 | .././include/net.h
32 | utils.h
33 | .././include/utils.h
34 |
35 | .././include/icmp.h
36 | stdint.h
37 | -
38 | utils.h
39 | .././include/utils.h
40 |
41 | .././include/ip.h
42 | stdint.h
43 | -
44 | net.h
45 | .././include/net.h
46 | utils.h
47 | .././include/utils.h
48 |
49 | .././include/net.h
50 | config.h
51 | .././include/config.h
52 | stdint.h
53 | -
54 |
55 | .././include/udp.h
56 | stdint.h
57 | -
58 | utils.h
59 | .././include/utils.h
60 |
61 | .././include/utils.h
62 | stdint.h
63 | -
64 | config.h
65 | .././include/config.h
66 |
67 | /home/parallels/Desktop/net_lab/src/arp.c
68 | arp.h
69 | /home/parallels/Desktop/net_lab/src/arp.h
70 | utils.h
71 | /home/parallels/Desktop/net_lab/src/utils.h
72 | ethernet.h
73 | /home/parallels/Desktop/net_lab/src/ethernet.h
74 | config.h
75 | /home/parallels/Desktop/net_lab/src/config.h
76 | string.h
77 | -
78 | stdio.h
79 | -
80 |
81 | /home/parallels/Desktop/net_lab/src/ethernet.c
82 | ethernet.h
83 | /home/parallels/Desktop/net_lab/src/ethernet.h
84 | utils.h
85 | /home/parallels/Desktop/net_lab/src/utils.h
86 | driver.h
87 | /home/parallels/Desktop/net_lab/src/driver.h
88 | arp.h
89 | /home/parallels/Desktop/net_lab/src/arp.h
90 | ip.h
91 | /home/parallels/Desktop/net_lab/src/ip.h
92 | string.h
93 | -
94 | stdio.h
95 | -
96 |
97 | /home/parallels/Desktop/net_lab/src/icmp.c
98 | icmp.h
99 | /home/parallels/Desktop/net_lab/src/icmp.h
100 | ip.h
101 | /home/parallels/Desktop/net_lab/src/ip.h
102 | string.h
103 | -
104 | stdio.h
105 | -
106 |
107 | /home/parallels/Desktop/net_lab/src/ip.c
108 | ip.h
109 | /home/parallels/Desktop/net_lab/src/ip.h
110 | arp.h
111 | /home/parallels/Desktop/net_lab/src/arp.h
112 | icmp.h
113 | /home/parallels/Desktop/net_lab/src/icmp.h
114 | udp.h
115 | /home/parallels/Desktop/net_lab/src/udp.h
116 | config.h
117 | /home/parallels/Desktop/net_lab/src/config.h
118 | string.h
119 | -
120 | stdlib.h
121 | -
122 |
123 | /home/parallels/Desktop/net_lab/src/utils.c
124 | utils.h
125 | /home/parallels/Desktop/net_lab/src/utils.h
126 | stdio.h
127 | -
128 | stdlib.h
129 | -
130 | string.h
131 | -
132 |
133 | /home/parallels/Desktop/net_lab/test/faker/driver.c
134 | pcap.h
135 | -
136 | string.h
137 | -
138 | utils.h
139 | -
140 | config.h
141 | /home/parallels/Desktop/net_lab/test/faker/config.h
142 |
143 | /home/parallels/Desktop/net_lab/test/faker/udp.c
144 | udp.h
145 | /home/parallels/Desktop/net_lab/test/faker/udp.h
146 | ip.h
147 | /home/parallels/Desktop/net_lab/test/faker/ip.h
148 | icmp.h
149 | /home/parallels/Desktop/net_lab/test/faker/icmp.h
150 | stdlib.h
151 | -
152 | string.h
153 | -
154 | stdio.h
155 | -
156 |
157 | /home/parallels/Desktop/net_lab/test/global.c
158 | stdio.h
159 | -
160 | stdlib.h
161 | -
162 | stdint.h
163 | -
164 | string.h
165 | -
166 | pcap.h
167 | -
168 | arp.h
169 | /home/parallels/Desktop/net_lab/test/arp.h
170 | utils.h
171 | /home/parallels/Desktop/net_lab/test/utils.h
172 |
173 | /home/parallels/Desktop/net_lab/test/icmp_test.c
174 | stdio.h
175 | -
176 | string.h
177 | -
178 | driver.h
179 | /home/parallels/Desktop/net_lab/test/driver.h
180 | ethernet.h
181 | /home/parallels/Desktop/net_lab/test/ethernet.h
182 | arp.h
183 | /home/parallels/Desktop/net_lab/test/arp.h
184 | ip.h
185 | /home/parallels/Desktop/net_lab/test/ip.h
186 |
187 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_icmp.dir/DependInfo.cmake:
--------------------------------------------------------------------------------
1 | # The set of languages for which implicit dependencies are needed:
2 | set(CMAKE_DEPENDS_LANGUAGES
3 | "C"
4 | )
5 | # The set of files for implicit dependencies of each language:
6 | set(CMAKE_DEPENDS_CHECK_C
7 | "/home/parallels/Desktop/net_lab/src/arp.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_icmp.dir/src/arp.c.o"
8 | "/home/parallels/Desktop/net_lab/src/ethernet.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_icmp.dir/src/ethernet.c.o"
9 | "/home/parallels/Desktop/net_lab/src/icmp.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_icmp.dir/src/icmp.c.o"
10 | "/home/parallels/Desktop/net_lab/src/ip.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_icmp.dir/src/ip.c.o"
11 | "/home/parallels/Desktop/net_lab/src/utils.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_icmp.dir/src/utils.c.o"
12 | "/home/parallels/Desktop/net_lab/test/faker/driver.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_icmp.dir/test/faker/driver.c.o"
13 | "/home/parallels/Desktop/net_lab/test/faker/udp.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_icmp.dir/test/faker/udp.c.o"
14 | "/home/parallels/Desktop/net_lab/test/global.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_icmp.dir/test/global.c.o"
15 | "/home/parallels/Desktop/net_lab/test/icmp_test.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_icmp.dir/test/icmp_test.c.o"
16 | )
17 | set(CMAKE_C_COMPILER_ID "GNU")
18 |
19 | # The include file search paths:
20 | set(CMAKE_C_TARGET_INCLUDE_PATH
21 | ".././include"
22 | ".././pcap"
23 | )
24 |
25 | # Targets to which this target links.
26 | set(CMAKE_TARGET_LINKED_INFO_FILES
27 | )
28 |
29 | # Fortran module output directory.
30 | set(CMAKE_Fortran_TARGET_MODULE_DIR "")
31 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_icmp.dir/cmake_clean.cmake:
--------------------------------------------------------------------------------
1 | file(REMOVE_RECURSE
2 | "CMakeFiles/ctest_icmp.dir/test/icmp_test.c.o"
3 | "CMakeFiles/ctest_icmp.dir/src/ethernet.c.o"
4 | "CMakeFiles/ctest_icmp.dir/src/arp.c.o"
5 | "CMakeFiles/ctest_icmp.dir/src/ip.c.o"
6 | "CMakeFiles/ctest_icmp.dir/src/icmp.c.o"
7 | "CMakeFiles/ctest_icmp.dir/test/faker/udp.c.o"
8 | "CMakeFiles/ctest_icmp.dir/test/faker/driver.c.o"
9 | "CMakeFiles/ctest_icmp.dir/test/global.c.o"
10 | "CMakeFiles/ctest_icmp.dir/src/utils.c.o"
11 | "../test/ctest_icmp.pdb"
12 | "../test/ctest_icmp"
13 | )
14 |
15 | # Per-language clean rules from dependency scanning.
16 | foreach(lang C)
17 | include(CMakeFiles/ctest_icmp.dir/cmake_clean_${lang}.cmake OPTIONAL)
18 | endforeach()
19 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_icmp.dir/depend.internal:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10
3 |
4 | CMakeFiles/ctest_icmp.dir/src/arp.c.o
5 | .././include/arp.h
6 | .././include/config.h
7 | .././include/ethernet.h
8 | .././include/net.h
9 | .././include/utils.h
10 | /home/parallels/Desktop/net_lab/src/arp.c
11 | CMakeFiles/ctest_icmp.dir/src/ethernet.c.o
12 | .././include/arp.h
13 | .././include/config.h
14 | .././include/driver.h
15 | .././include/ethernet.h
16 | .././include/ip.h
17 | .././include/net.h
18 | .././include/utils.h
19 | /home/parallels/Desktop/net_lab/src/ethernet.c
20 | CMakeFiles/ctest_icmp.dir/src/icmp.c.o
21 | .././include/config.h
22 | .././include/icmp.h
23 | .././include/ip.h
24 | .././include/net.h
25 | .././include/utils.h
26 | /home/parallels/Desktop/net_lab/src/icmp.c
27 | CMakeFiles/ctest_icmp.dir/src/ip.c.o
28 | .././include/arp.h
29 | .././include/config.h
30 | .././include/icmp.h
31 | .././include/ip.h
32 | .././include/net.h
33 | .././include/udp.h
34 | .././include/utils.h
35 | /home/parallels/Desktop/net_lab/src/ip.c
36 | CMakeFiles/ctest_icmp.dir/src/utils.c.o
37 | .././include/config.h
38 | .././include/utils.h
39 | /home/parallels/Desktop/net_lab/src/utils.c
40 | CMakeFiles/ctest_icmp.dir/test/faker/driver.c.o
41 | .././include/config.h
42 | .././include/utils.h
43 | /home/parallels/Desktop/net_lab/test/faker/driver.c
44 | CMakeFiles/ctest_icmp.dir/test/faker/udp.c.o
45 | .././include/config.h
46 | .././include/icmp.h
47 | .././include/ip.h
48 | .././include/net.h
49 | .././include/udp.h
50 | .././include/utils.h
51 | /home/parallels/Desktop/net_lab/test/faker/udp.c
52 | CMakeFiles/ctest_icmp.dir/test/global.c.o
53 | .././include/arp.h
54 | .././include/config.h
55 | .././include/net.h
56 | .././include/utils.h
57 | /home/parallels/Desktop/net_lab/test/global.c
58 | CMakeFiles/ctest_icmp.dir/test/icmp_test.c.o
59 | .././include/arp.h
60 | .././include/config.h
61 | .././include/driver.h
62 | .././include/ethernet.h
63 | .././include/ip.h
64 | .././include/net.h
65 | .././include/utils.h
66 | /home/parallels/Desktop/net_lab/test/icmp_test.c
67 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_icmp.dir/depend.make:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10
3 |
4 | CMakeFiles/ctest_icmp.dir/src/arp.c.o: .././include/arp.h
5 | CMakeFiles/ctest_icmp.dir/src/arp.c.o: .././include/config.h
6 | CMakeFiles/ctest_icmp.dir/src/arp.c.o: .././include/ethernet.h
7 | CMakeFiles/ctest_icmp.dir/src/arp.c.o: .././include/net.h
8 | CMakeFiles/ctest_icmp.dir/src/arp.c.o: .././include/utils.h
9 | CMakeFiles/ctest_icmp.dir/src/arp.c.o: ../src/arp.c
10 |
11 | CMakeFiles/ctest_icmp.dir/src/ethernet.c.o: .././include/arp.h
12 | CMakeFiles/ctest_icmp.dir/src/ethernet.c.o: .././include/config.h
13 | CMakeFiles/ctest_icmp.dir/src/ethernet.c.o: .././include/driver.h
14 | CMakeFiles/ctest_icmp.dir/src/ethernet.c.o: .././include/ethernet.h
15 | CMakeFiles/ctest_icmp.dir/src/ethernet.c.o: .././include/ip.h
16 | CMakeFiles/ctest_icmp.dir/src/ethernet.c.o: .././include/net.h
17 | CMakeFiles/ctest_icmp.dir/src/ethernet.c.o: .././include/utils.h
18 | CMakeFiles/ctest_icmp.dir/src/ethernet.c.o: ../src/ethernet.c
19 |
20 | CMakeFiles/ctest_icmp.dir/src/icmp.c.o: .././include/config.h
21 | CMakeFiles/ctest_icmp.dir/src/icmp.c.o: .././include/icmp.h
22 | CMakeFiles/ctest_icmp.dir/src/icmp.c.o: .././include/ip.h
23 | CMakeFiles/ctest_icmp.dir/src/icmp.c.o: .././include/net.h
24 | CMakeFiles/ctest_icmp.dir/src/icmp.c.o: .././include/utils.h
25 | CMakeFiles/ctest_icmp.dir/src/icmp.c.o: ../src/icmp.c
26 |
27 | CMakeFiles/ctest_icmp.dir/src/ip.c.o: .././include/arp.h
28 | CMakeFiles/ctest_icmp.dir/src/ip.c.o: .././include/config.h
29 | CMakeFiles/ctest_icmp.dir/src/ip.c.o: .././include/icmp.h
30 | CMakeFiles/ctest_icmp.dir/src/ip.c.o: .././include/ip.h
31 | CMakeFiles/ctest_icmp.dir/src/ip.c.o: .././include/net.h
32 | CMakeFiles/ctest_icmp.dir/src/ip.c.o: .././include/udp.h
33 | CMakeFiles/ctest_icmp.dir/src/ip.c.o: .././include/utils.h
34 | CMakeFiles/ctest_icmp.dir/src/ip.c.o: ../src/ip.c
35 |
36 | CMakeFiles/ctest_icmp.dir/src/utils.c.o: .././include/config.h
37 | CMakeFiles/ctest_icmp.dir/src/utils.c.o: .././include/utils.h
38 | CMakeFiles/ctest_icmp.dir/src/utils.c.o: ../src/utils.c
39 |
40 | CMakeFiles/ctest_icmp.dir/test/faker/driver.c.o: .././include/config.h
41 | CMakeFiles/ctest_icmp.dir/test/faker/driver.c.o: .././include/utils.h
42 | CMakeFiles/ctest_icmp.dir/test/faker/driver.c.o: ../test/faker/driver.c
43 |
44 | CMakeFiles/ctest_icmp.dir/test/faker/udp.c.o: .././include/config.h
45 | CMakeFiles/ctest_icmp.dir/test/faker/udp.c.o: .././include/icmp.h
46 | CMakeFiles/ctest_icmp.dir/test/faker/udp.c.o: .././include/ip.h
47 | CMakeFiles/ctest_icmp.dir/test/faker/udp.c.o: .././include/net.h
48 | CMakeFiles/ctest_icmp.dir/test/faker/udp.c.o: .././include/udp.h
49 | CMakeFiles/ctest_icmp.dir/test/faker/udp.c.o: .././include/utils.h
50 | CMakeFiles/ctest_icmp.dir/test/faker/udp.c.o: ../test/faker/udp.c
51 |
52 | CMakeFiles/ctest_icmp.dir/test/global.c.o: .././include/arp.h
53 | CMakeFiles/ctest_icmp.dir/test/global.c.o: .././include/config.h
54 | CMakeFiles/ctest_icmp.dir/test/global.c.o: .././include/net.h
55 | CMakeFiles/ctest_icmp.dir/test/global.c.o: .././include/utils.h
56 | CMakeFiles/ctest_icmp.dir/test/global.c.o: ../test/global.c
57 |
58 | CMakeFiles/ctest_icmp.dir/test/icmp_test.c.o: .././include/arp.h
59 | CMakeFiles/ctest_icmp.dir/test/icmp_test.c.o: .././include/config.h
60 | CMakeFiles/ctest_icmp.dir/test/icmp_test.c.o: .././include/driver.h
61 | CMakeFiles/ctest_icmp.dir/test/icmp_test.c.o: .././include/ethernet.h
62 | CMakeFiles/ctest_icmp.dir/test/icmp_test.c.o: .././include/ip.h
63 | CMakeFiles/ctest_icmp.dir/test/icmp_test.c.o: .././include/net.h
64 | CMakeFiles/ctest_icmp.dir/test/icmp_test.c.o: .././include/utils.h
65 | CMakeFiles/ctest_icmp.dir/test/icmp_test.c.o: ../test/icmp_test.c
66 |
67 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_icmp.dir/flags.make:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10
3 |
4 | # compile C with /usr/bin/x86_64-linux-gnu-gcc-7
5 | C_FLAGS = -g
6 |
7 | C_DEFINES =
8 |
9 | C_INCLUDES = -I/home/parallels/Desktop/net_lab/./include -I/home/parallels/Desktop/net_lab/./pcap
10 |
11 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_icmp.dir/link.txt:
--------------------------------------------------------------------------------
1 | /usr/bin/x86_64-linux-gnu-gcc-7 -g -rdynamic CMakeFiles/ctest_icmp.dir/test/icmp_test.c.o CMakeFiles/ctest_icmp.dir/src/ethernet.c.o CMakeFiles/ctest_icmp.dir/src/arp.c.o CMakeFiles/ctest_icmp.dir/src/ip.c.o CMakeFiles/ctest_icmp.dir/src/icmp.c.o CMakeFiles/ctest_icmp.dir/test/faker/udp.c.o CMakeFiles/ctest_icmp.dir/test/faker/driver.c.o CMakeFiles/ctest_icmp.dir/test/global.c.o CMakeFiles/ctest_icmp.dir/src/utils.c.o -o ../test/ctest_icmp -lpcap
2 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_icmp.dir/progress.make:
--------------------------------------------------------------------------------
1 | CMAKE_PROGRESS_1 = 25
2 | CMAKE_PROGRESS_2 = 26
3 | CMAKE_PROGRESS_3 = 27
4 | CMAKE_PROGRESS_4 = 28
5 | CMAKE_PROGRESS_5 = 29
6 | CMAKE_PROGRESS_6 = 30
7 | CMAKE_PROGRESS_7 = 31
8 | CMAKE_PROGRESS_8 = 32
9 | CMAKE_PROGRESS_9 = 33
10 | CMAKE_PROGRESS_10 = 34
11 |
12 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_icmp.dir/src/arp.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_icmp.dir/src/arp.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_icmp.dir/src/ethernet.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_icmp.dir/src/ethernet.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_icmp.dir/src/icmp.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_icmp.dir/src/icmp.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_icmp.dir/src/ip.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_icmp.dir/src/ip.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_icmp.dir/src/utils.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_icmp.dir/src/utils.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_icmp.dir/test/faker/driver.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_icmp.dir/test/faker/driver.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_icmp.dir/test/faker/udp.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_icmp.dir/test/faker/udp.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_icmp.dir/test/global.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_icmp.dir/test/global.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_icmp.dir/test/icmp_test.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_icmp.dir/test/icmp_test.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip.dir/C.includecache:
--------------------------------------------------------------------------------
1 | #IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">])
2 |
3 | #IncludeRegexScan: ^.*$
4 |
5 | #IncludeRegexComplain: ^$
6 |
7 | #IncludeRegexTransform:
8 |
9 | .././include/arp.h
10 | stdint.h
11 | -
12 | time.h
13 | -
14 | config.h
15 | .././include/config.h
16 | net.h
17 | .././include/net.h
18 | utils.h
19 | .././include/utils.h
20 |
21 | .././include/config.h
22 |
23 | .././include/driver.h
24 | utils.h
25 | .././include/utils.h
26 |
27 | .././include/ethernet.h
28 | stdint.h
29 | -
30 | net.h
31 | .././include/net.h
32 | utils.h
33 | .././include/utils.h
34 |
35 | .././include/icmp.h
36 | stdint.h
37 | -
38 | utils.h
39 | .././include/utils.h
40 |
41 | .././include/ip.h
42 | stdint.h
43 | -
44 | net.h
45 | .././include/net.h
46 | utils.h
47 | .././include/utils.h
48 |
49 | .././include/net.h
50 | config.h
51 | .././include/config.h
52 | stdint.h
53 | -
54 |
55 | .././include/udp.h
56 | stdint.h
57 | -
58 | utils.h
59 | .././include/utils.h
60 |
61 | .././include/utils.h
62 | stdint.h
63 | -
64 | config.h
65 | .././include/config.h
66 |
67 | /home/parallels/Desktop/net_lab/src/arp.c
68 | arp.h
69 | /home/parallels/Desktop/net_lab/src/arp.h
70 | utils.h
71 | /home/parallels/Desktop/net_lab/src/utils.h
72 | ethernet.h
73 | /home/parallels/Desktop/net_lab/src/ethernet.h
74 | config.h
75 | /home/parallels/Desktop/net_lab/src/config.h
76 | string.h
77 | -
78 | stdio.h
79 | -
80 |
81 | /home/parallels/Desktop/net_lab/src/ethernet.c
82 | ethernet.h
83 | /home/parallels/Desktop/net_lab/src/ethernet.h
84 | utils.h
85 | /home/parallels/Desktop/net_lab/src/utils.h
86 | driver.h
87 | /home/parallels/Desktop/net_lab/src/driver.h
88 | arp.h
89 | /home/parallels/Desktop/net_lab/src/arp.h
90 | ip.h
91 | /home/parallels/Desktop/net_lab/src/ip.h
92 | string.h
93 | -
94 | stdio.h
95 | -
96 |
97 | /home/parallels/Desktop/net_lab/src/ip.c
98 | ip.h
99 | /home/parallels/Desktop/net_lab/src/ip.h
100 | arp.h
101 | /home/parallels/Desktop/net_lab/src/arp.h
102 | icmp.h
103 | /home/parallels/Desktop/net_lab/src/icmp.h
104 | udp.h
105 | /home/parallels/Desktop/net_lab/src/udp.h
106 | config.h
107 | /home/parallels/Desktop/net_lab/src/config.h
108 | string.h
109 | -
110 | stdlib.h
111 | -
112 |
113 | /home/parallels/Desktop/net_lab/src/utils.c
114 | utils.h
115 | /home/parallels/Desktop/net_lab/src/utils.h
116 | stdio.h
117 | -
118 | stdlib.h
119 | -
120 | string.h
121 | -
122 |
123 | /home/parallels/Desktop/net_lab/test/faker/driver.c
124 | pcap.h
125 | -
126 | string.h
127 | -
128 | utils.h
129 | -
130 | config.h
131 | /home/parallels/Desktop/net_lab/test/faker/config.h
132 |
133 | /home/parallels/Desktop/net_lab/test/faker/icmp.c
134 | icmp.h
135 | /home/parallels/Desktop/net_lab/test/faker/icmp.h
136 | ip.h
137 | /home/parallels/Desktop/net_lab/test/faker/ip.h
138 | string.h
139 | -
140 | stdio.h
141 | -
142 |
143 | /home/parallels/Desktop/net_lab/test/faker/udp.c
144 | udp.h
145 | /home/parallels/Desktop/net_lab/test/faker/udp.h
146 | ip.h
147 | /home/parallels/Desktop/net_lab/test/faker/ip.h
148 | icmp.h
149 | /home/parallels/Desktop/net_lab/test/faker/icmp.h
150 | stdlib.h
151 | -
152 | string.h
153 | -
154 | stdio.h
155 | -
156 |
157 | /home/parallels/Desktop/net_lab/test/global.c
158 | stdio.h
159 | -
160 | stdlib.h
161 | -
162 | stdint.h
163 | -
164 | string.h
165 | -
166 | pcap.h
167 | -
168 | arp.h
169 | /home/parallels/Desktop/net_lab/test/arp.h
170 | utils.h
171 | /home/parallels/Desktop/net_lab/test/utils.h
172 |
173 | /home/parallels/Desktop/net_lab/test/ip_test.c
174 | stdio.h
175 | -
176 | string.h
177 | -
178 | driver.h
179 | /home/parallels/Desktop/net_lab/test/driver.h
180 | ethernet.h
181 | /home/parallels/Desktop/net_lab/test/ethernet.h
182 | arp.h
183 | /home/parallels/Desktop/net_lab/test/arp.h
184 | ip.h
185 | /home/parallels/Desktop/net_lab/test/ip.h
186 |
187 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip.dir/DependInfo.cmake:
--------------------------------------------------------------------------------
1 | # The set of languages for which implicit dependencies are needed:
2 | set(CMAKE_DEPENDS_LANGUAGES
3 | "C"
4 | )
5 | # The set of files for implicit dependencies of each language:
6 | set(CMAKE_DEPENDS_CHECK_C
7 | "/home/parallels/Desktop/net_lab/src/arp.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_ip.dir/src/arp.c.o"
8 | "/home/parallels/Desktop/net_lab/src/ethernet.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_ip.dir/src/ethernet.c.o"
9 | "/home/parallels/Desktop/net_lab/src/ip.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_ip.dir/src/ip.c.o"
10 | "/home/parallels/Desktop/net_lab/src/utils.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_ip.dir/src/utils.c.o"
11 | "/home/parallels/Desktop/net_lab/test/faker/driver.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_ip.dir/test/faker/driver.c.o"
12 | "/home/parallels/Desktop/net_lab/test/faker/icmp.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_ip.dir/test/faker/icmp.c.o"
13 | "/home/parallels/Desktop/net_lab/test/faker/udp.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_ip.dir/test/faker/udp.c.o"
14 | "/home/parallels/Desktop/net_lab/test/global.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_ip.dir/test/global.c.o"
15 | "/home/parallels/Desktop/net_lab/test/ip_test.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_ip.dir/test/ip_test.c.o"
16 | )
17 | set(CMAKE_C_COMPILER_ID "GNU")
18 |
19 | # The include file search paths:
20 | set(CMAKE_C_TARGET_INCLUDE_PATH
21 | ".././include"
22 | ".././pcap"
23 | )
24 |
25 | # Targets to which this target links.
26 | set(CMAKE_TARGET_LINKED_INFO_FILES
27 | )
28 |
29 | # Fortran module output directory.
30 | set(CMAKE_Fortran_TARGET_MODULE_DIR "")
31 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip.dir/cmake_clean.cmake:
--------------------------------------------------------------------------------
1 | file(REMOVE_RECURSE
2 | "CMakeFiles/ctest_ip.dir/test/ip_test.c.o"
3 | "CMakeFiles/ctest_ip.dir/src/ethernet.c.o"
4 | "CMakeFiles/ctest_ip.dir/src/arp.c.o"
5 | "CMakeFiles/ctest_ip.dir/src/ip.c.o"
6 | "CMakeFiles/ctest_ip.dir/test/faker/icmp.c.o"
7 | "CMakeFiles/ctest_ip.dir/test/faker/udp.c.o"
8 | "CMakeFiles/ctest_ip.dir/test/faker/driver.c.o"
9 | "CMakeFiles/ctest_ip.dir/test/global.c.o"
10 | "CMakeFiles/ctest_ip.dir/src/utils.c.o"
11 | "../test/ctest_ip.pdb"
12 | "../test/ctest_ip"
13 | )
14 |
15 | # Per-language clean rules from dependency scanning.
16 | foreach(lang C)
17 | include(CMakeFiles/ctest_ip.dir/cmake_clean_${lang}.cmake OPTIONAL)
18 | endforeach()
19 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip.dir/depend.internal:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10
3 |
4 | CMakeFiles/ctest_ip.dir/src/arp.c.o
5 | .././include/arp.h
6 | .././include/config.h
7 | .././include/ethernet.h
8 | .././include/net.h
9 | .././include/utils.h
10 | /home/parallels/Desktop/net_lab/src/arp.c
11 | CMakeFiles/ctest_ip.dir/src/ethernet.c.o
12 | .././include/arp.h
13 | .././include/config.h
14 | .././include/driver.h
15 | .././include/ethernet.h
16 | .././include/ip.h
17 | .././include/net.h
18 | .././include/utils.h
19 | /home/parallels/Desktop/net_lab/src/ethernet.c
20 | CMakeFiles/ctest_ip.dir/src/ip.c.o
21 | .././include/arp.h
22 | .././include/config.h
23 | .././include/icmp.h
24 | .././include/ip.h
25 | .././include/net.h
26 | .././include/udp.h
27 | .././include/utils.h
28 | /home/parallels/Desktop/net_lab/src/ip.c
29 | CMakeFiles/ctest_ip.dir/src/utils.c.o
30 | .././include/config.h
31 | .././include/utils.h
32 | /home/parallels/Desktop/net_lab/src/utils.c
33 | CMakeFiles/ctest_ip.dir/test/faker/driver.c.o
34 | .././include/config.h
35 | .././include/utils.h
36 | /home/parallels/Desktop/net_lab/test/faker/driver.c
37 | CMakeFiles/ctest_ip.dir/test/faker/icmp.c.o
38 | .././include/config.h
39 | .././include/icmp.h
40 | .././include/ip.h
41 | .././include/net.h
42 | .././include/utils.h
43 | /home/parallels/Desktop/net_lab/test/faker/icmp.c
44 | CMakeFiles/ctest_ip.dir/test/faker/udp.c.o
45 | .././include/config.h
46 | .././include/icmp.h
47 | .././include/ip.h
48 | .././include/net.h
49 | .././include/udp.h
50 | .././include/utils.h
51 | /home/parallels/Desktop/net_lab/test/faker/udp.c
52 | CMakeFiles/ctest_ip.dir/test/global.c.o
53 | .././include/arp.h
54 | .././include/config.h
55 | .././include/net.h
56 | .././include/utils.h
57 | /home/parallels/Desktop/net_lab/test/global.c
58 | CMakeFiles/ctest_ip.dir/test/ip_test.c.o
59 | .././include/arp.h
60 | .././include/config.h
61 | .././include/driver.h
62 | .././include/ethernet.h
63 | .././include/ip.h
64 | .././include/net.h
65 | .././include/utils.h
66 | /home/parallels/Desktop/net_lab/test/ip_test.c
67 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip.dir/depend.make:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10
3 |
4 | CMakeFiles/ctest_ip.dir/src/arp.c.o: .././include/arp.h
5 | CMakeFiles/ctest_ip.dir/src/arp.c.o: .././include/config.h
6 | CMakeFiles/ctest_ip.dir/src/arp.c.o: .././include/ethernet.h
7 | CMakeFiles/ctest_ip.dir/src/arp.c.o: .././include/net.h
8 | CMakeFiles/ctest_ip.dir/src/arp.c.o: .././include/utils.h
9 | CMakeFiles/ctest_ip.dir/src/arp.c.o: ../src/arp.c
10 |
11 | CMakeFiles/ctest_ip.dir/src/ethernet.c.o: .././include/arp.h
12 | CMakeFiles/ctest_ip.dir/src/ethernet.c.o: .././include/config.h
13 | CMakeFiles/ctest_ip.dir/src/ethernet.c.o: .././include/driver.h
14 | CMakeFiles/ctest_ip.dir/src/ethernet.c.o: .././include/ethernet.h
15 | CMakeFiles/ctest_ip.dir/src/ethernet.c.o: .././include/ip.h
16 | CMakeFiles/ctest_ip.dir/src/ethernet.c.o: .././include/net.h
17 | CMakeFiles/ctest_ip.dir/src/ethernet.c.o: .././include/utils.h
18 | CMakeFiles/ctest_ip.dir/src/ethernet.c.o: ../src/ethernet.c
19 |
20 | CMakeFiles/ctest_ip.dir/src/ip.c.o: .././include/arp.h
21 | CMakeFiles/ctest_ip.dir/src/ip.c.o: .././include/config.h
22 | CMakeFiles/ctest_ip.dir/src/ip.c.o: .././include/icmp.h
23 | CMakeFiles/ctest_ip.dir/src/ip.c.o: .././include/ip.h
24 | CMakeFiles/ctest_ip.dir/src/ip.c.o: .././include/net.h
25 | CMakeFiles/ctest_ip.dir/src/ip.c.o: .././include/udp.h
26 | CMakeFiles/ctest_ip.dir/src/ip.c.o: .././include/utils.h
27 | CMakeFiles/ctest_ip.dir/src/ip.c.o: ../src/ip.c
28 |
29 | CMakeFiles/ctest_ip.dir/src/utils.c.o: .././include/config.h
30 | CMakeFiles/ctest_ip.dir/src/utils.c.o: .././include/utils.h
31 | CMakeFiles/ctest_ip.dir/src/utils.c.o: ../src/utils.c
32 |
33 | CMakeFiles/ctest_ip.dir/test/faker/driver.c.o: .././include/config.h
34 | CMakeFiles/ctest_ip.dir/test/faker/driver.c.o: .././include/utils.h
35 | CMakeFiles/ctest_ip.dir/test/faker/driver.c.o: ../test/faker/driver.c
36 |
37 | CMakeFiles/ctest_ip.dir/test/faker/icmp.c.o: .././include/config.h
38 | CMakeFiles/ctest_ip.dir/test/faker/icmp.c.o: .././include/icmp.h
39 | CMakeFiles/ctest_ip.dir/test/faker/icmp.c.o: .././include/ip.h
40 | CMakeFiles/ctest_ip.dir/test/faker/icmp.c.o: .././include/net.h
41 | CMakeFiles/ctest_ip.dir/test/faker/icmp.c.o: .././include/utils.h
42 | CMakeFiles/ctest_ip.dir/test/faker/icmp.c.o: ../test/faker/icmp.c
43 |
44 | CMakeFiles/ctest_ip.dir/test/faker/udp.c.o: .././include/config.h
45 | CMakeFiles/ctest_ip.dir/test/faker/udp.c.o: .././include/icmp.h
46 | CMakeFiles/ctest_ip.dir/test/faker/udp.c.o: .././include/ip.h
47 | CMakeFiles/ctest_ip.dir/test/faker/udp.c.o: .././include/net.h
48 | CMakeFiles/ctest_ip.dir/test/faker/udp.c.o: .././include/udp.h
49 | CMakeFiles/ctest_ip.dir/test/faker/udp.c.o: .././include/utils.h
50 | CMakeFiles/ctest_ip.dir/test/faker/udp.c.o: ../test/faker/udp.c
51 |
52 | CMakeFiles/ctest_ip.dir/test/global.c.o: .././include/arp.h
53 | CMakeFiles/ctest_ip.dir/test/global.c.o: .././include/config.h
54 | CMakeFiles/ctest_ip.dir/test/global.c.o: .././include/net.h
55 | CMakeFiles/ctest_ip.dir/test/global.c.o: .././include/utils.h
56 | CMakeFiles/ctest_ip.dir/test/global.c.o: ../test/global.c
57 |
58 | CMakeFiles/ctest_ip.dir/test/ip_test.c.o: .././include/arp.h
59 | CMakeFiles/ctest_ip.dir/test/ip_test.c.o: .././include/config.h
60 | CMakeFiles/ctest_ip.dir/test/ip_test.c.o: .././include/driver.h
61 | CMakeFiles/ctest_ip.dir/test/ip_test.c.o: .././include/ethernet.h
62 | CMakeFiles/ctest_ip.dir/test/ip_test.c.o: .././include/ip.h
63 | CMakeFiles/ctest_ip.dir/test/ip_test.c.o: .././include/net.h
64 | CMakeFiles/ctest_ip.dir/test/ip_test.c.o: .././include/utils.h
65 | CMakeFiles/ctest_ip.dir/test/ip_test.c.o: ../test/ip_test.c
66 |
67 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip.dir/flags.make:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10
3 |
4 | # compile C with /usr/bin/x86_64-linux-gnu-gcc-7
5 | C_FLAGS = -g
6 |
7 | C_DEFINES =
8 |
9 | C_INCLUDES = -I/home/parallels/Desktop/net_lab/./include -I/home/parallels/Desktop/net_lab/./pcap
10 |
11 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip.dir/link.txt:
--------------------------------------------------------------------------------
1 | /usr/bin/x86_64-linux-gnu-gcc-7 -g -rdynamic CMakeFiles/ctest_ip.dir/test/ip_test.c.o CMakeFiles/ctest_ip.dir/src/ethernet.c.o CMakeFiles/ctest_ip.dir/src/arp.c.o CMakeFiles/ctest_ip.dir/src/ip.c.o CMakeFiles/ctest_ip.dir/test/faker/icmp.c.o CMakeFiles/ctest_ip.dir/test/faker/udp.c.o CMakeFiles/ctest_ip.dir/test/faker/driver.c.o CMakeFiles/ctest_ip.dir/test/global.c.o CMakeFiles/ctest_ip.dir/src/utils.c.o -o ../test/ctest_ip -lpcap
2 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip.dir/progress.make:
--------------------------------------------------------------------------------
1 | CMAKE_PROGRESS_1 = 35
2 | CMAKE_PROGRESS_2 = 36
3 | CMAKE_PROGRESS_3 = 37
4 | CMAKE_PROGRESS_4 = 38
5 | CMAKE_PROGRESS_5 = 39
6 | CMAKE_PROGRESS_6 = 40
7 | CMAKE_PROGRESS_7 = 41
8 | CMAKE_PROGRESS_8 = 42
9 | CMAKE_PROGRESS_9 = 43
10 | CMAKE_PROGRESS_10 = 44
11 |
12 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip.dir/src/arp.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_ip.dir/src/arp.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip.dir/src/ethernet.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_ip.dir/src/ethernet.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip.dir/src/ip.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_ip.dir/src/ip.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip.dir/src/utils.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_ip.dir/src/utils.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip.dir/test/faker/driver.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_ip.dir/test/faker/driver.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip.dir/test/faker/icmp.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_ip.dir/test/faker/icmp.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip.dir/test/faker/udp.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_ip.dir/test/faker/udp.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip.dir/test/global.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_ip.dir/test/global.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip.dir/test/ip_test.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_ip.dir/test/ip_test.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip_frag.dir/C.includecache:
--------------------------------------------------------------------------------
1 | #IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">])
2 |
3 | #IncludeRegexScan: ^.*$
4 |
5 | #IncludeRegexComplain: ^$
6 |
7 | #IncludeRegexTransform:
8 |
9 | .././include/arp.h
10 | stdint.h
11 | -
12 | time.h
13 | -
14 | config.h
15 | .././include/config.h
16 | net.h
17 | .././include/net.h
18 | utils.h
19 | .././include/utils.h
20 |
21 | .././include/config.h
22 |
23 | .././include/ethernet.h
24 | stdint.h
25 | -
26 | net.h
27 | .././include/net.h
28 | utils.h
29 | .././include/utils.h
30 |
31 | .././include/icmp.h
32 | stdint.h
33 | -
34 | utils.h
35 | .././include/utils.h
36 |
37 | .././include/ip.h
38 | stdint.h
39 | -
40 | net.h
41 | .././include/net.h
42 | utils.h
43 | .././include/utils.h
44 |
45 | .././include/net.h
46 | config.h
47 | .././include/config.h
48 | stdint.h
49 | -
50 |
51 | .././include/udp.h
52 | stdint.h
53 | -
54 | utils.h
55 | .././include/utils.h
56 |
57 | .././include/utils.h
58 | stdint.h
59 | -
60 | config.h
61 | .././include/config.h
62 |
63 | /home/parallels/Desktop/net_lab/src/ip.c
64 | ip.h
65 | /home/parallels/Desktop/net_lab/src/ip.h
66 | arp.h
67 | /home/parallels/Desktop/net_lab/src/arp.h
68 | icmp.h
69 | /home/parallels/Desktop/net_lab/src/icmp.h
70 | udp.h
71 | /home/parallels/Desktop/net_lab/src/udp.h
72 | config.h
73 | /home/parallels/Desktop/net_lab/src/config.h
74 | string.h
75 | -
76 | stdlib.h
77 | -
78 |
79 | /home/parallels/Desktop/net_lab/src/utils.c
80 | utils.h
81 | /home/parallels/Desktop/net_lab/src/utils.h
82 | stdio.h
83 | -
84 | stdlib.h
85 | -
86 | string.h
87 | -
88 |
89 | /home/parallels/Desktop/net_lab/test/faker/arp.c
90 | arp.h
91 | /home/parallels/Desktop/net_lab/test/faker/arp.h
92 | utils.h
93 | /home/parallels/Desktop/net_lab/test/faker/utils.h
94 | ethernet.h
95 | /home/parallels/Desktop/net_lab/test/faker/ethernet.h
96 | config.h
97 | /home/parallels/Desktop/net_lab/test/faker/config.h
98 | string.h
99 | -
100 | stdio.h
101 | -
102 |
103 | /home/parallels/Desktop/net_lab/test/faker/icmp.c
104 | icmp.h
105 | /home/parallels/Desktop/net_lab/test/faker/icmp.h
106 | ip.h
107 | /home/parallels/Desktop/net_lab/test/faker/ip.h
108 | string.h
109 | -
110 | stdio.h
111 | -
112 |
113 | /home/parallels/Desktop/net_lab/test/faker/udp.c
114 | udp.h
115 | /home/parallels/Desktop/net_lab/test/faker/udp.h
116 | ip.h
117 | /home/parallels/Desktop/net_lab/test/faker/ip.h
118 | icmp.h
119 | /home/parallels/Desktop/net_lab/test/faker/icmp.h
120 | stdlib.h
121 | -
122 | string.h
123 | -
124 | stdio.h
125 | -
126 |
127 | /home/parallels/Desktop/net_lab/test/global.c
128 | stdio.h
129 | -
130 | stdlib.h
131 | -
132 | stdint.h
133 | -
134 | string.h
135 | -
136 | pcap.h
137 | -
138 | arp.h
139 | /home/parallels/Desktop/net_lab/test/arp.h
140 | utils.h
141 | /home/parallels/Desktop/net_lab/test/utils.h
142 |
143 | /home/parallels/Desktop/net_lab/test/ip_frag_test.c
144 | stdio.h
145 | -
146 | string.h
147 | -
148 | net.h
149 | /home/parallels/Desktop/net_lab/test/net.h
150 | ip.h
151 | /home/parallels/Desktop/net_lab/test/ip.h
152 | utils.h
153 | /home/parallels/Desktop/net_lab/test/utils.h
154 |
155 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip_frag.dir/DependInfo.cmake:
--------------------------------------------------------------------------------
1 | # The set of languages for which implicit dependencies are needed:
2 | set(CMAKE_DEPENDS_LANGUAGES
3 | "C"
4 | )
5 | # The set of files for implicit dependencies of each language:
6 | set(CMAKE_DEPENDS_CHECK_C
7 | "/home/parallels/Desktop/net_lab/src/ip.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_ip_frag.dir/src/ip.c.o"
8 | "/home/parallels/Desktop/net_lab/src/utils.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_ip_frag.dir/src/utils.c.o"
9 | "/home/parallels/Desktop/net_lab/test/faker/arp.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_ip_frag.dir/test/faker/arp.c.o"
10 | "/home/parallels/Desktop/net_lab/test/faker/icmp.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_ip_frag.dir/test/faker/icmp.c.o"
11 | "/home/parallels/Desktop/net_lab/test/faker/udp.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_ip_frag.dir/test/faker/udp.c.o"
12 | "/home/parallels/Desktop/net_lab/test/global.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_ip_frag.dir/test/global.c.o"
13 | "/home/parallels/Desktop/net_lab/test/ip_frag_test.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/ctest_ip_frag.dir/test/ip_frag_test.c.o"
14 | )
15 | set(CMAKE_C_COMPILER_ID "GNU")
16 |
17 | # The include file search paths:
18 | set(CMAKE_C_TARGET_INCLUDE_PATH
19 | ".././include"
20 | ".././pcap"
21 | )
22 |
23 | # Targets to which this target links.
24 | set(CMAKE_TARGET_LINKED_INFO_FILES
25 | )
26 |
27 | # Fortran module output directory.
28 | set(CMAKE_Fortran_TARGET_MODULE_DIR "")
29 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip_frag.dir/cmake_clean.cmake:
--------------------------------------------------------------------------------
1 | file(REMOVE_RECURSE
2 | "CMakeFiles/ctest_ip_frag.dir/test/ip_frag_test.c.o"
3 | "CMakeFiles/ctest_ip_frag.dir/test/faker/arp.c.o"
4 | "CMakeFiles/ctest_ip_frag.dir/src/ip.c.o"
5 | "CMakeFiles/ctest_ip_frag.dir/test/faker/icmp.c.o"
6 | "CMakeFiles/ctest_ip_frag.dir/test/faker/udp.c.o"
7 | "CMakeFiles/ctest_ip_frag.dir/test/global.c.o"
8 | "CMakeFiles/ctest_ip_frag.dir/src/utils.c.o"
9 | "../test/ctest_ip_frag.pdb"
10 | "../test/ctest_ip_frag"
11 | )
12 |
13 | # Per-language clean rules from dependency scanning.
14 | foreach(lang C)
15 | include(CMakeFiles/ctest_ip_frag.dir/cmake_clean_${lang}.cmake OPTIONAL)
16 | endforeach()
17 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip_frag.dir/depend.internal:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10
3 |
4 | CMakeFiles/ctest_ip_frag.dir/src/ip.c.o
5 | .././include/arp.h
6 | .././include/config.h
7 | .././include/icmp.h
8 | .././include/ip.h
9 | .././include/net.h
10 | .././include/udp.h
11 | .././include/utils.h
12 | /home/parallels/Desktop/net_lab/src/ip.c
13 | CMakeFiles/ctest_ip_frag.dir/src/utils.c.o
14 | .././include/config.h
15 | .././include/utils.h
16 | /home/parallels/Desktop/net_lab/src/utils.c
17 | CMakeFiles/ctest_ip_frag.dir/test/faker/arp.c.o
18 | .././include/arp.h
19 | .././include/config.h
20 | .././include/ethernet.h
21 | .././include/net.h
22 | .././include/utils.h
23 | /home/parallels/Desktop/net_lab/test/faker/arp.c
24 | CMakeFiles/ctest_ip_frag.dir/test/faker/icmp.c.o
25 | .././include/config.h
26 | .././include/icmp.h
27 | .././include/ip.h
28 | .././include/net.h
29 | .././include/utils.h
30 | /home/parallels/Desktop/net_lab/test/faker/icmp.c
31 | CMakeFiles/ctest_ip_frag.dir/test/faker/udp.c.o
32 | .././include/config.h
33 | .././include/icmp.h
34 | .././include/ip.h
35 | .././include/net.h
36 | .././include/udp.h
37 | .././include/utils.h
38 | /home/parallels/Desktop/net_lab/test/faker/udp.c
39 | CMakeFiles/ctest_ip_frag.dir/test/global.c.o
40 | .././include/arp.h
41 | .././include/config.h
42 | .././include/net.h
43 | .././include/utils.h
44 | /home/parallels/Desktop/net_lab/test/global.c
45 | CMakeFiles/ctest_ip_frag.dir/test/ip_frag_test.c.o
46 | .././include/config.h
47 | .././include/ip.h
48 | .././include/net.h
49 | .././include/utils.h
50 | /home/parallels/Desktop/net_lab/test/ip_frag_test.c
51 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip_frag.dir/depend.make:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10
3 |
4 | CMakeFiles/ctest_ip_frag.dir/src/ip.c.o: .././include/arp.h
5 | CMakeFiles/ctest_ip_frag.dir/src/ip.c.o: .././include/config.h
6 | CMakeFiles/ctest_ip_frag.dir/src/ip.c.o: .././include/icmp.h
7 | CMakeFiles/ctest_ip_frag.dir/src/ip.c.o: .././include/ip.h
8 | CMakeFiles/ctest_ip_frag.dir/src/ip.c.o: .././include/net.h
9 | CMakeFiles/ctest_ip_frag.dir/src/ip.c.o: .././include/udp.h
10 | CMakeFiles/ctest_ip_frag.dir/src/ip.c.o: .././include/utils.h
11 | CMakeFiles/ctest_ip_frag.dir/src/ip.c.o: ../src/ip.c
12 |
13 | CMakeFiles/ctest_ip_frag.dir/src/utils.c.o: .././include/config.h
14 | CMakeFiles/ctest_ip_frag.dir/src/utils.c.o: .././include/utils.h
15 | CMakeFiles/ctest_ip_frag.dir/src/utils.c.o: ../src/utils.c
16 |
17 | CMakeFiles/ctest_ip_frag.dir/test/faker/arp.c.o: .././include/arp.h
18 | CMakeFiles/ctest_ip_frag.dir/test/faker/arp.c.o: .././include/config.h
19 | CMakeFiles/ctest_ip_frag.dir/test/faker/arp.c.o: .././include/ethernet.h
20 | CMakeFiles/ctest_ip_frag.dir/test/faker/arp.c.o: .././include/net.h
21 | CMakeFiles/ctest_ip_frag.dir/test/faker/arp.c.o: .././include/utils.h
22 | CMakeFiles/ctest_ip_frag.dir/test/faker/arp.c.o: ../test/faker/arp.c
23 |
24 | CMakeFiles/ctest_ip_frag.dir/test/faker/icmp.c.o: .././include/config.h
25 | CMakeFiles/ctest_ip_frag.dir/test/faker/icmp.c.o: .././include/icmp.h
26 | CMakeFiles/ctest_ip_frag.dir/test/faker/icmp.c.o: .././include/ip.h
27 | CMakeFiles/ctest_ip_frag.dir/test/faker/icmp.c.o: .././include/net.h
28 | CMakeFiles/ctest_ip_frag.dir/test/faker/icmp.c.o: .././include/utils.h
29 | CMakeFiles/ctest_ip_frag.dir/test/faker/icmp.c.o: ../test/faker/icmp.c
30 |
31 | CMakeFiles/ctest_ip_frag.dir/test/faker/udp.c.o: .././include/config.h
32 | CMakeFiles/ctest_ip_frag.dir/test/faker/udp.c.o: .././include/icmp.h
33 | CMakeFiles/ctest_ip_frag.dir/test/faker/udp.c.o: .././include/ip.h
34 | CMakeFiles/ctest_ip_frag.dir/test/faker/udp.c.o: .././include/net.h
35 | CMakeFiles/ctest_ip_frag.dir/test/faker/udp.c.o: .././include/udp.h
36 | CMakeFiles/ctest_ip_frag.dir/test/faker/udp.c.o: .././include/utils.h
37 | CMakeFiles/ctest_ip_frag.dir/test/faker/udp.c.o: ../test/faker/udp.c
38 |
39 | CMakeFiles/ctest_ip_frag.dir/test/global.c.o: .././include/arp.h
40 | CMakeFiles/ctest_ip_frag.dir/test/global.c.o: .././include/config.h
41 | CMakeFiles/ctest_ip_frag.dir/test/global.c.o: .././include/net.h
42 | CMakeFiles/ctest_ip_frag.dir/test/global.c.o: .././include/utils.h
43 | CMakeFiles/ctest_ip_frag.dir/test/global.c.o: ../test/global.c
44 |
45 | CMakeFiles/ctest_ip_frag.dir/test/ip_frag_test.c.o: .././include/config.h
46 | CMakeFiles/ctest_ip_frag.dir/test/ip_frag_test.c.o: .././include/ip.h
47 | CMakeFiles/ctest_ip_frag.dir/test/ip_frag_test.c.o: .././include/net.h
48 | CMakeFiles/ctest_ip_frag.dir/test/ip_frag_test.c.o: .././include/utils.h
49 | CMakeFiles/ctest_ip_frag.dir/test/ip_frag_test.c.o: ../test/ip_frag_test.c
50 |
51 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip_frag.dir/flags.make:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10
3 |
4 | # compile C with /usr/bin/x86_64-linux-gnu-gcc-7
5 | C_FLAGS = -g
6 |
7 | C_DEFINES =
8 |
9 | C_INCLUDES = -I/home/parallels/Desktop/net_lab/./include -I/home/parallels/Desktop/net_lab/./pcap
10 |
11 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip_frag.dir/link.txt:
--------------------------------------------------------------------------------
1 | /usr/bin/x86_64-linux-gnu-gcc-7 -g -rdynamic CMakeFiles/ctest_ip_frag.dir/test/ip_frag_test.c.o CMakeFiles/ctest_ip_frag.dir/test/faker/arp.c.o CMakeFiles/ctest_ip_frag.dir/src/ip.c.o CMakeFiles/ctest_ip_frag.dir/test/faker/icmp.c.o CMakeFiles/ctest_ip_frag.dir/test/faker/udp.c.o CMakeFiles/ctest_ip_frag.dir/test/global.c.o CMakeFiles/ctest_ip_frag.dir/src/utils.c.o -o ../test/ctest_ip_frag -lpcap
2 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip_frag.dir/progress.make:
--------------------------------------------------------------------------------
1 | CMAKE_PROGRESS_1 = 45
2 | CMAKE_PROGRESS_2 = 46
3 | CMAKE_PROGRESS_3 = 47
4 | CMAKE_PROGRESS_4 = 48
5 | CMAKE_PROGRESS_5 = 49
6 | CMAKE_PROGRESS_6 = 50
7 | CMAKE_PROGRESS_7 = 51
8 | CMAKE_PROGRESS_8 = 52
9 |
10 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip_frag.dir/src/ip.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_ip_frag.dir/src/ip.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip_frag.dir/src/utils.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_ip_frag.dir/src/utils.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip_frag.dir/test/faker/arp.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_ip_frag.dir/test/faker/arp.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip_frag.dir/test/faker/icmp.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_ip_frag.dir/test/faker/icmp.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip_frag.dir/test/faker/udp.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_ip_frag.dir/test/faker/udp.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip_frag.dir/test/global.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_ip_frag.dir/test/global.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/ctest_ip_frag.dir/test/ip_frag_test.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/ctest_ip_frag.dir/test/ip_frag_test.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/feature_tests.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/feature_tests.bin
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/feature_tests.c:
--------------------------------------------------------------------------------
1 |
2 | const char features[] = {"\n"
3 | "C_FEATURE:"
4 | #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 304
5 | "1"
6 | #else
7 | "0"
8 | #endif
9 | "c_function_prototypes\n"
10 | "C_FEATURE:"
11 | #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
12 | "1"
13 | #else
14 | "0"
15 | #endif
16 | "c_restrict\n"
17 | "C_FEATURE:"
18 | #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201000L
19 | "1"
20 | #else
21 | "0"
22 | #endif
23 | "c_static_assert\n"
24 | "C_FEATURE:"
25 | #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
26 | "1"
27 | #else
28 | "0"
29 | #endif
30 | "c_variadic_macros\n"
31 |
32 | };
33 |
34 | int main(int argc, char** argv) { (void)argv; return features[argc]; }
35 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/main.dir/C.includecache:
--------------------------------------------------------------------------------
1 | #IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">])
2 |
3 | #IncludeRegexScan: ^.*$
4 |
5 | #IncludeRegexComplain: ^$
6 |
7 | #IncludeRegexTransform:
8 |
9 | .././include/arp.h
10 | stdint.h
11 | -
12 | time.h
13 | -
14 | config.h
15 | .././include/config.h
16 | net.h
17 | .././include/net.h
18 | utils.h
19 | .././include/utils.h
20 |
21 | .././include/config.h
22 |
23 | .././include/driver.h
24 | utils.h
25 | .././include/utils.h
26 |
27 | .././include/ethernet.h
28 | stdint.h
29 | -
30 | net.h
31 | .././include/net.h
32 | utils.h
33 | .././include/utils.h
34 |
35 | .././include/icmp.h
36 | stdint.h
37 | -
38 | utils.h
39 | .././include/utils.h
40 |
41 | .././include/ip.h
42 | stdint.h
43 | -
44 | net.h
45 | .././include/net.h
46 | utils.h
47 | .././include/utils.h
48 |
49 | .././include/net.h
50 | config.h
51 | .././include/config.h
52 | stdint.h
53 | -
54 |
55 | .././include/udp.h
56 | stdint.h
57 | -
58 | utils.h
59 | .././include/utils.h
60 |
61 | .././include/utils.h
62 | stdint.h
63 | -
64 | config.h
65 | .././include/config.h
66 |
67 | /home/parallels/Desktop/net_lab/src/arp.c
68 | arp.h
69 | /home/parallels/Desktop/net_lab/src/arp.h
70 | utils.h
71 | /home/parallels/Desktop/net_lab/src/utils.h
72 | ethernet.h
73 | /home/parallels/Desktop/net_lab/src/ethernet.h
74 | config.h
75 | /home/parallels/Desktop/net_lab/src/config.h
76 | string.h
77 | -
78 | stdio.h
79 | -
80 |
81 | /home/parallels/Desktop/net_lab/src/driver.c
82 | pcap.h
83 | -
84 | string.h
85 | -
86 | utils.h
87 | /home/parallels/Desktop/net_lab/src/utils.h
88 | config.h
89 | /home/parallels/Desktop/net_lab/src/config.h
90 | driver.h
91 | /home/parallels/Desktop/net_lab/src/driver.h
92 |
93 | /home/parallels/Desktop/net_lab/src/ethernet.c
94 | ethernet.h
95 | /home/parallels/Desktop/net_lab/src/ethernet.h
96 | utils.h
97 | /home/parallels/Desktop/net_lab/src/utils.h
98 | driver.h
99 | /home/parallels/Desktop/net_lab/src/driver.h
100 | arp.h
101 | /home/parallels/Desktop/net_lab/src/arp.h
102 | ip.h
103 | /home/parallels/Desktop/net_lab/src/ip.h
104 | string.h
105 | -
106 | stdio.h
107 | -
108 |
109 | /home/parallels/Desktop/net_lab/src/icmp.c
110 | icmp.h
111 | /home/parallels/Desktop/net_lab/src/icmp.h
112 | ip.h
113 | /home/parallels/Desktop/net_lab/src/ip.h
114 | string.h
115 | -
116 | stdio.h
117 | -
118 |
119 | /home/parallels/Desktop/net_lab/src/ip.c
120 | ip.h
121 | /home/parallels/Desktop/net_lab/src/ip.h
122 | arp.h
123 | /home/parallels/Desktop/net_lab/src/arp.h
124 | icmp.h
125 | /home/parallels/Desktop/net_lab/src/icmp.h
126 | udp.h
127 | /home/parallels/Desktop/net_lab/src/udp.h
128 | config.h
129 | /home/parallels/Desktop/net_lab/src/config.h
130 | string.h
131 | -
132 | stdlib.h
133 | -
134 |
135 | /home/parallels/Desktop/net_lab/src/main.c
136 | stdio.h
137 | -
138 | string.h
139 | -
140 | time.h
141 | -
142 | net.h
143 | /home/parallels/Desktop/net_lab/src/net.h
144 | udp.h
145 | /home/parallels/Desktop/net_lab/src/udp.h
146 |
147 | /home/parallels/Desktop/net_lab/src/net.c
148 | net.h
149 | /home/parallels/Desktop/net_lab/src/net.h
150 | arp.h
151 | /home/parallels/Desktop/net_lab/src/arp.h
152 | udp.h
153 | /home/parallels/Desktop/net_lab/src/udp.h
154 | ethernet.h
155 | /home/parallels/Desktop/net_lab/src/ethernet.h
156 |
157 | /home/parallels/Desktop/net_lab/src/udp.c
158 | udp.h
159 | /home/parallels/Desktop/net_lab/src/udp.h
160 | ip.h
161 | /home/parallels/Desktop/net_lab/src/ip.h
162 | icmp.h
163 | /home/parallels/Desktop/net_lab/src/icmp.h
164 | stdlib.h
165 | -
166 | string.h
167 | -
168 | stdio.h
169 | -
170 |
171 | /home/parallels/Desktop/net_lab/src/utils.c
172 | utils.h
173 | /home/parallels/Desktop/net_lab/src/utils.h
174 | stdio.h
175 | -
176 | stdlib.h
177 | -
178 | string.h
179 | -
180 |
181 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/main.dir/DependInfo.cmake:
--------------------------------------------------------------------------------
1 | # The set of languages for which implicit dependencies are needed:
2 | set(CMAKE_DEPENDS_LANGUAGES
3 | "C"
4 | )
5 | # The set of files for implicit dependencies of each language:
6 | set(CMAKE_DEPENDS_CHECK_C
7 | "/home/parallels/Desktop/net_lab/src/arp.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/main.dir/src/arp.c.o"
8 | "/home/parallels/Desktop/net_lab/src/driver.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/main.dir/src/driver.c.o"
9 | "/home/parallels/Desktop/net_lab/src/ethernet.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/main.dir/src/ethernet.c.o"
10 | "/home/parallels/Desktop/net_lab/src/icmp.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/main.dir/src/icmp.c.o"
11 | "/home/parallels/Desktop/net_lab/src/ip.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/main.dir/src/ip.c.o"
12 | "/home/parallels/Desktop/net_lab/src/main.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/main.dir/src/main.c.o"
13 | "/home/parallels/Desktop/net_lab/src/net.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/main.dir/src/net.c.o"
14 | "/home/parallels/Desktop/net_lab/src/udp.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/main.dir/src/udp.c.o"
15 | "/home/parallels/Desktop/net_lab/src/utils.c" "/home/parallels/Desktop/net_lab/build/CMakeFiles/main.dir/src/utils.c.o"
16 | )
17 | set(CMAKE_C_COMPILER_ID "GNU")
18 |
19 | # The include file search paths:
20 | set(CMAKE_C_TARGET_INCLUDE_PATH
21 | ".././include"
22 | ".././pcap"
23 | )
24 |
25 | # Targets to which this target links.
26 | set(CMAKE_TARGET_LINKED_INFO_FILES
27 | )
28 |
29 | # Fortran module output directory.
30 | set(CMAKE_Fortran_TARGET_MODULE_DIR "")
31 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/main.dir/cmake_clean.cmake:
--------------------------------------------------------------------------------
1 | file(REMOVE_RECURSE
2 | "CMakeFiles/main.dir/src/arp.c.o"
3 | "CMakeFiles/main.dir/src/driver.c.o"
4 | "CMakeFiles/main.dir/src/ethernet.c.o"
5 | "CMakeFiles/main.dir/src/icmp.c.o"
6 | "CMakeFiles/main.dir/src/ip.c.o"
7 | "CMakeFiles/main.dir/src/main.c.o"
8 | "CMakeFiles/main.dir/src/net.c.o"
9 | "CMakeFiles/main.dir/src/udp.c.o"
10 | "CMakeFiles/main.dir/src/utils.c.o"
11 | "../test/main.pdb"
12 | "../test/main"
13 | )
14 |
15 | # Per-language clean rules from dependency scanning.
16 | foreach(lang C)
17 | include(CMakeFiles/main.dir/cmake_clean_${lang}.cmake OPTIONAL)
18 | endforeach()
19 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/main.dir/depend.internal:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10
3 |
4 | CMakeFiles/main.dir/src/arp.c.o
5 | .././include/arp.h
6 | .././include/config.h
7 | .././include/ethernet.h
8 | .././include/net.h
9 | .././include/utils.h
10 | /home/parallels/Desktop/net_lab/src/arp.c
11 | CMakeFiles/main.dir/src/driver.c.o
12 | .././include/config.h
13 | .././include/driver.h
14 | .././include/utils.h
15 | /home/parallels/Desktop/net_lab/src/driver.c
16 | CMakeFiles/main.dir/src/ethernet.c.o
17 | .././include/arp.h
18 | .././include/config.h
19 | .././include/driver.h
20 | .././include/ethernet.h
21 | .././include/ip.h
22 | .././include/net.h
23 | .././include/utils.h
24 | /home/parallels/Desktop/net_lab/src/ethernet.c
25 | CMakeFiles/main.dir/src/icmp.c.o
26 | .././include/config.h
27 | .././include/icmp.h
28 | .././include/ip.h
29 | .././include/net.h
30 | .././include/utils.h
31 | /home/parallels/Desktop/net_lab/src/icmp.c
32 | CMakeFiles/main.dir/src/ip.c.o
33 | .././include/arp.h
34 | .././include/config.h
35 | .././include/icmp.h
36 | .././include/ip.h
37 | .././include/net.h
38 | .././include/udp.h
39 | .././include/utils.h
40 | /home/parallels/Desktop/net_lab/src/ip.c
41 | CMakeFiles/main.dir/src/main.c.o
42 | .././include/config.h
43 | .././include/net.h
44 | .././include/udp.h
45 | .././include/utils.h
46 | /home/parallels/Desktop/net_lab/src/main.c
47 | CMakeFiles/main.dir/src/net.c.o
48 | .././include/arp.h
49 | .././include/config.h
50 | .././include/ethernet.h
51 | .././include/net.h
52 | .././include/udp.h
53 | .././include/utils.h
54 | /home/parallels/Desktop/net_lab/src/net.c
55 | CMakeFiles/main.dir/src/udp.c.o
56 | .././include/config.h
57 | .././include/icmp.h
58 | .././include/ip.h
59 | .././include/net.h
60 | .././include/udp.h
61 | .././include/utils.h
62 | /home/parallels/Desktop/net_lab/src/udp.c
63 | CMakeFiles/main.dir/src/utils.c.o
64 | .././include/config.h
65 | .././include/utils.h
66 | /home/parallels/Desktop/net_lab/src/utils.c
67 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/main.dir/depend.make:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10
3 |
4 | CMakeFiles/main.dir/src/arp.c.o: .././include/arp.h
5 | CMakeFiles/main.dir/src/arp.c.o: .././include/config.h
6 | CMakeFiles/main.dir/src/arp.c.o: .././include/ethernet.h
7 | CMakeFiles/main.dir/src/arp.c.o: .././include/net.h
8 | CMakeFiles/main.dir/src/arp.c.o: .././include/utils.h
9 | CMakeFiles/main.dir/src/arp.c.o: ../src/arp.c
10 |
11 | CMakeFiles/main.dir/src/driver.c.o: .././include/config.h
12 | CMakeFiles/main.dir/src/driver.c.o: .././include/driver.h
13 | CMakeFiles/main.dir/src/driver.c.o: .././include/utils.h
14 | CMakeFiles/main.dir/src/driver.c.o: ../src/driver.c
15 |
16 | CMakeFiles/main.dir/src/ethernet.c.o: .././include/arp.h
17 | CMakeFiles/main.dir/src/ethernet.c.o: .././include/config.h
18 | CMakeFiles/main.dir/src/ethernet.c.o: .././include/driver.h
19 | CMakeFiles/main.dir/src/ethernet.c.o: .././include/ethernet.h
20 | CMakeFiles/main.dir/src/ethernet.c.o: .././include/ip.h
21 | CMakeFiles/main.dir/src/ethernet.c.o: .././include/net.h
22 | CMakeFiles/main.dir/src/ethernet.c.o: .././include/utils.h
23 | CMakeFiles/main.dir/src/ethernet.c.o: ../src/ethernet.c
24 |
25 | CMakeFiles/main.dir/src/icmp.c.o: .././include/config.h
26 | CMakeFiles/main.dir/src/icmp.c.o: .././include/icmp.h
27 | CMakeFiles/main.dir/src/icmp.c.o: .././include/ip.h
28 | CMakeFiles/main.dir/src/icmp.c.o: .././include/net.h
29 | CMakeFiles/main.dir/src/icmp.c.o: .././include/utils.h
30 | CMakeFiles/main.dir/src/icmp.c.o: ../src/icmp.c
31 |
32 | CMakeFiles/main.dir/src/ip.c.o: .././include/arp.h
33 | CMakeFiles/main.dir/src/ip.c.o: .././include/config.h
34 | CMakeFiles/main.dir/src/ip.c.o: .././include/icmp.h
35 | CMakeFiles/main.dir/src/ip.c.o: .././include/ip.h
36 | CMakeFiles/main.dir/src/ip.c.o: .././include/net.h
37 | CMakeFiles/main.dir/src/ip.c.o: .././include/udp.h
38 | CMakeFiles/main.dir/src/ip.c.o: .././include/utils.h
39 | CMakeFiles/main.dir/src/ip.c.o: ../src/ip.c
40 |
41 | CMakeFiles/main.dir/src/main.c.o: .././include/config.h
42 | CMakeFiles/main.dir/src/main.c.o: .././include/net.h
43 | CMakeFiles/main.dir/src/main.c.o: .././include/udp.h
44 | CMakeFiles/main.dir/src/main.c.o: .././include/utils.h
45 | CMakeFiles/main.dir/src/main.c.o: ../src/main.c
46 |
47 | CMakeFiles/main.dir/src/net.c.o: .././include/arp.h
48 | CMakeFiles/main.dir/src/net.c.o: .././include/config.h
49 | CMakeFiles/main.dir/src/net.c.o: .././include/ethernet.h
50 | CMakeFiles/main.dir/src/net.c.o: .././include/net.h
51 | CMakeFiles/main.dir/src/net.c.o: .././include/udp.h
52 | CMakeFiles/main.dir/src/net.c.o: .././include/utils.h
53 | CMakeFiles/main.dir/src/net.c.o: ../src/net.c
54 |
55 | CMakeFiles/main.dir/src/udp.c.o: .././include/config.h
56 | CMakeFiles/main.dir/src/udp.c.o: .././include/icmp.h
57 | CMakeFiles/main.dir/src/udp.c.o: .././include/ip.h
58 | CMakeFiles/main.dir/src/udp.c.o: .././include/net.h
59 | CMakeFiles/main.dir/src/udp.c.o: .././include/udp.h
60 | CMakeFiles/main.dir/src/udp.c.o: .././include/utils.h
61 | CMakeFiles/main.dir/src/udp.c.o: ../src/udp.c
62 |
63 | CMakeFiles/main.dir/src/utils.c.o: .././include/config.h
64 | CMakeFiles/main.dir/src/utils.c.o: .././include/utils.h
65 | CMakeFiles/main.dir/src/utils.c.o: ../src/utils.c
66 |
67 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/main.dir/flags.make:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10
3 |
4 | # compile C with /usr/bin/x86_64-linux-gnu-gcc-7
5 | C_FLAGS = -g
6 |
7 | C_DEFINES =
8 |
9 | C_INCLUDES = -I/home/parallels/Desktop/net_lab/./include -I/home/parallels/Desktop/net_lab/./pcap
10 |
11 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/main.dir/link.txt:
--------------------------------------------------------------------------------
1 | /usr/bin/x86_64-linux-gnu-gcc-7 -g -rdynamic CMakeFiles/main.dir/src/arp.c.o CMakeFiles/main.dir/src/driver.c.o CMakeFiles/main.dir/src/ethernet.c.o CMakeFiles/main.dir/src/icmp.c.o CMakeFiles/main.dir/src/ip.c.o CMakeFiles/main.dir/src/main.c.o CMakeFiles/main.dir/src/net.c.o CMakeFiles/main.dir/src/udp.c.o CMakeFiles/main.dir/src/utils.c.o -o ../test/main -lpcap
2 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/main.dir/progress.make:
--------------------------------------------------------------------------------
1 | CMAKE_PROGRESS_1 = 53
2 | CMAKE_PROGRESS_2 = 54
3 | CMAKE_PROGRESS_3 = 55
4 | CMAKE_PROGRESS_4 = 56
5 | CMAKE_PROGRESS_5 = 57
6 | CMAKE_PROGRESS_6 = 58
7 | CMAKE_PROGRESS_7 = 59
8 | CMAKE_PROGRESS_8 = 60
9 | CMAKE_PROGRESS_9 = 61
10 | CMAKE_PROGRESS_10 = 62
11 |
12 |
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/main.dir/src/arp.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/main.dir/src/arp.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/main.dir/src/driver.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/main.dir/src/driver.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/main.dir/src/ethernet.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/main.dir/src/ethernet.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/main.dir/src/icmp.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/main.dir/src/icmp.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/main.dir/src/ip.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/main.dir/src/ip.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/main.dir/src/main.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/main.dir/src/main.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/main.dir/src/net.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/main.dir/src/net.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/main.dir/src/udp.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/main.dir/src/udp.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/main.dir/src/utils.c.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/build/CMakeFiles/main.dir/src/utils.c.o
--------------------------------------------------------------------------------
/net_lab/build/CMakeFiles/progress.marks:
--------------------------------------------------------------------------------
1 | 62
2 |
--------------------------------------------------------------------------------
/net_lab/build/cmake_install.cmake:
--------------------------------------------------------------------------------
1 | # Install script for directory: /home/parallels/Desktop/net_lab
2 |
3 | # Set the install prefix
4 | if(NOT DEFINED CMAKE_INSTALL_PREFIX)
5 | set(CMAKE_INSTALL_PREFIX "/usr/local")
6 | endif()
7 | string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
8 |
9 | # Set the install configuration name.
10 | if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
11 | if(BUILD_TYPE)
12 | string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
13 | CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
14 | else()
15 | set(CMAKE_INSTALL_CONFIG_NAME "Debug")
16 | endif()
17 | message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
18 | endif()
19 |
20 | # Set the component getting installed.
21 | if(NOT CMAKE_INSTALL_COMPONENT)
22 | if(COMPONENT)
23 | message(STATUS "Install component: \"${COMPONENT}\"")
24 | set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
25 | else()
26 | set(CMAKE_INSTALL_COMPONENT)
27 | endif()
28 | endif()
29 |
30 | # Install shared libraries without execute permission?
31 | if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
32 | set(CMAKE_INSTALL_SO_NO_EXE "1")
33 | endif()
34 |
35 | # Is this installation the result of a crosscompile?
36 | if(NOT DEFINED CMAKE_CROSSCOMPILING)
37 | set(CMAKE_CROSSCOMPILING "FALSE")
38 | endif()
39 |
40 | if(CMAKE_INSTALL_COMPONENT)
41 | set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
42 | else()
43 | set(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
44 | endif()
45 |
46 | string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT
47 | "${CMAKE_INSTALL_MANIFEST_FILES}")
48 | file(WRITE "/home/parallels/Desktop/net_lab/build/${CMAKE_INSTALL_MANIFEST}"
49 | "${CMAKE_INSTALL_MANIFEST_CONTENT}")
50 |
--------------------------------------------------------------------------------
/net_lab/include/arp.h:
--------------------------------------------------------------------------------
1 | #ifndef ARP_H
2 | #define ARP_H
3 |
4 | #include
5 | #include
6 | #include "config.h"
7 | #include "net.h"
8 | #include "utils.h"
9 | #define ARP_HW_ETHER 0x1 // 以太网
10 | #define ARP_REQUEST 0x1 // ARP请求包
11 | #define ARP_REPLY 0x2 // ARP响应包
12 |
13 | typedef enum arp_state
14 | {
15 | ARP_PENDING, //等待响应
16 | ARP_VALID, //有效
17 | ARP_INVALID, //无效
18 | } arp_state_t;
19 |
20 | typedef struct arp_entry
21 | {
22 | arp_state_t state; //状态
23 | time_t timeout; //超时时间戳
24 | uint8_t ip[NET_IP_LEN]; //ip地址
25 | uint8_t mac[NET_MAC_LEN]; //mac地址
26 | } arp_entry_t;
27 |
28 | typedef struct arp_buf
29 | {
30 | int valid; //有效位
31 | buf_t buf; //数据包
32 | uint8_t ip[NET_IP_LEN]; //目的ip地址
33 | net_protocol_t protocol; //上层协议
34 | } arp_buf_t;
35 |
36 | #pragma pack(1)
37 | typedef struct arp_pkt
38 | {
39 | uint16_t hw_type, pro_type; // 硬件类型和协议类型
40 | uint8_t hw_len, pro_len; // 硬件地址长 + 协议地址长
41 | uint16_t opcode; // 请求/响应
42 | uint8_t sender_mac[NET_MAC_LEN]; // 发送包硬件地址
43 | uint8_t sender_ip[NET_IP_LEN]; // 发送包协议地址
44 | uint8_t target_mac[NET_MAC_LEN]; // 接收方硬件地址
45 | uint8_t target_ip[NET_IP_LEN]; // 接收方协议地址
46 | } arp_pkt_t;
47 |
48 | #pragma pack()
49 |
50 | /**
51 | * @brief 初始化arp协议
52 | *
53 | */
54 | void arp_init();
55 |
56 | /**
57 | * @brief 处理一个收到的数据包
58 | *
59 | * @param buf 要处理的数据包
60 | */
61 | void arp_in(buf_t *buf);
62 |
63 | /**
64 | * @brief 处理一个要发送的数据包
65 | *
66 | * @param buf 要处理的数据包
67 | * @param ip 目标ip地址
68 | * @param protocol 上层协议
69 | */
70 | void arp_out(buf_t *buf, uint8_t *ip, net_protocol_t protocol);
71 |
72 | /**
73 | * @brief 更新arp表
74 | *
75 | * @param ip ip地址
76 | * @param mac mac地址
77 | * @param state 表项的状态
78 | */
79 | void arp_update(uint8_t *ip, uint8_t *mac, arp_state_t state);
80 | #endif
--------------------------------------------------------------------------------
/net_lab/include/config.h:
--------------------------------------------------------------------------------
1 | #ifndef CONFIG_H
2 | #define CONFIG_H
3 |
4 | #define DRIVER_IF_NAME "enp0s5" //使用的物理网卡名称
5 | #define DRIVER_IF_IP \
6 | { \
7 | 10, 211, 55, 88\
8 | } //自定义网卡ip地址
9 | // 前三位为网卡号
10 | // 最后一位为主机号
11 | // 虚拟机IP为10.211.55.8
12 | // 实验九中改为10.211.55.88
13 | // 192.168.163.103
14 | #define DRIVER_IF_MAC \
15 | { \
16 | 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 \
17 | } //自定义网卡mac地址
18 |
19 |
20 | #define ETHERNET_MTU 1500 //以太网最大传输单元
21 |
22 | #define ARP_MAX_ENTRY 16 //arp表最大长度
23 | #define ARP_TIMEOUT_SEC 60 * 5 //arp表过期时间
24 | #define ARP_MIN_INTERVAL 1 //向相同地址发送arp请求的最小间隔
25 |
26 | #define IP_DEFALUT_TTL 64 //IP默认TTL
27 |
28 | #define UDP_MAX_HANDLER 16 //最多的UDP处理程序数
29 |
30 | #endif
--------------------------------------------------------------------------------
/net_lab/include/driver.h:
--------------------------------------------------------------------------------
1 | #ifndef DRIVER_H
2 | #define DRIVER_H
3 | #include "utils.h"
4 | #ifndef PCAP_BUF_SIZE
5 | #define PCAP_BUF_SIZE 1024
6 | #endif
7 | /**
8 | * @brief 打开网卡
9 | *
10 | * @return int 成功为0,失败为-1
11 | */
12 | int driver_open();
13 |
14 | /**
15 | * @brief 试图从网卡接收数据包
16 | *
17 | * @param buf 收到的数据包
18 | * @return int 数据包的长度,未收到为0,错误为-1
19 | */
20 | int driver_recv(buf_t *buf);
21 |
22 | /**
23 | * @brief 使用网卡发送一个数据包
24 | *
25 | * @param buf 要发送的数据包
26 | * @return int 成功为0,失败为-1
27 | */
28 | int driver_send(buf_t *buf);
29 |
30 | /**
31 | * @brief 关闭网卡
32 | *
33 | */
34 | void driver_close();
35 | #endif
--------------------------------------------------------------------------------
/net_lab/include/ethernet.h:
--------------------------------------------------------------------------------
1 | #ifndef ETHERNET_H
2 | #define ETHERNET_H
3 | #include
4 | #include "net.h"
5 | #include "utils.h"
6 |
7 | #pragma pack(1)
8 |
9 | typedef struct ether_hdr
10 | {
11 | uint8_t dest[NET_MAC_LEN]; // 目标mac地址
12 | uint8_t src[NET_MAC_LEN]; // 源mac地址
13 | uint16_t protocol; // 协议/长度
14 | } ether_hdr_t;
15 | #pragma pack()
16 |
17 | /**
18 | * @brief 初始化以太网协议
19 | *
20 | * @return int 成功为0,失败为-1
21 | */
22 | int ethernet_init();
23 |
24 | /**
25 | * @brief 处理一个收到的数据包
26 | *
27 | * @param buf 要处理的数据包
28 | */
29 | void ethernet_in(buf_t *buf);
30 |
31 | /**
32 | * @brief 处理一个要发送的数据包
33 | *
34 | * @param buf 要处理的数据包
35 | * @param mac 目标ip地址
36 | * @param protocol 上层协议
37 | */
38 | void ethernet_out(buf_t *buf, const uint8_t *mac, net_protocol_t protocol);
39 |
40 | /**
41 | * @brief 一次以太网轮询
42 | *
43 | */
44 | void ethernet_poll();
45 |
46 | static const uint8_t ether_broadcast_mac[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; //以太网广播mac地址
47 | #endif
--------------------------------------------------------------------------------
/net_lab/include/icmp.h:
--------------------------------------------------------------------------------
1 | #ifndef ICMP_H
2 | #define ICMP_H
3 | #include
4 | #include "utils.h"
5 | #pragma pack(1)
6 | typedef struct icmp_hdr
7 | {
8 | uint8_t type; // 类型
9 | uint8_t code; // 代码
10 | uint16_t checksum; // ICMP报文的校验和
11 | uint16_t id; // 标识符
12 | uint16_t seq; // 序号
13 | } icmp_hdr_t;
14 |
15 | #pragma pack()
16 | typedef enum icmp_type
17 | {
18 | ICMP_TYPE_ECHO_REQUEST = 8, // 回显请求
19 | ICMP_TYPE_ECHO_REPLY = 0, // 回显响应
20 | ICMP_TYPE_UNREACH = 3, // 目的不可达
21 | } icmp_type_t;
22 |
23 | typedef enum icmp_code
24 | {
25 | ICMP_CODE_PROTOCOL_UNREACH = 2, // 协议不可达
26 | ICMP_CODE_PORT_UNREACH = 3 // 端口不可达
27 | } icmp_code_t;
28 |
29 | /**
30 | * @brief 处理一个收到的数据包
31 | *
32 | * @param buf 要处理的数据包
33 | * @param src_ip 源ip地址
34 | */
35 | void icmp_in(buf_t *buf, uint8_t *src_ip);
36 |
37 | /**
38 | * @brief 发送icmp不可达
39 | *
40 | * @param recv_buf 收到的ip数据包
41 | * @param src_ip 源ip地址
42 | * @param code icmp code,协议不可达或端口不可达
43 | */
44 | void icmp_unreachable(buf_t *recv_buf, uint8_t *src_ip, icmp_code_t code);
45 | #endif
46 |
--------------------------------------------------------------------------------
/net_lab/include/ip.h:
--------------------------------------------------------------------------------
1 | #ifndef IP_H
2 | #define IP_H
3 | #include
4 | #include "net.h"
5 | #include "utils.h"
6 | #pragma pack(1)
7 | typedef struct ip_hdr
8 | {
9 | uint8_t hdr_len : 4; // 首部长, 4字节为单位
10 | uint8_t version : 4; // 版本号
11 | uint8_t tos; // 服务类型
12 | uint16_t total_len; // 总长度
13 | uint16_t id; // 标识符
14 | uint16_t flags_fragment; // 标志与分段
15 | uint8_t ttl; // 存活时间
16 | uint8_t protocol; // 上层协议
17 | uint16_t hdr_checksum; // 首部校验和
18 | uint8_t src_ip[NET_IP_LEN]; // 源IP
19 | uint8_t dest_ip[NET_IP_LEN]; // 目标IP
20 | } ip_hdr_t;
21 | #pragma pack()
22 |
23 | #define IP_HDR_LEN_PER_BYTE (4) //ip包头长度单位
24 | #define IP_HDR_OFFSET_PER_BYTE (8) //ip分片偏移长度单位
25 | #define IP_VERSION_4 (4) //ipv4
26 | #define IP_MORE_FRAGMENT 1 << 5 //ip分片mf位
27 |
28 |
29 | /**
30 | * @brief 处理一个收到的数据包
31 | *
32 | * @param buf 要处理的包
33 | */
34 | void ip_in(buf_t *buf);
35 |
36 | /**
37 | * @brief 处理一个要发送的ip数据包
38 | *
39 | * @param buf 要处理的包
40 | * @param ip 目标ip地址
41 | * @param protocol 上层协议
42 | */
43 | void ip_out(buf_t *buf, uint8_t *ip, net_protocol_t protocol);
44 | #endif
--------------------------------------------------------------------------------
/net_lab/include/net.h:
--------------------------------------------------------------------------------
1 | #ifndef NET_H
2 | #define NET_H
3 | #include "config.h"
4 | #include
5 | typedef enum net_protocol
6 | {
7 | NET_PROTOCOL_ARP = 0x0806,
8 | NET_PROTOCOL_IP = 0x0800,
9 | NET_PROTOCOL_ICMP = 1,
10 | NET_PROTOCOL_UDP = 17,
11 | NET_PROTOCOL_TCP = 6,
12 | } net_protocol_t;
13 |
14 | static uint8_t net_if_mac[] = DRIVER_IF_MAC;
15 | static uint8_t net_if_ip[] = DRIVER_IF_IP;
16 |
17 | #define NET_MAC_LEN (6) //mac地址长度
18 | #define NET_IP_LEN (4) //ip地址长度
19 | #define swap16(x) ((((x)&0xFF) << 8) | (((x) >> 8) & 0xFF)) //为16位数据交换大小端
20 |
21 | /**
22 | * @brief 初始化协议栈
23 | *
24 | */
25 | void net_init();
26 |
27 | /**
28 | * @brief 一次协议栈轮询
29 | *
30 | */
31 | void net_poll();
32 |
33 | #endif
--------------------------------------------------------------------------------
/net_lab/include/udp.h:
--------------------------------------------------------------------------------
1 | #ifndef UDP_H
2 | #define UDP_H
3 | #include
4 | #include "utils.h"
5 | #pragma pack(1)
6 | typedef struct udp_hdr
7 | {
8 | uint16_t src_port; // 源端口
9 | uint16_t dest_port; // 目标端口
10 | uint16_t total_len; // 整个数据包的长度
11 | uint16_t checksum; // 校验和
12 | } udp_hdr_t;
13 |
14 | typedef struct udp_peso_hdr
15 | {
16 | uint8_t src_ip[4]; // 源IP地址
17 | uint8_t dest_ip[4]; // 目的IP地址
18 | uint8_t placeholder; // 必须置0,用于填充对齐
19 | uint8_t protocol; // 协议号
20 | uint16_t total_len; // 整个数据包的长度
21 | } udp_peso_hdr_t;
22 | #pragma pack()
23 |
24 | typedef struct udp_entry udp_entry_t;
25 | typedef void (*udp_handler_t)(udp_entry_t *entry, uint8_t *src_ip, uint16_t src_port, buf_t *buf);
26 | struct udp_entry
27 | {
28 | int valid; //有效位
29 | int port; //端口号
30 | udp_handler_t handler; //处理程序
31 | };
32 |
33 | /**
34 | * @brief 初始化udp协议
35 | *
36 | */
37 | void udp_init();
38 |
39 | /**
40 | * @brief 处理一个收到的udp数据包
41 | *
42 | * @param buf 要处理的包
43 | * @param src_ip 源ip地址
44 | */
45 | void udp_in(buf_t *buf, uint8_t *src_ip);
46 |
47 | /**
48 | * @brief 处理一个要发送的数据包
49 | *
50 | * @param buf 要处理的包
51 | * @param src_port 源端口号
52 | * @param dest_ip 目的ip地址
53 | * @param dest_port 目的端口号
54 | */
55 | void udp_out(buf_t *buf, uint16_t src_port, uint8_t *dest_ip, uint16_t dest_port);
56 |
57 | /**
58 | * @brief 发送一个udp包
59 | *
60 | * @param data 要发送的数据
61 | * @param len 数据长度
62 | * @param src_port 源端口号
63 | * @param dest_ip 目的ip地址
64 | * @param dest_port 目的端口号
65 | */
66 | void udp_send(uint8_t *data, uint16_t len, uint16_t src_port, uint8_t *dest_ip, uint16_t dest_port);
67 |
68 | /**
69 | * @brief 打开一个udp端口并注册处理程序
70 | *
71 | * @param port 端口号
72 | * @param handler 处理程序
73 | * @return int 成功为0,失败为-1
74 | */
75 | int udp_open(uint16_t port, udp_handler_t handler);
76 |
77 | /**
78 | * @brief 关闭一个udp端口
79 | *
80 | * @param port 端口号
81 | */
82 | void udp_close(uint16_t port);
83 | #endif
--------------------------------------------------------------------------------
/net_lab/include/utils.h:
--------------------------------------------------------------------------------
1 | #ifndef UTILS_H
2 | #define UTILS_H
3 | #include
4 | #include "config.h"
5 | #define BUF_MAX_LEN (UINT16_MAX + 14) //最大udp包 + 以太网帧报头长度
6 |
7 | typedef struct buf
8 | {
9 | uint16_t len; // 包中有效数据大小
10 | uint8_t *data; // 包的数据起始地址
11 | uint8_t payload[BUF_MAX_LEN]; // 最大负载数据量
12 | } buf_t;
13 | static buf_t rxbuf, txbuf; //一个buf足够单线程使用
14 |
15 | /**
16 | * @brief 初始化buffer为给定的长度,用于装载数据包
17 | *
18 | * @param buf 要初始化的buffer
19 | * @param len 长度
20 | */
21 | void buf_init(buf_t *buf, int len); //buf可以在头部装卸数据,以供协议头的添加和去除
22 |
23 | /**
24 | * @brief 为buffer在头部增加一段长度,用于添加协议头
25 | *
26 | * @param buf 要修改的buffer
27 | * @param len 增加的长度
28 | */
29 | void buf_add_header(buf_t *buf, int len);
30 |
31 | /**
32 | * @brief 为buffer在头部减少一段长度,去除协议头
33 | *
34 | * @param buf 要修改的buffer
35 | * @param len 减少的长度
36 | */
37 | void buf_remove_header(buf_t *buf, int len);
38 |
39 | /**
40 | * @brief 复制一个buffer到新buffer
41 | *
42 | * @param dst 目的buffer
43 | * @param src 源buffer
44 | */
45 | void buf_copy(buf_t *dst, buf_t *src);
46 |
47 | /**
48 | * @brief 计算16位校验和
49 | *
50 | * @param buf 要计算的数据包
51 | * @param len 要计算的长度
52 | * @return uint16_t 校验和
53 | */
54 | uint16_t checksum16(uint16_t *buf, int len);
55 |
56 | /**
57 | * @brief ip转字符串
58 | *
59 | * @param ip ip地址
60 | * @return char* 生成的字符串
61 | */
62 | char *iptos(uint8_t *ip);
63 |
64 | #endif
--------------------------------------------------------------------------------
/net_lab/src/driver.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "utils.h"
4 | #include "config.h"
5 | #include "driver.h"
6 |
7 | static pcap_t *pcap;
8 | static char pcap_errbuf[PCAP_ERRBUF_SIZE];
9 |
10 | /**
11 | * @brief 打开网卡
12 | *
13 | * @return int 成功为0,失败为-1
14 | */
15 | int driver_open()
16 | {
17 | uint32_t net, mask;
18 |
19 | // 根据DRIVER_IF_NAME网卡名,获取网卡的网络号net和子网掩码mask
20 | if (pcap_lookupnet(DRIVER_IF_NAME, &net, &mask, pcap_errbuf) == -1) //查找网卡
21 | {
22 | fprintf(stderr, "Error in pcap_lookupnet: %s\n", pcap_geterr(pcap));
23 | return -1;
24 | }
25 |
26 | // 获取一个数据包捕获的描述符,以便用来查看网络上的数据包。
27 | // 第二个参数表示捕获的最大字节数,通常来说数据包的大小不会超过65535
28 | // 第三个参数表示开启混杂模式,0表示非混杂模式,任何其他值表示混合模式
29 | // 第四个参数指定需要等待的毫秒数,0表示一直等待直到有数据包到来
30 | if ((pcap = pcap_open_live(DRIVER_IF_NAME, 65536, 1, 0, pcap_errbuf)) == NULL) //混杂模式打开网卡
31 | {
32 | fprintf(stderr, "Error in pcap_open_live: %s.\n", pcap_geterr(pcap));
33 | return -1;
34 | }
35 | if (pcap_setnonblock(pcap, 1, pcap_errbuf) != 0) //设置非阻塞模式
36 | {
37 | fprintf(stderr, "Error in pcap_setnonblock: %s\n", pcap_geterr(pcap));
38 | return -1;
39 | }
40 | char filter_exp[PCAP_BUF_SIZE];
41 | struct bpf_program fp;
42 | uint8_t mac_addr[6] = DRIVER_IF_MAC;
43 | sprintf(filter_exp, //过滤数据包
44 | "(ether dst %02x:%02x:%02x:%02x:%02x:%02x or ether broadcast) and (not ether src %02x:%02x:%02x:%02x:%02x:%02x)",
45 | mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5],
46 | mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
47 |
48 | // 只捕获发往本网卡接口与广播的数据帧,也就是只处理发往这张网卡的数据包
49 | if (pcap_compile(pcap, &fp, filter_exp, 0, net) == -1)
50 | {
51 | fprintf(stderr, "Error in pcap_compile: %s\n", pcap_geterr(pcap));
52 | return -1;
53 | }
54 | if (pcap_setfilter(pcap, &fp) == -1)
55 | {
56 | fprintf(stderr, "Error in pcap_setfilter: %s\n", pcap_geterr(pcap));
57 | return -1;
58 | }
59 | return 0;
60 | }
61 |
62 | /**
63 | * @brief 试图从网卡接收数据包
64 | *
65 | * @param buf 收到的数据包
66 | * @return int 数据包的长度,未收到为0,错误为-1
67 | */
68 | int driver_recv(buf_t *buf)
69 | {
70 | struct pcap_pkthdr *pkt_hdr;
71 | const uint8_t *pkt_data;
72 |
73 | // 从本网卡接口获取一个数据报文
74 | int ret = pcap_next_ex(pcap, &pkt_hdr, &pkt_data);
75 | if (ret == 0)
76 | return 0;
77 | else if (ret == 1)
78 | {
79 | memcpy(buf->data, pkt_data, pkt_hdr->len);
80 | buf->len = pkt_hdr->len;
81 | return pkt_hdr->len;
82 | }
83 | fprintf(stderr, "Error in driver_recv: %s\n", pcap_geterr(pcap));
84 | return -1;
85 | }
86 |
87 | /**
88 | * @brief 使用网卡发送一个数据包
89 | *
90 | * @param buf 要发送的数据包
91 | * @return int 成功为0,失败为-1
92 | */
93 | int driver_send(buf_t *buf)
94 | {
95 | // 将数据包发往指定的网卡接口
96 | if (pcap_sendpacket(pcap, buf->data, buf->len) == -1)
97 | {
98 | fprintf(stderr, "Error in driver_send: %s\n", pcap_geterr(pcap));
99 | return -1;
100 | }
101 |
102 | return 0;
103 | }
104 |
105 | /**
106 | * @brief 关闭网卡
107 | *
108 | */
109 | void driver_close()
110 | {
111 | pcap_close(pcap);
112 | }
113 |
--------------------------------------------------------------------------------
/net_lab/src/ethernet.c:
--------------------------------------------------------------------------------
1 | #include "ethernet.h"
2 | #include "utils.h"
3 | #include "driver.h"
4 | #include "arp.h"
5 | #include "ip.h"
6 | #include
7 | #include
8 |
9 | /**
10 | * @brief 处理一个收到的数据包
11 | * 你需要判断以太网数据帧的协议类型,注意大小端转换
12 | * 如果是ARP协议数据包,则去掉以太网包头,发送到arp层处理arp_in()
13 | * 如果是IP协议数据包,则去掉以太网包头,发送到IP层处理ip_in()
14 | *
15 | * @param buf 要处理的数据包
16 | */
17 | void ethernet_in(buf_t *buf)
18 | {
19 | uint16_t type;
20 | uint16_t *type_p;
21 | type_p = (uint16_t *)(buf->data + 12); // 得到以太网数据帧的协议类型
22 | type = swap16(*type_p); // 大小端转换
23 | buf_remove_header(buf, 14); // 去掉以太网包头(长度14)
24 | switch (type)
25 | {
26 | // 如果是ARP协议数据包, 发送到arp层处理
27 | case 0x0806:
28 | arp_in(buf);
29 | break;
30 | // 如果是IP协议数据包, 发送到IP层处理
31 | case 0x0800:
32 | ip_in(buf);
33 | break;
34 | default:
35 | break;
36 | }
37 | }
38 |
39 | /**
40 | * @brief 处理一个要发送的数据包
41 | * 你需添加以太网包头,填写目的MAC地址、源MAC地址、协议类型
42 | * 添加完成后将以太网数据帧发送到驱动层
43 | *
44 | * @param buf 要处理的数据包
45 | * @param mac 目标mac地址
46 | * @param protocol 上层协议
47 | */
48 | void ethernet_out(buf_t *buf, const uint8_t *mac, net_protocol_t protocol)
49 | {
50 | ether_hdr_t header;
51 | memcpy(header.dest, mac, NET_MAC_LEN); // 设置包头的目的MAC地址
52 | memcpy(header.src, net_if_mac, NET_MAC_LEN); // 设置包头的源MAC地址
53 | header.protocol = swap16(protocol); // 设置包头的协议类型(注意大小端转换)
54 |
55 | buf_add_header(buf, sizeof(ether_hdr_t)); // 添加以太网包头
56 | memcpy(buf->data, &header, sizeof(ether_hdr_t));
57 | driver_send(buf);
58 | }
59 |
60 | /**
61 | * @brief 初始化以太网协议
62 | *
63 | * @return int 成功为0,失败为-1
64 | */
65 | int ethernet_init()
66 | {
67 | buf_init(&rxbuf, ETHERNET_MTU + sizeof(ether_hdr_t));
68 | return driver_open();
69 | }
70 |
71 | /**
72 | * @brief 一次以太网轮询
73 | *
74 | */
75 | void ethernet_poll()
76 | {
77 | if (driver_recv(&rxbuf) > 0)
78 | ethernet_in(&rxbuf);
79 | }
80 |
--------------------------------------------------------------------------------
/net_lab/src/icmp.c:
--------------------------------------------------------------------------------
1 | #include "icmp.h"
2 | #include "ip.h"
3 | #include
4 | #include
5 |
6 | /**
7 | * @brief 处理一个收到的数据包
8 | * 你首先要检查buf长度是否小于icmp头部长度
9 | * 接着,查看该报文的ICMP类型是否为回显请求,
10 | * 如果是,则回送一个回显应答(ping应答),需要自行封装应答包。
11 | *
12 | * 应答包封装如下:
13 | * 首先调用buf_init()函数初始化txbuf,然后封装报头和数据,
14 | * 数据部分可以拷贝来自接收到的回显请求报文中的数据。
15 | * 最后将封装好的ICMP报文发送到IP层。
16 | *
17 | * @param buf 要处理的数据包
18 | * @param src_ip 源ip地址
19 | */
20 | void icmp_in(buf_t *buf, uint8_t *src_ip)
21 | {
22 | if (buf->len < 8)
23 | {// 如果buf长度小于icmp头部长度(8字节),不处理
24 | return;
25 | }
26 | // 报文检查正确,继续
27 | icmp_hdr_t *icmp = (icmp_hdr_t *)buf->data;
28 | if ((icmp->type == ICMP_TYPE_ECHO_REQUEST) && (icmp->code == 0))
29 | {// 如果该报文的ICMP类型为回显请求
30 | // 检测校验和
31 | uint16_t hdr_checksum = swap16(icmp->checksum); // 缓存头部校验和字段(注意大小端转换)
32 | icmp->checksum = 0; // 将校验和字段清零
33 | if (hdr_checksum != checksum16((uint16_t *)buf->data, buf->len)) // 整个icmp数据报都需要检测
34 | {// 计算的结果与之前缓存的校验和不一致, 不处理
35 | return;
36 | }
37 |
38 | // 校验和正确,继续
39 | buf_init(&txbuf, buf->len); // 调用buf_init()函数初始化txbuf
40 | memcpy(txbuf.data, buf->data, buf->len); // 数据部分拷贝来自接收到的回显请求报文中的数据
41 |
42 | // 填写icmp头部
43 | icmp_hdr_t header;
44 | header.type = ICMP_TYPE_ECHO_REPLY;
45 | header.code = 0;
46 | header.checksum = swap16(0);
47 | header.id = icmp->id;
48 | header.seq = icmp->seq;
49 |
50 | // 添加icmp头部
51 | memcpy(txbuf.data, &header, sizeof(icmp_hdr_t));
52 | // 计算校验和
53 | header.checksum = swap16(checksum16((uint16_t *)txbuf.data, txbuf.len));
54 | memcpy(txbuf.data, &header, sizeof(icmp_hdr_t));
55 |
56 | // 将封装好的ICMP报文发送到IP层
57 | ip_out(&txbuf, src_ip, NET_PROTOCOL_ICMP);
58 | return;
59 | }
60 |
61 |
62 |
63 | }
64 |
65 | /**
66 | * @brief 发送icmp不可达
67 | * 你需要首先调用buf_init初始化buf,长度为ICMP头部 + IP头部 + 原始IP数据报中的前8字节
68 | * 填写ICMP报头首部,类型值为目的不可达
69 | * 填写校验和
70 | * 将封装好的ICMP数据报发送到IP层。
71 | *
72 | * @param recv_buf 收到的ip数据包
73 | * @param src_ip 源ip地址
74 | * @param code icmp code,协议不可达或端口不可达
75 | */
76 | void icmp_unreachable(buf_t *recv_buf, uint8_t *src_ip, icmp_code_t code)
77 | {
78 | buf_t buf;
79 | // 先初始化长度为IP头部 + 原始IP数据报中的前8字节的buf
80 | buf_init(&buf, sizeof(ip_hdr_t) + 8);
81 | // 将IP头部和原始IP数据报中的前8字节拷贝到buf中
82 | memcpy(buf.data, recv_buf->data, sizeof(ip_hdr_t) + 8);
83 | // 增加icmp头部缓存空间
84 | buf_add_header(&buf, sizeof(icmp_hdr_t));
85 | icmp_hdr_t header;
86 | header.type = ICMP_TYPE_UNREACH;
87 | header.code = code;
88 | header.id = swap16(0); // 必须为0
89 | header.seq = swap16(0); // 必须为0
90 | // 填写校验和
91 | header.checksum = swap16(0);
92 | memcpy(buf.data, &header, sizeof(icmp_hdr_t));
93 | header.checksum = swap16(checksum16((uint16_t *)buf.data, buf.len));
94 | memcpy(buf.data, &header, sizeof(icmp_hdr_t));
95 | ip_out(&buf, src_ip, NET_PROTOCOL_ICMP);
96 | return;
97 | }
--------------------------------------------------------------------------------
/net_lab/src/main.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include "net.h"
5 | #include "udp.h"
6 |
7 | void handler(udp_entry_t *entry, uint8_t *src_ip, uint16_t src_port, buf_t *buf)
8 | {
9 | printf("recv udp packet from %s:%d len=%d\n", iptos(src_ip), src_port, buf->len);
10 | for (int i = 0; i < buf->len; i++)
11 | putchar(buf->data[i]);
12 | putchar('\n');
13 | uint16_t len = 1800;
14 | //uint16_t len = 1000;
15 | uint8_t data[len];
16 |
17 | uint16_t dest_port = 60001;
18 | for (int i = 0; i < len; i++)
19 | data[i] = i;
20 | udp_send(data, len, 60000, src_ip, dest_port); //发送udp包
21 | }
22 | int main(int argc, char const *argv[])
23 | {
24 |
25 | net_init(); //初始化协议栈
26 | udp_open(60000, handler); //注册端口的udp监听回调
27 |
28 | while (1)
29 | {
30 | net_poll(); //一次主循环
31 | }
32 |
33 | return 0;
34 | }
35 |
--------------------------------------------------------------------------------
/net_lab/src/net.c:
--------------------------------------------------------------------------------
1 | #include "net.h"
2 | #include "arp.h"
3 | #include "udp.h"
4 | #include "ethernet.h"
5 |
6 | /**
7 | * @brief 初始化协议栈
8 | *
9 | */
10 | void net_init()
11 | {
12 | ethernet_init();
13 | arp_init();
14 | udp_init();
15 | }
16 |
17 | /**
18 | * @brief 一次协议栈轮询
19 | *
20 | */
21 | void net_poll()
22 | {
23 | ethernet_poll();
24 | }
--------------------------------------------------------------------------------
/net_lab/src/utils.c:
--------------------------------------------------------------------------------
1 | #include "utils.h"
2 | #include
3 | #include
4 | #include
5 | #define IPTOSBUFFERS 12
6 |
7 | /**
8 | * @brief ip转字符串
9 | *
10 | * @param ip ip地址
11 | * @return char* 生成的字符串
12 | */
13 | char *iptos(uint8_t *ip)
14 | {
15 | static char output[IPTOSBUFFERS][3 * 4 + 3 + 1];
16 | static short which;
17 | which = (which + 1 == IPTOSBUFFERS ? 0 : which + 1);
18 | sprintf(output[which], "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
19 | return output[which];
20 | }
21 |
22 | /**
23 | * @brief 初始化buffer为给定的长度,用于装载数据包
24 | *
25 | * @param buf 要初始化的buffer
26 | * @param len 长度
27 | */
28 | void buf_init(buf_t *buf, int len)
29 | {
30 | buf->len = len;
31 | buf->data = buf->payload + BUF_MAX_LEN - len;
32 | }
33 |
34 | /**
35 | * @brief 为buffer在头部增加一段长度,用于添加协议头
36 | *
37 | * @param buf 要修改的buffer
38 | * @param len 增加的长度
39 | */
40 | void buf_add_header(buf_t *buf, int len)
41 | {
42 | buf->len += len;
43 | buf->data -= len;
44 | }
45 |
46 | /**
47 | * @brief 为buffer在头部减少一段长度,去除协议头
48 | *
49 | * @param buf 要修改的buffer
50 | * @param len 减少的长度
51 | */
52 | void buf_remove_header(buf_t *buf, int len)
53 | {
54 | buf->len -= len;
55 | buf->data += len;
56 | }
57 |
58 | /**
59 | * @brief 复制一个buffer到新buffer
60 | *
61 | * @param dst 目的buffer
62 | * @param src 源buffer
63 | */
64 | void buf_copy(buf_t *dst, buf_t *src)
65 | {
66 | buf_init(dst, src->len);
67 | memcpy(dst->payload, src->payload, BUF_MAX_LEN);
68 | }
69 |
70 | /**
71 | * @brief 计算16位校验和
72 | * 1. 把首部看成以 16 位为单位的数字组成,依次进行二进制求和
73 | * 注意:求和时应将最高位的进位保存,所以加法应采用 32 位加法
74 | * 2. 将上述加法过程中产生的进位(最高位的进位)加到低 16 位
75 | * 采用 32 位加法时,即为将高 16 位与低 16 位相加,
76 | * 之后还要把该次加法最高位产生的进位加到低 16 位
77 | * 3. 将上述的和取反,即得到校验和。
78 | *
79 | * @param buf 要计算的数据包
80 | * @param len 要计算的长度
81 | * @return uint16_t 校验和
82 | */
83 | uint16_t checksum16(uint16_t *buf, int len)
84 | {
85 | uint32_t cksum = 0; // 加法应采用 32 位加法
86 |
87 | // 16 位为单位数字相加
88 | while(len > 1){
89 | cksum += (((*buf)&0xFF) << 8) | (((*buf) >> 8) & 0xFF); // 注意大小端转换!
90 | buf++; // 指针前移16位
91 | len -= sizeof(uint16_t); // 减去2字节
92 |
93 | // 高位有进位,进位到低位
94 | cksum = (cksum >> 16) + (cksum & 0xffff); // 将高 16 位与低 16 位相加
95 | cksum += (cksum >> 16); // 把该次加法最高位产生的进位加到低 16 位
96 | }
97 |
98 | // 如果长度是奇数
99 | if (len != 0)
100 | {
101 | cksum += *((uint8_t *)buf);
102 | // 高位有进位,进位到低位
103 | cksum = (cksum >> 16) + (cksum & 0xffff); // 将高 16 位与低 16 位相加
104 | cksum += (cksum >> 16); // 把该次加法最高位产生的进位加到低 16 位
105 | }
106 |
107 | // 将上述的和取反
108 | return ~(uint16_t)cksum;
109 |
110 | }
--------------------------------------------------------------------------------
/net_lab/test/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 | !Makefile
4 | !faker/
5 | !*.c
6 | !data/
7 | !data/*
8 | !data/*/demo_*
9 | !data/*/in.*
10 |
--------------------------------------------------------------------------------
/net_lab/test/Makefile:
--------------------------------------------------------------------------------
1 | SRC=../src/
2 |
3 | CC=gcc
4 |
5 | LFLAG=-lpcap -I../include/
6 |
7 | test_icmp:
8 | $(CC) icmp_test.c $(SRC)ethernet.c $(SRC)arp.c $(SRC)ip.c $(SRC)icmp.c faker/udp.c faker/driver.c global.c $(SRC)utils.c -o icmp_test $(LFLAG)
9 | ./icmp_test
10 |
11 | test_ip_frag:
12 | $(CC) ip_frag_test.c faker/arp.c $(SRC)ip.c faker/icmp.c faker/udp.c global.c $(SRC)utils.c -o ip_frag_test $(LFLAG)
13 | ./ip_frag_test
14 |
15 | test_ip:
16 | $(CC) ip_test.c $(SRC)ethernet.c $(SRC)arp.c $(SRC)ip.c faker/icmp.c faker/udp.c faker/driver.c global.c $(SRC)utils.c -o ip_test $(LFLAG)
17 | ./ip_test
18 |
19 | test_arp:
20 | $(CC) arp_test.c $(SRC)ethernet.c $(SRC)arp.c faker/ip.c faker/driver.c global.c $(SRC)utils.c -o arp_test $(LFLAG)
21 | ./arp_test
22 |
23 | test_eth_out:
24 | $(CC) eth_out_test.c $(SRC)ethernet.c faker/arp.c faker/ip.c faker/driver.c global.c $(SRC)utils.c -o eth_out_test $(LFLAG)
25 | ./eth_out_test
26 |
27 | test_eth_in:
28 | $(CC) eth_in_test.c $(SRC)ethernet.c faker/arp.c faker/ip.c faker/driver.c global.c $(SRC)utils.c -o eth_in_test $(LFLAG)
29 | ./eth_in_test
30 |
31 | clean:
32 | find -maxdepth 1 -type f -name "*_test" -delete
33 | find -type f -name "log" -delete
34 | find -type f -name "out.pcap" -delete
35 |
36 | # Following not in use for testing
37 | test_dv:
38 | $(CC) driver_test.c faker/driver.c global.c $(SRC)utils.c -o driver_test $(LFLAG)
39 | ./driver_test
40 |
41 | demo:
42 | mv data/$(DIR)/log data/$(DIR)/demo_log
43 | mv data/$(DIR)/out.pcap data/$(DIR)/demo_out.pcap
44 |
--------------------------------------------------------------------------------
/net_lab/test/arp_test.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "driver.h"
4 | #include "ethernet.h"
5 | #include "arp.h"
6 |
7 | extern FILE *pcap_in;
8 | extern FILE *pcap_out;
9 | extern FILE *pcap_demo;
10 | extern FILE *ip_fout;
11 | extern FILE *control_flow;
12 | extern FILE *demo_log;
13 | extern FILE *out_log;
14 | extern FILE *arp_log_f;
15 |
16 | char* print_ip(uint8_t *ip);
17 | char* print_mac(uint8_t *mac);
18 |
19 | uint8_t my_mac[] = DRIVER_IF_MAC;
20 | uint8_t boardcast_mac[] = {0xff,0xff,0xff,0xff,0xff,0xff};
21 |
22 | int check_log();
23 | int check_pcap();
24 | void log_tab_buf();
25 |
26 | buf_t buf;
27 | int main(){
28 | int ret;
29 | printf("\e[0;34mTest begin.\n");
30 | pcap_in = fopen("data/arp_test/in.pcap","r");
31 | pcap_out = fopen("data/arp_test/out.pcap","w");
32 | control_flow = fopen("data/arp_test/log","w");
33 | if(pcap_in == 0 || pcap_out == 0 || control_flow == 0){
34 | if(pcap_in) fclose(pcap_in); else printf("\e[1;31mFailed to open in.pcap\n");
35 | if(pcap_out)fclose(pcap_out); else printf("\e[1;31mFailed to open out.pcap\n");
36 | if(control_flow) fclose(control_flow); else printf("\e[1;31mFailed to open log\n");
37 | return 0;
38 | }
39 | arp_log_f = control_flow;
40 | ip_fout = control_flow;
41 |
42 | printf("\e[0;34mTest start\n");
43 | if(ethernet_init()){
44 | fprintf(stderr,"\e[1;31mDriver open failed,exiting\n");
45 | fclose(pcap_in);
46 | fclose(pcap_out);
47 | fclose(control_flow);
48 | return 0;
49 | }
50 | arp_init();
51 | log_tab_buf();
52 | int i = 1;
53 | printf("\e[0;34mFeeding input %02d",i);
54 | while((ret = driver_recv(&buf)) > 0){
55 | printf("\b\b%02d",i);
56 | fprintf(control_flow,"\nRound %02d -----------------------------\n",i++);
57 | if(memcmp(buf.data,my_mac,6) && memcmp(buf.data,boardcast_mac,6)){
58 | buf_t buf2;
59 | buf_copy(&buf2, &buf);
60 | memset(buf2.data,0,sizeof(ether_hdr_t));
61 | buf_remove_header(&buf2, sizeof(ether_hdr_t));
62 | uint8_t * ip = buf.data + 30;
63 | net_protocol_t pro = buf.data[13] ? NET_PROTOCOL_ARP : NET_PROTOCOL_IP;
64 | arp_out(&buf2,ip,pro);
65 | }else{
66 | ethernet_in(&buf);
67 | }
68 | log_tab_buf();
69 | }
70 | if(ret < 0){
71 | fprintf(stderr,"\e[1;31m\nError occur on receive,exiting\n");
72 | }
73 | driver_close();
74 | printf("\e[0;34m\nSample input all processed, checking output\n");
75 |
76 | fclose(control_flow);
77 |
78 | demo_log = fopen("data/arp_test/demo_log","r");
79 | out_log = fopen("data/arp_test/log","r");
80 | pcap_out = fopen("data/arp_test/out.pcap","r");
81 | pcap_demo = fopen("data/arp_test/demo_out.pcap","r");
82 | if(demo_log == 0 || out_log == 0 || pcap_out == 0 || pcap_demo == 0){
83 | if(demo_log) fclose(demo_log); else printf("\e[1;31mFailed to open demo_log\n");
84 | if(out_log) fclose(out_log); else printf("\e[1;31mFailed to open log\n");
85 | if(pcap_demo) fclose(pcap_demo); else printf("\e[1;31mFailed to open demo_out.pcap\n");
86 | if(pcap_out) fclose(pcap_out); else printf("\e[1;31mFailed to open out.pcap\n");
87 | return 0;
88 | }
89 | check_log();
90 | check_pcap();
91 | printf("\e[1;33mFor this test, log is only a reference. Your implementation is OK if your pcap file is the same to the demo pcap file.\n");
92 | fclose(demo_log);
93 | fclose(out_log);
94 | return 0;
95 | }
--------------------------------------------------------------------------------
/net_lab/test/ctest_arp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/test/ctest_arp
--------------------------------------------------------------------------------
/net_lab/test/ctest_eth_in:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/test/ctest_eth_in
--------------------------------------------------------------------------------
/net_lab/test/ctest_eth_out:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/test/ctest_eth_out
--------------------------------------------------------------------------------
/net_lab/test/ctest_icmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/test/ctest_icmp
--------------------------------------------------------------------------------
/net_lab/test/ctest_ip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/test/ctest_ip
--------------------------------------------------------------------------------
/net_lab/test/ctest_ip_frag:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/test/ctest_ip_frag
--------------------------------------------------------------------------------
/net_lab/test/data/arp_test/demo_out.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/test/data/arp_test/demo_out.pcap
--------------------------------------------------------------------------------
/net_lab/test/data/arp_test/in.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/test/data/arp_test/in.pcap
--------------------------------------------------------------------------------
/net_lab/test/data/arp_test/out.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/test/data/arp_test/out.pcap
--------------------------------------------------------------------------------
/net_lab/test/data/eth_in/demo_log:
--------------------------------------------------------------------------------
1 | driver opened
2 |
3 | Round 01 -----------------------------
4 | ip_in: buf: 45 08 00 28 06 f4 40 00 40 06 1b c4 0a 00 02 0f c0 a8 a3 67 00 16 fb 21 4f 43 b0 37 22 ea f8 1f 50 10 ff ff 18 2b 00 00
5 |
6 | Round 02 -----------------------------
7 | ip_in: buf: 45 08 00 5c 06 f5 40 00 40 06 1b 8f 0a 00 02 0f c0 a8 a3 67 00 16 fb 21 4f 43 b0 37 22 ea f8 1f 50 18 ff ff 18 5f 00 00 80 87 66 2c fd e8 d6 13 6e e5 62 ca db dc 4e 74 84 74 54 84 fe 36 84 09 e8 92 e6 77 7d e6 66 f9 b9 c4 cd 42 2b 21 dd 8c 85 da 71 71 14 ce 53 75 90 8a c3 1e
8 |
9 | Round 03 -----------------------------
10 | ip_in: buf: 45 00 00 46 fb 7c 40 00 40 11 c6 05 0a 00 02 0f c0 a8 a3 67 ae 1b 00 35 00 32 79 68 96 da 01 00 00 01 00 00 00 00 00 01 03 77 77 77 05 62 61 69 64 75 03 63 6f 6d 00 00 01 00 01 00 00 29 02 00 00 00 00 00 00 00
11 |
12 | Round 04 -----------------------------
13 | ip_in: buf: 45 00 00 46 fb 7d 40 00 40 11 c6 04 0a 00 02 0f c0 a8 a3 67 bf 6a 00 35 00 32 79 68 97 59 01 00 00 01 00 00 00 00 00 01 03 77 77 77 05 62 61 69 64 75 03 63 6f 6d 00 00 1c 00 01 00 00 29 02 00 00 00 00 00 00 00
14 |
15 | Round 05 -----------------------------
16 | ip_in: buf: 45 00 00 49 fb 7e 40 00 40 11 c6 00 0a 00 02 0f c0 a8 a3 67 84 9f 00 35 00 35 79 6b 5a 54 01 00 00 01 00 00 00 00 00 01 03 77 77 77 01 61 06 73 68 69 66 65 6e 03 63 6f 6d 00 00 1c 00 01 00 00 29 02 00 00 00 00 00 00 00
17 |
18 | Round 06 -----------------------------
19 | ip_in: buf: 45 00 00 54 01 f4 40 00 40 01 8d 11 0a 00 02 0f c0 a8 a3 67 08 00 3b 6a 00 01 00 01 c8 e4 86 5f 00 00 00 00 ae 7c 00 00 00 00 00 00 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37
20 |
21 | Round 07 -----------------------------
22 | ip_in: buf: 45 08 00 28 06 fe 40 00 40 06 1b ba 0a 00 02 0f c0 a8 a3 67 00 16 fb 21 4f 43 b1 3b 22 ea f9 23 50 10 ff ff 18 2b 00 00
23 |
24 | Round 08 -----------------------------
25 | ip_in: buf: 45 08 00 5c 06 ff 40 00 40 06 1b 85 0a 00 02 0f c0 a8 a3 67 00 16 fb 21 4f 43 b1 3b 22 ea f9 23 50 18 ff ff 18 5f 00 00 43 73 d2 49 55 63 e4 ce 3c 5e 8e bc 3f 25 6a 9c 76 39 e2 c9 3c 24 c3 4f be f0 38 58 48 4e 58 1c 81 66 81 a3 cc 00 95 e9 25 af 7b 8d 10 40 42 7a cb a7 e6 38
26 |
27 | Round 09 -----------------------------
28 | arp_in: buf: 00 01 08 00 06 04 00 01 08 00 27 6c 48 4f 0a 00 02 0f 11 22 33 44 55 66 c0 a8 a3 67
29 |
30 | Round 10 -----------------------------
31 | arp_in: buf: 00 01 08 00 06 04 00 01 08 00 27 6c 48 4f 0a 00 02 0f 11 22 33 44 55 66 c0 a8 a3 67
32 |
33 | Round 11 -----------------------------
34 | ip_in: buf: 45 00 00 54 2a ba 40 00 40 01 f7 dc 0a 00 02 0f c0 a8 a3 67 08 00 d3 fc 00 03 00 01 dd e4 86 5f 00 00 00 00 fc e7 04 00 00 00 00 00 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37
35 |
36 | Round 12 -----------------------------
37 | ip_in: buf: 45 00 00 56 ff 9f 40 00 40 11 c1 d2 0a 00 02 0f c0 a8 a3 67 a5 d4 00 35 00 42 79 78 5d 43 01 00 00 01 00 00 00 00 00 01 12 63 6f 6e 6e 65 63 74 69 76 69 74 79 2d 63 68 65 63 6b 06 75 62 75 6e 74 75 03 63 6f 6d 00 00 01 00 01 00 00 29 02 00 00 00 00 00 00 00
38 |
39 | Round 13 -----------------------------
40 | arp_in: buf: 00 01 08 00 06 04 00 01 08 00 27 6c 48 4f 0a 00 02 0f 11 22 33 44 55 66 c0 a8 a3 67
41 |
42 | Round 14 -----------------------------
43 | ip_in: buf: 45 00 00 7f 08 90 40 00 40 06 9e 5e 0a 00 02 0f c0 a8 a3 67 d8 84 00 50 7f 53 e7 20 a5 e0 66 02 50 18 fa f0 93 fc 00 00 47 45 54 20 2f 20 48 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 63 6f 6e 6e 65 63 74 69 76 69 74 79 2d 63 68 65 63 6b 2e 75 62 75 6e 74 75 2e 63 6f 6d 0d 0a 41 63 63 65 70 74 3a 20 2a 2f 2a 0d 0a 43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 63 6c 6f 73 65 0d 0a 0d 0a
44 |
45 | Round 15 -----------------------------
46 |
47 | Round 16 -----------------------------
48 |
49 | Round 17 -----------------------------
50 |
51 | driver closed
52 |
--------------------------------------------------------------------------------
/net_lab/test/data/eth_in/demo_out.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/test/data/eth_in/demo_out.pcap
--------------------------------------------------------------------------------
/net_lab/test/data/eth_in/in.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/test/data/eth_in/in.pcap
--------------------------------------------------------------------------------
/net_lab/test/data/eth_in/log:
--------------------------------------------------------------------------------
1 | driver opened
2 |
3 | Round 01 -----------------------------
4 | ip_in: buf: 45 08 00 28 06 f4 40 00 40 06 1b c4 0a 00 02 0f c0 a8 a3 67 00 16 fb 21 4f 43 b0 37 22 ea f8 1f 50 10 ff ff 18 2b 00 00
5 |
6 | Round 02 -----------------------------
7 | ip_in: buf: 45 08 00 5c 06 f5 40 00 40 06 1b 8f 0a 00 02 0f c0 a8 a3 67 00 16 fb 21 4f 43 b0 37 22 ea f8 1f 50 18 ff ff 18 5f 00 00 80 87 66 2c fd e8 d6 13 6e e5 62 ca db dc 4e 74 84 74 54 84 fe 36 84 09 e8 92 e6 77 7d e6 66 f9 b9 c4 cd 42 2b 21 dd 8c 85 da 71 71 14 ce 53 75 90 8a c3 1e
8 |
9 | Round 03 -----------------------------
10 | ip_in: buf: 45 00 00 46 fb 7c 40 00 40 11 c6 05 0a 00 02 0f c0 a8 a3 67 ae 1b 00 35 00 32 79 68 96 da 01 00 00 01 00 00 00 00 00 01 03 77 77 77 05 62 61 69 64 75 03 63 6f 6d 00 00 01 00 01 00 00 29 02 00 00 00 00 00 00 00
11 |
12 | Round 04 -----------------------------
13 | ip_in: buf: 45 00 00 46 fb 7d 40 00 40 11 c6 04 0a 00 02 0f c0 a8 a3 67 bf 6a 00 35 00 32 79 68 97 59 01 00 00 01 00 00 00 00 00 01 03 77 77 77 05 62 61 69 64 75 03 63 6f 6d 00 00 1c 00 01 00 00 29 02 00 00 00 00 00 00 00
14 |
15 | Round 05 -----------------------------
16 | ip_in: buf: 45 00 00 49 fb 7e 40 00 40 11 c6 00 0a 00 02 0f c0 a8 a3 67 84 9f 00 35 00 35 79 6b 5a 54 01 00 00 01 00 00 00 00 00 01 03 77 77 77 01 61 06 73 68 69 66 65 6e 03 63 6f 6d 00 00 1c 00 01 00 00 29 02 00 00 00 00 00 00 00
17 |
18 | Round 06 -----------------------------
19 | ip_in: buf: 45 00 00 54 01 f4 40 00 40 01 8d 11 0a 00 02 0f c0 a8 a3 67 08 00 3b 6a 00 01 00 01 c8 e4 86 5f 00 00 00 00 ae 7c 00 00 00 00 00 00 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37
20 |
21 | Round 07 -----------------------------
22 | ip_in: buf: 45 08 00 28 06 fe 40 00 40 06 1b ba 0a 00 02 0f c0 a8 a3 67 00 16 fb 21 4f 43 b1 3b 22 ea f9 23 50 10 ff ff 18 2b 00 00
23 |
24 | Round 08 -----------------------------
25 | ip_in: buf: 45 08 00 5c 06 ff 40 00 40 06 1b 85 0a 00 02 0f c0 a8 a3 67 00 16 fb 21 4f 43 b1 3b 22 ea f9 23 50 18 ff ff 18 5f 00 00 43 73 d2 49 55 63 e4 ce 3c 5e 8e bc 3f 25 6a 9c 76 39 e2 c9 3c 24 c3 4f be f0 38 58 48 4e 58 1c 81 66 81 a3 cc 00 95 e9 25 af 7b 8d 10 40 42 7a cb a7 e6 38
26 |
27 | Round 09 -----------------------------
28 | arp_in: buf: 00 01 08 00 06 04 00 01 08 00 27 6c 48 4f 0a 00 02 0f 11 22 33 44 55 66 c0 a8 a3 67
29 |
30 | Round 10 -----------------------------
31 | arp_in: buf: 00 01 08 00 06 04 00 01 08 00 27 6c 48 4f 0a 00 02 0f 11 22 33 44 55 66 c0 a8 a3 67
32 |
33 | Round 11 -----------------------------
34 | ip_in: buf: 45 00 00 54 2a ba 40 00 40 01 f7 dc 0a 00 02 0f c0 a8 a3 67 08 00 d3 fc 00 03 00 01 dd e4 86 5f 00 00 00 00 fc e7 04 00 00 00 00 00 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37
35 |
36 | Round 12 -----------------------------
37 | ip_in: buf: 45 00 00 56 ff 9f 40 00 40 11 c1 d2 0a 00 02 0f c0 a8 a3 67 a5 d4 00 35 00 42 79 78 5d 43 01 00 00 01 00 00 00 00 00 01 12 63 6f 6e 6e 65 63 74 69 76 69 74 79 2d 63 68 65 63 6b 06 75 62 75 6e 74 75 03 63 6f 6d 00 00 01 00 01 00 00 29 02 00 00 00 00 00 00 00
38 |
39 | Round 13 -----------------------------
40 | arp_in: buf: 00 01 08 00 06 04 00 01 08 00 27 6c 48 4f 0a 00 02 0f 11 22 33 44 55 66 c0 a8 a3 67
41 |
42 | Round 14 -----------------------------
43 | ip_in: buf: 45 00 00 7f 08 90 40 00 40 06 9e 5e 0a 00 02 0f c0 a8 a3 67 d8 84 00 50 7f 53 e7 20 a5 e0 66 02 50 18 fa f0 93 fc 00 00 47 45 54 20 2f 20 48 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 63 6f 6e 6e 65 63 74 69 76 69 74 79 2d 63 68 65 63 6b 2e 75 62 75 6e 74 75 2e 63 6f 6d 0d 0a 41 63 63 65 70 74 3a 20 2a 2f 2a 0d 0a 43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 63 6c 6f 73 65 0d 0a 0d 0a
44 |
45 | Round 15 -----------------------------
46 |
47 | Round 16 -----------------------------
48 |
49 | Round 17 -----------------------------
50 |
51 | driver closed
52 |
--------------------------------------------------------------------------------
/net_lab/test/data/eth_in/out.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/test/data/eth_in/out.pcap
--------------------------------------------------------------------------------
/net_lab/test/data/eth_out/demo_log:
--------------------------------------------------------------------------------
1 | driver opened
2 |
3 | Round 01 -----------------------------
4 |
5 | Round 02 -----------------------------
6 |
7 | Round 03 -----------------------------
8 |
9 | Round 04 -----------------------------
10 |
11 | Round 05 -----------------------------
12 |
13 | Round 06 -----------------------------
14 |
15 | Round 07 -----------------------------
16 |
17 | Round 08 -----------------------------
18 |
19 | Round 09 -----------------------------
20 |
21 | Round 10 -----------------------------
22 |
23 | Round 11 -----------------------------
24 |
25 | Round 12 -----------------------------
26 |
27 | Round 13 -----------------------------
28 |
29 | Round 14 -----------------------------
30 |
31 | Round 15 -----------------------------
32 |
33 | Round 16 -----------------------------
34 |
35 | Round 17 -----------------------------
36 |
37 | driver closed
38 |
--------------------------------------------------------------------------------
/net_lab/test/data/eth_out/demo_out.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/test/data/eth_out/demo_out.pcap
--------------------------------------------------------------------------------
/net_lab/test/data/eth_out/in.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/test/data/eth_out/in.pcap
--------------------------------------------------------------------------------
/net_lab/test/data/eth_out/log:
--------------------------------------------------------------------------------
1 | driver opened
2 |
3 | Round 01 -----------------------------
4 |
5 | Round 02 -----------------------------
6 |
7 | Round 03 -----------------------------
8 |
9 | Round 04 -----------------------------
10 |
11 | Round 05 -----------------------------
12 |
13 | Round 06 -----------------------------
14 |
15 | Round 07 -----------------------------
16 |
17 | Round 08 -----------------------------
18 |
19 | Round 09 -----------------------------
20 |
21 | Round 10 -----------------------------
22 |
23 | Round 11 -----------------------------
24 |
25 | Round 12 -----------------------------
26 |
27 | Round 13 -----------------------------
28 |
29 | Round 14 -----------------------------
30 |
31 | Round 15 -----------------------------
32 |
33 | Round 16 -----------------------------
34 |
35 | Round 17 -----------------------------
36 |
37 | driver closed
38 |
--------------------------------------------------------------------------------
/net_lab/test/data/eth_out/out.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/test/data/eth_out/out.pcap
--------------------------------------------------------------------------------
/net_lab/test/data/icmp_test/demo_out.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/test/data/icmp_test/demo_out.pcap
--------------------------------------------------------------------------------
/net_lab/test/data/icmp_test/in.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/test/data/icmp_test/in.pcap
--------------------------------------------------------------------------------
/net_lab/test/data/icmp_test/out.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/test/data/icmp_test/out.pcap
--------------------------------------------------------------------------------
/net_lab/test/data/ip_test/demo_out.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/test/data/ip_test/demo_out.pcap
--------------------------------------------------------------------------------
/net_lab/test/data/ip_test/in.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/test/data/ip_test/in.pcap
--------------------------------------------------------------------------------
/net_lab/test/data/ip_test/out.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/test/data/ip_test/out.pcap
--------------------------------------------------------------------------------
/net_lab/test/eth_in_test.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include "driver.h"
3 | #include "ethernet.h"
4 |
5 | extern FILE *pcap_in;
6 | extern FILE *pcap_out;
7 | extern FILE *control_flow;
8 | extern FILE *ip_fout;
9 | extern FILE *arp_fout;
10 | extern FILE *demo_log;
11 | extern FILE *out_log;
12 |
13 | int check_log();
14 |
15 | buf_t buf;
16 | int main(){
17 | int ret;
18 | pcap_in = fopen("data/eth_in/in.pcap","r");
19 | pcap_out = fopen("data/eth_in/out.pcap","w");
20 | ip_fout = fopen("data/eth_in/log","w");
21 | if(pcap_in == 0 || pcap_out == 0 || ip_fout == 0){
22 | if(pcap_in) fclose(pcap_in); else printf("\e[1;31mFailed to open in.pcap\n");
23 | if(pcap_out)fclose(pcap_out); else printf("\e[1;31mFailed to open out.pcap\n");
24 | if(ip_fout) fclose(ip_fout); else printf("\e[1;31mFailed to open log\n");
25 | return 0;
26 | }
27 | arp_fout = ip_fout;
28 | control_flow = ip_fout;
29 |
30 | printf("\e[0;34mTest start\n");
31 | if(ethernet_init()){
32 | fprintf(stderr,"\e[1;31mDriver open failed,exiting\n");
33 | fclose(pcap_in);
34 | fclose(pcap_out);
35 | fclose(ip_fout);
36 | return 0;
37 | }
38 | int i = 1;
39 | printf("\e[0;34mFeeding input %02d",i);
40 | while((ret = driver_recv(&buf)) > 0){
41 | printf("\b\b%02d",i);
42 | fprintf(control_flow,"\nRound %02d -----------------------------\n",i++);
43 | ethernet_in(&buf);
44 | }
45 | if(ret < 0){
46 | fprintf(stderr,"\e[1;31m\nError occur on loading input,exiting\n");
47 | }
48 | driver_close();
49 | printf("\e[0;34m\nSample input all processed, checking output\n");
50 |
51 | fclose(ip_fout);
52 |
53 | demo_log = fopen("data/eth_in/demo_log","r");
54 | out_log = fopen("data/eth_in/log","r");
55 | if(demo_log == 0 || out_log == 0){
56 | if(demo_log) fclose(demo_log); else printf("\e[1;31mFailed to open demo_log\n");
57 | if(out_log) fclose(out_log); else printf("\e[1;31mFailed to open log\n");
58 | return 0;
59 | }
60 | check_log();
61 | fclose(demo_log);
62 | fclose(out_log);
63 | return 0;
64 | }
--------------------------------------------------------------------------------
/net_lab/test/eth_out_test.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "driver.h"
4 | #include "ethernet.h"
5 |
6 | extern FILE *pcap_in;
7 | extern FILE *pcap_out;
8 | extern FILE *pcap_demo;
9 | extern FILE *control_flow;
10 | extern FILE *demo_log;
11 | extern FILE *out_log;
12 |
13 | int check_log();
14 | int check_pcap();
15 | char* print_mac(uint8_t *mac);
16 |
17 | buf_t buf,buf2;
18 | int main(){
19 | int ret;
20 | pcap_in = fopen("data/eth_out/in.pcap","r");
21 | pcap_out = fopen("data/eth_out/out.pcap","w");
22 | control_flow = fopen("data/eth_out/log","w");
23 | if(pcap_in == 0 || pcap_out == 0 || control_flow == 0){
24 | if(pcap_in) fclose(pcap_in); else printf("\e[1;31mFailed to open in.pcap\n");
25 | if(pcap_out)fclose(pcap_out); else printf("\e[1;31mFailed to open out.pcap\n");
26 | if(control_flow) fclose(control_flow); else printf("\e[1;31mFailed to open log\n");
27 | return 0;
28 | }
29 |
30 | printf("\e[0;34mTest start\n");
31 | if(ethernet_init()){
32 | fprintf(stderr,"\e[1;31mDriver open failed,exiting\n");
33 | fclose(pcap_in);
34 | fclose(pcap_out);
35 | fclose(control_flow);
36 | return 0;
37 | }
38 | int i = 1;
39 | printf("\e[0;34mFeeding input %02d",i);
40 | while((ret = driver_recv(&buf)) > 0){
41 | printf("\b\b%02d",i);
42 | fprintf(control_flow,"\nRound %02d -----------------------------\n",i++);
43 | buf_copy(&buf2, &buf);
44 | memset(buf.data,0,sizeof(ether_hdr_t));
45 | buf_remove_header(&buf, sizeof(ether_hdr_t));
46 | int proto = buf2.data[12];
47 | proto <<= 8;
48 | proto |= buf2.data[13];
49 | ethernet_out(&buf,buf2.data,proto);
50 | }
51 | if(ret < 0){
52 | fprintf(stderr,"\e[1;31m\nError occur on loading input,exiting\n");
53 | }
54 | driver_close();
55 | printf("\e[0;34m\nSample input all processed, checking output\n");
56 |
57 | fclose(control_flow);
58 |
59 | demo_log = fopen("data/eth_out/demo_log","r");
60 | out_log = fopen("data/eth_out/log","r");
61 | pcap_out = fopen("data/eth_out/out.pcap","r");
62 | pcap_demo = fopen("data/eth_out/demo_out.pcap","r");
63 | if(demo_log == 0 || out_log == 0 || pcap_out == 0 || pcap_demo == 0){
64 | if(demo_log) fclose(demo_log); else printf("\e[1;31mFailed to open demo_log\n");
65 | if(out_log) fclose(out_log); else printf("\e[1;31mFailed to open log\n");
66 | if(pcap_demo) fclose(pcap_demo); else printf("\e[1;31mFailed to open demo_out.pcap\n");
67 | if(pcap_out) fclose(pcap_out); else printf("\e[1;31mFailed to open out.pcap\n");
68 | return 0;
69 | }
70 | check_log();
71 | check_pcap();
72 | fclose(demo_log);
73 | fclose(out_log);
74 | return 0;
75 | }
--------------------------------------------------------------------------------
/net_lab/test/faker/arp.c:
--------------------------------------------------------------------------------
1 | #include "arp.h"
2 | #include "utils.h"
3 | #include "ethernet.h"
4 | #include "config.h"
5 | #include
6 | #include
7 |
8 | extern FILE *control_flow;
9 |
10 | extern FILE *arp_fin;
11 | extern FILE *arp_fout;
12 |
13 | char* print_ip(uint8_t *ip);
14 | char* print_mac(uint8_t *mac);
15 | void fprint_buf(FILE* f, buf_t* buf);
16 |
17 | arp_entry_t arp_table[ARP_MAX_ENTRY];
18 | arp_buf_t arp_buf;
19 |
20 | void arp_update(uint8_t *ip, uint8_t *mac, arp_state_t state)
21 | {
22 | fprintf(arp_fout,"arp update:\t");
23 | fprintf(arp_fout,"ip:%s\t",print_ip(ip));
24 | fprintf(arp_fout,"mac:%s\t",print_mac(mac));
25 | fprintf(arp_fout,"state:%d\n",state);
26 | }
27 |
28 | void arp_in(buf_t *buf)
29 | {
30 | fprintf(arp_fout,"arp_in:");
31 | fprint_buf(arp_fout,buf);
32 | }
33 |
34 | void arp_out(buf_t *buf, uint8_t *ip, net_protocol_t protocol)
35 | {
36 | fprintf(arp_fout,"arp_out\t");
37 | fprintf(arp_fout,"ip:%s\t",print_ip(ip));
38 | fprintf(arp_fout,"protocol: %d\t",protocol);
39 | fprint_buf(arp_fout,buf);
40 | }
41 |
42 | void arp_init()
43 | {
44 | fprintf(arp_fout,"arp_init\n");
45 | }
--------------------------------------------------------------------------------
/net_lab/test/faker/driver.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include "config.h"
5 | static pcap_t *pcap;
6 | static pcap_dumper_t *pdump;
7 | static char pcap_errbuf[PCAP_ERRBUF_SIZE];
8 | extern FILE* pcap_in;
9 | extern FILE* pcap_out;
10 | extern FILE *control_flow;
11 |
12 | int driver_open()
13 | {
14 | pcap = pcap_fopen_offline(pcap_in,pcap_errbuf);
15 | if(pcap == NULL){
16 | fprintf(stderr,"pcap_open_offline() failed:%s\n",pcap_errbuf);
17 | return -1;
18 | }
19 |
20 | pdump = pcap_dump_fopen(pcap,pcap_out);
21 | if(pdump == NULL){
22 | fprintf(stderr,"pcap_dump_fopen() failed:%s\n", pcap_geterr(pcap));
23 | return -1;
24 | }
25 |
26 | fprintf(control_flow,"driver opened\n");
27 | return 0;
28 | }
29 |
30 | int driver_recv(buf_t *buf)
31 | {
32 | struct pcap_pkthdr *pkt_hdr;
33 | const uint8_t *pkt_data;
34 | int ret = pcap_next_ex(pcap, &pkt_hdr, &pkt_data);
35 | if (ret == PCAP_ERROR_BREAK){
36 | // printf("meet end of file\n");
37 | return 0;
38 | }else if (ret == 1){
39 | buf_init(buf,pkt_hdr->len);
40 | memcpy(buf->data, pkt_data, pkt_hdr->len);
41 | return pkt_hdr->len;
42 | }else{
43 | fprintf(stderr, "Error in driver_recv: %s\n", pcap_geterr(pcap));
44 | return -1;
45 | }
46 | }
47 |
48 | int driver_send(buf_t *buf)
49 | {
50 | struct pcap_pkthdr header;
51 | memset(&header.ts,0,sizeof(header.ts));
52 | header.caplen = buf->len;
53 | header.len = buf->len;
54 | pcap_dump((u_char *)pdump,&header,buf->data);
55 | return 0;
56 | }
57 |
58 | void driver_close()
59 | {
60 | fprintf(control_flow,"\ndriver closed\n");
61 | pcap_dump_close(pdump);
62 | pcap_close(pcap);
63 | }
64 |
--------------------------------------------------------------------------------
/net_lab/test/faker/icmp.c:
--------------------------------------------------------------------------------
1 | #include "icmp.h"
2 | #include "ip.h"
3 | #include
4 | #include
5 |
6 | extern FILE *icmp_fin;
7 | extern FILE *icmp_fout;
8 | char* print_ip(uint8_t *ip);
9 | void fprint_buf(FILE* f, buf_t* buf);
10 |
11 | static void icmp_resp(buf_t *req_buf, uint8_t *src_ip)
12 | {
13 | fprintf(icmp_fout,"icmp_resp:\t");
14 | fprintf(icmp_fout,"ip: %s\n",src_ip ? print_ip(src_ip) : "null");
15 | fprint_buf(icmp_fout, req_buf);
16 | }
17 |
18 | void icmp_in(buf_t *buf, uint8_t *src_ip)
19 | {
20 | fprintf(icmp_fout,"icmp_in:\t");
21 | fprintf(icmp_fout,"ip: %s\n",print_ip(src_ip));
22 | fprint_buf(icmp_fout, buf);
23 | }
24 |
25 |
26 | void icmp_unreachable(buf_t *recv_buf, uint8_t *src_ip, icmp_code_t code)
27 | {
28 | fprintf(icmp_fout,"icmp_unreachable:\t");
29 | fprintf(icmp_fout,"ip: %s\t",src_ip ? print_ip(src_ip) : "null");
30 | fprintf(icmp_fout,"code: %d\n",code);
31 | fprint_buf(icmp_fout, recv_buf);
32 | }
--------------------------------------------------------------------------------
/net_lab/test/faker/ip.c:
--------------------------------------------------------------------------------
1 | #include "ip.h"
2 | #include "arp.h"
3 | #include "icmp.h"
4 | #include "udp.h"
5 | #include
6 | #include
7 |
8 | extern FILE *control_flow;
9 |
10 | extern FILE *ip_fin;
11 | extern FILE *ip_fout;
12 |
13 | char* print_ip(uint8_t *ip);
14 | void fprint_buf(FILE* f, buf_t* buf);
15 |
16 | void ip_in(buf_t *buf)
17 | {
18 | fprintf(ip_fout,"ip_in:");
19 | fprint_buf(ip_fout, buf);
20 | }
21 |
22 | void ip_fragment_out(buf_t *buf, uint8_t *ip, net_protocol_t protocol, int id, uint16_t offset, int mf)
23 | {
24 | fprintf(ip_fout,"ip_fragment_out:\t");
25 | fprintf(ip_fout,"ip: %s\t", print_ip(ip));
26 | fprintf(ip_fout,"protocol: %d\t",protocol);
27 | fprintf(ip_fout,"id: %d\t",id);
28 | fprintf(ip_fout,"offset: %d\t",offset);
29 | fprintf(ip_fout,"mf: %d\n",mf);
30 | fprint_buf(ip_fout, buf);
31 | }
32 |
33 | void ip_out(buf_t *buf, uint8_t *ip, net_protocol_t protocol)
34 | {
35 | fprintf(ip_fout,"ip_out:\t");
36 | fprintf(ip_fout,"ip: %s\t", print_ip(ip));
37 | fprintf(ip_fout,"protocol: %d\n",protocol);
38 | fprint_buf(ip_fout, buf);
39 | }
--------------------------------------------------------------------------------
/net_lab/test/faker/udp.c:
--------------------------------------------------------------------------------
1 | #include "udp.h"
2 | #include "ip.h"
3 | #include "icmp.h"
4 | #include
5 | #include
6 | #include
7 |
8 | extern FILE *udp_fin;
9 | extern FILE *udp_fout;
10 | char* print_ip(uint8_t *ip);
11 | void fprint_buf(FILE* f, buf_t* buf);
12 |
13 | void udp_in(buf_t *buf, uint8_t *src_ip)
14 | {
15 | fprintf(udp_fout,"udp_in:\tsrc_ip:%s\n",print_ip(src_ip));
16 | fprint_buf(udp_fout, buf);
17 | }
18 |
19 | void udp_out(buf_t *buf, uint16_t src_port, uint8_t *dest_ip, uint16_t dest_port)
20 | {
21 | fprintf(udp_fout,"udp_out:\t");
22 | fprintf(udp_fout,"src_port: %d\t", src_port);
23 | fprintf(udp_fout,"dest_ip: %s\t", print_ip(dest_ip));
24 | fprintf(udp_fout,"dest_port: %d\n", dest_port);
25 | fprint_buf(udp_fout, buf);
26 | }
27 |
28 | void udp_init()
29 | {
30 | fprintf(udp_fout,"udp_init\n");
31 | }
32 |
33 | int udp_open(uint16_t port, udp_handler_t handler)
34 | {
35 | fprintf(udp_fout,"udp_open: port:%d\n",port);
36 | }
37 |
38 | void udp_close(uint16_t port)
39 | {
40 | fprintf(udp_fout,"udp_close: port:%d\n",port);
41 | }
42 |
43 |
44 | void udp_send(uint8_t *data, uint16_t len, uint16_t src_port, uint8_t *dest_ip, uint16_t dest_port)
45 | {
46 | fprintf(udp_fout,"udp_send: len:%d\t",len);
47 | fprintf(udp_fout,"src_port:%d\t",src_port);
48 | fprintf(udp_fout,"dest_ip:%s\t",print_ip(dest_ip));
49 | fprintf(udp_fout,"dest_port:%d\n",dest_port);
50 | fprintf(udp_fout,"\tdata:");
51 | if(data){
52 | for(int i = 0; i < len; i++){
53 | fprintf(udp_fout," %02x",data[i]);
54 | }
55 | fprintf(udp_fout,"\n");
56 | }else{
57 | fprintf(udp_fout," (null)\n");
58 | }
59 | }
--------------------------------------------------------------------------------
/net_lab/test/icmp_test.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "driver.h"
4 | #include "ethernet.h"
5 | #include "arp.h"
6 | #include "ip.h"
7 |
8 | extern FILE *pcap_in;
9 | extern FILE *pcap_out;
10 | extern FILE *pcap_demo;
11 | extern FILE *control_flow;
12 | extern FILE *udp_fout;
13 | extern FILE *demo_log;
14 | extern FILE *out_log;
15 | extern FILE *arp_log_f;
16 |
17 | char* print_ip(uint8_t *ip);
18 | char* print_mac(uint8_t *mac);
19 |
20 | uint8_t my_mac[] = DRIVER_IF_MAC;
21 | uint8_t boardcast_mac[] = {0xff,0xff,0xff,0xff,0xff,0xff};
22 |
23 |
24 |
25 | int check_log();
26 | int check_pcap();
27 |
28 | void log_tab_buf();
29 |
30 | buf_t buf;
31 | int main(){
32 | int ret;
33 | printf("\e[0;34mTest begin.\n");
34 | pcap_in = fopen("data/icmp_test/in.pcap","r");
35 | pcap_out = fopen("data/icmp_test/out.pcap","w");
36 | control_flow = fopen("data/icmp_test/log","w");
37 | if(pcap_in == 0 || pcap_out == 0 || control_flow == 0){
38 | if(pcap_in) fclose(pcap_in); else printf("\e[1;31mFailed to open in.pcap\n");
39 | if(pcap_out)fclose(pcap_out); else printf("\e[1;31mFailed to open out.pcap\n");
40 | if(control_flow) fclose(control_flow); else printf("\e[1;31mFailed to open log\n");
41 | return 0;
42 | }
43 | udp_fout = control_flow;
44 | arp_log_f = control_flow;
45 |
46 | if(ethernet_init()){
47 | fprintf(stderr,"\e[1;31mDriver open failed,exiting\n");
48 | fclose(pcap_in);
49 | fclose(pcap_out);
50 | fclose(control_flow);
51 | return 0;
52 | }
53 | arp_init();
54 | log_tab_buf();
55 | int i = 1;
56 | printf("\e[0;34mFeeding input %02d",i);
57 | while((ret = driver_recv(&buf)) > 0){
58 | printf("\b\b%02d",i);
59 | fprintf(control_flow,"\nRound %02d -----------------------------\n",i++);
60 | if(memcmp(buf.data,my_mac,6) && memcmp(buf.data,boardcast_mac,6)){
61 | buf_t buf2;
62 | buf_copy(&buf2, &buf);
63 | memset(buf2.data,0,sizeof(ether_hdr_t));
64 | buf_remove_header(&buf2, sizeof(ether_hdr_t));
65 | int len = (buf2.data[0] & 0xf) << 2;
66 | uint8_t * ip = buf.data + 30;
67 | net_protocol_t pro = buf2.data[9];
68 | memset(buf2.data,0,sizeof(len));
69 | buf_remove_header(&buf2, len);
70 | ip_out(&buf2,ip,pro);
71 | }else{
72 | ethernet_in(&buf);
73 | }
74 | log_tab_buf();
75 | }
76 | if(ret < 0){
77 | fprintf(stderr,"\e[1;31m\nError occur on loading input,exiting\n");
78 | }
79 | driver_close();
80 | printf("\e[0;34m\nSample input all processed, checking output\n");
81 |
82 | fclose(control_flow);
83 |
84 | demo_log = fopen("data/icmp_test/demo_log","r");
85 | out_log = fopen("data/icmp_test/log","r");
86 | pcap_out = fopen("data/icmp_test/out.pcap","r");
87 | pcap_demo = fopen("data/icmp_test/demo_out.pcap","r");
88 | if(demo_log == 0 || out_log == 0 || pcap_out == 0 || pcap_demo == 0){
89 | if(demo_log) fclose(demo_log); else printf("\e[1;31mFailed to open demo_log\n\e[0m");
90 | if(out_log) fclose(out_log); else printf("\e[1;31mFailed to open log\n\e[0m");
91 | if(pcap_demo) fclose(pcap_demo); else printf("\e[1;31mFailed to open demo_out.pcap\n\e[0m");
92 | if(pcap_out) fclose(pcap_out); else printf("\e[1;31mFailed to open out.pcap\n\e[0m");
93 | return 0;
94 | }
95 | check_log();
96 | check_pcap();
97 | printf("\e[1;33mFor this test, log is only a reference. Your implementation is OK if your pcap file is the same to the demo pcap file.\n");
98 | fclose(demo_log);
99 | fclose(out_log);
100 | return 0;
101 | }
--------------------------------------------------------------------------------
/net_lab/test/ip_frag_test.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include "net.h"
5 | #include "ip.h"
6 | #include "utils.h"
7 |
8 | extern FILE *control_flow;
9 | extern FILE *arp_fout;
10 |
11 | buf_t buf;
12 | int main()
13 | {
14 | FILE *in = fopen("data/ip_frag_test/in.txt","r");
15 | control_flow = fopen("data/ip_frag_test/log","w");
16 | if(in == 0 || control_flow == 0){
17 | in && fclose(in);
18 | control_flow && fclose(control_flow);
19 | return 0;
20 | }
21 | arp_fout = control_flow;
22 | char * p = buf.payload + 1000;
23 | buf.data = p;
24 | buf.len = 0;
25 | char c;
26 | while(fread(&c,1,1,in)){
27 | *p = c;
28 | p++;
29 | buf.len++;
30 | }
31 | printf("\e[0;34mFeeding input.\n");
32 | ip_out(&buf,net_if_ip,NET_PROTOCOL_TCP);
33 |
34 | fclose(in);
35 | fclose(control_flow);
36 |
37 | FILE * demo = fopen("data/ip_frag_test/demo_log","r");
38 | FILE * log = fopen("data/ip_frag_test/log","r");
39 | int line = 1;
40 | int column = 0;
41 | int diff = 0;
42 | char c1,c2;
43 | printf("\e[0;34mComparing logs.\n");
44 | while(fread(&c1,1,1,demo)){
45 | column++;
46 | if(fread(&c2,1,1,log) <= 0){
47 | printf("\e[0;31mLog file shorter than expected.\n");
48 | diff = 1;
49 | break;
50 | }
51 | if(c1 != c2){
52 | printf("\e[0;31mDifferent char found at line %d column %d.\n",line,column);
53 | diff = 1;
54 | break;
55 | }
56 | if(c1 == '\n'){
57 | line ++;
58 | column = 0;
59 | }
60 | }
61 | if(diff == 0 && fread(&c2,1,1,log) == 1){
62 | printf("\e[0;31mLog file longer than expected.\n");
63 | diff = 1;
64 | }
65 | if(diff == 0){
66 | printf("\e[1;32mLog file check passed\n");
67 | }
68 | fclose(log);
69 | fclose(demo);
70 | return 0;
71 | }
72 |
73 |
--------------------------------------------------------------------------------
/net_lab/test/ip_test.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "driver.h"
4 | #include "ethernet.h"
5 | #include "arp.h"
6 | #include "ip.h"
7 |
8 | extern FILE *pcap_in;
9 | extern FILE *pcap_out;
10 | extern FILE *pcap_demo;
11 | extern FILE *control_flow;
12 | extern FILE *icmp_fout;
13 | extern FILE *udp_fout;
14 | extern FILE *demo_log;
15 | extern FILE *out_log;
16 | extern FILE *arp_log_f;
17 |
18 | char* print_ip(uint8_t *ip);
19 | char* print_mac(uint8_t *mac);
20 |
21 | uint8_t my_mac[] = DRIVER_IF_MAC;
22 | uint8_t boardcast_mac[] = {0xff,0xff,0xff,0xff,0xff,0xff};
23 |
24 | int check_log();
25 | int check_pcap();
26 | void log_tab_buf();
27 |
28 | buf_t buf;
29 | int main(){
30 | int ret;
31 | printf("\e[0;34mTest begin.\n");
32 | pcap_in = fopen("data/ip_test/in.pcap","r");
33 | pcap_out = fopen("data/ip_test/out.pcap","w");
34 | control_flow = fopen("data/ip_test/log","w");
35 | if(pcap_in == 0 || pcap_out == 0 || control_flow == 0){
36 | if(pcap_in) fclose(pcap_in); else printf("\e[1;31mFailed to open in.pcap\n");
37 | if(pcap_out)fclose(pcap_out); else printf("\e[1;31mFailed to open out.pcap\n");
38 | if(control_flow) fclose(control_flow); else printf("\e[1;31mFailed to open log\n");
39 | return 0;
40 | }
41 | icmp_fout = control_flow;
42 | udp_fout = control_flow;
43 | arp_log_f = control_flow;
44 |
45 | if(ethernet_init()){
46 | fprintf(stderr,"\e[1;31mDriver open failed,exiting\n");
47 | fclose(pcap_in);
48 | fclose(pcap_out);
49 | fclose(control_flow);
50 | return 0;
51 | }
52 | arp_init();
53 | log_tab_buf();
54 | int i = 1;
55 | printf("\e[0;34mFeeding input %02d",i);
56 | while((ret = driver_recv(&buf)) > 0){
57 | printf("\b\b%02d",i);
58 | // printf("\nFeeding input %02d\n",i);
59 | fprintf(control_flow,"\nRound %02d -----------------------------\n",i++);
60 | if(memcmp(buf.data,my_mac,6) && memcmp(buf.data,boardcast_mac,6)){
61 | buf_t buf2;
62 | buf_copy(&buf2, &buf);
63 | memset(buf2.data,0,sizeof(ether_hdr_t));
64 | buf_remove_header(&buf2, sizeof(ether_hdr_t));
65 | int len = (buf2.data[0] & 0xf) << 2;
66 | uint8_t * ip = buf.data + 30;
67 | net_protocol_t pro = buf2.data[9];
68 | memset(buf2.data,0,len);
69 | buf_remove_header(&buf2, len);
70 | // printf("ip_out: hd_len:%d\tip:%s\tpro:%d\n",len,print_ip(ip),pro);
71 | ip_out(&buf2,ip,pro);
72 | }else{
73 | ethernet_in(&buf);
74 | }
75 | log_tab_buf();
76 | }
77 | if(ret < 0){
78 | fprintf(stderr,"\e[1;31m\nError occur on loading input,exiting\n");
79 | }
80 | driver_close();
81 | printf("\e[0;34m\nSample input all processed, checking output\n");
82 |
83 | fclose(control_flow);
84 |
85 | demo_log = fopen("data/ip_test/demo_log","r");
86 | out_log = fopen("data/ip_test/log","r");
87 | pcap_out = fopen("data/ip_test/out.pcap","r");
88 | pcap_demo = fopen("data/ip_test/demo_out.pcap","r");
89 | if(demo_log == 0 || out_log == 0 || pcap_out == 0 || pcap_demo == 0){
90 | if(demo_log) fclose(demo_log); else printf("\e[1;31mFailed to open demo_log\n");
91 | if(out_log) fclose(out_log); else printf("\e[1;31mFailed to open log\n");
92 | if(pcap_demo) fclose(pcap_demo); else printf("\e[1;31mFailed to open demo_out.pcap\n");
93 | if(pcap_out) fclose(pcap_out); else printf("\e[1;31mFailed to open out.pcap\n");
94 | return 0;
95 | }
96 | check_log();
97 | check_pcap();
98 | printf("\e[1;33mFor this test, log is only a reference. Your implementation is OK if your pcap file is the same to the demo pcap file.\n");
99 | fclose(demo_log);
100 | fclose(out_log);
101 | return 0;
102 | }
--------------------------------------------------------------------------------
/net_lab/test/main:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab/test/main
--------------------------------------------------------------------------------
/net_lab10/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/net_lab10/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/net_lab10/.idea/net_lab10.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/net_lab10/net_lab10_client/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/net_lab10/net_lab10_client/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/net_lab10/net_lab10_client/.idea/net_lab10_client.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/net_lab10/net_lab10_client/Goodbye.txt:
--------------------------------------------------------------------------------
1 | Goodbye, server.
2 |
--------------------------------------------------------------------------------
/net_lab10/net_lab10_client/Hello.txt:
--------------------------------------------------------------------------------
1 | Hello,I am server.Hello,I am server.
--------------------------------------------------------------------------------
/net_lab10/net_lab10_client/__pycache__/client.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab10/net_lab10_client/__pycache__/client.cpython-38.pyc
--------------------------------------------------------------------------------
/net_lab10/net_lab10_client/client.py:
--------------------------------------------------------------------------------
1 | from socket import *
2 |
3 | serverHost = '127.0.0.1'
4 | serverPort = 5000
5 |
6 |
7 | def download_file(filename):
8 | clientSocket = socket(AF_INET, SOCK_STREAM)
9 | clientSocket.connect((serverHost, serverPort))
10 | # 发送要下载文件的命令以及文件名给服务器
11 | outputdata = 'download ' + filename
12 | clientSocket.send(outputdata.encode())
13 | data = 1
14 | while data:
15 | data = clientSocket.recv(1024)
16 | list = data.decode().split()
17 | if len(list):
18 | flag = list[0]
19 | if flag == '1':
20 | del list[0]
21 | str = ' '
22 | data = str.join(list)
23 | # 创建文件,写入内容
24 | f = open(filename, 'a+')
25 | f.write(data)
26 | f.close()
27 | elif flag == '0':
28 | print('Not found this file!')
29 |
30 | clientSocket.close()
31 | print('Download finished!\n')
32 |
33 |
34 | def upload_file(filename):
35 | clientSocket = socket(AF_INET, SOCK_STREAM)
36 | clientSocket.connect((serverHost, serverPort))
37 | outputdata = 'upload ' + filename + ' '
38 |
39 | f = open(filename, "rb")
40 | outputdata += f.read().decode()
41 | f.close()
42 | clientSocket.send(outputdata.encode())
43 | clientSocket.close()
44 | print('Upload finished!\n')
45 |
--------------------------------------------------------------------------------
/net_lab10/net_lab10_client/main.py:
--------------------------------------------------------------------------------
1 | import client
2 |
3 |
4 | if __name__ == '__main__':
5 | print('We provide the following two functions: ')
6 | print('1. Upload file ')
7 | print('2. Download file \n')
8 | print('Please input the function number you want: (eg. 1) ')
9 | option = input()
10 | if option == '1':
11 | print('Please input the file name you want to upload: (eg. Goodbye.txt) ')
12 | else:
13 | print('Please input the file name you want to download: (eg. Goodbye.txt) ')
14 | filename = input()
15 | if option == '1':
16 | print('Upload... ')
17 | client.upload_file(filename)
18 | else:
19 | print('Download... ')
20 | client.download_file(filename)
21 |
--------------------------------------------------------------------------------
/net_lab10/net_lab10_server/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/net_lab10/net_lab10_server/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/net_lab10/net_lab10_server/.idea/net_lab10_server.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/net_lab10/net_lab10_server/Goodbye.txt:
--------------------------------------------------------------------------------
1 | Goodbye, server.
--------------------------------------------------------------------------------
/net_lab10/net_lab10_server/Hello.txt:
--------------------------------------------------------------------------------
1 | Hello,I am server.
--------------------------------------------------------------------------------
/net_lab10/net_lab10_server/server.py:
--------------------------------------------------------------------------------
1 | from socket import *
2 | import threading
3 |
4 |
5 | def server_process(connectionSocket):
6 | try:
7 | message = connectionSocket.recv(1024)
8 | message = message.decode()
9 | list = message.split() # 将数据用空格分开
10 | option = list[0]
11 | filename = list[1]
12 | if option == 'download':
13 | outputdata = '1 ' # 表示有该文件
14 | f = open(filename, "rb")
15 | outputdata += f.read().decode()
16 | f.close()
17 | connectionSocket.send(outputdata.encode())
18 | connectionSocket.close()
19 | print('thread id: ', threading.currentThread())
20 | print('Download finished!')
21 | elif option == 'upload':
22 | data = 1
23 | while data:
24 | f = open(filename, 'a+')
25 | del list[0:2] # 删掉前两个元素option和filename
26 | str = ' '
27 | data = str.join(list)
28 | print(data)
29 | f.write(data)
30 | f.close()
31 | connectionSocket.close()
32 | print('Upload finished!')
33 | except IOError:
34 | # Send response message for file not found
35 | outputdata = '0 Not found this file!\r\n\r\n'
36 | # Close client socket
37 | for i in range(0, len(outputdata)):
38 | connectionSocket.send(outputdata[i].encode())
39 | connectionSocket.close()
40 |
41 |
42 | if __name__ == '__main__':
43 | serverSocket = socket(AF_INET, SOCK_STREAM)
44 | # Prepare a sever socket
45 | serverHost = '127.0.0.1'
46 | serverPort = 5000
47 | serverSocket.bind((serverHost, serverPort)) # 指定ip和端口号
48 | serverSocket.listen(10) # 保证挂起的连接池中至少要有10个连接
49 |
50 | while True:
51 | # Establish the connection
52 | print('Ready to serve...')
53 | connectionSocket, addr = serverSocket.accept()
54 | thread = threading.Thread(target=server_process, args=(connectionSocket,))
55 | thread.start()
56 |
57 | serverSocket.close()
58 |
59 |
--------------------------------------------------------------------------------
/net_lab11/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/net_lab11/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/net_lab11/.idea/net_lab11.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/net_lab11/image.py:
--------------------------------------------------------------------------------
1 | from socket import *
2 | import base64
3 | subject = 'I love computer networks!'
4 | contenttype = 'multipart/mixed'
5 | endmsg = '\r\n.\r\n'
6 |
7 | text_msg = 'I love computer networks!'
8 | with open("networks.jpg", "rb") as f:
9 | image_msg = base64.b64encode(f.read())
10 |
11 | # Choose a mail server (e.g. Google mail server)
12 | # and call it mailserver
13 | mailserver = ('smtp.qq.com', 587)
14 |
15 | # Sender and reciever
16 | sender = '50627****@qq.com'
17 | senderpwd = 'dccc************'
18 | receiver = 'kairo****@163.com'
19 |
20 | # Auth information (Encode with base64)
21 | user = base64.b64encode(sender.encode()) + b'\r\n'
22 | password = base64.b64encode(senderpwd.encode()) + b'\r\n'
23 |
24 | # Create socket called clientSocket
25 | # and establish a TCP connection with mailserver
26 | clientSocket = socket(AF_INET, SOCK_STREAM)
27 | clientSocket.connect(mailserver)
28 |
29 | recv = clientSocket.recv(1024).decode()
30 | print(recv)
31 | if recv[:3] != '220':
32 | print('220 reply not received from server.')
33 |
34 | # Send HELO command and print server response.
35 | heloCommand = 'HELO Alice\r\n'
36 | clientSocket.send(heloCommand.encode())
37 | recv1 = clientSocket.recv(1024).decode()
38 | print(recv1)
39 | if recv1[:3] != '250':
40 | print('250 reply not received from server.')
41 |
42 | # Auth
43 | # Send MAIL FROM command and print server response.
44 | login = 'AUTH LOGIN\r\n'
45 | clientSocket.send(login.encode())
46 | recv2 = clientSocket.recv(1024).decode()
47 | print('login: ', recv2)
48 |
49 | clientSocket.send(user)
50 | recv2 = clientSocket.recv(1024).decode()
51 | print('user: ', recv2)
52 | clientSocket.send(password)
53 | recv3 = clientSocket.recv(1024).decode()
54 | print('password: ', recv3)
55 |
56 | mailFrom = 'MAIL FROM: <50627****@qq.com>\r\n'
57 | clientSocket.send(mailFrom.encode())
58 | recv4 = clientSocket.recv(1024).decode()
59 | print('mail from: ', recv4)
60 |
61 | # Send RCPT TO command and print server response.
62 | reptTo = 'RCPT TO: \r\n'
63 | clientSocket.send(reptTo.encode())
64 | recv5 = clientSocket.recv(1024).decode()
65 | print('rcpt to: ', recv5)
66 |
67 | # Send DATA command and print server response.
68 | data = 'DATA\r\n'
69 | clientSocket.send(data.encode())
70 | recv6 = clientSocket.recv(1024).decode()
71 | print('data: ', recv6)
72 |
73 | # Send message data.
74 | msg = 'From: ' + sender + '\r\n'
75 | msg += 'To: ' + receiver + '\r\n'
76 | msg += 'Subject: ' + subject + '\r\n'
77 | msg += 'Content-Type: ' + contenttype + '; boundary="----=_Part_000_0012345DWL"\r\n'
78 | msg += 'MIME-Version: 1.0\r\n'
79 | msg += '\r\n'
80 | msg = msg.encode()
81 | msg += '------=_Part_000_0012345DWL\r\n'.encode()
82 | msg += 'Content-Type: text/plain\r\n'.encode()
83 | msg += '\r\n'.encode()
84 | msg += text_msg.encode()
85 | msg += '\r\n'.encode()
86 | msg += '\r\n'.encode()
87 | msg += '------=_Part_000_0012345DWL\r\n'.encode()
88 | msg += 'Content-Type: image/jpeg; name="networks.jpg"\r\n'.encode()
89 | msg += 'Content-Transfer-Encoding: base64\r\n'.encode()
90 | msg += '\r\n'.encode()
91 | msg += image_msg + '\r\n'.encode()
92 | msg += '\r\n'.encode()
93 | msg += '------=_Part_000_0012345DWL--\r\n'.encode()
94 | clientSocket.send(msg)
95 |
96 | # Message ends with a single period.
97 | clientSocket.send(endmsg.encode())
98 | recv9 = clientSocket.recv(1024).decode()
99 | print('mail: ', recv9)
100 |
101 | # Send QUIT command and get server response.
102 | quitCommand = 'QUIT\r\n'
103 | clientSocket.send(quitCommand.encode())
104 | recv10 = clientSocket.recv(1024).decode()
105 | print('quit: ', recv10)
106 |
107 | # Close connection
108 | clientSocket.close()
109 |
110 |
111 |
--------------------------------------------------------------------------------
/net_lab11/networks.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeilingDu/HITsz-Computer-Networks-Project/e2f40bdaf7967da3e550fef4b7070ea6130fffb0/net_lab11/networks.jpg
--------------------------------------------------------------------------------
/net_lab11/text.py:
--------------------------------------------------------------------------------
1 | from socket import *
2 | import base64
3 | subject = 'I love computer networks!'
4 | contenttype = 'text/plain'
5 | text_msg = '\r\n I love computer networks!'
6 | endmsg = '\r\n.\r\n'
7 |
8 | # Choose a mail server (e.g. Google mail server)
9 | # and call it mailserver
10 | mailserver = ('smtp.qq.com', 587)
11 |
12 | # Sender and reciever
13 | sender = '50627****@qq.com'
14 | senderpwd = 'dccc************'
15 | receiver = 'kairos****@163.com'
16 |
17 | # Auth information (Encode with base64)
18 | # 账户和密码需要经过base64编码加密
19 | user = base64.b64encode(sender.encode()) + b'\r\n'
20 | password = base64.b64encode(senderpwd.encode()) + b'\r\n'
21 |
22 | # Create socket called clientSocket
23 | # and establish a TCP connection with mailserver
24 | clientSocket = socket(AF_INET, SOCK_STREAM)
25 | clientSocket.connect(mailserver)
26 |
27 | recv = clientSocket.recv(1024).decode()
28 | print(recv)
29 | if recv[:3] != '220':
30 | print('220 reply not received from server.')
31 |
32 | # Send HELO command and print server response.
33 | heloCommand = 'HELO Alice\r\n'
34 | clientSocket.send(heloCommand.encode())
35 | recv1 = clientSocket.recv(1024).decode()
36 | print(recv1)
37 | if recv1[:3] != '250':
38 | print('250 reply not received from server.')
39 |
40 | # Auth
41 | # Send MAIL FROM command and print server response.
42 | login = 'AUTH LOGIN\r\n'
43 | clientSocket.send(login.encode())
44 | recv2 = clientSocket.recv(1024).decode()
45 | print('login: ', recv2)
46 |
47 | clientSocket.send(user)
48 | recv2 = clientSocket.recv(1024).decode()
49 | print('user: ', recv2)
50 | clientSocket.send(password)
51 | recv3 = clientSocket.recv(1024).decode()
52 | print('password: ', recv3)
53 |
54 | mailFrom = 'MAIL FROM: <50627****@qq.com>\r\n'
55 | clientSocket.send(mailFrom.encode())
56 | recv4 = clientSocket.recv(1024).decode()
57 | print('mail from: ', recv4)
58 |
59 | # Send RCPT TO command and print server response.
60 | reptTo = 'RCPT TO: \r\n'
61 | clientSocket.send(reptTo.encode())
62 | recv5 = clientSocket.recv(1024).decode()
63 | print('rcpt to: ', recv5)
64 |
65 | # Send DATA command and print server response.
66 | data = 'DATA\r\n'
67 | clientSocket.send(data.encode())
68 | recv6 = clientSocket.recv(1024).decode()
69 | print('data: ', recv6)
70 |
71 | # Send message data.
72 | msg = 'From: ' + sender + '\r\n'
73 | msg += 'To: ' + receiver + '\r\n'
74 | msg += 'Subject: ' + subject + '\r\n'
75 | msg += 'Content-Type: ' + contenttype + '\r\n'
76 | msg += text_msg
77 | clientSocket.send(msg.encode())
78 |
79 | # Message ends with a single period.
80 | clientSocket.send(endmsg.encode())
81 | recv9 = clientSocket.recv(1024).decode()
82 | print('mail: ', recv9)
83 |
84 |
85 | # Send QUIT command and get server response.
86 | quitCommand = 'QUIT\r\n'
87 | clientSocket.send(quitCommand.encode())
88 | recv10 = clientSocket.recv(1024).decode()
89 | print('quit: ', recv10)
90 |
91 |
92 | # Close connection
93 | clientSocket.close()
94 |
95 |
96 |
--------------------------------------------------------------------------------