xorp

coord.hh

00001 // -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
00002 
00003 // Copyright (c) 2001-2009 XORP, Inc.
00004 //
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License, Version 2, June
00007 // 1991 as published by the Free Software Foundation. Redistribution
00008 // and/or modification of this program under the terms of any other
00009 // version of the GNU General Public License is not permitted.
00010 // 
00011 // This program is distributed in the hope that it will be useful, but
00012 // WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
00014 // see the GNU General Public License, Version 2, a copy of which can be
00015 // found in the XORP LICENSE.gpl file.
00016 // 
00017 // XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
00018 // http://xorp.net
00019 
00020 // $XORP: xorp/bgp/harness/coord.hh,v 1.14 2008/10/02 21:56:26 bms Exp $
00021 
00022 #ifndef __BGP_HARNESS_COORD_HH__
00023 #define __BGP_HARNESS_COORD_HH__
00024 
00025 #include "xrl/targets/coord_base.hh"
00026 #include "command.hh"
00027 
00028 class Coord {
00029 public:
00030     Coord(EventLoop& eventloop, Command& command);
00031     void command(const string& command);
00032     void status(const string&   peer, string& status);
00033     bool pending();
00034     void datain(const string&  peer, const uint32_t& genid,
00035         const bool& status, const uint32_t& secs,
00036         const uint32_t& micro, const vector<uint8_t>&  data);
00037     void datain_error(const string&  peer, const uint32_t& genid,
00038               const string& reason);
00039     void datain_closed(const string&  peer, const uint32_t& genid);
00040     bool done();
00041     void mark_done();
00042 
00043 private:
00044     bool _done;
00045     EventLoop& _eventloop;
00046     Command& _command;
00047 };
00048 
00049 class XrlCoordTarget : XrlCoordTargetBase {
00050 public:
00051     XrlCoordTarget(XrlRouter *r, Coord& coord);
00052 
00056     XrlCmdError common_0_1_get_target_name(
00057     // Output values, 
00058     string& name);
00059 
00063     XrlCmdError common_0_1_get_version(
00064     // Output values, 
00065     string& version);
00066 
00070     XrlCmdError common_0_1_get_status(
00071                       // Output values,
00072                       uint32_t& status,
00073                       string&   reason);
00074 
00075     XrlCmdError common_0_1_startup() { return XrlCmdError::OKAY(); }
00076 
00080     XrlCmdError common_0_1_shutdown();
00081 
00082     XrlCmdError coord_0_1_command(
00083     // Input values, 
00084         const string&   command);
00085 
00086     XrlCmdError coord_0_1_status(
00087     // Input values, 
00088     const string&   peer, 
00089     // Output values, 
00090     string& status);
00091 
00092     XrlCmdError coord_0_1_pending(
00093     // Output values, 
00094     bool&   pending);
00095 
00096     XrlCmdError datain_0_1_receive(
00097     // Input values, 
00098     const string&   peer, 
00099     const uint32_t& genid, 
00100     const bool& status, 
00101     const uint32_t& secs, 
00102     const uint32_t& micro, 
00103     const vector<uint8_t>&  data);
00104 
00105     XrlCmdError datain_0_1_error(
00106     // Input values, 
00107     const string&   peer, 
00108     const uint32_t& genid, 
00109     const string&   reason);
00110 
00111     XrlCmdError datain_0_1_closed(
00112     // Input values, 
00113     const string&   peer,
00114     const uint32_t& genid);
00115 private:
00116     Coord& _coord;
00117     int _incommand;
00118 };
00119 
00120 #endif // __BGP_HARNESS_COORD_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations