Exemple #1
0
int
ndmca_op_test_data (struct ndm_session *sess)
{
	struct ndm_control_agent *ca = sess->control_acb;
	struct ndmconn *	conn;
	int			(*save_call) (struct ndmconn *conn,
						struct ndmp_xa_buf *xa);
	int			rc;

	rc = ndmca_connect_data_agent(sess);
	if (rc) {
		ndmconn_destruct (sess->plumb.data);
		return rc;
	}

	conn = sess->plumb.data;
	save_call = conn->call;
	conn->call = ndma_call_no_tattle;

	/* perform query to find out about TCP and LOCAL support */
	rc = ndmca_test_query_conn_types (sess, conn);
	if (rc) return rc;

	rc = ndmca_td_wrapper (sess, ndmca_td_idle);
	if (sess->plumb.data->protocol_version >= 3) {
	    // version 3 and later adds LISTEN
	    rc = ndmca_td_wrapper (sess, ndmca_td_listen);
	}

	ndmca_test_done_series (sess, "test-data");

	ca = sess->control_acb;
	if (ca->has_tcp_addr && ca->has_local_addr) {
	    ndmalogf (sess, "TEST", 0, "LOCAL and TCP addressing tested.");
	} else if (ca->has_tcp_addr) {
	    ndmalogf (sess, "TEST", 0, "TCP addressing ONLY tested.");
	} else if (ca->has_local_addr) {
	    ndmalogf (sess, "TEST", 0, "LOCAL addressing ONLY tested.");
	} else {
	    ndmalogf (sess, "TEST", 0, "Neither TCP or LOCAL addressing tested.");
	}

	return 0;
}
Exemple #2
0
int
ndmca_op_test_tape (struct ndm_session *sess)
{
	struct ndmconn *	conn;
	int			(*save_call) (struct ndmconn *conn,
						struct ndmp_xa_buf *xa);
	int			rc;

	rc = ndmca_test_load_tape (sess);
	if (rc) return rc;

	conn = sess->plumb.tape;
	save_call = conn->call;
	conn->call = ndma_call_no_tattle;

	if (rc == 0)
		rc = ndmca_tt_wrapper (sess, ndmca_tt_openclose);
	if (rc == 0)
		rc = ndmca_tt_wrapper (sess, ndmca_tt_basic_getstate);
	if (rc == 0)
		rc = ndmca_tt_wrapper (sess, ndmca_tt_basic_write);
	if (rc == 0)
		rc = ndmca_tt_wrapper (sess, ndmca_tt_basic_read);
	if (rc == 0)
		rc = ndmca_tt_wrapper (sess, ndmca_tt_basic_write_and_read);
	if (rc == 0)
		rc = ndmca_tt_wrapper (sess, ndmca_tt_write);
	if (rc == 0)
		rc = ndmca_tt_wrapper (sess, ndmca_tt_read);
	if (rc == 0)
		rc = ndmca_tt_wrapper (sess, ndmca_tt_mtio);

	ndmca_test_unload_tape (sess);

	ndmca_test_done_series (sess, "test-tape");

	conn->call = save_call;

	return 0;
}