xorp

test_common.hh

00001 // -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
00002 // vim:set sts=4 ts=8:
00003 
00004 // Copyright (c) 2001-2009 XORP, Inc.
00005 //
00006 // This program is free software; you can redistribute it and/or modify
00007 // it under the terms of the GNU General Public License, Version 2, June
00008 // 1991 as published by the Free Software Foundation. Redistribution
00009 // and/or modification of this program under the terms of any other
00010 // version of the GNU General Public License is not permitted.
00011 // 
00012 // This program is distributed in the hope that it will be useful, but
00013 // WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
00015 // see the GNU General Public License, Version 2, a copy of which can be
00016 // found in the XORP LICENSE.gpl file.
00017 // 
00018 // XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
00019 // http://xorp.net
00020 
00021 // $XORP: xorp/ospf/test_common.hh,v 1.8 2008/10/02 21:57:49 bms Exp $
00022 
00023 #ifndef __OSPF_TEST_COMMON_HH__
00024 #define __OSPF_TEST_COMMON_HH__
00025 
00029 inline
00030 uint32_t
00031 compute_options(OspfTypes::Version version, OspfTypes::AreaType area_type)
00032 {
00033     // Set/UnSet E-Bit.
00034     Options options(version, 0);
00035     switch(area_type) {
00036     case OspfTypes::NORMAL:
00037     options.set_e_bit(true);
00038     break;
00039     case OspfTypes::STUB:
00040     case OspfTypes::NSSA:
00041     options.set_e_bit(false);
00042     break;
00043     }
00044 
00045     switch (version) {
00046     case OspfTypes::V2:
00047     break;
00048     case OspfTypes::V3:
00049     options.set_v6_bit(true);
00050     break;
00051     }
00052 
00053     return options.get_options();
00054 }
00055 
00059 enum TLV {
00060     TLV_VERSION = 1,    // The first entry in a file 4 byte version number.
00061     TLV_SYSTEM_INFO = 2,// A string defining the creation system. 
00062     TLV_OSPF_VERSION = 3,// The OSPF version that the database came from.
00063     TLV_AREA = 4,   // AREA that the following LSAs belong to 4 bytes
00064     TLV_LSA = 5     // Binary LSA.
00065 };
00066 const uint32_t TLV_CURRENT_VERSION = 1; // Current version number
00067 
00068 #endif // __OSPF_TEST_COMMON_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations