1 /* 2 * scamper_list.h 3 * 4 * $Id: scamper_list.h,v 1.7 2011/09/16 03:15:44 mjl Exp $ 5 * 6 * Copyright (C) 2005-2006 Matthew Luckie 7 * Copyright (C) 2006-2008 The University of Waikato 8 * Author: Matthew Luckie 9 * 10 * This program is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License as published by 12 * the Free Software Foundation, version 2. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * 23 */ 24 25 #ifndef __SCAMPER_LIST_H 26 #define __SCAMPER_LIST_H 27 28 /* 29 * scamper_list: 30 * 31 * details regarding a list that was fed into scamper for probing. 32 * 33 * id: some ID assigned to identify the list by a person 34 * name: the name assigned to the list 35 * monitor: the (optional) canonical name of the monitor 36 * descr: optional free-form text describing the list somehow. 37 * refcnt: a count of references to an instance of this struct 38 */ 39 typedef struct scamper_list 40 { 41 uint32_t id; 42 char *name; 43 char *descr; 44 char *monitor; 45 int refcnt; 46 } scamper_list_t; 47 48 /* 49 * scamper_cycle: 50 * 51 * details of the cycle that scamper is currently making over the list. 52 * 53 * list: the list id of the cycle. 54 * id: the cycle id. 55 * start_time: time at which cycle began, seconds since the epoch 56 * stop_time: time at which cycle ended, seconds since the epoch 57 * hostname: optional record of the hostname at the beginning of the cycle. 58 * refcnt: a count of references to an instance of this struct 59 */ 60 typedef struct scamper_cycle 61 { 62 scamper_list_t *list; 63 uint32_t id; 64 uint32_t start_time; 65 uint32_t stop_time; 66 char *hostname; 67 int refcnt; 68 } scamper_cycle_t; 69 70 /* 71 * scamper_[list|cycle]_[alloc|use|free] 72 * 73 * in order to prevent list and cycle objects from being copied many times 74 * for use by data objects, we use a reference counter in each structure 75 * so that it is allocated just the once. 76 */ 77 scamper_list_t *scamper_list_alloc(const uint32_t id, const char *name, 78 const char *descr, const char *monitor); 79 scamper_list_t *scamper_list_use(scamper_list_t *list); 80 void scamper_list_free(scamper_list_t *list); 81 int scamper_list_cmp(const scamper_list_t *a, const scamper_list_t *b); 82 83 scamper_cycle_t *scamper_cycle_alloc(scamper_list_t *list); 84 scamper_cycle_t *scamper_cycle_use(scamper_cycle_t *cycle); 85 void scamper_cycle_free(scamper_cycle_t *cycle); 86 int scamper_cycle_cmp(scamper_cycle_t *a, scamper_cycle_t *b); 87 88 #endif /* __SCAMPER_LIST_H */ 89