blob: c4aaaa6a126e1b2f8bb8d58f292907d878afdf7c [file] [log] [blame]
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +00001/* Copyright (C) 2002-2003 RealVNC Ltd. All Rights Reserved.
2 *
3 * This is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This software is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this software; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 * USA.
17 */
18
19#ifndef __RDR_RANDOMSTREAM_H__
20#define __RDR_RANDOMSTREAM_H__
21
22#include <stdio.h>
23#include <rdr/InStream.h>
24
25#ifdef WIN32
26#ifndef _WIN32_WINNT
27#define _WIN32_WINNT 0x0400
28#endif
29#define WIN32_LEAN_AND_MEAN
30#include <windows.h>
31#include <wincrypt.h>
32#endif
33
34namespace rdr {
35
36 class RandomStream : public InStream {
37
38 public:
39
40 RandomStream();
41 virtual ~RandomStream();
42
43 int pos();
44
45 protected:
46 int overrun(int itemSize, int nItems, bool wait);
47
48 private:
49 U8* start;
50 int offset;
51
52 static unsigned int seed;
53#ifdef WIN32
54 HCRYPTPROV provider;
55#else
56 FILE* fp;
57#endif
58
59 };
60
61} // end of namespace rdr
62
63#endif