1 /* 2 * Copyright 2006, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Axel Dörfler, axeld@pinc-software.de 7 */ 8 #ifndef NET_UTILITY_H 9 #define NET_UTILITY_H 10 11 12 #include <net_stack.h> 13 14 15 // checksums 16 uint16 compute_checksum(uint8 *_buffer, size_t length); 17 uint16 checksum(uint8 *buffer, size_t length); 18 19 // notifications 20 status_t notify_socket(net_socket *socket, uint8 event, int32 value); 21 22 // fifos 23 status_t init_fifo(net_fifo *fifo, const char *name, size_t maxBytes); 24 void uninit_fifo(net_fifo *fifo); 25 status_t fifo_enqueue_buffer(net_fifo *fifo, struct net_buffer *buffer); 26 ssize_t fifo_dequeue_buffer(net_fifo *fifo, uint32 flags, bigtime_t timeout, 27 struct net_buffer **_buffer); 28 status_t clear_fifo(net_fifo *fifo); 29 30 // timer 31 void init_timer(net_timer *timer, net_timer_func hook, void *data); 32 void set_timer(net_timer *timer, bigtime_t delay); 33 status_t init_timers(void); 34 void uninit_timers(void); 35 36 #endif // NET_UTILITY_H 37