Motr  M0
rpc_ping.c File Reference
#include "lib/assert.h"
#include "lib/errno.h"
#include "lib/getopts.h"
#include "lib/memory.h"
#include "lib/misc.h"
#include "lib/thread.h"
#include "lib/time.h"
#include "motr/init.h"
#include "reqh/reqh.h"
#include "net/net.h"
#include "net/lnet/lnet.h"
#include "fop/fop.h"
#include "rpc/rpc.h"
#include "rpc/rpclib.h"
#include "rpc/item.h"
#include "rpc/it/ping_fop.h"
#include "rpc/it/ping_fop_xc.h"
#include "rpc/it/ping_fom.h"
#include "ut/cs_service.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <netdb.h>
#include "module/instance.h"
Include dependency graph for rpc_ping.c:

Go to the source code of this file.

Macros

#define SERVER_ENDPOINT_ADDR   "0@lo:12345:34:1"
 
#define SERVER_ENDPOINT   M0_NET_XPRT_PREFIX_DEFAULT":"SERVER_ENDPOINT_ADDR
 
#define SERVER_DB_FILE_NAME   "m0rpcping_server.db"
 
#define SERVER_STOB_FILE_NAME   "m0rpcping_server.stob"
 
#define SERVER_ADDB_STOB_FILE_NAME   "linuxstob:m0rpcping_server_addb.stob"
 
#define SERVER_LOG_FILE_NAME   "m0rpcping_server.log"
 

Enumerations

enum  ep_type { EP_SERVER, EP_CLIENT }
 
enum  { BUF_LEN = 128, M0_LNET_PORTAL = 34, MAX_RPCS_IN_FLIGHT = 32, MAX_RETRIES = 10 }
 

Functions

static int build_endpoint_addr (enum ep_type type, char *out_buf, size_t buf_size)
 
static void __print_stats (struct m0_rpc_machine *rpc_mach)
 
static void print_stats (struct m0_reqh *reqh)
 
static void ping_reply_received (struct m0_rpc_item *item)
 
static void send_ping_fop (struct m0_rpc_session *session)
 
static void rpcping_thread (struct m0_rpc_session *session)
 
static int run_client (void)
 
static void quit_dialog (void)
 
static int int2str (char *dest, size_t size, int src, int defval)
 
static int run_server (void)
 
int main (int argc, char *argv[])
 
M0_INTERNAL void m0_rpc_ping_fini (void)
 

Variables

enum ep_type M0_XCA_DOMAIN
 
static struct m0 instance
 
static bool server_mode = false
 
static bool verbose = false
 
static char * server_nid = "0@lo"
 
static char * client_nid = "0@lo"
 
static int server_tmid = 1
 
static int client_tmid = 2
 
static int nr_client_threads = 1
 
static int nr_ping_bytes = 8
 
static int nr_ping_item = 1
 
static int tm_recv_queue_len = M0_NET_TM_RECV_QUEUE_DEF_LEN
 
static int max_rpc_msg_size = M0_RPC_DEF_MAX_RPC_MSG_SIZE
 
static char client_endpoint [M0_NET_LNET_XEP_ADDR_LEN]
 
static char server_endpoint [M0_NET_LNET_XEP_ADDR_LEN]
 
const struct m0_rpc_item_ops ping_item_ops
 

Macro Definition Documentation

◆ SERVER_ADDB_STOB_FILE_NAME

#define SERVER_ADDB_STOB_FILE_NAME   "linuxstob:m0rpcping_server_addb.stob"

Definition at line 64 of file rpc_ping.c.

◆ SERVER_DB_FILE_NAME

#define SERVER_DB_FILE_NAME   "m0rpcping_server.db"

Definition at line 62 of file rpc_ping.c.

◆ SERVER_ENDPOINT

#define SERVER_ENDPOINT   M0_NET_XPRT_PREFIX_DEFAULT":"SERVER_ENDPOINT_ADDR

Definition at line 60 of file rpc_ping.c.

◆ SERVER_ENDPOINT_ADDR

#define SERVER_ENDPOINT_ADDR   "0@lo:12345:34:1"

Definition at line 59 of file rpc_ping.c.

◆ SERVER_LOG_FILE_NAME

#define SERVER_LOG_FILE_NAME   "m0rpcping_server.log"

Definition at line 65 of file rpc_ping.c.

◆ SERVER_STOB_FILE_NAME

