1 /* 2 * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef PACKET_BUFFER_H 6 #define PACKET_BUFFER_H 7 8 9 #include <OS.h> 10 11 12 struct packet_buffer; 13 typedef struct packet_buffer packet_buffer; 14 15 #ifdef __cplusplus 16 extern "C" { 17 #endif 18 19 struct packet_buffer *create_packet_buffer(size_t size); 20 void delete_packet_buffer(struct packet_buffer *buffer); 21 22 void packet_buffer_clear(struct packet_buffer *buffer); 23 size_t packet_buffer_readable(struct packet_buffer *buffer); 24 size_t packet_buffer_writable(struct packet_buffer *buffer); 25 void packet_buffer_flush(struct packet_buffer *buffer, size_t bytes); 26 size_t packet_buffer_read(struct packet_buffer *buffer, uint8 *data, size_t 27 length); 28 size_t packet_buffer_write(struct packet_buffer *buffer, const uint8 *data, 29 size_t length); 30 31 #ifdef __cplusplus 32 } 33 #endif 34 35 #endif /* PACKET_BUFFER_H */ 36