XrdMonSndAdminApp.cc

Go to the documentation of this file.
00001 /*****************************************************************************/
00002 /*                                                                           */
00003 /*                           XrdMonSndAdminApp.cc                            */
00004 /*                                                                           */
00005 /* (c) 2005 by the Board of Trustees of the Leland Stanford, Jr., University */
00006 /*                            All Rights Reserved                            */
00007 /*       Produced by Jacek Becla for Stanford University under contract      */
00008 /*              DE-AC02-76SF00515 with the Department of Energy              */
00009 /*****************************************************************************/
00010 
00011 // $Id: XrdMonSndAdminApp.cc 22437 2008-03-04 14:35:16Z rdm $
00012 
00013 #include "XrdMon/XrdMonArgParser.hh"
00014 #include "XrdMon/XrdMonArgParserConvert.hh"
00015 #include "XrdMon/XrdMonSndAdminEntry.hh"
00016 #include "XrdMon/XrdMonSndCoder.hh"
00017 #include "XrdMon/XrdMonSndTransmitter.hh"
00018 #include <assert.h>
00019 using namespace XrdMonArgParserConvert;
00020 
00021 void
00022 printHelp()
00023 {
00024     cout << "\nxrdmonAdmin\n"
00025          << "    [-host <hostName>]\n"
00026          << "    [-port <portNr>]\n"
00027          << "\n"
00028          << "-host <hostName>         Name of the receiver's host.\n"
00029          << "                         Default value is \"" << DEFAULT_HOST << "\".\n"
00030          << "-port <portNr>           Port number of the receiver's host\n"
00031          << "                         Default valus is \"" << DEFAULT_PORT << "\".\n"
00032          << endl;
00033 }
00034 
00035 int main(int argc, char* argv[])
00036 {
00037     XrdMonArgParser::ArgImpl<const char*, Convert2String>
00038         arg_host("-host", DEFAULT_HOST);
00039     XrdMonArgParser::ArgImpl<int, Convert2Int> 
00040         arg_port("-port", DEFAULT_PORT);
00041 
00042     try {
00043         XrdMonArgParser argParser;
00044         argParser.registerExpectedArg(&arg_host);
00045         argParser.registerExpectedArg(&arg_port);
00046         argParser.parseArguments(argc, argv);
00047     } catch (XrdMonException& e) {
00048         e.printIt();
00049         printHelp();
00050         return 1;
00051     }
00052 
00053     XrdMonSndDebug::initialize();
00054 
00055     XrdMonSndCoder coder;
00056     XrdMonSndTransmitter transmitter;
00057     assert ( !transmitter.initialize(arg_host.myVal(), arg_port.myVal()) );
00058 
00059     XrdMonSndAdminEntry ae;
00060     ae.setShutdown();
00061     coder.prepare2Transfer(ae);
00062     transmitter(coder.packet());
00063 
00064     return 0;
00065 }

Generated on Tue Jul 5 14:46:43 2011 for ROOT_528-00b_version by  doxygen 1.5.1