Network Block Device  @PACKAGE_VERSION@
Macros | Functions | Variables
cliserv.h File Reference
#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
 

Macro Definition Documentation

#define __be32   u32

Definition at line 39 of file cliserv.h.

#define __be64   u64

Definition at line 40 of file cliserv.h.

#define fdatasync (   arg)    fsync(arg)

Definition at line 44 of file cliserv.h.

#define G_GNUC_NORETURN

Definition at line 87 of file cliserv.h.

#define G_GNUC_UNUSED

Definition at line 88 of file cliserv.h.

Referenced by integrity_test(), main(), oversize_test(), and parse_cfile().

#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
Value:
"10809" /* Port on which named exports are
* served */

Definition at line 148 of file cliserv.h.

Referenced by main().

#define NBD_FLAG_C_FIXED_NEWSTYLE   NBD_FLAG_FIXED_NEWSTYLE

Definition at line 168 of file cliserv.h.

Referenced by main().

#define NBD_FLAG_FIXED_NEWSTYLE   (1 << 0) /* new-style export that actually supports extending */

Definition at line 166 of file cliserv.h.

Referenced by main().

#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 */

Definition at line 162 of file cliserv.h.

#define NBD_REP_ERR_PLATFORM   (4 | NBD_REP_FLAG_ERROR) /** Option not supported on this platform */

Definition at line 163 of file cliserv.h.

#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 */

Definition at line 160 of file cliserv.h.

#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().

Function Documentation

void err ( const char *  s)
void err_nonfatal ( const char *  s)

Definition at line 92 of file cliserv.h.

Referenced by err(), and opennet().

void logging ( void  )

Definition at line 125 of file cliserv.h.

References MY_NAME.

Referenced by main().

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)

Definition at line 64 of file cliserv.h.

References INFO, and size.

Referenced by opennet(), and setup_connection().

Variable Documentation

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().