1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
20 #ifndef INCLUDED_RTL_RANDOM_H
21 #define INCLUDED_RTL_RANDOM_H
23 #include "sal/config.h"
25 #include "sal/saldllapi.h"
26 #include "sal/types.h"
32 /** Random Pool opaque type.
34 typedef void* rtlRandomPool
;
37 /** Error Code enumeration.
39 enum __rtl_RandomError
42 rtl_Random_E_Argument
,
45 rtl_Random_E_FORCE_EQUAL_SIZE
= SAL_MAX_ENUM
50 typedef enum __rtl_RandomError rtlRandomError
;
53 /** Create a Random Pool.
54 @return initialized Random Pool, or NULL upon failure.
56 SAL_DLLPUBLIC rtlRandomPool SAL_CALL
rtl_random_createPool (void) SAL_THROW_EXTERN_C();
59 /** Destroy a Random Pool.
60 @param[in] Pool a Random Pool.
61 @return none. Pool is invalid.
63 SAL_DLLPUBLIC
void SAL_CALL
rtl_random_destroyPool (
65 ) SAL_THROW_EXTERN_C();
68 /** Add bytes to a Random Pool.
69 @param[in] Pool a Random Pool.
70 @param[in] Buffer a buffer containing the bytes to add.
71 @param[in] Bytes the number of bytes to read from the buffer.
72 @retval rtl_Random_E_None upon success.
74 SAL_DLLPUBLIC rtlRandomError SAL_CALL
rtl_random_addBytes (
78 ) SAL_THROW_EXTERN_C();
81 /** Retrieve bytes from a Random Pool.
82 @param[in] Pool a Random Pool.
83 @param[in,out] Buffer a buffer to receive the random bytes.
84 @param[in] Bytes the number of bytes to write to the buffer.
85 @retval rtl_Random_E_None upon success.
87 SAL_DLLPUBLIC rtlRandomError SAL_CALL
rtl_random_getBytes (
91 ) SAL_THROW_EXTERN_C();
97 #endif // INCLUDED_RTL_RANDOM_H
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */