tor_multipath_voip/src/utils.h

21 lines
533 B
C
Raw Normal View History

2019-02-12 10:17:37 +00:00
#pragma once
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
2019-02-13 13:17:06 +00:00
// 1500 = internet MTU
#define RING_BUFFER_SIZE 1500
2019-02-12 10:17:37 +00:00
struct ring_buffer {
char buffer[RING_BUFFER_SIZE];
int head;
int tail;
};
int ring_buffer_read(struct ring_buffer* rb, char* dest, int size);
void ring_buffer_ack_read(struct ring_buffer* rb, int size);
int ring_buffer_write(struct ring_buffer* rb, char* source, int size);
int ring_buffer_free_space(struct ring_buffer* rb);
int ring_buffer_used_space(struct ring_buffer* rb);