network: Add net_buffer::buffer_flags field.
Does not actually break ABI since net_buffer had 3 bytes of padding remaining unused. Add the first two constants for this field: L3/L4_CHECKSUM_VALID. These will indicate when the checksum of the packet is known to be valid (good/correct). Change-Id: I155b3ea51d1093e229677cb788a007560ddbd428 Reviewed-on: https://review.haiku-os.org/c/haiku/+/7916 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
e864e93949
commit
258ae0c892
@@ -16,6 +16,12 @@
|
||||
#define NET_BUFFER_MODULE_NAME "network/stack/buffer/v1"
|
||||
|
||||
|
||||
enum net_buffer_flags {
|
||||
NET_BUFFER_L3_CHECKSUM_VALID = (1 << 0),
|
||||
NET_BUFFER_L4_CHECKSUM_VALID = (1 << 1),
|
||||
};
|
||||
|
||||
|
||||
typedef struct net_buffer {
|
||||
struct list_link link;
|
||||
|
||||
@@ -35,6 +41,7 @@ typedef struct net_buffer {
|
||||
uint32 msg_flags;
|
||||
uint32 size;
|
||||
uint8 protocol;
|
||||
uint16 buffer_flags;
|
||||
} net_buffer;
|
||||
|
||||
struct ancillary_data_container;
|
||||
|
||||
@@ -609,9 +609,10 @@ dump_buffer(net_buffer* _buffer)
|
||||
{
|
||||
net_buffer_private* buffer = (net_buffer_private*)_buffer;
|
||||
|
||||
dprintf("buffer %p, size %" B_PRIu32 ", msg_flags %" B_PRIx32 ", stored header "
|
||||
"%" B_PRIuSIZE ", interface address %p\n", buffer, buffer->size,
|
||||
buffer->msg_flags, buffer->stored_header_length, buffer->interface_address);
|
||||
dprintf("buffer %p, size %" B_PRIu32 ", msg_flags %" B_PRIx32 ", buffer_flags %" B_PRIx16
|
||||
", stored header %" B_PRIuSIZE ", interface address %p\n", buffer, buffer->size,
|
||||
buffer->msg_flags, buffer->buffer_flags, buffer->stored_header_length,
|
||||
buffer->interface_address);
|
||||
|
||||
dump_address("source", buffer->source, buffer->interface_address);
|
||||
dump_address("destination", buffer->destination, buffer->interface_address);
|
||||
@@ -1074,6 +1075,7 @@ copy_metadata(net_buffer* destination, const net_buffer* source)
|
||||
min_c(source->destination->sa_len, sizeof(sockaddr_storage)));
|
||||
|
||||
destination->msg_flags = source->msg_flags;
|
||||
destination->buffer_flags = source->buffer_flags;
|
||||
destination->interface_address = source->interface_address;
|
||||
if (destination->interface_address != NULL)
|
||||
((InterfaceAddress*)destination->interface_address)->AcquireReference();
|
||||
@@ -1127,6 +1129,7 @@ create_buffer(size_t headerSpace)
|
||||
buffer->interface_address = NULL;
|
||||
buffer->offset = 0;
|
||||
buffer->msg_flags = 0;
|
||||
buffer->buffer_flags = 0;
|
||||
buffer->size = 0;
|
||||
|
||||
CHECK_BUFFER(buffer);
|
||||
|
||||
Reference in New Issue
Block a user