]> git.ipfire.org Git - thirdparty/rng-tools.git/blame - rngd.h
s/list_add/src_list_add/
[thirdparty/rng-tools.git] / rngd.h
CommitLineData
61af3de3
JG
1/*
2 * rngd.h -- rngd globals
3 *
4 * Copyright (C) 2001 Philipp Rumpf
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
d1b4c504 10 *
61af3de3
JG
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef RNGD__H
22#define RNGD__H
23
24#define _GNU_SOURCE
25
26#include "rng-tools-config.h"
27
28#include <unistd.h>
29#include <stdint.h>
30#include <stdio.h>
31#include <syslog.h>
32
33#include "fips.h"
34
35/* Command line arguments and processing */
36struct arguments {
37 char *random_name;
d1b4c504 38
61af3de3
JG
39 int random_step;
40 int fill_watermark;
41 double poll_timeout;
42
43 int daemon;
d1b4c504 44 int enable_tpm;
61af3de3
JG
45};
46extern struct arguments *arguments;
47
d1b4c504
JG
48/* structures to store rng information */
49struct rng {
50 char *rng_name;
51 int rng_fd;
52
53 int (*xread) (void *buf, size_t size, struct rng *ent_src);
54 fips_ctx_t *fipsctx;
55
56 struct rng *next;
57};
58
61af3de3
JG
59/* Background/daemon mode */
60extern int am_daemon; /* Nonzero if we went daemon */
61
62
63/*
64 * Routines and macros
65 */
66#define message(priority,fmt,args...) do { \
67 if (am_daemon) { \
68 syslog((priority), fmt, ##args); \
69 } else { \
70 fprintf(stderr, fmt, ##args); \
71 fprintf(stderr, "\n"); \
72 } \
73} while (0)
74
a26d20cf 75extern void src_list_add(struct rng *ent_src);
61af3de3
JG
76#endif /* RNGD__H */
77