Changeset 11347 in vbox for trunk/src/VBox/Runtime/include
- Timestamp:
- Aug 11, 2008 9:12:55 PM (16 years ago)
- Location:
- trunk/src/VBox/Runtime/include/internal
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/include/internal/magics.h
r10944 r11347 55 55 /** RTR0MEMOBJ::u32Magic. (Masakazu Katsura) */ 56 56 #define RTR0MEMOBJ_MAGIC 0x19611210 57 /** RTRANDINT::u32Magic. (Alan Moore) */ 58 #define RTRANDINT_MAGIC 0x19531118 57 59 /** Magic for the event semaphore structure. (Neil Gaiman) */ 58 60 #define RTSEMEVENT_MAGIC 0x19601110 -
trunk/src/VBox/Runtime/include/internal/rand.h
r11019 r11347 33 33 34 34 #include <iprt/types.h> 35 #include <iprt/critsect.h> 36 37 /** Pointer to a random number generator instance. */ 38 typedef struct RTRANDINT *PRTRANDINT; 39 40 /** 41 * Random number generator instance. 42 * 43 * @remarks Not sure if it makes sense to have three random getters... 44 */ 45 typedef struct RTRANDINT 46 { 47 /** Magic value (RTRANDINT_MAGIC). */ 48 uint32_t u32Magic; 49 #if 0 /** @todo later. */ 50 /** Fast mutex semaphore that serializes the access, this is optional. */ 51 PRTCRITSECT pCritSect; 52 #endif 53 54 /** 55 * Generates random bytes. 56 * 57 * @param pThis Pointer to the instance data. 58 * @param pb Where to store the bytes. 59 * @param cb The number of bytes to produce. 60 */ 61 DECLCALLBACKMEMBER(void , pfnGetBytes)(PRTRANDINT pThis, uint8_t *pb, size_t cb); 62 63 /** 64 * Generates a unsigned 32-bit random number. 65 * 66 * @returns The random number. 67 * @param pThis Pointer to the instance data. 68 * @param u32First The first number in the range. 69 * @param u32Last The last number in the range (i.e. inclusive). 70 */ 71 DECLCALLBACKMEMBER(uint32_t, pfnGetU32)(PRTRANDINT pThis, uint32_t u32First, uint32_t u32Last); 72 73 /** 74 * Generates a unsigned 64-bit random number. 75 * 76 * @returns The random number. 77 * @param pThis Pointer to the instance data. 78 * @param u64First The first number in the range. 79 * @param u64Last The last number in the range (i.e. inclusive). 80 */ 81 DECLCALLBACKMEMBER(uint64_t, pfnGetU64)(PRTRANDINT pThis, uint64_t u64First, uint64_t u64Last); 82 83 /** 84 * Generic seeding. 85 * 86 * @returns IPRT status code. 87 * @param pThis Pointer to the instance data. 88 * @param u64Seed The seed. 89 */ 90 DECLCALLBACKMEMBER(int, pfnSeed)(PRTRANDINT pThis, uint64_t u64Seed); 91 92 /** 93 * Destroys the instance. 94 * 95 * The callee is responsible for freeing all resources, including 96 * the instance data. 97 * 98 * @returns IPRT status code. State undefined on failure. 99 * @param pThis Pointer to the instance data. 100 */ 101 DECLCALLBACKMEMBER(int, pfnDestroy)(PRTRANDINT pThis); 102 103 /** Union containing the specific state info for each generator. */ 104 union 105 { 106 struct RTRandParkMiller 107 { 108 /** The context. */ 109 uint32_t u32Ctx; 110 /** The number of single bits used to fill in the 31st bit. */ 111 uint32_t u32Bits; 112 /** The number bits in u32Bits. */ 113 uint32_t cBits; 114 } ParkMiller; 115 } u; 116 } RTRANDINT; 117 35 118 36 119 __BEGIN_DECLS … … 52 135 void rtRandGenBytesFallback(void *pv, size_t cb) RT_NO_THROW; 53 136 137 DECLCALLBACK(void) rtRandAdvSynthesizeBytesFromU32(PRTRANDINT pThis, uint8_t *pb, size_t cb); 138 DECLCALLBACK(void) rtRandAdvSynthesizeBytesFromU64(PRTRANDINT pThis, uint8_t *pb, size_t cb); 139 DECLCALLBACK(uint32_t) rtRandAdvSynthesizeU32FromBytes(PRTRANDINT pThis, uint32_t u32First, uint32_t u32Last); 140 DECLCALLBACK(uint32_t) rtRandAdvSynthesizeU32FromU64(PRTRANDINT pThis, uint32_t u32First, uint32_t u32Last); 141 DECLCALLBACK(uint64_t) rtRandAdvSynthesizeU64FromBytes(PRTRANDINT pThis, uint64_t u64First, uint64_t u64Last); 142 DECLCALLBACK(uint64_t) rtRandAdvSynthesizeU64FromU32(PRTRANDINT pThis, uint64_t u64First, uint64_t u64Last); 143 54 144 __END_DECLS 55 145 56 146 #endif 147
Note:
See TracChangeset
for help on using the changeset viewer.