2012-06-11 14:34:17 +01:00
|
|
|
#ifndef READWRITE_H
|
2012-05-21 04:03:17 +01:00
|
|
|
|
2012-06-11 14:34:17 +01:00
|
|
|
#define READWRITE_H
|
2012-05-21 04:03:17 +01:00
|
|
|
|
2012-06-21 17:12:06 +01:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
2013-08-09 17:02:33 +01:00
|
|
|
#include "nbdtypes.h"
|
2012-06-21 17:12:06 +01:00
|
|
|
|
2012-06-06 09:55:08 +01:00
|
|
|
int socket_connect(struct sockaddr* to, struct sockaddr* from);
|
2014-02-27 16:04:25 +00:00
|
|
|
int socket_nbd_read_hello(int fd, uint64_t* size);
|
|
|
|
int socket_nbd_write_hello(int fd, uint64_t size);
|
|
|
|
void socket_nbd_read(int fd, uint64_t from, uint32_t len, int out_fd, void* out_buf, int timeout_secs);
|
|
|
|
void socket_nbd_write(int fd, uint64_t from, uint32_t len, int out_fd, void* out_buf, int timeout_secs);
|
2012-06-21 17:12:06 +01:00
|
|
|
int socket_nbd_disconnect( int fd );
|
2012-05-21 04:03:17 +01:00
|
|
|
|
2013-06-18 15:36:15 +01:00
|
|
|
/* as you can see, we're slowly accumulating code that should really be in an
|
|
|
|
* NBD library */
|
|
|
|
|
2014-02-27 16:04:25 +00:00
|
|
|
void nbd_hello_to_buf( struct nbd_init_raw* buf, uint64_t out_size );
|
|
|
|
int nbd_check_hello( struct nbd_init_raw* init_raw, uint64_t* out_size );
|
2013-06-18 15:36:15 +01:00
|
|
|
|
2012-05-21 04:03:17 +01:00
|
|
|
#endif
|
|
|
|
|