/* * Copyright (c) 2001 Fenris, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ /* * File: display.h * * Purpose: This header file declares the display object (a struct of lists) * and its interface. The use of display is: * instantiation * initialization * loop { * population * clear * } * The rate_to_color() need not be used, it is used internally by populate(). * */ #ifndef DISPLAY_H #define DISPLAY_H #include "display_list.h" #include "network.h" #include "bool.h" #define RES 40 #define PMAX 65535 #define PMIN 0 #define STEP 13107 typedef struct { int red; int blue; int green; } Color; typedef struct { unsigned int src; unsigned int dst; char src_name[MAX_HOSTNAME_LEN]; char dst_name[MAX_HOSTNAME_LEN]; Color color; } Dsp_Obj; typedef struct { Dsp_List* src_list; Dsp_List* dst_list; Dsp_List* pair_list; enum bool abs; unsigned int min_rate; unsigned int max_rate; } Display; int init_dsp(Display* dsp); void populate_dsp(Display* dsp, Network* net); void clear_dsp(Display* dsp); void rate_to_color(Display* dsp, float rate, Color* color); #endif /* DISPLAY_H */