10 #include <sys/socket.h>
11 #include <sys/types.h>
57 struct sockaddr_storage clientaddr;
80 #define NBDS_ERR g_quark_from_static_string("server-error-quark")
114 #define msg(prio, ...) syslog(prio, __VA_ARGS__)
116 #define msg(prio, ...) g_log(G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, __VA_ARGS__)
118 #define MY_NAME "nbd_server"
The (required) group "generic" is missing.
gchar * servename
name of the export as selected by nbd-client
GArray * export
array of FILE_INFO of exported files; array size is always 1 unless we're doing the multiple file opt...
Variables associated with a server.
uint8_t getmaskbyte(int masklen)
Gets a byte to allow for address masking.
uint32_t difffilelen
number of pages in difffile
SERVER * server
The server this client is getting data from.
Failed to set SO_LINGER to a socket.
gchar * postrun
command that will be ran after the client disconnects
int clientfeats
Features supported by this client.
NBDS_ERRS
NBD server error codes.
Failed to bind an address to socket.
Error occurred during readdir()
The configuration file is not found.
int flags
flags associated with this exported file
Failed to start listening on a socket.
A (required) key is missing.
gchar * exportname
(unprocessed) filename of the file we're exporting
int net
The actual client socket.
Underlying system call or library error.
unsigned int port
port we're exporting this file at
gchar * transactionlog
filename for transaction log
Every subnet in its own directory.
gchar * listenaddr
The IP address we're listening on.
Failed to set SO_KEEPALIVE to a socket.
char * clientname
peer, in human-readable format
int socket
The socket of this server.
Variables associated with a client connection.
int difffile
filedescriptor of copyonwrite file.
Failed to get address info.
SERVER * dup_serve(const SERVER *const s)
duplicate server
uint32_t * difmap
see comment on the global difmap for this one
VIRT_STYLE
Types of virtuatlization.
uint64_t size_autodetect(int fhandle)
Detect the size of a file.
Literal IP address as part of the filename.
int transactionlogfd
fd for transaction log
void err(const char *s) G_GNUC_NORETURN
The reserved port was specified for an old-style export.
int max_connections
maximum number of opened connections
VIRT_STYLE virtstyle
The style of virtualization, if any.
Failed to set SO_REUSEADDR to a socket.
int append_serve(const SERVER *const s, GArray *const a)
append new server to array
int socket_family
family of the socket
uint64_t expected_size
size of the exported file as it was told to us through configuration
gchar * prerun
command to be ran after connecting a client, but before starting to serve
bool address_matches(const char *mask, const void *addr, int af, GError **err)
Check whether a given address matches a given netmask.
uint64_t exportsize
size of the file we're exporting
char * authname
filename of the authorization file
gboolean modern
client was negotiated using modern negotiation protocol
A config file was specified that does not define any exports.
char * difffilename
filename of the copy-on-write file, if any
Replacing all dots in an ip address by a / before doing the same as in IPLIT.
uint8_t cidrlen
The length of the mask when we use CIDR-style virtualization.
A value is not supported in this build.
A directory requested does not exist.
char * exportname
(processed) filename of the file we're exporting
A value is syntactically invalid.
Failed to create a socket.
int authorized_client(CLIENT *opts)
Check whether a client is allowed to connect.