root / lab4 / .minix-src / include / randomid.h @ 14
History | View | Annotate | Download (3.92 KB)
1 | 13 | up20180614 | /* $NetBSD: randomid.h,v 1.2 2005/12/26 19:01:47 perry Exp $ */
|
---|---|---|---|
2 | /* $KAME: ip6_id.c,v 1.8 2003/09/06 13:41:06 itojun Exp $ */
|
||
3 | /* $OpenBSD: ip_id.c,v 1.6 2002/03/15 18:19:52 millert Exp $ */
|
||
4 | |||
5 | /*
|
||
6 | * Copyright (C) 2003 WIDE Project.
|
||
7 | * All rights reserved.
|
||
8 | *
|
||
9 | * Redistribution and use in source and binary forms, with or without
|
||
10 | * modification, are permitted provided that the following conditions
|
||
11 | * are met:
|
||
12 | * 1. Redistributions of source code must retain the above copyright
|
||
13 | * notice, this list of conditions and the following disclaimer.
|
||
14 | * 2. Redistributions in binary form must reproduce the above copyright
|
||
15 | * notice, this list of conditions and the following disclaimer in the
|
||
16 | * documentation and/or other materials provided with the distribution.
|
||
17 | * 3. Neither the name of the project nor the names of its contributors
|
||
18 | * may be used to endorse or promote products derived from this software
|
||
19 | * without specific prior written permission.
|
||
20 | *
|
||
21 | * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||
25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||
26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||
27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||
28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||
29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||
30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||
31 | * SUCH DAMAGE.
|
||
32 | */
|
||
33 | |||
34 | /*
|
||
35 | * Copyright 1998 Niels Provos <provos@citi.umich.edu>
|
||
36 | * All rights reserved.
|
||
37 | *
|
||
38 | * Theo de Raadt <deraadt@openbsd.org> came up with the idea of using
|
||
39 | * such a mathematical system to generate more random (yet non-repeating)
|
||
40 | * ids to solve the resolver/named problem. But Niels designed the
|
||
41 | * actual system based on the constraints.
|
||
42 | *
|
||
43 | * Redistribution and use in source and binary forms, with or without
|
||
44 | * modification, are permitted provided that the following conditions
|
||
45 | * are met:
|
||
46 | * 1. Redistributions of source code must retain the above copyright
|
||
47 | * notice, this list of conditions and the following disclaimer.
|
||
48 | * 2. Redistributions in binary form must reproduce the above copyright
|
||
49 | * notice, this list of conditions and the following disclaimer in the
|
||
50 | * documentation and/or other materials provided with the distribution.
|
||
51 | * 3. All advertising materials mentioning features or use of this software
|
||
52 | * must display the following acknowledgement:
|
||
53 | * This product includes software developed by Niels Provos.
|
||
54 | * 4. The name of the author may not be used to endorse or promote products
|
||
55 | * derived from this software without specific prior written permission.
|
||
56 | *
|
||
57 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||
58 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||
59 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||
60 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||
61 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||
62 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||
63 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||
64 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||
65 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||
66 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
67 | */
|
||
68 | |||
69 | #ifndef _RANDOMID_H_
|
||
70 | #define _RANDOMID_H_
|
||
71 | |||
72 | struct randomid_ctx;
|
||
73 | |||
74 | typedef struct randomid_ctx *randomid_t; |
||
75 | |||
76 | extern uint32_t randomid(randomid_t);
|
||
77 | extern randomid_t randomid_new(int, long); |
||
78 | extern void randomid_delete(randomid_t); |
||
79 | |||
80 | #define RANDOMID_TIMEO_MIN ((long)60) |
||
81 | #define RANDOMID_TIMEO_DEFAULT ((long)180) |
||
82 | |||
83 | #endif /*_RANDOMID_H_*/ |