xorp

protocol.hh

00001 // -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
00002 
00003 // Copyright (c) 2001-2011 XORP, Inc and Others-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 
00021 #ifndef __RIB_PROTOCOL_HH__
00022 #define __RIB_PROTOCOL_HH__
00023 
00024 #include "libxorp/xorp.h"
00025 
00026 
00027 enum ProtocolType {
00028     IGP = 1,        // Interior Gateway Protocol
00029     EGP = 2     // Exterior Gateway Protocol
00030 };
00031 
00032 enum ProtocolAdminDistance {
00033     CONNECTED_ADMIN_DISTANCE    = 0,    // Only for connected routes.
00034     UNKNOWN_ADMIN_DISTANCE  = 255,
00035     UNSET_ADMIN_DISTANCE    = 256,
00036     MAX_ADMIN_DISTANCE      = 65535
00037 };
00038 
00045 class Protocol {
00046 public:
00056     Protocol(const string& name, ProtocolType protocol_type, uint32_t genid);
00057 
00062     ProtocolType protocol_type() const { return _protocol_type; }
00063 
00067     const string& name() const { return _name; }
00068 
00078     bool operator==(const Protocol& other) const {
00079     return (name() == other.name());
00080     }
00081 
00085     void increment_genid() { _genid++; }
00086 
00087 private:
00088     string      _name;
00089     ProtocolType    _protocol_type; // The protocol type (IGP or EGP)
00090     uint32_t        _genid;     // The protocol generation ID.
00091 };
00092 
00093 #endif // __RIB_PROTOCOL_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations