Conversation
if it's the size of a thing,
you should do what you think is best lol |
47f4498 to
400eb78
Compare
dc7c097 to
d381eb1
Compare
|
TODO: fix CI format complaints ( requires make format on kieran branch first) TODO: header guards on my headers |
ac4fe4d to
e58d66b
Compare
|
good for review on Wednesday, needs some squashing, moving around and testing but core functionality is there. |
| u16 calc_chksum(u16 *buf, usize size); | ||
|
|
||
| // u64 udp_read(struct udp_header *header, u8 *data, usize len); | ||
| u64 udp_send_datagram(u16 src_port, u16 dst_port, struct ip_address src_addr, |
There was a problem hiding this comment.
gcc magic COUNTED_BY lets you say that len is the length of the buffer
There was a problem hiding this comment.
https://gcc.gnu.org/onlinedocs/gcc/Common-Attributes.html#index-counted_005fby
this seems to apply only to struct fields.
u64 udp_send_datagram(u16 src_port, u16 dst_port, struct ip_address src_addr,
struct ip_address dst_addr, [[gnu::counted_by (len)]] u8 *data, usize len);results in
udp.h:53:81: error: 'counted_by' attribute is not allowed for a non-field declaration 'data'
Signed-off-by: jastintime <130672671+jastintime@users.noreply.github.com>
Signed-off-by: jastintime <130672671+jastintime@users.noreply.github.com>
Signed-off-by: jastintime <130672671+jastintime@users.noreply.github.com>
Signed-off-by: jastintime <130672671+jastintime@users.noreply.github.com>
start off UDP header.
questions:
should we use a size_t or something similar or u64 everything
how do we want to model our general networking code(plan9 style would be sick 🔥 )
useful UDP links:
https://www.rfc-editor.org/rfc/rfc768
Notes so I don't forget:
UDP and TCP checksum is the same, can be brought out to a common file