Network Block Device @PACKAGE_VERSION@
Defines | 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.

Defines

#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   "10809"
#define NBD_OPT_EXPORT_NAME   (1)
#define NBD_OPT_ABORT   (2)
#define NBD_OPT_LIST   (3)
#define NBD_REP_ACK   (1)
#define NBD_REP_SERVER   (2)
#define NBD_REP_FLAG_ERROR   (1 << 31)
#define NBD_REP_ERR_UNSUP   (1 | NBD_REP_FLAG_ERROR)
#define NBD_REP_ERR_POLICY   (2 | NBD_REP_FLAG_ERROR)
#define NBD_REP_ERR_INVALID   (3 | NBD_REP_FLAG_ERROR)
#define NBD_REP_ERR_PLATFORM   (4 | NBD_REP_FLAG_ERROR)
#define NBD_FLAG_FIXED_NEWSTYLE   (1 << 0)
#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

static u64 cliserv_magic = 0x00420281861253LL
static u64 opts_magic = 0x49484156454F5054LL
static u64 rep_magic = 0x3e889045565a9LL

Define 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.

Referenced by expwrite(), and rawexpwrite().

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

#define htonll   ntohll

Definition at line 146 of file cliserv.h.

Referenced by ask_list(), main(), negotiate(), and send_reply().

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

#define NBD_DEFAULT_PORT   "10809"

Definition at line 148 of file cliserv.h.

Referenced by main(), and open_modern().

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

Definition at line 166 of file cliserv.h.

Referenced by main(), and negotiate().

#define NBD_OPT_ABORT   (2)

Definition at line 153 of file cliserv.h.

Referenced by ask_list(), and negotiate().

#define NBD_OPT_EXPORT_NAME   (1)

Definition at line 152 of file cliserv.h.

Referenced by negotiate().

#define NBD_OPT_LIST   (3)

Definition at line 154 of file cliserv.h.

Referenced by ask_list(), and negotiate().

#define NBD_REP_ACK   (1)

Definition at line 157 of file cliserv.h.

Referenced by ask_list(), and handle_list().

#define NBD_REP_ERR_INVALID   (3 | NBD_REP_FLAG_ERROR)

Definition at line 162 of file cliserv.h.

Referenced by handle_list().

#define NBD_REP_ERR_PLATFORM   (4 | NBD_REP_FLAG_ERROR)

Definition at line 163 of file cliserv.h.

#define NBD_REP_ERR_POLICY   (2 | NBD_REP_FLAG_ERROR)

Definition at line 161 of file cliserv.h.

Referenced by ask_list(), and handle_list().

#define NBD_REP_ERR_UNSUP   (1 | NBD_REP_FLAG_ERROR)

Definition at line 160 of file cliserv.h.

Referenced by negotiate().

#define NBD_REP_FLAG_ERROR   (1 << 31)

Definition at line 159 of file cliserv.h.

Referenced by ask_list().

#define NBD_REP_SERVER   (2)

Definition at line 158 of file cliserv.h.

Referenced by ask_list(), and handle_list().


Function Documentation

void err ( const char *  s) [inline]
void err_nonfatal ( const char *  s) [inline]

Definition at line 92 of file cliserv.h.

Referenced by err(), handle_list(), negotiate(), opennet(), and socket_accept().

void logging ( void  ) [inline]

Definition at line 125 of file cliserv.h.

References MY_NAME.

Referenced by main().

u64 ntohll ( u64  a) [inline]

Definition at line 138 of file cliserv.h.

Referenced by ask_list(), main(), mainloop(), and negotiate().

void setmysockopt ( int  sock) [inline]

Definition at line 64 of file cliserv.h.

References INFO.

Referenced by opennet(), and serveconnection().


Variable Documentation

u64 cliserv_magic = 0x00420281861253LL [static]

Definition at line 57 of file cliserv.h.

Referenced by negotiate().

u64 opts_magic = 0x49484156454F5054LL [static]

Definition at line 58 of file cliserv.h.

Referenced by ask_list(), and negotiate().

u64 rep_magic = 0x3e889045565a9LL [static]

Definition at line 59 of file cliserv.h.

Referenced by ask_list().