37 lines
604 B
C
37 lines
604 B
C
#ifndef RINGBUFFER_H
|
|
#define RINGBUFFER_H
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include <arpa/inet.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
#define DATA_LENGTH 256
|
|
#define BUFFER_LENGTH 8
|
|
|
|
struct BufferRecord
|
|
{
|
|
size_t length;
|
|
uint8_t data[DATA_LENGTH];
|
|
};
|
|
|
|
struct RingBuffer
|
|
{
|
|
size_t marks;
|
|
size_t delay;
|
|
size_t index;
|
|
struct BufferRecord records[BUFFER_LENGTH];
|
|
};
|
|
|
|
void PokeData(struct RingBuffer* buffer, uint32_t number, uint8_t* data, size_t length);
|
|
void ProcessBuffer(struct RingBuffer* buffer, int handle, struct sockaddr_in* address);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|