Whamcloud - gitweb
50d9c87d1f911da79b970b5782768ae64993788d
[fs/lustre-release.git] / lnet / utils / ptlctl.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * Copyright (C) 2001, 2002 Cluster File Systems, Inc.
5  *
6  *   This file is part of Portals, http://www.sf.net/projects/lustre/
7  *
8  *   Portals is free software; you can redistribute it and/or
9  *   modify it under the terms of version 2 of the GNU General Public
10  *   License as published by the Free Software Foundation.
11  *
12  *   Portals is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *   GNU General Public License for more details.
16  *
17  *   You should have received a copy of the GNU General Public License
18  *   along with Portals; if not, write to the Free Software
19  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  *
21  */
22
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <portals/api-support.h>
26 #include <portals/ptlctl.h>
27
28 #include "parser.h"
29
30
31 command_t list[] = {
32         {"network", jt_ptl_network, 0,"setup the NAL (args: nal name)"},
33         {"print_autoconns", jt_ptl_print_autoconnects, 0, "print autoconnect entries (no args)"},
34         {"add_autoconn", jt_ptl_add_autoconnect, 0, "add autoconnect entry (args: nid host [ixs])"},
35         {"del_autoconn", jt_ptl_del_autoconnect, 0, "delete autoconnect entry (args: [nid] [host] [ks])"},
36         {"print_conns", jt_ptl_print_connections, 0, "print connections (no args)"},
37         {"connect", jt_ptl_connect, 0, "connect to a remote nid (args: host port [xi])"},
38         {"disconnect", jt_ptl_disconnect, 0, "disconnect from a remote nid (args: [nid] [host]"},
39         {"push", jt_ptl_push_connection, 0, "flush connection to a remote nid (args: [nid]"},
40         {"ping", jt_ptl_ping, 0, "do a ping test (args: nid [count] [size] [timeout])"},
41         {"shownid", jt_ptl_shownid, 0, "print the local NID"},
42         {"mynid", jt_ptl_mynid, 0, "inform the socknal of the local NID (args: [hostname])"},
43         {"add_route", jt_ptl_add_route, 0, "add an entry to the routing table (args: gatewayNID targetNID [targetNID])"},
44         {"del_route", jt_ptl_del_route, 0, "delete an entry from the routing table (args: targetNID"},
45         {"print_routes", jt_ptl_print_routes, 0, "print the routing table (args: none)"},
46         {"recv_mem", jt_ptl_rxmem, 0, "Set socket receive buffer size (args: [size])"},
47         {"send_mem", jt_ptl_txmem, 0, "Set socket send buffer size (args: [size])"},
48         {"nagle", jt_ptl_nagle, 0, "Enable/Disable Nagle (args: [on/off])"},
49         {"dump", jt_ioc_dump, 0, "usage: dump file, save ioctl buffer to file"},
50         {"fail", jt_ptl_fail_nid, 0, "usage: fail nid|_all_ [count]"},
51         {"help", Parser_help, 0, "help"},
52         {"exit", Parser_quit, 0, "quit"},
53         {"quit", Parser_quit, 0, "quit"},
54         { 0, 0, 0, NULL }
55 };
56
57 int main(int argc, char **argv)
58 {
59         if (ptl_initialize(argc, argv) < 0)
60                 exit(1);
61
62         Parser_init("ptlctl > ", list);
63         if (argc > 1)
64                 return Parser_execarg(argc - 1, &argv[1], list);
65
66         Parser_commands();
67
68         return 0;
69 }