2 * Copyright (c) 1998,1999,2000
3 * Traakan, Inc., Los Altos, CA
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice unmodified, this list of conditions, and the following
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46 main (int ac, char *av[])
51 dbopen(DBG_SUBDIR_CLIENT);
54 NDMOS_MACRO_ZEROFILL(&the_session);
57 /* ready the_param early so logging works during process_args() */
58 NDMOS_MACRO_ZEROFILL (&the_param);
59 the_param.log.deliver = ndmjob_log_deliver;
60 the_param.log_level = 0;
61 the_param.log_tag = "SESS";
63 #ifndef NDMOS_OPTION_NO_CONTROL_AGENT
69 p_ndmp_port = NDMPPORT;
70 #endif /* !NDMOS_OPTION_NO_CONTROL_AGENT */
72 process_args (ac, av);
74 if (the_param.log_level < d_debug)
75 the_param.log_level = d_debug;
76 if (the_param.log_level < v_verbose)
77 the_param.log_level = v_verbose;
78 the_param.config_file_name = o_config_file;
80 if (the_mode == NDM_JOB_OP_DAEMON || the_mode == NDM_JOB_OP_TEST_DAEMON) {
81 the_session.param = the_param;
87 ndma_daemon_session (&the_session, p_ndmp_port, the_mode == NDM_JOB_OP_TEST_DAEMON);
91 #ifndef NDMOS_OPTION_NO_CONTROL_AGENT
92 the_session.control_acb.swap_connect = (o_swap_connect != 0);
94 build_job(); /* might not return */
96 the_session.param = the_param;
97 the_session.control_acb.job = the_job;
106 rc = ndma_client_session (&the_session);
111 ndmjob_log (1, "Operation complete");
113 ndmjob_log (1, "Operation complete but had problems.");
114 #endif /* !NDMOS_OPTION_NO_CONTROL_AGENT */