summaryrefslogtreecommitdiff
path: root/apps/drwho/Multicast_Manager.h
blob: c54e1b8f822b6e1c673516b86220a149a173f6f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* -*- C++ -*- */
// $Id$

// ============================================================================
//
// = LIBRARY
//    drwho
//
// = FILENAME
//    Multicast_Manager.h
//
// = AUTHOR
//    Douglas C. Schmidt
//
// ============================================================================

#if !defined (_MULTICAST_MANAGER_H)
#define _MULTICAST_MANAGER_H

#include "global.h"

class Host_Elem 
{
public:
  const char *host_name;
  in_addr host_addr;
  int checked_off;
  Host_Elem *next;

  Host_Elem (const char *h_name, Host_Elem *n);
};

class Multicast_Manager 
{
  // = TITLE
  //   This file handles all the operations upon host machines names
  //   and addresses.
public:
  static void add_host (const char *host_name);
  static void checkoff_host (in_addr host_addr);
  static int get_next_host_addr (in_addr &host_addr);
  static int outstanding_hosts_remain (void);
  static int get_next_non_responding_host (char *&host_name);
  static int insert_hosts_from_file (const char *filename);
  static void insert_default_hosts (void);

private:
  static hostent *get_host_entry (const char *host);

  static int received_host_count;
  static char *host_names[];
  static Host_Elem *drwho_list;
  static Host_Elem *current_ptr;
};

#endif /* _MULTICAST_MANAGER_H */