summaryrefslogtreecommitdiffstats
path: root/src/fuse/connection.h
blob: c919d95935751ebdeeab165bb558223b2df8b635 (plain) (blame)
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
27
28
29
30
31
32
33
34
35
#ifndef _CONNECTION_H_
#define _CONNECTION_H_

#include "../shared/fdsignal.h"
#include "../shared/timing.h"
#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>

struct _dnbd3_async;

typedef struct _dnbd3_async {
	struct _dnbd3_async *next; // Next in this linked list (provate field, not set by caller)
	dnbd3_signal_t* signal; // Used to signal the caller
	char* buffer;      // Caller-provided buffer to be filled
	ticks time;        // When request was put on wire, 0 if not measuring
	uint64_t offset;
	uint32_t length;
	bool finished;     // Will be set to true if the request has been handled
	bool success;      // Will be set to true if the request succeeded
} dnbd3_async_t;

bool connection_init(const char *hosts, const char *image, const uint16_t rid);

bool connection_initThreads();

uint64_t connection_getImageSize();

bool connection_read(dnbd3_async_t *request);

void connection_close();

size_t connection_printStats(char *buffer, const size_t len);

#endif /* CONNECTION_H_ */