File: randomorg.h

package info (click to toggle)
gnubg 1.08.003-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 30,308 kB
  • sloc: ansic: 104,162; xml: 15,451; sh: 5,292; pascal: 820; yacc: 700; makefile: 586; python: 538; lex: 286; sql: 236; awk: 26
file content (48 lines) | stat: -rw-r--r-- 1,504 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
 * Copyright (C) 2015 Michael Petch <mpetch@capp-sysware.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 *
 * $Id: randomorg.h,v 1.4 2020/02/23 21:07:07 plm Exp $
 */

#ifndef RANDOMORG_H
#define RANDOMORG_H

#include <stdlib.h>

/*#define RANDOMORG_DEBUG 1 */

#define STRINGIZEAUX(num) #num
#define STRINGIZE(num) STRINGIZEAUX(num)

#define RANDOMORGSITE "www.random.org"
#define BUFLENGTH 500
#define BUFLENGTH_STR STRINGIZE(BUFLENGTH)

#define RANDOMORG_URL "https://" RANDOMORGSITE "/integers/?num=" \
	BUFLENGTH_STR "&min=0&max=5&col=1&base=10&format=plain&rnd=new"
#define RANDOMORG_USERAGENT "GNUbg/" VERSION " (" PACKAGE_BUGREPORT ")"
#define RANDOMORG_CERTPATH ".\\etc\\ssl\\"
#define RANDOMORG_CABUNDLE "ca-bundle.crt"

typedef struct {
    size_t nNumRolls;
    int nCurrent;
    unsigned int anBuf[BUFLENGTH];
} RandomData;

extern unsigned int getDiceRandomDotOrg(void);

#endif