Moved the container management for ancillary data from the net_buffer
module to the stack module. There's a dedicated struct ancillary_data_container, now. One can just set the container on a net_buffer. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25292 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -37,11 +37,7 @@ typedef struct net_buffer {
|
||||
uint8 protocol;
|
||||
} net_buffer;
|
||||
|
||||
typedef struct ancillary_data_header {
|
||||
int level;
|
||||
int type;
|
||||
size_t len;
|
||||
} ancillary_data_header;
|
||||
struct ancillary_data_container;
|
||||
|
||||
struct net_buffer_module_info {
|
||||
module_info info;
|
||||
@@ -74,16 +70,11 @@ struct net_buffer_module_info {
|
||||
|
||||
status_t (*associate_data)(net_buffer *buffer, void *data);
|
||||
|
||||
status_t (*attach_ancillary_data)(net_buffer *buffer,
|
||||
const ancillary_data_header *header, const void *data,
|
||||
void (*destructor)(const ancillary_data_header*, void*),
|
||||
void **_allocatedData);
|
||||
status_t (*detach_ancillary_data)(net_buffer *buffer, void *data,
|
||||
bool destroy);
|
||||
void (*set_ancillary_data)(net_buffer *buffer,
|
||||
ancillary_data_container *container);
|
||||
ancillary_data_container* (*get_ancillary_data)(net_buffer *buffer);
|
||||
void * (*transfer_ancillary_data)(net_buffer *from,
|
||||
net_buffer *to);
|
||||
void * (*next_ancillary_data)(net_buffer *buffer,
|
||||
void *previousData, ancillary_data_header *_header);
|
||||
|
||||
status_t (*direct_access)(net_buffer *buffer, uint32 offset,
|
||||
size_t bytes, void **_data);
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
#define LEVEL_DRIVER_IOCTL 0x0f000000
|
||||
#define LEVEL_MASK 0x0fffffff
|
||||
|
||||
struct ancillary_data_container;
|
||||
struct ancillary_data_header;
|
||||
|
||||
typedef struct net_protocol {
|
||||
struct net_protocol *next;
|
||||
struct net_protocol_module_info *module;
|
||||
@@ -69,8 +72,8 @@ struct net_protocol_module_info {
|
||||
status_t (*error_reply)(net_protocol *self, net_buffer *causedError,
|
||||
uint32 code, void *errorData);
|
||||
|
||||
status_t (*attach_ancillary_data)(net_protocol *self, net_buffer *buffer,
|
||||
const cmsghdr *header);
|
||||
status_t (*add_ancillary_data)(net_protocol *self,
|
||||
ancillary_data_container *container, const cmsghdr *header);
|
||||
ssize_t (*process_ancillary_data)(net_protocol *self,
|
||||
const ancillary_data_header *header, const void *data,
|
||||
void *buffer, size_t bufferSize);
|
||||
|
||||
@@ -24,6 +24,8 @@ struct net_domain;
|
||||
struct net_socket;
|
||||
struct net_timer;
|
||||
|
||||
typedef struct ancillary_data_container ancillary_data_container;
|
||||
|
||||
struct net_fifo {
|
||||
benaphore lock;
|
||||
sem_id notify;
|
||||
@@ -64,6 +66,12 @@ struct net_device_monitor {
|
||||
void (*event)(struct net_device_monitor *monitor, int32 event);
|
||||
};
|
||||
|
||||
typedef struct ancillary_data_header {
|
||||
int level;
|
||||
int type;
|
||||
size_t len;
|
||||
} ancillary_data_header;
|
||||
|
||||
struct net_stack_module_info {
|
||||
module_info info;
|
||||
|
||||
@@ -139,6 +147,21 @@ struct net_stack_module_info {
|
||||
bool (*is_restarted_syscall)(void);
|
||||
void (*store_syscall_restart_timeout)(bigtime_t timeout);
|
||||
bigtime_t (*restore_syscall_restart_timeout)(void);
|
||||
|
||||
// ancillary data
|
||||
ancillary_data_container* (*create_ancillary_data_container)();
|
||||
void (*delete_ancillary_data_container)(
|
||||
ancillary_data_container* container);
|
||||
status_t (*add_ancillary_data)(ancillary_data_container *container,
|
||||
const ancillary_data_header *header, const void *data,
|
||||
void (*destructor)(const ancillary_data_header*, void*),
|
||||
void **_allocatedData);
|
||||
status_t (*remove_ancillary_data)(ancillary_data_container *container,
|
||||
void *data, bool destroy);
|
||||
void* (*move_ancillary_data)(ancillary_data_container *from,
|
||||
ancillary_data_container *to);
|
||||
void* (*next_ancillary_data)(ancillary_data_container *container,
|
||||
void *previousData, ancillary_data_header *_header);
|
||||
};
|
||||
|
||||
#endif // NET_STACK_H
|
||||
|
||||
Reference in New Issue
Block a user