/*************************************************
* Unix EntropySource Header File                 *
* (C) 1999-2003 The Botan Project                *
*************************************************/

#include <botan/buf_es.h>
#include <vector>

#ifndef BOTAN_EXT_ENTROPY_SRC_UNIX_H__
#define BOTAN_EXT_ENTROPY_SRC_UNIX_H__

namespace Botan {

/*************************************************
* Unix Program Entry                             *
*************************************************/
struct Unix_Program
   {
   Unix_Program(const std::string& n, const std::string a, u32bit p)
      { name = n; args = a; priority = p; working = true; }
   Unix_Program(const std::string& n, u32bit p)
      { name = n; priority = p; working = true; }
   std::string name, args;
   u32bit priority;
   bool working;
   };

/*************************************************
* Unix Entropy Source                            *
*************************************************/
class Unix_EntropySource : public Buffered_EntropySource
   {
   public:
      void add_sources(const Unix_Program[], u32bit);
      Unix_EntropySource();
   private:
      static const Unix_Program DEFAULT_SOURCES[];
      void do_fast_poll();
      void do_slow_poll();
      void gather(u32bit);
      void gather_from(const std::vector<u32bit>&);
      std::vector<Unix_Program> sources;
   };

}

#endif
