xorp

coord_base.hh

00001 /*
00002  * obj/i686-pc-linux-gnu/xrl/targets/coord_base.hh
00003  * vim:set sts=4 ts=8 ft=cpp:
00004  *
00005  * Copyright (c) 2001-2011 XORP, Inc and Others
00006  * See the XORP LICENSE.lgpl file for licensing, conditions, and warranties
00007  * on use.
00008  *
00009  * DO NOT EDIT THIS FILE - IT IS PROGRAMMATICALLY GENERATED
00010  *
00011  * Generated by 'tgt-gen'.
00012  */
00013 
00014 
00015 #ifndef __XRL_TARGETS_COORD_BASE_HH__
00016 #define __XRL_TARGETS_COORD_BASE_HH__
00017 
00018 #undef XORP_LIBRARY_NAME
00019 #define XORP_LIBRARY_NAME "XrlCoordTarget"
00020 
00021 #include "libxorp/xlog.h"
00022 #include "libxipc/xrl_cmd_map.hh"
00023 
00024 class XrlCoordTargetBase {
00025 protected:
00026     XrlCmdMap* _cmds;
00027 
00028 public:
00036     XrlCoordTargetBase(XrlCmdMap* cmds = 0);
00037 
00043     virtual ~XrlCoordTargetBase();
00044 
00055     bool set_command_map(XrlCmdMap* cmds);
00056 
00060     const string& get_name() const { return _cmds->name(); }
00061 
00065     const char* version() const { return "coord/0.0"; }
00066 
00067 protected:
00068 
00074     virtual XrlCmdError common_0_1_get_target_name(
00075     // Output values,
00076     string& name) = 0;
00077 #ifdef XORP_ENABLE_ASYNC_SERVER
00078     typedef
00079     XorpCallback2<void, const XrlCmdError &,
00080     const string*>::RefPtr
00081     Common01GetTargetNameRF;
00082 
00083     class Common01GetTargetNameCB {
00084         Common01GetTargetNameRF cb;
00085 
00086     public:
00087         operator const Common01GetTargetNameRF& () const { return cb; }
00088         const Common01GetTargetNameRF& operator ->() const { return cb; }
00089         Common01GetTargetNameCB(const Common01GetTargetNameRF& cb)
00090           : cb(cb) { }
00091 
00092         void fail(const XrlCmdError &e) const { cb->dispatch(e, NULL); }
00093 
00094         void respond(const string& arg_name) const {
00095             cb->dispatch(XrlCmdError::OKAY(),
00096                          &arg_name);
00097         }
00098     };
00099 
00100     struct Common01GetTargetNameRsp :
00101       public Common01GetTargetNameCB {
00102         struct args_str {
00103             string name;
00104         };
00105 
00106     private:
00107         args_str args;
00108 
00109     public:
00110         Common01GetTargetNameRsp(const Common01GetTargetNameRF& cb)
00111           : Common01GetTargetNameCB(cb) { }
00112 
00113         void respond() const {
00114             Common01GetTargetNameCB::
00115             respond(args.name);
00116         }
00117 
00118         args_str* operator ->() {
00119             return &args;
00120         }
00121     };
00122 
00123     virtual void async_common_0_1_get_target_name
00124        (
00125     Common01GetTargetNameCB);
00126 #endif
00127 
00133     virtual XrlCmdError common_0_1_get_version(
00134     // Output values,
00135     string& version) = 0;
00136 #ifdef XORP_ENABLE_ASYNC_SERVER
00137     typedef
00138     XorpCallback2<void, const XrlCmdError &,
00139     const string*>::RefPtr
00140     Common01GetVersionRF;
00141 
00142     class Common01GetVersionCB {
00143         Common01GetVersionRF cb;
00144 
00145     public:
00146         operator const Common01GetVersionRF& () const { return cb; }
00147         const Common01GetVersionRF& operator ->() const { return cb; }
00148         Common01GetVersionCB(const Common01GetVersionRF& cb)
00149           : cb(cb) { }
00150 
00151         void fail(const XrlCmdError &e) const { cb->dispatch(e, NULL); }
00152 
00153         void respond(const string& arg_version) const {
00154             cb->dispatch(XrlCmdError::OKAY(),
00155                          &arg_version);
00156         }
00157     };
00158 
00159     struct Common01GetVersionRsp :
00160       public Common01GetVersionCB {
00161         struct args_str {
00162             string version;
00163         };
00164 
00165     private:
00166         args_str args;
00167 
00168     public:
00169         Common01GetVersionRsp(const Common01GetVersionRF& cb)
00170           : Common01GetVersionCB(cb) { }
00171 
00172         void respond() const {
00173             Common01GetVersionCB::
00174             respond(args.version);
00175         }
00176 
00177         args_str* operator ->() {
00178             return &args;
00179         }
00180     };
00181 
00182     virtual void async_common_0_1_get_version
00183        (
00184     Common01GetVersionCB);
00185 #endif
00186 
00192     virtual XrlCmdError common_0_1_get_status(
00193     // Output values,
00194     uint32_t&   status,
00195     string& reason) = 0;
00196 #ifdef XORP_ENABLE_ASYNC_SERVER
00197     typedef
00198     XorpCallback3<void, const XrlCmdError &,
00199     const uint32_t*,
00200     const string*>::RefPtr
00201     Common01GetStatusRF;
00202 
00203     class Common01GetStatusCB {
00204         Common01GetStatusRF cb;
00205 
00206     public:
00207         operator const Common01GetStatusRF& () const { return cb; }
00208         const Common01GetStatusRF& operator ->() const { return cb; }
00209         Common01GetStatusCB(const Common01GetStatusRF& cb)
00210           : cb(cb) { }
00211 
00212         void fail(const XrlCmdError &e) const { cb->dispatch(e, NULL, NULL); }
00213 
00214         void respond(const uint32_t& arg_status,
00215                      const string& arg_reason) const {
00216             cb->dispatch(XrlCmdError::OKAY(),
00217                          &arg_status,
00218                          &arg_reason);
00219         }
00220     };
00221 
00222     struct Common01GetStatusRsp :
00223       public Common01GetStatusCB {
00224         struct args_str {
00225             uint32_t status;
00226             string reason;
00227         };
00228 
00229     private:
00230         args_str args;
00231 
00232     public:
00233         Common01GetStatusRsp(const Common01GetStatusRF& cb)
00234           : Common01GetStatusCB(cb) { }
00235 
00236         void respond() const {
00237             Common01GetStatusCB::
00238             respond(args.status,
00239                         args.reason);
00240         }
00241 
00242         args_str* operator ->() {
00243             return &args;
00244         }
00245     };
00246 
00247     virtual void async_common_0_1_get_status
00248        (
00249     Common01GetStatusCB);
00250 #endif
00251 
00257     virtual XrlCmdError common_0_1_shutdown() = 0;
00258 #ifdef XORP_ENABLE_ASYNC_SERVER
00259     typedef
00260     XorpCallback1<void, const XrlCmdError &>::RefPtr
00261     Common01ShutdownRF;
00262 
00263     class Common01ShutdownCB {
00264         Common01ShutdownRF cb;
00265 
00266     public:
00267         operator const Common01ShutdownRF& () const { return cb; }
00268         const Common01ShutdownRF& operator ->() const { return cb; }
00269         Common01ShutdownCB(const Common01ShutdownRF& cb)
00270           : cb(cb) { }
00271 
00272         void fail(const XrlCmdError &e) const { cb->dispatch(e); }
00273 
00274         void respond() const {
00275             cb->dispatch(XrlCmdError::OKAY());
00276         }
00277     };
00278 
00279     struct Common01ShutdownRsp :
00280       public Common01ShutdownCB {
00281         Common01ShutdownRsp(const Common01ShutdownRF& cb)
00282           : Common01ShutdownCB(cb) { }
00283 
00284     };
00285 
00286     virtual void async_common_0_1_shutdown
00287        (
00288     Common01ShutdownCB);
00289 #endif
00290 
00296     virtual XrlCmdError common_0_1_startup() = 0;
00297 #ifdef XORP_ENABLE_ASYNC_SERVER
00298     typedef
00299     XorpCallback1<void, const XrlCmdError &>::RefPtr
00300     Common01StartupRF;
00301 
00302     class Common01StartupCB {
00303         Common01StartupRF cb;
00304 
00305     public:
00306         operator const Common01StartupRF& () const { return cb; }
00307         const Common01StartupRF& operator ->() const { return cb; }
00308         Common01StartupCB(const Common01StartupRF& cb)
00309           : cb(cb) { }
00310 
00311         void fail(const XrlCmdError &e) const { cb->dispatch(e); }
00312 
00313         void respond() const {
00314             cb->dispatch(XrlCmdError::OKAY());
00315         }
00316     };
00317 
00318     struct Common01StartupRsp :
00319       public Common01StartupCB {
00320         Common01StartupRsp(const Common01StartupRF& cb)
00321           : Common01StartupCB(cb) { }
00322 
00323     };
00324 
00325     virtual void async_common_0_1_startup
00326        (
00327     Common01StartupCB);
00328 #endif
00329 
00337     virtual XrlCmdError coord_0_1_command(
00338     // Input values,
00339     const string&   command) = 0;
00340 #ifdef XORP_ENABLE_ASYNC_SERVER
00341     typedef
00342     XorpCallback1<void, const XrlCmdError &>::RefPtr
00343     Coord01CommandRF;
00344 
00345     class Coord01CommandCB {
00346         Coord01CommandRF cb;
00347 
00348     public:
00349         operator const Coord01CommandRF& () const { return cb; }
00350         const Coord01CommandRF& operator ->() const { return cb; }
00351         Coord01CommandCB(const Coord01CommandRF& cb)
00352           : cb(cb) { }
00353 
00354         void fail(const XrlCmdError &e) const { cb->dispatch(e); }
00355 
00356         void respond() const {
00357             cb->dispatch(XrlCmdError::OKAY());
00358         }
00359     };
00360 
00361     struct Coord01CommandRsp :
00362       public Coord01CommandCB {
00363         Coord01CommandRsp(const Coord01CommandRF& cb)
00364           : Coord01CommandCB(cb) { }
00365 
00366     };
00367 
00368     virtual void async_coord_0_1_command
00369        (
00370     const string&   command,
00371     Coord01CommandCB);
00372 #endif
00373 
00379     virtual XrlCmdError coord_0_1_status(
00380     // Input values,
00381     const string&   peer,
00382     // Output values,
00383     string& status) = 0;
00384 #ifdef XORP_ENABLE_ASYNC_SERVER
00385     typedef
00386     XorpCallback2<void, const XrlCmdError &,
00387     const string*>::RefPtr
00388     Coord01StatusRF;
00389 
00390     class Coord01StatusCB {
00391         Coord01StatusRF cb;
00392 
00393     public:
00394         operator const Coord01StatusRF& () const { return cb; }
00395         const Coord01StatusRF& operator ->() const { return cb; }
00396         Coord01StatusCB(const Coord01StatusRF& cb)
00397           : cb(cb) { }
00398 
00399         void fail(const XrlCmdError &e) const { cb->dispatch(e, NULL); }
00400 
00401         void respond(const string& arg_status) const {
00402             cb->dispatch(XrlCmdError::OKAY(),
00403                          &arg_status);
00404         }
00405     };
00406 
00407     struct Coord01StatusRsp :
00408       public Coord01StatusCB {
00409         struct args_str {
00410             string status;
00411         };
00412 
00413     private:
00414         args_str args;
00415 
00416     public:
00417         Coord01StatusRsp(const Coord01StatusRF& cb)
00418           : Coord01StatusCB(cb) { }
00419 
00420         void respond() const {
00421             Coord01StatusCB::
00422             respond(args.status);
00423         }
00424 
00425         args_str* operator ->() {
00426             return &args;
00427         }
00428     };
00429 
00430     virtual void async_coord_0_1_status
00431        (
00432     const string&   peer,
00433     Coord01StatusCB);
00434 #endif
00435 
00443     virtual XrlCmdError coord_0_1_pending(
00444     // Output values,
00445     bool&   pending) = 0;
00446 #ifdef XORP_ENABLE_ASYNC_SERVER
00447     typedef
00448     XorpCallback2<void, const XrlCmdError &,
00449     const bool*>::RefPtr
00450     Coord01PendingRF;
00451 
00452     class Coord01PendingCB {
00453         Coord01PendingRF cb;
00454 
00455     public:
00456         operator const Coord01PendingRF& () const { return cb; }
00457         const Coord01PendingRF& operator ->() const { return cb; }
00458         Coord01PendingCB(const Coord01PendingRF& cb)
00459           : cb(cb) { }
00460 
00461         void fail(const XrlCmdError &e) const { cb->dispatch(e, NULL); }
00462 
00463         void respond(const bool& arg_pending) const {
00464             cb->dispatch(XrlCmdError::OKAY(),
00465                          &arg_pending);
00466         }
00467     };
00468 
00469     struct Coord01PendingRsp :
00470       public Coord01PendingCB {
00471         struct args_str {
00472             bool pending;
00473         };
00474 
00475     private:
00476         args_str args;
00477 
00478     public:
00479         Coord01PendingRsp(const Coord01PendingRF& cb)
00480           : Coord01PendingCB(cb) { }
00481 
00482         void respond() const {
00483             Coord01PendingCB::
00484             respond(args.pending);
00485         }
00486 
00487         args_str* operator ->() {
00488             return &args;
00489         }
00490     };
00491 
00492     virtual void async_coord_0_1_pending
00493        (
00494     Coord01PendingCB);
00495 #endif
00496 
00497     virtual XrlCmdError datain_0_1_receive(
00498     // Input values,
00499     const string&   peer,
00500     const uint32_t& genid,
00501     const bool& status,
00502     const uint32_t& secs,
00503     const uint32_t& micro,
00504     const vector<uint8_t>&  data) = 0;
00505 #ifdef XORP_ENABLE_ASYNC_SERVER
00506     typedef
00507     XorpCallback1<void, const XrlCmdError &>::RefPtr
00508     Datain01ReceiveRF;
00509 
00510     class Datain01ReceiveCB {
00511         Datain01ReceiveRF cb;
00512 
00513     public:
00514         operator const Datain01ReceiveRF& () const { return cb; }
00515         const Datain01ReceiveRF& operator ->() const { return cb; }
00516         Datain01ReceiveCB(const Datain01ReceiveRF& cb)
00517           : cb(cb) { }
00518 
00519         void fail(const XrlCmdError &e) const { cb->dispatch(e); }
00520 
00521         void respond() const {
00522             cb->dispatch(XrlCmdError::OKAY());
00523         }
00524     };
00525 
00526     struct Datain01ReceiveRsp :
00527       public Datain01ReceiveCB {
00528         Datain01ReceiveRsp(const Datain01ReceiveRF& cb)
00529           : Datain01ReceiveCB(cb) { }
00530 
00531     };
00532 
00533     virtual void async_datain_0_1_receive
00534        (
00535     const string&   peer,
00536     const uint32_t& genid,
00537     const bool& status,
00538     const uint32_t& secs,
00539     const uint32_t& micro,
00540     const vector<uint8_t>&  data,
00541     Datain01ReceiveCB);
00542 #endif
00543 
00544     virtual XrlCmdError datain_0_1_error(
00545     // Input values,
00546     const string&   peer,
00547     const uint32_t& genid,
00548     const string&   reason) = 0;
00549 #ifdef XORP_ENABLE_ASYNC_SERVER
00550     typedef
00551     XorpCallback1<void, const XrlCmdError &>::RefPtr
00552     Datain01ErrorRF;
00553 
00554     class Datain01ErrorCB {
00555         Datain01ErrorRF cb;
00556 
00557     public:
00558         operator const Datain01ErrorRF& () const { return cb; }
00559         const Datain01ErrorRF& operator ->() const { return cb; }
00560         Datain01ErrorCB(const Datain01ErrorRF& cb)
00561           : cb(cb) { }
00562 
00563         void fail(const XrlCmdError &e) const { cb->dispatch(e); }
00564 
00565         void respond() const {
00566             cb->dispatch(XrlCmdError::OKAY());
00567         }
00568     };
00569 
00570     struct Datain01ErrorRsp :
00571       public Datain01ErrorCB {
00572         Datain01ErrorRsp(const Datain01ErrorRF& cb)
00573           : Datain01ErrorCB(cb) { }
00574 
00575     };
00576 
00577     virtual void async_datain_0_1_error
00578        (
00579     const string&   peer,
00580     const uint32_t& genid,
00581     const string&   reason,
00582     Datain01ErrorCB);
00583 #endif
00584 
00585     virtual XrlCmdError datain_0_1_closed(
00586     // Input values,
00587     const string&   peer,
00588     const uint32_t& genid) = 0;
00589 #ifdef XORP_ENABLE_ASYNC_SERVER
00590     typedef
00591     XorpCallback1<void, const XrlCmdError &>::RefPtr
00592     Datain01ClosedRF;
00593 
00594     class Datain01ClosedCB {
00595         Datain01ClosedRF cb;
00596 
00597     public:
00598         operator const Datain01ClosedRF& () const { return cb; }
00599         const Datain01ClosedRF& operator ->() const { return cb; }
00600         Datain01ClosedCB(const Datain01ClosedRF& cb)
00601           : cb(cb) { }
00602 
00603         void fail(const XrlCmdError &e) const { cb->dispatch(e); }
00604 
00605         void respond() const {
00606             cb->dispatch(XrlCmdError::OKAY());
00607         }
00608     };
00609 
00610     struct Datain01ClosedRsp :
00611       public Datain01ClosedCB {
00612         Datain01ClosedRsp(const Datain01ClosedRF& cb)
00613           : Datain01ClosedCB(cb) { }
00614 
00615     };
00616 
00617     virtual void async_datain_0_1_closed
00618        (
00619     const string&   peer,
00620     const uint32_t& genid,
00621     Datain01ClosedCB);
00622 #endif
00623 
00624 private:
00625     XrlCmdRT handle_common_0_1_get_target_name(const XrlArgs& in, XrlCmdOT out);
00626 #ifdef XORP_ENABLE_ASYNC_SERVER
00627     void callback_common_0_1_get_target_name
00628        (const XrlCmdError &e,
00629     const string* arg_name,
00630         XrlRespCallback);
00631 #endif
00632 
00633     XrlCmdRT handle_common_0_1_get_version(const XrlArgs& in, XrlCmdOT out);
00634 #ifdef XORP_ENABLE_ASYNC_SERVER
00635     void callback_common_0_1_get_version
00636        (const XrlCmdError &e,
00637     const string* arg_version,
00638         XrlRespCallback);
00639 #endif
00640 
00641     XrlCmdRT handle_common_0_1_get_status(const XrlArgs& in, XrlCmdOT out);
00642 #ifdef XORP_ENABLE_ASYNC_SERVER
00643     void callback_common_0_1_get_status
00644        (const XrlCmdError &e,
00645     const uint32_t* arg_status,
00646     const string* arg_reason,
00647         XrlRespCallback);
00648 #endif
00649 
00650     XrlCmdRT handle_common_0_1_shutdown(const XrlArgs& in, XrlCmdOT out);
00651 #ifdef XORP_ENABLE_ASYNC_SERVER
00652     void callback_common_0_1_shutdown
00653        (const XrlCmdError &e,
00654         XrlRespCallback);
00655 #endif
00656 
00657     XrlCmdRT handle_common_0_1_startup(const XrlArgs& in, XrlCmdOT out);
00658 #ifdef XORP_ENABLE_ASYNC_SERVER
00659     void callback_common_0_1_startup
00660        (const XrlCmdError &e,
00661         XrlRespCallback);
00662 #endif
00663 
00664     XrlCmdRT handle_coord_0_1_command(const XrlArgs& in, XrlCmdOT out);
00665 #ifdef XORP_ENABLE_ASYNC_SERVER
00666     void callback_coord_0_1_command
00667        (const XrlCmdError &e,
00668         XrlRespCallback);
00669 #endif
00670 
00671     XrlCmdRT handle_coord_0_1_status(const XrlArgs& in, XrlCmdOT out);
00672 #ifdef XORP_ENABLE_ASYNC_SERVER
00673     void callback_coord_0_1_status
00674        (const XrlCmdError &e,
00675     const string* arg_status,
00676         XrlRespCallback);
00677 #endif
00678 
00679     XrlCmdRT handle_coord_0_1_pending(const XrlArgs& in, XrlCmdOT out);
00680 #ifdef XORP_ENABLE_ASYNC_SERVER
00681     void callback_coord_0_1_pending
00682        (const XrlCmdError &e,
00683     const bool* arg_pending,
00684         XrlRespCallback);
00685 #endif
00686 
00687     XrlCmdRT handle_datain_0_1_receive(const XrlArgs& in, XrlCmdOT out);
00688 #ifdef XORP_ENABLE_ASYNC_SERVER
00689     void callback_datain_0_1_receive
00690        (const XrlCmdError &e,
00691         XrlRespCallback);
00692 #endif
00693 
00694     XrlCmdRT handle_datain_0_1_error(const XrlArgs& in, XrlCmdOT out);
00695 #ifdef XORP_ENABLE_ASYNC_SERVER
00696     void callback_datain_0_1_error
00697        (const XrlCmdError &e,
00698         XrlRespCallback);
00699 #endif
00700 
00701     XrlCmdRT handle_datain_0_1_closed(const XrlArgs& in, XrlCmdOT out);
00702 #ifdef XORP_ENABLE_ASYNC_SERVER
00703     void callback_datain_0_1_closed
00704        (const XrlCmdError &e,
00705         XrlRespCallback);
00706 #endif
00707 
00708     void add_handlers();
00709     void remove_handlers();
00710 
00711     struct handler_table {
00712         const char *name;
00713         XrlCmdRT (XrlCoordTargetBase::*method)(const XrlArgs&, XrlCmdOT);
00714     };
00715 
00716     static const struct handler_table handlers[];
00717     static const size_t num_handlers;
00718 };
00719 
00720 #endif // __XRL_TARGETS_COORD_BASE_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations