xorp

peer_handler_debug.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/peer_handler_debug.hh,v 1.12 2008/11/08 06:14:37 mjh Exp $
00021 
00022 #ifndef __BGP_PEER_HANDLER_DEBUG_HH__
00023 #define __BGP_PEER_HANDLER_DEBUG_HH__
00024 
00025 
00026 
00027 #include "peer_handler.hh"
00028 
00029 class DebugPeerHandler : public PeerHandler {
00030 public:
00031     DebugPeerHandler(BGPPeer *peer);
00032 
00033     ~DebugPeerHandler();
00034 
00035     int start_packet();
00036     /* add_route and delete_route are called to propagate a route *to*
00037        the RIB. */
00038     int add_route(const SubnetRoute<IPv4> &rt,
00039                           FPAList4Ref& pa_list,
00040                           bool ibgp, Safi safi);
00041     int add_route(const SubnetRoute<IPv6> &rt,
00042                           FPAList6Ref& pa_list,
00043                           bool ibgp, Safi safi);
00044     int replace_route(const SubnetRoute<IPv4> &old_rt, bool old_ibgp,
00045                               const SubnetRoute<IPv4> &new_rt, bool new_ibgp,
00046                               FPAList4Ref& pa_list,
00047                               Safi safi);
00048     int replace_route(const SubnetRoute<IPv6> &old_rt, bool old_ibgp,
00049                               const SubnetRoute<IPv6> &new_rt, bool new_ibgp,
00050                               FPAList6Ref& pa_list,
00051                               Safi safi);
00052     int delete_route(const SubnetRoute<IPv4> &rt,
00053                              FPAList4Ref& pa_list,
00054                              bool new_ibgp,
00055                              Safi safi);
00056     int delete_route(const SubnetRoute<IPv6> &rt,
00057                              FPAList6Ref& pa_list,
00058                              bool new_ibgp,
00059                              Safi safi);
00060     PeerOutputState push_packet();
00061 
00062     void set_output_file(FILE *file) {_ofile = file;}
00063     void set_canned_response(PeerOutputState state) {
00064     _canned_response = state;
00065     }
00066 private:
00067     void print_route(const SubnetRoute<IPv4>& route, FPAList4Ref palist) const;
00068     void print_route(const SubnetRoute<IPv6>& route, FPAList6Ref palist) const;
00069     FILE *_ofile;
00070     PeerOutputState _canned_response;
00071 };
00072 
00073 #endif // __BGP_PEER_HANDLER_DEBUG_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations