update dev300-m58
[ooovba.git] / sal / inc / rtl / random.h
blobaacc987e31879e3f903603e8a006d939e8010c71
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: random.h,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _RTL_RANDOM_H_
32 #define _RTL_RANDOM_H_ "$Revision: 1.7 $"
34 #include <sal/types.h>
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
40 /*========================================================================
42 * rtlRandom interface.
44 *======================================================================*/
45 /** Random Pool opaque type.
47 typedef void* rtlRandomPool;
50 /** Error Code enumeration.
52 enum __rtl_RandomError
54 rtl_Random_E_None,
55 rtl_Random_E_Argument,
56 rtl_Random_E_Memory,
57 rtl_Random_E_Unknown,
58 rtl_Random_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
61 /** Error Code type.
63 typedef enum __rtl_RandomError rtlRandomError;
66 /** Create a Random Pool.
67 @return initialized Random Pool, or NULL upon failure.
69 rtlRandomPool SAL_CALL rtl_random_createPool (void) SAL_THROW_EXTERN_C();
72 /** Destroy a Random Pool.
73 @param Pool [in] a Random Pool.
74 @return none. Pool is invalid.
76 void SAL_CALL rtl_random_destroyPool (
77 rtlRandomPool Pool
78 ) SAL_THROW_EXTERN_C();
81 /** Add bytes to a Random Pool.
82 @param Pool [in] a Random Pool.
83 @param pBuffer [in] a buffer containing the bytes to add.
84 @param nBufLen [in] the number of bytes to read from the buffer.
85 @return rtl_Random_E_None upon success.
87 rtlRandomError SAL_CALL rtl_random_addBytes (
88 rtlRandomPool Pool,
89 const void *Buffer,
90 sal_Size Bytes
91 ) SAL_THROW_EXTERN_C();
94 /** Retrieve bytes from a Random Pool.
95 @param Pool [in] a Random Pool.
96 @param pBuffer [inout] a buffer to receive the random bytes.
97 @param nBufLen [in] the number of bytes to write to the buffer.
98 @return rtl_Random_E_None upon success.
100 rtlRandomError SAL_CALL rtl_random_getBytes (
101 rtlRandomPool Pool,
102 void *Buffer,
103 sal_Size Bytes
104 ) SAL_THROW_EXTERN_C();
106 /*========================================================================
108 * The End.
110 *======================================================================*/
112 #ifdef __cplusplus
114 #endif
116 #endif /* _RTL_RANDOM_H_ */