summaryrefslogtreecommitdiff
path: root/src/multipart-replace.h
blob: 2aa5e611576b79c060ef32e60db2981198b7c9bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* Copyright 2016 Luke Shumaker */

#pragma once

#include <pthread.h>
#include <stdbool.h>

struct frame {
	ssize_t len;
	size_t cap;
	char *buf;
};

struct multipart_replace_stream {
	struct frame a, b;
	struct frame *front, *back;
	pthread_rwlock_t frontlock;
	long framecount;
};

void multipart_replace_reader(struct multipart_replace_stream *s, int fd, const char *boundary);
void multipart_replace_writer(struct multipart_replace_stream *s, int fd, const char *boundary);
void init_multipart_replace_stream(struct multipart_replace_stream *s);
void destroy_multipart_replace_stream(struct multipart_replace_stream *s);

extern bool running;