lintian doesn't like orphan packages with uploaders...
[debian/amanda] / common-src / simpleprng.h
index e5b6a7ea6160cdf777114be83548de20289507a4..3aa94ac99f7c3bd85c18a2ce8363ba47d651e346 100644 (file)
@@ -1,9 +1,10 @@
 /*
- * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+ * Copyright (c) 2008-2012 Zmanda, Inc.  All Rights Reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
@@ -14,7 +15,7 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  *
- * Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+ * Contact information: Zmanda Inc, 465 S. Mathilda Ave., Suite 300
  * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 
 #include "amanda.h"
 
-/* A very simple, thread-safe PRNG.  This is intended for use in reproducable
- * generating bytestreams for testing purposes.  It is *not* cryptographically
- * secure! */
+/* A very simple, thread-safe PRNG.  This is intended for use in generating
+ * reproducable bytestreams for testing purposes.  It is *not*
+ * cryptographically secure! */
 
-typedef guint32 simpleprng_state_t;
+typedef struct {
+    guint32 val;
+    guint64 count;
+} simpleprng_state_t;
 
 /* Initialize and seed the PRNG
  *
@@ -38,6 +42,14 @@ void simpleprng_seed(
     simpleprng_state_t *state,
     guint32 seed);
 
+/* Get a seed that will reproduce the PRNG's current state
+ *
+ * @param state: pointer to PRNG state
+ * @returns: seed;
+ */
+guint32 simpleprng_get_seed(
+    simpleprng_state_t *state);
+
 /* Get a random guint32
  *
  * @param state: pointer to PRNG state