Botan
1.11.15
|
00001 /* 00002 * BeOS EntropySource 00003 * (C) 1999-2008 Jack Lloyd 00004 * 00005 * Botan is released under the Simplified BSD License (see license.txt) 00006 */ 00007 00008 #include <botan/internal/es_beos.h> 00009 00010 #include <kernel/OS.h> 00011 #include <kernel/image.h> 00012 #include <interface/InterfaceDefs.h> 00013 00014 namespace Botan { 00015 00016 /** 00017 * BeOS entropy poll 00018 */ 00019 void BeOS_EntropySource::poll(Entropy_Accumulator& accum) 00020 { 00021 system_info info_sys; 00022 get_system_info(&info_sys); 00023 accum.add(info_sys, 2); 00024 00025 key_info info_key; // current state of the keyboard 00026 get_key_info(&info_key); 00027 accum.add(info_key, 0); 00028 00029 team_info info_team; 00030 int32 cookie_team = 0; 00031 00032 while(get_next_team_info(&cookie_team, &info_team) == B_OK) 00033 { 00034 accum.add(info_team, 2); 00035 00036 team_id id = info_team.team; 00037 int32 cookie = 0; 00038 00039 thread_info info_thr; 00040 while(get_next_thread_info(id, &cookie, &info_thr) == B_OK) 00041 accum.add(info_thr, 1); 00042 00043 cookie = 0; 00044 image_info info_img; 00045 while(get_next_image_info(id, &cookie, &info_img) == B_OK) 00046 accum.add(info_img, 1); 00047 00048 cookie = 0; 00049 sem_info info_sem; 00050 while(get_next_sem_info(id, &cookie, &info_sem) == B_OK) 00051 accum.add(info_sem, 1); 00052 00053 cookie = 0; 00054 area_info info_area; 00055 while(get_next_area_info(id, &cookie, &info_area) == B_OK) 00056 accum.add(info_area, 2); 00057 00058 if(accum.polling_goal_achieved()) 00059 break; 00060 } 00061 } 00062 00063 }