Files
libreoffice/include/rtl/random.h

111 lines
3.0 KiB
C
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
2000-09-18 14:18:43 +00:00
#ifndef INCLUDED_RTL_RANDOM_H
#define INCLUDED_RTL_RANDOM_H
2000-09-18 14:18:43 +00:00
#include <sal/config.h>
#include <sal/saldllapi.h>
#include <sal/types.h>
2000-09-18 14:18:43 +00:00
#ifdef __cplusplus
extern "C" {
#endif
/*========================================================================
*
* rtlRandom interface.
*
*======================================================================*/
/** Random Pool opaque type.
2000-09-18 14:18:43 +00:00
*/
typedef void* rtlRandomPool;
/** Error Code enumeration.
2000-09-18 14:18:43 +00:00
*/
enum __rtl_RandomError
2000-09-18 14:18:43 +00:00
{
rtl_Random_E_None,
rtl_Random_E_Argument,
rtl_Random_E_Memory,
rtl_Random_E_Unknown,
rtl_Random_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
};
2000-09-18 14:18:43 +00:00
/** Error Code type.
*/
typedef enum __rtl_RandomError rtlRandomError;
/** Create a Random Pool.
@return initialized Random Pool, or NULL upon failure.
2000-09-18 14:18:43 +00:00
*/
2011-12-17 13:22:02 +01:00
SAL_DLLPUBLIC rtlRandomPool SAL_CALL rtl_random_createPool (void) SAL_THROW_EXTERN_C();
2000-09-18 14:18:43 +00:00
/** Destroy a Random Pool.
@param Pool [in] a Random Pool.
@return none. Pool is invalid.
2000-09-18 14:18:43 +00:00
*/
2011-12-17 13:22:02 +01:00
SAL_DLLPUBLIC void SAL_CALL rtl_random_destroyPool (
rtlRandomPool Pool
) SAL_THROW_EXTERN_C();
2000-09-18 14:18:43 +00:00
/** Add bytes to a Random Pool.
2012-01-20 17:16:19 -06:00
@param[in] Pool a Random Pool.
@param[in] Buffer a buffer containing the bytes to add.
@param[in] Bytes the number of bytes to read from the buffer.
@return rtl_Random_E_None upon success.
2000-09-18 14:18:43 +00:00
*/
2011-12-17 13:22:02 +01:00
SAL_DLLPUBLIC rtlRandomError SAL_CALL rtl_random_addBytes (
2000-09-18 14:18:43 +00:00
rtlRandomPool Pool,
const void *Buffer,
sal_Size Bytes
) SAL_THROW_EXTERN_C();
2000-09-18 14:18:43 +00:00
/** Retrieve bytes from a Random Pool.
2012-01-20 17:16:19 -06:00
@param[in] Pool a Random Pool.
@param[in,out] Buffer a buffer to receive the random bytes.
@param[in] Bytes the number of bytes to write to the buffer.
@return rtl_Random_E_None upon success.
2000-09-18 14:18:43 +00:00
*/
2011-12-17 13:22:02 +01:00
SAL_DLLPUBLIC rtlRandomError SAL_CALL rtl_random_getBytes (
2000-09-18 14:18:43 +00:00
rtlRandomPool Pool,
void *Buffer,
sal_Size Bytes
) SAL_THROW_EXTERN_C();
2000-09-18 14:18:43 +00:00
/*========================================================================
*
* The End.
*
*======================================================================*/
#ifdef __cplusplus
}
#endif
#endif // INCLUDED_RTL_RANDOM_H
2000-09-18 14:18:43 +00:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */