Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / include / rtl / random.h
blobcc7cf7943581058471580d80a4446bc961f5f4f9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 * This file is part of LibreOffice published API.
24 #ifndef INCLUDED_RTL_RANDOM_H
25 #define INCLUDED_RTL_RANDOM_H
27 #include "sal/config.h"
29 #include "sal/saldllapi.h"
30 #include "sal/types.h"
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
36 /** Random Pool opaque type.
38 typedef void* rtlRandomPool;
41 /** Error Code enumeration.
43 enum __rtl_RandomError
45 rtl_Random_E_None,
46 rtl_Random_E_Argument,
47 rtl_Random_E_Memory,
48 rtl_Random_E_Unknown,
49 rtl_Random_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
52 /** Error Code type.
54 typedef enum __rtl_RandomError rtlRandomError;
57 /** Create a Random Pool.
58 @return initialized Random Pool, or NULL upon failure.
60 SAL_DLLPUBLIC rtlRandomPool SAL_CALL rtl_random_createPool (void) SAL_THROW_EXTERN_C();
63 /** Destroy a Random Pool.
64 @param[in] Pool a Random Pool.
66 SAL_DLLPUBLIC void SAL_CALL rtl_random_destroyPool (
67 rtlRandomPool Pool
68 ) SAL_THROW_EXTERN_C();
71 /** Add bytes to a Random Pool.
72 @param[in] Pool a Random Pool.
73 @param[in] Buffer a buffer containing the bytes to add.
74 @param[in] Bytes the number of bytes to read from the buffer.
75 @retval rtl_Random_E_None upon success.
77 SAL_DLLPUBLIC rtlRandomError SAL_CALL rtl_random_addBytes (
78 rtlRandomPool Pool,
79 const void *Buffer,
80 sal_Size Bytes
81 ) SAL_THROW_EXTERN_C();
84 /** Retrieve bytes from a Random Pool.
85 @param[in] Pool a Random Pool.
86 @param[in,out] Buffer a buffer to receive the random bytes.
87 @param[in] Bytes the number of bytes to write to the buffer.
88 @retval rtl_Random_E_None upon success.
90 SAL_DLLPUBLIC rtlRandomError SAL_CALL rtl_random_getBytes (
91 rtlRandomPool Pool,
92 void *Buffer,
93 sal_Size Bytes
94 ) SAL_THROW_EXTERN_C();
96 #ifdef __cplusplus
98 #endif
100 #endif // INCLUDED_RTL_RANDOM_H
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */