2 * Copyright 2006-2008, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
6 * Axel Dörfler, axeld@pinc-software.de
12 #include <net_stack.h>
17 UserBuffer(void* buffer
, size_t size
);
19 void* Push(void* source
, size_t size
);
20 status_t
Pad(size_t length
);
21 status_t
PadToNext(size_t length
);
23 status_t
Status() const
25 size_t BytesConsumed() const
26 { return fBufferSize
- fAvailable
; }
37 UserBuffer::UserBuffer(void* buffer
, size_t size
)
39 fBuffer((uint8
*)buffer
),
48 uint16
compute_checksum(uint8
* _buffer
, size_t length
);
49 uint16
checksum(uint8
* buffer
, size_t length
);
52 status_t
notify_socket(net_socket
* socket
, uint8 event
, int32 value
);
55 status_t
init_fifo(net_fifo
* fifo
, const char *name
, size_t maxBytes
);
56 void uninit_fifo(net_fifo
* fifo
);
57 status_t
fifo_enqueue_buffer(net_fifo
* fifo
, struct net_buffer
* buffer
);
58 ssize_t
fifo_dequeue_buffer(net_fifo
* fifo
, uint32 flags
, bigtime_t timeout
,
59 struct net_buffer
** _buffer
);
60 status_t
clear_fifo(net_fifo
* fifo
);
61 status_t
fifo_socket_enqueue_buffer(net_fifo
* fifo
, net_socket
* socket
,
62 uint8 event
, net_buffer
* buffer
);
65 void init_timer(net_timer
* timer
, net_timer_func hook
, void* data
);
66 void set_timer(net_timer
* timer
, bigtime_t delay
);
67 bool cancel_timer(struct net_timer
* timer
);
68 status_t
wait_for_timer(struct net_timer
* timer
);
69 bool is_timer_active(net_timer
* timer
);
70 bool is_timer_running(net_timer
* timer
);
71 status_t
init_timers(void);
72 void uninit_timers(void);
75 bool is_syscall(void);
76 bool is_restarted_syscall(void);
77 void store_syscall_restart_timeout(bigtime_t timeout
);
78 bigtime_t
restore_syscall_restart_timeout(void);
80 #endif // NET_UTILITY_H