xorp

xrl_target.hh

00001 // -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
00002 
00003 // Copyright (c) 2001-2011 XORP, Inc and Others
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/xrl_target.hh,v 1.46 2008/10/02 21:56:23 bms Exp $
00021 
00022 #ifndef __BGP_XRL_TARGET_HH__
00023 #define __BGP_XRL_TARGET_HH__
00024 
00025 #include "xrl/targets/bgp_base.hh"
00026 
00027 class BGPMain;
00028 
00029 class XrlBgpTarget :  XrlBgpTargetBase {
00030 public:
00031     XrlBgpTarget(XrlRouter *r, BGPMain& bgp);
00032 
00033     XrlCmdError common_0_1_get_target_name(string& name);
00034 
00035     XrlCmdError common_0_1_get_version(string& version);
00036 
00040     XrlCmdError common_0_1_get_status(
00041                       // Output values,
00042                       uint32_t& status,
00043                       string&   reason);
00044 
00048     XrlCmdError common_0_1_shutdown();
00049 
00050     XrlCmdError common_0_1_startup() { return XrlCmdError::OKAY(); }
00051 
00052     XrlCmdError bgp_0_3_get_bgp_version(
00053                     // Output values,
00054                     uint32_t& version);
00055 
00056     XrlCmdError bgp_0_3_local_config(
00057     // Input values,
00058     const string&   as_num,
00059     const IPv4& id,
00060     const bool&     use_4byte_asnums);
00061 
00062     XrlCmdError bgp_0_3_set_local_as(
00063     // Input values,
00064     const string&   as);
00065 
00066     XrlCmdError bgp_0_3_get_local_as(
00067                      // Output values,
00068                      string& as);
00069 
00070     XrlCmdError bgp_0_3_set_4byte_as_support(
00071     // Input values,
00072     const bool& enabled);
00073 
00074     XrlCmdError bgp_0_3_set_bgp_id(
00075     // Input values,
00076     const IPv4& id);
00077 
00078     XrlCmdError bgp_0_3_get_bgp_id(
00079                    // Output values,
00080                    IPv4& id);
00081 
00082     XrlCmdError bgp_0_3_set_confederation_identifier(
00083         // Input values,
00084     const string&   as,
00085     const bool& disable);
00086 
00087     XrlCmdError bgp_0_3_set_cluster_id(
00088     // Input values,
00089     const IPv4& cluster_id,
00090     const bool& disable);
00091 
00092     XrlCmdError bgp_0_3_set_damping(
00093     // Input values,
00094     const uint32_t& half_life,
00095     const uint32_t& max_suppress,
00096     const uint32_t& reuse,
00097     const uint32_t& suppress,
00098     const bool& disable);
00099 
00100     XrlCmdError bgp_0_3_add_peer(
00101     // Input values,
00102     const string&   local_dev,
00103     const string&   local_ip,
00104     const uint32_t& local_port,
00105     const string&   peer_ip,
00106     const uint32_t& peer_port,
00107     const string&   as,
00108     const IPv4& next_hop,
00109     const uint32_t& holdtime);
00110 
00111     XrlCmdError bgp_0_3_delete_peer(
00112     // Input values,
00113     const string&   local_ip,
00114     const uint32_t& local_port,
00115     const string&   peer_ip,
00116     const uint32_t& peer_port);
00117 
00118     XrlCmdError bgp_0_3_enable_peer(
00119     // Input values,
00120     const string&   local_ip,
00121     const uint32_t& local_port,
00122     const string&   peer_ip,
00123     const uint32_t& peer_port);
00124 
00125     XrlCmdError bgp_0_3_disable_peer(
00126     // Input values,
00127     const string&   local_ip,
00128     const uint32_t& local_port,
00129     const string&   peer_ip,
00130     const uint32_t& peer_port);
00131 
00132     XrlCmdError bgp_0_3_change_local_ip(
00133     // Input values,
00134     const string&   local_ip,
00135     const uint32_t& local_port,
00136     const string&   peer_ip,
00137     const uint32_t& peer_port,
00138     const string&   new_local_ip,
00139     const string&   new_local_dev);
00140 
00141     XrlCmdError bgp_0_3_change_local_port(
00142     // Input values,
00143     const string&   local_ip,
00144     const uint32_t& local_port,
00145     const string&   peer_ip,
00146     const uint32_t& peer_port,
00147     const uint32_t& new_local_port);
00148 
00149     XrlCmdError bgp_0_3_change_peer_port(
00150     // Input values,
00151     const string&   local_ip,
00152     const uint32_t& local_port,
00153     const string&   peer_ip,
00154     const uint32_t& peer_port,
00155     const uint32_t& new_peer_port);
00156 
00157     XrlCmdError bgp_0_3_set_peer_as(
00158     // Input values,
00159     const string&   local_ip,
00160     const uint32_t& local_port,
00161     const string&   peer_ip,
00162     const uint32_t& peer_port,
00163     const string&   peer_as);
00164 
00165     XrlCmdError bgp_0_3_set_holdtime(
00166     // Input values,
00167     const string&   local_ip,
00168     const uint32_t& local_port,
00169     const string&   peer_ip,
00170     const uint32_t& peer_port,
00171     const uint32_t& holdtime);
00172 
00173     XrlCmdError bgp_0_3_set_delay_open_time(
00174     // Input values,
00175     const string&   local_ip,
00176     const uint32_t& local_port,
00177     const string&   peer_ip,
00178     const uint32_t& peer_port,
00179     const uint32_t& delay_open_time);
00180 
00181     XrlCmdError bgp_0_3_set_route_reflector_client(
00182     // Input values,
00183     const string&   local_ip,
00184     const uint32_t& local_port,
00185     const string&   peer_ip,
00186     const uint32_t& peer_port,
00187     const bool& state);
00188 
00189     XrlCmdError bgp_0_3_set_confederation_member(
00190     // Input values,
00191     const string&   local_ip,
00192     const uint32_t& local_port,
00193     const string&   peer_ip,
00194     const uint32_t& peer_port,
00195     const bool& state);
00196 
00197     XrlCmdError bgp_0_3_set_prefix_limit(
00198     // Input values,
00199     const string&   local_ip,
00200     const uint32_t& local_port,
00201     const string&   peer_ip,
00202     const uint32_t& peer_port,
00203     const uint32_t& maximum,
00204     const bool& state);
00205 
00206     XrlCmdError bgp_0_3_set_nexthop4(
00207     // Input values,
00208     const string&   local_ip,
00209     const uint32_t& local_port,
00210     const string&   peer_ip,
00211     const uint32_t& peer_port,
00212     const IPv4& next_hop);
00213 
00214     XrlCmdError bgp_0_3_set_peer_state(
00215     // Input values,
00216     const string&   local_ip,
00217     const uint32_t& local_port,
00218     const string&   peer_ip,
00219     const uint32_t& peer_port,
00220     const bool& state);
00221 
00222     XrlCmdError bgp_0_3_set_peer_md5_password(
00223     // Input values,
00224     const string&   local_ip,
00225     const uint32_t& local_port,
00226     const string&   peer_ip,
00227     const uint32_t& peer_port,
00228     const string&   password);
00229 
00230     XrlCmdError bgp_0_3_activate(
00231     // Input values,
00232     const string&   local_ip,
00233     const uint32_t& local_port,
00234     const string&   peer_ip,
00235     const uint32_t& peer_port);
00236 
00237     XrlCmdError bgp_0_3_next_hop_rewrite_filter(
00238     // Input values,
00239     const string&   local_ip,
00240     const uint32_t& local_port,
00241     const string&   peer_ip,
00242     const uint32_t& peer_port,
00243     const IPv4& next_hop);
00244 
00245     XrlCmdError bgp_0_3_originate_route4(
00246     // Input values,
00247     const IPv4Net&  nlri,
00248     const IPv4& next_hop,
00249     const bool& unicast,
00250     const bool& multicast);
00251 
00252     XrlCmdError bgp_0_3_withdraw_route4(
00253     // Input values,
00254     const IPv4Net&  nlri,
00255     const bool& unicast,
00256     const bool& multicast);
00257 
00258     XrlCmdError bgp_0_3_trace(
00259     // Input values,
00260     const string&   tvar,
00261     const bool& enable);
00262 
00263     XrlCmdError bgp_0_3_get_peer_list_start(
00264         // Output values,
00265         uint32_t& token,
00266     bool& more);
00267 
00268     XrlCmdError bgp_0_3_get_peer_list_next(
00269         // Input values,
00270         const uint32_t& token,
00271     // Output values,
00272     string& local_ip,
00273     uint32_t&   local_port,
00274     string& peer_ip,
00275     uint32_t&   peer_port,
00276     bool&   more);
00277 
00278     XrlCmdError bgp_0_3_get_peer_id(
00279         // Input values,
00280         const string&   local_ip,
00281     const uint32_t& local_port,
00282     const string&   peer_ip,
00283     const uint32_t& peer_port,
00284     // Output values,
00285     IPv4&   peer_id);
00286 
00287     XrlCmdError bgp_0_3_get_peer_status(
00288         // Input values,
00289         const string&   local_ip,
00290     const uint32_t& local_port,
00291     const string&   peer_ip,
00292     const uint32_t& peer_port,
00293     // Output values,
00294     uint32_t&   peer_state,
00295     uint32_t&   admin_status);
00296 
00297     XrlCmdError bgp_0_3_get_peer_negotiated_version(
00298         // Input values,
00299         const string& local_ip,
00300     const uint32_t& local_port,
00301     const string& peer_ip,
00302     const uint32_t& peer_port,
00303     // Output values,
00304     int32_t& neg_version);
00305 
00306     XrlCmdError bgp_0_3_get_peer_as(
00307         // Input values,
00308         const string& local_ip,
00309     const uint32_t& local_port,
00310     const string&   peer_ip,
00311     const uint32_t& peer_port,
00312     // Output values,
00313     string& peer_as);
00314 
00315     XrlCmdError bgp_0_3_get_peer_msg_stats(
00316         // Input values,
00317         const string& local_ip,
00318     const uint32_t& local_port,
00319     const string& peer_ip,
00320     const uint32_t& peer_port,
00321     // Output values,
00322     uint32_t&   in_updates,
00323     uint32_t&   out_updates,
00324     uint32_t&   in_msgs,
00325     uint32_t&   out_msgs,
00326     uint32_t&   last_error,
00327     uint32_t&   in_update_elapsed);
00328 
00329     XrlCmdError bgp_0_3_get_peer_established_stats(
00330         // Input values,
00331         const string& local_ip,
00332     const uint32_t& local_port,
00333     const string& peer_ip,
00334     const uint32_t& peer_port,
00335     // Output values,
00336     uint32_t& transitions,
00337     uint32_t& established_time);
00338 
00339     XrlCmdError bgp_0_3_get_peer_timer_config(
00340         // Input values,
00341         const string&   local_ip,
00342     const uint32_t& local_port,
00343     const string&   peer_ip,
00344     const uint32_t& peer_port,
00345     // Output values,
00346     uint32_t& retry_interval,
00347     uint32_t& hold_time,
00348     uint32_t& keep_alive,
00349     uint32_t& hold_time_conf,
00350     uint32_t& keep_alive_conf,
00351     uint32_t& min_as_origin_interval,
00352     uint32_t& min_route_adv_interval);
00353 
00354     XrlCmdError bgp_0_3_register_rib(
00355     // Input values,
00356     const string&   name);
00357 
00358     XrlCmdError bgp_0_3_get_v4_route_list_start(
00359     // Input values,
00360     const IPv4Net&  net,
00361     const bool& unicast,
00362     const bool& multicast,
00363     // Output values,
00364     uint32_t& token);
00365 
00366     XrlCmdError bgp_0_3_get_v4_route_list_next(
00367     // Input values,
00368     const uint32_t& token,
00369     // Output values,
00370     IPv4&   peer_id,
00371     IPv4Net& net,
00372     uint32_t& best_and_origin,
00373     vector<uint8_t>& aspath,
00374     IPv4& nexthop,
00375     int32_t& med,
00376     int32_t& localpref,
00377     int32_t& atomic_agg,
00378     vector<uint8_t>& aggregator,
00379     int32_t& calc_localpref,
00380     vector<uint8_t>& attr_unknown,
00381     bool& valid,
00382     bool& unicast,
00383     bool& multicast);
00384 
00385     XrlCmdError rib_client_0_1_route_info_changed4(
00386     // Input values,
00387     const IPv4& addr,
00388     const uint32_t& prefix_len,
00389     const IPv4& nexthop,
00390     const uint32_t& metric,
00391     const uint32_t& admin_distance,
00392     const string&   protocol_origin);
00393 
00394     XrlCmdError rib_client_0_1_route_info_invalid4(
00395     // Input values,
00396     const IPv4& addr,
00397     const uint32_t& prefix_len);
00398 
00399     XrlCmdError bgp_0_3_set_parameter(
00400         // Input values,
00401     const string&   local_ip,
00402     const uint32_t& local_port,
00403     const string&   peer_ip,
00404     const uint32_t& peer_port,
00405         const string& parameter,
00406     const bool& toggle);
00407 
00408     XrlCmdError finder_event_observer_0_1_xrl_target_birth(
00409     // Input values,
00410     const string&   target_class,
00411     const string&   target_instance);
00412 
00413     XrlCmdError finder_event_observer_0_1_xrl_target_death(
00414     // Input values,
00415     const string&   target_class,
00416     const string&   target_instance);
00417 
00418     XrlCmdError policy_backend_0_1_configure(
00419         // Input values,
00420         const uint32_t& filter,
00421         const string&   conf);
00422 
00423     XrlCmdError policy_backend_0_1_reset(
00424         // Input values,
00425         const uint32_t& filter);
00426 
00427     XrlCmdError policy_backend_0_1_push_routes();
00428 
00429     XrlCmdError policy_redist4_0_1_add_route4(
00430         // Input values,
00431         const IPv4Net&  network,
00432         const bool&     unicast,
00433         const bool&     multicast,
00434         const IPv4&     nexthop,
00435         const uint32_t& metric,
00436         const XrlAtomList&      policytags);
00437         
00438     XrlCmdError policy_redist4_0_1_delete_route4(
00439         // Input values,
00440         const IPv4Net&  network,
00441         const bool&     unicast,
00442         const bool&     multicast);
00443 
00444 #ifdef HAVE_IPV6
00445 
00446     XrlCmdError bgp_0_3_set_nexthop6(
00447     // Input values,
00448     const string&   local_ip,
00449     const uint32_t& local_port,
00450     const string&   peer_ip,
00451     const uint32_t& peer_port,
00452     const IPv6& next_hop);
00453 
00454 
00455     XrlCmdError bgp_0_3_get_nexthop6(
00456     // Input values,
00457     const string&   local_ip,
00458     const uint32_t& local_port,
00459     const string&   peer_ip,
00460     const uint32_t& peer_port,
00461     // Output values,
00462     IPv6&   next_hop);
00463 
00464     XrlCmdError bgp_0_3_originate_route6(
00465     // Input values,
00466     const IPv6Net&  nlri,
00467     const IPv6& next_hop,
00468     const bool& unicast,
00469     const bool& multicast);
00470 
00471 
00472     XrlCmdError bgp_0_3_withdraw_route6(
00473     // Input values,
00474     const IPv6Net&  nlri,
00475     const bool& unicast,
00476     const bool& multicast);
00477 
00478     XrlCmdError bgp_0_3_get_v6_route_list_start(
00479     // Input values,
00480     const IPv6Net&  net,
00481     const bool& unicast,
00482     const bool& multicast,
00483     // Output values,
00484     uint32_t& token);
00485 
00486     XrlCmdError bgp_0_3_get_v6_route_list_next(
00487     // Input values,
00488     const uint32_t& token,
00489     // Output values,
00490     IPv4& peer_id,
00491     IPv6Net& net,
00492     uint32_t& best_and_origin,
00493     vector<uint8_t>& aspath,
00494     IPv6& nexthop,
00495     int32_t& med,
00496     int32_t& localpref,
00497     int32_t& atomic_agg,
00498     vector<uint8_t>& aggregator,
00499     int32_t& calc_localpref,
00500     vector<uint8_t>& attr_unknown,
00501     bool& valid,
00502     bool& unicast,
00503     bool& multicast);
00504 
00505     XrlCmdError rib_client_0_1_route_info_changed6(
00506     // Input values,
00507     const IPv6& addr,
00508     const uint32_t& prefix_len,
00509     const IPv6& nexthop,
00510     const uint32_t& metric,
00511     const uint32_t& admin_distance,
00512     const string&   protocol_origin);
00513 
00514     XrlCmdError rib_client_0_1_route_info_invalid6(
00515     // Input values,
00516     const IPv6& addr,
00517     const uint32_t& prefix_len);
00518         
00519     XrlCmdError policy_redist6_0_1_add_route6(
00520         // Input values,
00521         const IPv6Net&  network,
00522         const bool&     unicast,
00523         const bool&     multicast,
00524         const IPv6&     nexthop,
00525         const uint32_t& metric,
00526         const XrlAtomList&      policytags);
00527         
00528     XrlCmdError policy_redist6_0_1_delete_route6(
00529         // Input values,
00530         const IPv6Net&  network,
00531         const bool&     unicast,
00532         const bool&     multicast);
00533 
00534 #endif //ipv6
00535 
00536 #ifndef XORP_DISABLE_PROFILE
00537     XrlCmdError profile_0_1_enable(
00538     // Input values,
00539     const string&   pname);
00540 
00541     XrlCmdError profile_0_1_disable(
00542     // Input values,
00543     const string&   pname);
00544 
00545     XrlCmdError profile_0_1_get_entries(
00546     // Input values,
00547     const string&   pname,
00548     const string&   instance_name);
00549 
00550     XrlCmdError profile_0_1_clear(
00551     // Input values,
00552     const string&   pname);
00553 
00554     XrlCmdError profile_0_1_list(
00555     // Output values,
00556     string& info);
00557 #endif
00558 
00559     bool waiting();
00560     bool done();
00561 
00562 private:
00566     BGPMain& _bgp;
00570     bool _awaiting_config;
00574     bool _awaiting_as;
00578     AsNum _as;
00582     bool _awaiting_bgp_id;
00586     IPv4 _id;
00590     bool _awaiting_4byte_asnums;
00594     bool _use_4byte_asnums;
00598     bool _done;
00599 };
00600 
00601 #endif // __BGP_XRL_TARGET_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations