#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <syslog.h>
#include <unistd.h>
#include "config.h"
#include "lfs.h"
#include "cliserv.h"
#include <netinet/in.h>
#include <glib.h>
Go to the source code of this file.
Defines | |
#define | MY_NAME "nbd-tester-client" |
Typedefs | |
typedef int(* | testfunc )(gchar *, int, char *, int, char, char) |
Enumerations | |
enum | CONNECTION_TYPE { CONNECTION_TYPE_NONE, CONNECTION_TYPE_CONNECT, CONNECTION_TYPE_INIT_PASSWD, CONNECTION_TYPE_CLISERV, CONNECTION_TYPE_FULL } |
enum | CLOSE_TYPE { CONNECTION_CLOSE_PROPERLY, CONNECTION_CLOSE_FAST } |
Functions | |
int | read_all (int f, void *buf, size_t len) |
int | setup_connection (gchar *hostname, int port, gchar *name, CONNECTION_TYPE ctype) |
int | close_connection (int sock, CLOSE_TYPE type) |
int | read_packet_check_header (int sock, size_t datasize, long long int curhandle) |
int | oversize_test (gchar *hostname, int port, char *name, int sock, char sock_is_open, char close_sock) |
int | throughput_test (gchar *hostname, int port, char *name, int sock, char sock_is_open, char close_sock) |
int | main (int argc, char **argv) |
Variables | |
static gchar | errstr [1024] |
static const int | errstr_len = 1024 |
static uint64_t | size |
#define MY_NAME "nbd-tester-client" |
Definition at line 35 of file nbd-tester-client.c.
typedef int(* testfunc)(gchar *, int, char *, int, char, char) |
Definition at line 397 of file nbd-tester-client.c.
enum CLOSE_TYPE |
Definition at line 54 of file nbd-tester-client.c.
enum CONNECTION_TYPE |
CONNECTION_TYPE_NONE | |
CONNECTION_TYPE_CONNECT | |
CONNECTION_TYPE_INIT_PASSWD | |
CONNECTION_TYPE_CLISERV | |
CONNECTION_TYPE_FULL |
Definition at line 46 of file nbd-tester-client.c.
int close_connection | ( | int | sock, | |
CLOSE_TYPE | type | |||
) |
Definition at line 163 of file nbd-tester-client.c.
References CONNECTION_CLOSE_FAST, CONNECTION_CLOSE_PROPERLY, errstr, errstr_len, nbd_request::from, nbd_request::handle, nbd_request::len, nbd_request::magic, NBD_CMD_DISC, NBD_REQUEST_MAGIC, and nbd_request::type.
Referenced by throughput_test().
int main | ( | int | argc, | |
char ** | argv | |||
) |
Definition at line 399 of file nbd-tester-client.c.
References errstr, logging(), oversize_test(), and throughput_test().
int oversize_test | ( | gchar * | hostname, | |
int | port, | |||
char * | name, | |||
int | sock, | |||
char | sock_is_open, | |||
char | close_sock | |||
) |
Definition at line 216 of file nbd-tester-client.c.
References CONNECTION_TYPE_FULL, err(), nbd_reply::error, errstr, nbd_request::from, nbd_request::handle, htonll, nbd_request::len, nbd_request::magic, NBD_CMD_READ, NBD_REQUEST_MAGIC, read_all(), setup_connection(), and nbd_request::type.
Referenced by main().
int read_all | ( | int | f, | |
void * | buf, | |||
size_t | len | |||
) | [inline] |
Definition at line 59 of file nbd-tester-client.c.
References errstr, and errstr_len.
Referenced by oversize_test(), read_packet_check_header(), and setup_connection().
int read_packet_check_header | ( | int | sock, | |
size_t | datasize, | |||
long long int | curhandle | |||
) |
Definition at line 192 of file nbd-tester-client.c.
References nbd_reply::error, errstr, errstr_len, nbd_reply::handle, nbd_reply::magic, NBD_REPLY_MAGIC, and read_all().
Referenced by throughput_test().
int setup_connection | ( | gchar * | hostname, | |
int | port, | |||
gchar * | name, | |||
CONNECTION_TYPE | ctype | |||
) |
Definition at line 75 of file nbd-tester-client.c.
References cliserv_magic, CONNECTION_TYPE_CLISERV, CONNECTION_TYPE_CONNECT, CONNECTION_TYPE_FULL, CONNECTION_TYPE_INIT_PASSWD, err(), errstr, errstr_len, htonll, INIT_PASSWD, NBD_OPT_EXPORT_NAME, ntohll(), opts_magic, read_all(), setmysockopt(), and size.
Referenced by oversize_test(), and throughput_test().
int throughput_test | ( | gchar * | hostname, | |
int | port, | |||
char * | name, | |||
int | sock, | |||
char | sock_is_open, | |||
char | close_sock | |||
) |
Definition at line 284 of file nbd-tester-client.c.
References close_connection(), CONNECTION_CLOSE_PROPERLY, CONNECTION_TYPE_FULL, err(), errstr, errstr_len, nbd_request::from, nbd_request::handle, htonll, nbd_request::len, nbd_request::magic, NBD_CMD_READ, NBD_REQUEST_MAGIC, read_packet_check_header(), setup_connection(), size, and nbd_request::type.
Referenced by main().
gchar errstr[1024] [static] |
Definition at line 41 of file nbd-tester-client.c.
Referenced by close_connection(), main(), oversize_test(), read_all(), read_packet_check_header(), setup_connection(), and throughput_test().
const int errstr_len = 1024 [static] |
Definition at line 42 of file nbd-tester-client.c.
Referenced by close_connection(), read_all(), read_packet_check_header(), setup_connection(), and throughput_test().
uint64_t size [static] |
Definition at line 44 of file nbd-tester-client.c.
Referenced by setmysockopt(), setsizes(), setup_connection(), and throughput_test().