Botan 1.10.17
es_beos.cpp
Go to the documentation of this file.
1/*
2* BeOS EntropySource
3* (C) 1999-2008 Jack Lloyd
4*
5* Distributed under the terms of the Botan license
6*/
7
8#include <botan/internal/es_beos.h>
9
10#include <kernel/OS.h>
11#include <kernel/image.h>
12#include <interface/InterfaceDefs.h>
13
14namespace Botan {
15
16/**
17* BeOS entropy poll
18*/
19void BeOS_EntropySource::poll(Entropy_Accumulator& accum)
20 {
21 system_info info_sys;
22 get_system_info(&info_sys);
23 accum.add(info_sys, 2);
24
25 key_info info_key; // current state of the keyboard
26 get_key_info(&info_key);
27 accum.add(info_key, 0);
28
29 team_info info_team;
30 int32 cookie_team = 0;
31
32 while(get_next_team_info(&cookie_team, &info_team) == B_OK)
33 {
34 accum.add(info_team, 2);
35
36 team_id id = info_team.team;
37 int32 cookie = 0;
38
39 thread_info info_thr;
40 while(get_next_thread_info(id, &cookie, &info_thr) == B_OK)
41 accum.add(info_thr, 1);
42
43 cookie = 0;
44 image_info info_img;
45 while(get_next_image_info(id, &cookie, &info_img) == B_OK)
46 accum.add(info_img, 1);
47
48 cookie = 0;
49 sem_info info_sem;
50 while(get_next_sem_info(id, &cookie, &info_sem) == B_OK)
51 accum.add(info_sem, 1);
52
53 cookie = 0;
54 area_info info_area;
55 while(get_next_area_info(id, &cookie, &info_area) == B_OK)
56 accum.add(info_area, 2);
57
58 if(accum.polling_goal_achieved())
59 break;
60 }
61 }
62
63}