#define SERVER_STOB_FILE_NAME   "m0rpcping_server.stob"

Definition at line 63 of file rpc_ping.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
BUF_LEN 
M0_LNET_PORTAL 
MAX_RPCS_IN_FLIGHT 
MAX_RETRIES 

Definition at line 69 of file rpc_ping.c.

◆ ep_type

enum ep_type
Enumerator
EP_SERVER 
EP_CLIENT 

Definition at line 67 of file rpc_ping.c.

Function Documentation

◆ __print_stats()

static void __print_stats ( struct m0_rpc_machine rpc_mach)
static

Definition at line 161 of file rpc_ping.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ build_endpoint_addr()

static int build_endpoint_addr ( enum ep_type  type,
char *  out_buf,
size_t  buf_size 
)
static

Definition at line 129 of file rpc_ping.c.

Here is the caller graph for this function:

◆ int2str()

static int int2str ( char *  dest,
size_t  size,
int  src,
int  defval 
)
static

Definition at line 371 of file rpc_ping.c.

Here is the caller graph for this function:

◆ m0_rpc_ping_fini()

M0_INTERNAL void m0_rpc_ping_fini ( void  )

Definition at line 495 of file rpc_ping.c.

Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 451 of file rpc_ping.c.

Here is the call graph for this function:

◆ ping_reply_received()

static void ping_reply_received ( struct m0_rpc_item item)
static

Definition at line 216 of file rpc_ping.c.

Here is the call graph for this function:

◆ print_stats()

static void print_stats ( struct m0_reqh reqh)
static

Definition at line 201 of file rpc_ping.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ quit_dialog()

static void quit_dialog ( void  )
static

Definition at line 360 of file rpc_ping.c.

Here is the caller graph for this function:

◆ rpcping_thread()

static void rpcping_thread ( struct m0_rpc_session session)
static

Definition at line 271 of file rpc_ping.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ run_client()

static int run_client ( void  )
static

Definition at line 279 of file rpc_ping.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ run_server()

static int run_server ( void  )
static

Definition at line 377 of file rpc_ping.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_ping_fop()

static void send_ping_fop ( struct m0_rpc_session session)
static

Definition at line 243 of file rpc_ping.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ client_endpoint

char client_endpoint[M0_NET_LNET_XEP_ADDR_LEN]
static

Definition at line 92 of file rpc_ping.c.

◆ client_nid

char* client_nid = "0@lo"
static

Definition at line 83 of file rpc_ping.c.

◆ client_tmid

int client_tmid = 2
static

Definition at line 85 of file rpc_ping.c.

◆ instance

struct m0 instance
static

Definition at line 77 of file rpc_ping.c.

◆ M0_XCA_DOMAIN

enum ep_type M0_XCA_DOMAIN

◆ max_rpc_msg_size

int max_rpc_msg_size = M0_RPC_DEF_MAX_RPC_MSG_SIZE
static

Definition at line 90 of file rpc_ping.c.

◆ nr_client_threads

int nr_client_threads = 1
static

Definition at line 86 of file rpc_ping.c.

◆ nr_ping_bytes

int nr_ping_bytes = 8
static

Definition at line 87 of file rpc_ping.c.

◆ nr_ping_item

int nr_ping_item = 1
static

Definition at line 88 of file rpc_ping.c.

◆ ping_item_ops

const struct m0_rpc_item_ops ping_item_ops
Initial value:
= {
.rio_replied = ping_reply_received,
}
static void ping_reply_received(struct m0_rpc_item *item)
Definition: rpc_ping.c:216

Definition at line 238 of file rpc_ping.c.

◆ server_endpoint

char server_endpoint[M0_NET_LNET_XEP_ADDR_LEN]
static

Definition at line 93 of file rpc_ping.c.

◆ server_mode

bool server_mode = false
static

Definition at line 78 of file rpc_ping.c.

◆ server_nid

char* server_nid = "0@lo"
static

Definition at line 82 of file rpc_ping.c.

◆ server_tmid

int server_tmid = 1
static

Definition at line 84 of file rpc_ping.c.

◆ tm_recv_queue_len

int tm_recv_queue_len = M0_NET_TM_RECV_QUEUE_DEF_LEN
static

Definition at line 89 of file rpc_ping.c.

◆ verbose

bool verbose = false
static

Definition at line 81 of file rpc_ping.c.