|
Network Block Device
@PACKAGE_VERSION@
|
#include <errno.h>#include <string.h>#include <netdb.h>#include <netinet/tcp.h>#include <netinet/in.h>#include <stdlib.h>#include "nbd.h"Go to the source code of this file.
Macros | |
| #define | __be32 u32 |
| #define | __be64 u64 |
| #define | fdatasync(arg) fsync(arg) |
| #define | INIT_PASSWD "NBDMAGIC" |
| #define | INFO(a) do { } while(0) |
| #define | G_GNUC_NORETURN |
| #define | G_GNUC_UNUSED |
| #define | htonll ntohll |
| #define | NBD_DEFAULT_PORT |
| #define | NBD_OPT_EXPORT_NAME (1) /** Client wants to select a named export (is followed by name of export) */ |
| #define | NBD_OPT_ABORT (2) /** Client wishes to abort negotiation */ |
| #define | NBD_OPT_LIST (3) /** Client request list of supported exports (not followed by data) */ |
| #define | NBD_REP_ACK (1) /** ACK a request. Data: option number to be acked */ |
| #define | NBD_REP_SERVER (2) /** Reply to NBD_OPT_LIST (one of these per server; must be followed by NBD_REP_ACK to signal the end of the list */ |
| #define | NBD_REP_FLAG_ERROR (1 << 31) /** If the high bit is set, the reply is an error */ |
| #define | NBD_REP_ERR_UNSUP (1 | NBD_REP_FLAG_ERROR) /** Client requested an option not understood by this version of the server */ |
| #define | NBD_REP_ERR_POLICY (2 | NBD_REP_FLAG_ERROR) /** Client requested an option not allowed by server configuration. (e.g., the option was disabled) */ |
| #define | NBD_REP_ERR_INVALID (3 | NBD_REP_FLAG_ERROR) /** Client issued an invalid request */ |
| #define | NBD_REP_ERR_PLATFORM (4 | NBD_REP_FLAG_ERROR) /** Option not supported on this platform */ |
| #define | NBD_FLAG_FIXED_NEWSTYLE (1 << 0) /* new-style export that actually supports extending */ |
| #define | NBD_FLAG_C_FIXED_NEWSTYLE NBD_FLAG_FIXED_NEWSTYLE |
Functions | |
| void | setmysockopt (int sock) |
| void | err_nonfatal (const char *s) |
| void | err (const char *s) G_GNUC_NORETURN |
| void | logging (void) |
| u64 | ntohll (u64 a) |
Variables | |
| u64 | cliserv_magic = 0x00420281861253LL |
| u64 | opts_magic = 0x49484156454F5054LL |
| u64 | rep_magic = 0x3e889045565a9LL |
| #define G_GNUC_UNUSED |
Definition at line 88 of file cliserv.h.
Referenced by integrity_test(), main(), and oversize_test().
| #define htonll ntohll |
Definition at line 146 of file cliserv.h.
Referenced by ask_list(), main(), negotiate(), oversize_test(), setup_connection(), and throughput_test().
| #define INFO | ( | a | ) | do { } while(0) |
Definition at line 62 of file cliserv.h.
Referenced by setmysockopt().
| #define INIT_PASSWD "NBDMAGIC" |
Definition at line 60 of file cliserv.h.
Referenced by negotiate(), and setup_connection().
| #define NBD_DEFAULT_PORT |
| #define NBD_FLAG_C_FIXED_NEWSTYLE NBD_FLAG_FIXED_NEWSTYLE |
| #define NBD_FLAG_FIXED_NEWSTYLE (1 << 0) /* new-style export that actually supports extending */ |
| #define NBD_OPT_ABORT (2) /** Client wishes to abort negotiation */ |
Definition at line 153 of file cliserv.h.
Referenced by ask_list().
| #define NBD_OPT_EXPORT_NAME (1) /** Client wants to select a named export (is followed by name of export) */ |
Definition at line 152 of file cliserv.h.
Referenced by negotiate(), and setup_connection().
| #define NBD_OPT_LIST (3) /** Client request list of supported exports (not followed by data) */ |
Definition at line 154 of file cliserv.h.
Referenced by ask_list().
| #define NBD_REP_ACK (1) /** ACK a request. Data: option number to be acked */ |
Definition at line 157 of file cliserv.h.
Referenced by ask_list().
| #define NBD_REP_ERR_INVALID (3 | NBD_REP_FLAG_ERROR) /** Client issued an invalid request */ |
| #define NBD_REP_ERR_PLATFORM (4 | NBD_REP_FLAG_ERROR) /** Option not supported on this platform */ |
| #define NBD_REP_ERR_POLICY (2 | NBD_REP_FLAG_ERROR) /** Client requested an option not allowed by server configuration. (e.g., the option was disabled) */ |
Definition at line 161 of file cliserv.h.
Referenced by ask_list().
| #define NBD_REP_ERR_UNSUP (1 | NBD_REP_FLAG_ERROR) /** Client requested an option not understood by this version of the server */ |
| #define NBD_REP_FLAG_ERROR (1 << 31) /** If the high bit is set, the reply is an error */ |
Definition at line 159 of file cliserv.h.
Referenced by ask_list().
| #define NBD_REP_SERVER (2) /** Reply to NBD_OPT_LIST (one of these per server; must be followed by NBD_REP_ACK to signal the end of the list */ |
Definition at line 158 of file cliserv.h.
Referenced by ask_list().
| void err | ( | const char * | s | ) |
Definition at line 120 of file cliserv.h.
References err_nonfatal().
Referenced by ask_list(), disconnect(), dousers(), finish_sock(), handle_export_name(), integrity_test(), main(), negotiate(), opennet(), oversize_test(), parse_cfile(), readit(), set_timeout(), setsizes(), setup_connection(), throughput_test(), and writeit().
| void err_nonfatal | ( | const char * | s | ) |
| void logging | ( | void | ) |
| u64 ntohll | ( | u64 | a | ) |
Definition at line 138 of file cliserv.h.
Referenced by ask_list(), integrity_test(), main(), negotiate(), and setup_connection().
| void setmysockopt | ( | int | sock | ) |
| u64 cliserv_magic = 0x00420281861253LL |
Definition at line 57 of file cliserv.h.
Referenced by negotiate(), and setup_connection().
| u64 opts_magic = 0x49484156454F5054LL |
Definition at line 58 of file cliserv.h.
Referenced by ask_list(), negotiate(), and setup_connection().
| u64 rep_magic = 0x3e889045565a9LL |
Definition at line 59 of file cliserv.h.
Referenced by ask_list().
1.8.8