summaryrefslogtreecommitdiff
path: root/ACE/apps/drwho/Rwho_DB_Manager.h
blob: f6646729f76124a3a4b9dbaea363493bad68469f (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
/* -*- C++ -*- */

//=============================================================================
/**
 *  @file    Rwho_DB_Manager.h
 *
 *  $Id$
 *
 *  @author Douglas C. Schmidt
 */
//=============================================================================


#ifndef _RWHO_DB_MANAGER_H
#define _RWHO_DB_MANAGER_H

#include <sys/types.h>
#include <protocols/rwhod.h>
#include "ace/Dirent.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "Protocol_Record.h"

/**
 * @class RWho_DB_Manager
 *
 * @brief This class returns the user/machine pairs one at a time from
 * the rwho database.
 */
class RWho_DB_Manager
{

public:
  RWho_DB_Manager (void);
  ~RWho_DB_Manager (void);
  int get_next_user (Protocol_Record &protocol_record);

private:
  ACE_Dirent rwho_dir;
  whod host_data;
  int number_of_users;
  int current_user;
  const int WHOD_HEADER_SIZE;
  char original_pathname[MAXPATHLEN + 1];
  const char *rwho_dir_name;

  int get_next_host (void);
};

#endif /* _RWHO_DB_MANAGER_H */