1 /*****************************************************************************\ 2 * $Id: hostlist.h,v 1.3 2009-12-16 17:49:40 chu11 Exp $ 3 ***************************************************************************** 4 * Copyright (C) 2007-2015 Lawrence Livermore National Security, LLC. 5 * Copyright (C) 2003-2007 The Regents of the University of California. 6 * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). 7 * Written by Albert Chu <chu11@llnl.gov> 8 * UCRL-CODE-155698 9 * 10 * This file is part of Ipmipower, a remote power control utility. 11 * For details, see http://www.llnl.gov/linux/. 12 * 13 * Ipmipower is free software; you can redistribute it and/or modify 14 * it under the terms of the GNU General Public License as published by the 15 * Free Software Foundation; either version 3 of the License, or (at your 16 * option) any later version. 17 * 18 * Ipmipower is distributed in the hope that it will be useful, but 19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 21 * for more details. 22 * 23 * You should have received a copy of the GNU General Public License along 24 * with Ipmipower. If not, see <http://www.gnu.org/licenses/>. 25 \*****************************************************************************/ 26 27 /* This library is a wrapper around hostlist to handle some special 28 * case parsing in FreeIPMI. 29 * 30 * For instructions on usage, see hostlist.h equivalent functions. 31 */ 32 33 #ifndef _FI_HOSTLIST_H 34 #define _FI_HOSTLIST_H 35 36 typedef struct fi_hostlist * fi_hostlist_t; 37 38 typedef struct fi_hostlist_iterator * fi_hostlist_iterator_t; 39 40 fi_hostlist_t fi_hostlist_create (const char *hostlist); 41 42 fi_hostlist_t fi_hostlist_copy (const fi_hostlist_t fihl); 43 44 void fi_hostlist_destroy (fi_hostlist_t fihl); 45 46 int fi_hostlist_push (fi_hostlist_t fihl, const char *hosts); 47 48 int fi_hostlist_push_host (fi_hostlist_t fihl, const char *host); 49 50 int fi_hostlist_push_list (fi_hostlist_t fihl1, fi_hostlist_t fihl2); 51 52 int fi_hostlist_find (fi_hostlist_t fihl, const char *hostname); 53 54 int fi_hostlist_delete (fi_hostlist_t fihl, const char *hosts); 55 56 int fi_hostlist_delete_host (fi_hostlist_t fihl, const char *hostname); 57 58 int fi_hostlist_count (fi_hostlist_t fihl); 59 60 #define fi_hostlist_is_empty(__fihl) ( fi_hostlist_count(__fihl) == 0 ) 61 62 void fi_hostlist_sort (fi_hostlist_t fihl); 63 64 void fi_hostlist_uniq (fi_hostlist_t fihl); 65 66 ssize_t fi_hostlist_ranged_string (fi_hostlist_t fihl, size_t n, char *buf); 67 68 ssize_t fi_hostlist_deranged_string (fi_hostlist_t fihl, size_t n, char *buf); 69 70 fi_hostlist_iterator_t fi_hostlist_iterator_create (fi_hostlist_t fihl); 71 72 void fi_hostlist_iterator_destroy (fi_hostlist_iterator_t fiitr); 73 74 void fi_hostlist_iterator_reset (fi_hostlist_iterator_t fiitr); 75 76 char * fi_hostlist_next (fi_hostlist_iterator_t fiitr); 77 78 int fi_hostlist_remove (fi_hostlist_iterator_t fiitr); 79 80 #endif /* !_FI_HOSTLIST_H */ 81