Source: ../../fea/fticonfig_table_set.hh
|
|
|
|
// -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
// Copyright (c) 2001-2003 International Computer Science Institute
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software")
// to deal in the Software without restriction, subject to the conditions
// listed in the XORP LICENSE file. These conditions include: you must
// preserve this copyright notice, and you cannot mention the copyright
// holders in advertising related to the Software without their permission.
// The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
// notice is a summary of the XORP LICENSE file; the license in that file is
// legally binding.
// $XORP: xorp/fea/fticonfig_table_set.hh,v 1.4 2003/05/14 01:13:41 pavlin Exp $
#ifndef __FEA_FTICONFIG_TABLE_SET_HH__
#define __FEA_FTICONFIG_TABLE_SET_HH__
#include "libxorp/xorp.h"
#include "libxorp/ipvx.hh"
#include "fte.hh"
#include "netlink_socket.hh"
#include "routing_socket.hh"
class FtiConfig;
class FtiConfigTableSet {
public:
FtiConfigTableSet(FtiConfig& ftic);
virtual ~FtiConfigTableSet();
FtiConfig& ftic() { return _ftic; }
virtual void register_ftic();
/**
* Start operation.
*
* @return XORP_OK on success, otherwise XORP_ERROR.
*/
virtual int start() = 0;
/**
* Stop operation.
*
* @return XORP_OK on success, otherwise XORP_ERROR.
*/
virtual int stop() = 0;
/**
* Start a configuration interval. All modifications to FtiConfig
* state must be within a marked "configuration" interval.
*
* This method provides derived classes with a mechanism to perform
* any actions necessary before forwarding table modifications can
* be made.
*
* @return true if configuration successfully started.
*/
virtual bool start_configuration() {
// Nothing particular to do, just label start.
return mark_configuration_start();
}
/**
* End of configuration interval.
*
* This method provides derived classes with a mechanism to
* perform any actions necessary at the end of a configuration, eg
* write a file.
*
* @return true configuration success pushed down into forwarding table.
*/
virtual bool end_configuration() {
// Nothing particular to do, just label start.
return mark_configuration_end();
}
/**
* Set the unicast forwarding table.
*
* @param fte_list the list with all entries to install into
* the unicast forwarding table.
*
* @return true on success, otherwise false.
*/
virtual bool set_table4(const list<Fte4>& fte_list) = 0;
/**
* Delete all entries in the routing table. Must be within a
* configuration interval.
*
* @return true on success, otherwise false.
*/
virtual bool delete_all_entries4() = 0;
/**
* Set the unicast forwarding table.
*
* @param fte_list the list with all entries to install into
* the unicast forwarding table.
*
* @return true on success, otherwise false.
*/
virtual bool set_table6(const list<Fte6>& fte_list) = 0;
/**
* Delete all entries in the routing table. Must be within a
* configuration interval.
*
* @return true on success, otherwise false.
*/
virtual bool delete_all_entries6() = 0;
protected:
/**
* Mark start of a configuration.
*
* @return true if configuration can be marked as started, false otherwise.
*/
inline bool mark_configuration_start() {
if (false == _in_configuration) {
_in_configuration = true;
return true;
}
return false;
}
/**
* Mark end of a configuration.
*
* @return true if configuration can be marked as ended, false otherwise.
*/
inline bool mark_configuration_end() {
if (true == _in_configuration) {
_in_configuration = false;
return true;
}
return false;
}
inline bool in_configuration() const { return _in_configuration; }
private:
FtiConfig& _ftic;
bool _in_configuration;
};
class FtiConfigTableSetDummy : public FtiConfigTableSet {
public:
FtiConfigTableSetDummy(FtiConfig& ftic);
virtual ~FtiConfigTableSetDummy();
/**
* Start operation.
*
* @return XORP_OK on success, otherwise XORP_ERROR.
*/
virtual int start();
/**
* Stop operation.
*
* @return XORP_OK on success, otherwise XORP_ERROR.
*/
virtual int stop();
/**
* Set the unicast forwarding table.
*
* @param fte_list the list with all entries to install into
* the unicast forwarding table.
*
* @return true on success, otherwise false.
*/
virtual bool set_table4(const list<Fte4>& fte_list);
/**
* Delete all entries in the routing table. Must be within a
* configuration interval.
*
* @return true on success, otherwise false.
*/
virtual bool delete_all_entries4();
/**
* Set the unicast forwarding table.
*
* @param fte_list the list with all entries to install into
* the unicast forwarding table.
*
* @return true on success, otherwise false.
*/
virtual bool set_table6(const list<Fte6>& fte_list);
/**
* Delete all entries in the routing table. Must be within a
* configuration interval.
*
* @return true on success, otherwise false.
*/
virtual bool delete_all_entries6();
private:
};
class FtiConfigTableSetRtsock : public FtiConfigTableSet,
public RoutingSocket {
public:
FtiConfigTableSetRtsock(FtiConfig& ftic);
virtual ~FtiConfigTableSetRtsock();
/**
* Start operation.
*
* @return XORP_OK on success, otherwise XORP_ERROR.
*/
virtual int start();
/**
* Stop operation.
*
* @return XORP_OK on success, otherwise XORP_ERROR.
*/
virtual int stop();
/**
* Set the unicast forwarding table.
*
* @param fte_list the list with all entries to install into
* the unicast forwarding table.
*
* @return true on success, otherwise false.
*/
virtual bool set_table4(const list<Fte4>& fte_list);
/**
* Delete all entries in the routing table. Must be within a
* configuration interval.
*
* @return true on success, otherwise false.
*/
virtual bool delete_all_entries4();
/**
* Set the unicast forwarding table.
*
* @param fte_list the list with all entries to install into
* the unicast forwarding table.
*
* @return true on success, otherwise false.
*/
virtual bool set_table6(const list<Fte6>& fte_list);
/**
* Delete all entries in the routing table. Must be within a
* configuration interval.
*
* @return true on success, otherwise false.
*/
virtual bool delete_all_entries6();
private:
};
#endif // __FEA_FTICONFIG_TABLE_SET_HH__
Generated by: pavlin on possum.icir.org on Thu Aug 28 12:52:10 2003, using kdoc 2.0a54+XORP. |