/* Copyright (c) 2000 RIPE NCC All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the author not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* ------------------------------------------------------------------------------- Module Header Filename : TestBoxConfig.C Author : Rene Wilhelm Date : 17-OCT-2000 Revised for Linux : 15-JUN-2001 Description : Implementation of TestBoxConfig class Language Version : C++ OSs Tested : Solaris 2.6 , Debian Linux 2.2 Todo : implement GetBoxByName method This class provides an interface between analysis software and the configuration of the TTM network (which boxes are on-line, what are their names and ids, what are the targets for measurements from a given box etc.). It is still in the early stages of development and will evolve as needs arise. $Id: TestBoxConfig.C,v 1.8 2002/08/09 14:32:41 ttraffic Exp $ ------------------------------------------------------------------------------- */ #include #include #include #include #include #include "TestBoxConfig.h" static char const rcsid[] = "$Id: TestBoxConfig.C,v 1.8 2002/08/09 14:32:41 ttraffic Exp $"; // ------------------------------------ // GetTargets - find active targets for given test box id // // Input: reference to source TestBox struct // Output: targetlist (array of pointers to TestBox structs); // as updated in source TestBox struct. // // // Currently we have a full mesh, every active box sending to and // receiving from every other active box. However, scaling problems // could prevent us from continuing this in future. // // In anticipation of such a change, all analysis software should // be flexible and get the 'target' information via this method // instead of implicitly assuming a full measurement mesh. TestBox **TestBoxConfig::GetTargets(TestBox *source) { if (source->targetlist == NULL) { source->number_of_targets=number_of_boxes-1; source->targetlist=new TestBox* [source->number_of_targets]; int target=0; for (int i=0; iid) { source->targetlist[target] = &tblist[i]; target++; } } } return(source->targetlist); } // ------------------------------------ // // GetBoxById - Get TestBox struct associated with given numeric id TestBox *TestBoxConfig::GetBoxById(uint id) { // simple linear search; replace by hash in future? for (int i=0; i