Skip to content

Commit

Permalink
Add directions to read headers
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Nov 8, 2023
1 parent 2c987b9 commit 8a1c927
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Homework/eui64/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
你需要在 `eui64.cpp` 文件中实现将这个转换过程实现中在下列的函数中。

```cpp
// 函数注释见代码
// 函数注释见 eui64.h
in6_addr eui64(const ether_addr mac) {
in6_addr res = {0};
// TODO
Expand Down
2 changes: 1 addition & 1 deletion Homework/eui64/README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This procedure is defined in [RFC 4291](https://datatracker.ietf.org/doc/html/rf
You need to implement this conversion process in the `eui64.cpp` file in the following functions.

```cpp
// See comments in the code for the function
// See comments of the function in eui64.h
in6_addr eui64(const ether_addr mac) {
in6_addr res = {0};
// TODO
Expand Down
2 changes: 1 addition & 1 deletion Homework/internet-checksum/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
你需要在 `checksum.cpp` 中实现下面的函数 `validateAndFillChecksum`,这个函数接收一个 IPv6 的 packet,在 IPv6 Header 之后一定是一个 UDP 或者 ICMPv6 的 packet。该函数的返回值为 UDP 或者 ICMPv6 中的校验和是否正确;同时,无论原来的校验和是否正确,该函数返回时,packet 中的校验和应该被填充为正确的值。

```cpp
// 函数注释见代码
// 函数注释见 checksum.h
bool validateAndFillChecksum(uint8_t *packet, size_t len) {
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion Homework/internet-checksum/README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
You need to implement the following function `validateAndFillChecksum` in `checksum.cpp`, which takes an IPv6 packet, which after the IPv6 Header must be a UDP or ICMPv6 packet. The function returns whether the checksum is correct or not; also, the checksum in the packet should be filled with the correct value when the function returns, regardless of whether the original checksum is correct or not.

```cpp
// See the code for function comments
// See checksum.h for function comments
bool validateAndFillChecksum(uint8_t *packet, size_t len) {
return true;
}
Expand Down
8 changes: 4 additions & 4 deletions Homework/lookup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@
这一题要求你实现路由表的更新和查询,包括以下四个函数:

```cpp
// 函数注释见代码
// 函数注释见 lookup.h
void update(bool insert, RoutingTableEntry entry) {
// TODO
}

// 函数注释见代码
// 函数注释见 lookup.h
bool prefix_query(in6_addr addr, in6_addr *nexthop, uint32_t *if_index) {
// TODO
*nexthop = 0;
*if_index = 0;
return false;
}

// 函数注释见代码
// 函数注释见 lookup.h
int mask_to_len(in6_addr mask) {
// TODO
return -1;
}

// 函数注释见代码
// 函数注释见 lookup.h
in6_addr len_to_mask(int len) {
// TODO
return 0;
Expand Down
8 changes: 4 additions & 4 deletions Homework/lookup/README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@
This problem requires you to implement routing table updates and lookups, including the following four functions.

```cpp
// See code for function comments
// See lookup.h for function comments
void update(bool insert, RoutingTableEntry entry) {
// TODO
}

// See code for function comments
// See lookup.h for function comments
bool prefix_query(in6_addr addr, in6_addr *nexthop, uint32_t *if_index) {
// TODO
*nexthop = 0;
*if_index = 0;
return false;
}

// See code for function comments
// See lookup.h for function comments
int mask_to_len(in6_addr mask) {
// TODO
return -1;
}

// See code for function comments
// See lookup.h for function comments
in6_addr len_to_mask(int len) {
// TODO
return 0;
Expand Down
6 changes: 3 additions & 3 deletions Homework/protocol-ospf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

## 题目描述

这一题要求你实现 [RFC 5340: OSPF for IPv6](https://datatracker.ietf.org/doc/html/rfc5340/) 数据格式的处理,你需要按照 `protocol_ospf.cpp` 文件中函数的注释,实现如下两个函数
这一题要求你实现 [RFC 5340: OSPF for IPv6](https://datatracker.ietf.org/doc/html/rfc5340/) 数据格式的处理,你需要按照 `protocol_ospf.h` 文件中函数的注释,`protocol_ospf.cpp` 中实现如下两个函数

```cpp
// 函数注释见代码
// 函数注释见 protocol_ospf.h
OspfErrorCode parse_ip(const uint8_t *packet, uint32_t len, const uint8_t **lsa_start, int *lsa_num) {
// TODO
return OspfErrorCode::SUCCESS;
}

// 函数注释见代码
// 函数注释见 protocol_ospf.h
OspfErrorCode disassemble(const uint8_t* lsa, uint16_t buf_len, uint16_t *len, RouterLsa *output) {
// TODO
return OspfErrorCode::SUCCESS;
Expand Down
6 changes: 3 additions & 3 deletions Homework/protocol-ospf/README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

## Problem Description

This problem requires you to implement the [RFC 5340: OSPF for IPv6](https://datatracker.ietf.org/doc/html/rfc5340/) data format processing. You need to implement the following two functions, as annotated in the functions in the ``protocol_ospf.cpp`` file:
This problem requires you to implement the [RFC 5340: OSPF for IPv6](https://datatracker.ietf.org/doc/html/rfc5340/) data format processing. You need to implement the following two functions in `protocol_ospf.cpp`, as annotated in the functions in the `protocol_ospf.h` file:

```cpp
// See the code for the function comments
// See protocol_ospf.h for the function comments
OspfErrorCode parse_ip(const uint8_t *packet, uint32_t len, const uint8_t **lsa_start, int *lsa_num) {
// TODO
return OspfErrorCode::SUCCESS;
}

// See the code for the function comments
// See protocol_ospf.h for the function comments
OspfErrorCode disassemble(const uint8_t* lsa, uint16_t buf_len, uint16_t *len, RouterLsa *output) {
// TODO
return OspfErrorCode::SUCCESS;
Expand Down
6 changes: 3 additions & 3 deletions Homework/protocol/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

## 题目描述

这一题要求你实现 [RFC 2080: RIPng for IPv6](https://datatracker.ietf.org/doc/html/rfc2080) 数据格式的处理,你需要按照 `protocol.cpp` 文件中函数的注释,实现如下两个函数
这一题要求你实现 [RFC 2080: RIPng for IPv6](https://datatracker.ietf.org/doc/html/rfc2080) 数据格式的处理,你需要按照 `protocol.h` 文件中函数的注释,`protocol.cpp` 中实现如下两个函数

```cpp
// 函数注释见代码
// 函数注释见 protocol.h
RipngErrorCode disassemble(const uint8_t *packet, uint32_t len, RipngPacket *output) {
// TODO
return RipngErrorCode::SUCCESS;
}

// 函数注释见代码
// 函数注释见 protocol.h
uint32_t assemble(const RipngPacket *ripng, uint8_t *buffer) {
// TODO
return 0;
Expand Down
6 changes: 3 additions & 3 deletions Homework/protocol/README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

## Problem Description

This problem requires you to implement the [RFC 2080: RIPng for IPv6](https://datatracker.ietf.org/doc/html/rfc2080) data format processing. You need to implement the following two functions, as annotated in the functions in the ``protocol.cpp`` file.
This problem requires you to implement the [RFC 2080: RIPng for IPv6](https://datatracker.ietf.org/doc/html/rfc2080) data format processing. You need to implement the following two functions in `protocol.cpp`, as annotated in the functions in the `protocol.h` file.

```cpp
// See the code for the function comments
// See protocol.h for the function comments
RipngErrorCode disassemble(const uint8_t *packet, uint32_t len, RipngPacket *output) {
// TODO
return RipngErrorCode::SUCCESS;
}

// See code for function comments
// See protocol.h for the function comments
uint32_t assemble(const RipngPacket *ripng, uint8_t *buffer) {
// TODO
return 0;
Expand Down

0 comments on commit 8a1c927

Please sign in to comment.