2012-06-27 15:45:33 +01:00
|
|
|
#ifndef FLEXNBD_H
|
|
|
|
#define FLEXNBD_H
|
|
|
|
|
|
|
|
#include "acl.h"
|
|
|
|
#include "mirror.h"
|
|
|
|
#include "serve.h"
|
2013-02-15 16:52:16 +00:00
|
|
|
#include "proxy.h"
|
2014-01-22 11:49:21 +00:00
|
|
|
#include "client.h"
|
2012-06-27 15:45:33 +01:00
|
|
|
#include "self_pipe.h"
|
|
|
|
#include "mbox.h"
|
|
|
|
#include "control.h"
|
2012-07-11 09:43:16 +01:00
|
|
|
#include "flexthread.h"
|
2012-06-27 15:45:33 +01:00
|
|
|
|
|
|
|
/* Carries the "globals". */
|
|
|
|
struct flexnbd {
|
2013-02-15 16:52:16 +00:00
|
|
|
/* Our serve pointer should never be dereferenced outside a
|
|
|
|
* flexnbd_switch_lock/unlock pair.
|
2012-06-27 15:45:33 +01:00
|
|
|
*/
|
|
|
|
struct server * serve;
|
2012-07-23 09:48:50 +01:00
|
|
|
|
2012-06-27 15:45:33 +01:00
|
|
|
/* We only have a control object if a control socket name was
|
|
|
|
* passed on the command line.
|
|
|
|
*/
|
|
|
|
struct control * control;
|
|
|
|
|
|
|
|
/* File descriptor for a signalfd(2) signal stream. */
|
|
|
|
int signal_fd;
|
|
|
|
};
|
|
|
|
|
2012-07-23 09:48:50 +01:00
|
|
|
|
2012-06-27 15:45:33 +01:00
|
|
|
struct flexnbd * flexnbd_create(void);
|
|
|
|
struct flexnbd * flexnbd_create_serving(
|
|
|
|
char* s_ip_address,
|
|
|
|
char* s_port,
|
|
|
|
char* s_file,
|
2013-02-01 15:20:43 +00:00
|
|
|
char* s_ctrl_sock,
|
2012-06-27 15:45:33 +01:00
|
|
|
int default_deny,
|
|
|
|
int acl_entries,
|
|
|
|
char** s_acl_entries,
|
2013-07-03 09:56:35 +01:00
|
|
|
int max_nbd_clients,
|
|
|
|
int use_killswitch);
|
2012-06-27 15:45:33 +01:00
|
|
|
|
|
|
|
struct flexnbd * flexnbd_create_listening(
|
2013-02-01 15:20:43 +00:00
|
|
|
char* s_ip_address,
|
|
|
|
char* s_port,
|
2012-07-23 09:48:50 +01:00
|
|
|
char* s_file,
|
2013-02-01 15:20:43 +00:00
|
|
|
char* s_ctrl_sock,
|
2012-07-23 09:48:50 +01:00
|
|
|
int default_deny,
|
2013-02-01 15:20:43 +00:00
|
|
|
int acl_entries,
|
2012-07-23 09:48:50 +01:00
|
|
|
char** s_acl_entries );
|
2012-06-27 15:45:33 +01:00
|
|
|
|
|
|
|
void flexnbd_destroy( struct flexnbd * );
|
|
|
|
enum mirror_state;
|
|
|
|
enum mirror_state flexnbd_get_mirror_state( struct flexnbd * );
|
|
|
|
int flexnbd_default_deny( struct flexnbd * );
|
|
|
|
void flexnbd_set_server( struct flexnbd * flexnbd, struct server * serve );
|
|
|
|
int flexnbd_signal_fd( struct flexnbd * flexnbd );
|
|
|
|
|
|
|
|
|
|
|
|
int flexnbd_serve( struct flexnbd * flexnbd );
|
2013-02-15 16:52:16 +00:00
|
|
|
int flexnbd_proxy( struct flexnbd * flexnbd );
|
2012-06-27 15:45:33 +01:00
|
|
|
struct server * flexnbd_server( struct flexnbd * flexnbd );
|
|
|
|
void flexnbd_replace_acl( struct flexnbd * flexnbd, struct acl * acl );
|
|
|
|
struct status * flexnbd_status_create( struct flexnbd * flexnbd );
|
|
|
|
#endif
|
2013-02-15 16:52:16 +00:00
|
|
|
|