1*d151926dSdholland /* $NetBSD: randomid.h,v 1.3 2016/01/22 23:15:42 dholland Exp $ */ 200552ebbSitojun /* $KAME: ip6_id.c,v 1.8 2003/09/06 13:41:06 itojun Exp $ */ 300552ebbSitojun /* $OpenBSD: ip_id.c,v 1.6 2002/03/15 18:19:52 millert Exp $ */ 400552ebbSitojun 500552ebbSitojun /* 600552ebbSitojun * Copyright (C) 2003 WIDE Project. 700552ebbSitojun * All rights reserved. 800552ebbSitojun * 900552ebbSitojun * Redistribution and use in source and binary forms, with or without 1000552ebbSitojun * modification, are permitted provided that the following conditions 1100552ebbSitojun * are met: 1200552ebbSitojun * 1. Redistributions of source code must retain the above copyright 1300552ebbSitojun * notice, this list of conditions and the following disclaimer. 1400552ebbSitojun * 2. Redistributions in binary form must reproduce the above copyright 1500552ebbSitojun * notice, this list of conditions and the following disclaimer in the 1600552ebbSitojun * documentation and/or other materials provided with the distribution. 1700552ebbSitojun * 3. Neither the name of the project nor the names of its contributors 1800552ebbSitojun * may be used to endorse or promote products derived from this software 1900552ebbSitojun * without specific prior written permission. 2000552ebbSitojun * 2100552ebbSitojun * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 2200552ebbSitojun * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2300552ebbSitojun * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2400552ebbSitojun * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 2500552ebbSitojun * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2600552ebbSitojun * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2700552ebbSitojun * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2800552ebbSitojun * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2900552ebbSitojun * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3000552ebbSitojun * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3100552ebbSitojun * SUCH DAMAGE. 3200552ebbSitojun */ 3300552ebbSitojun 3400552ebbSitojun /* 3500552ebbSitojun * Copyright 1998 Niels Provos <provos@citi.umich.edu> 3600552ebbSitojun * All rights reserved. 3700552ebbSitojun * 3800552ebbSitojun * Theo de Raadt <deraadt@openbsd.org> came up with the idea of using 3900552ebbSitojun * such a mathematical system to generate more random (yet non-repeating) 4000552ebbSitojun * ids to solve the resolver/named problem. But Niels designed the 4100552ebbSitojun * actual system based on the constraints. 4200552ebbSitojun * 4300552ebbSitojun * Redistribution and use in source and binary forms, with or without 4400552ebbSitojun * modification, are permitted provided that the following conditions 4500552ebbSitojun * are met: 4600552ebbSitojun * 1. Redistributions of source code must retain the above copyright 4700552ebbSitojun * notice, this list of conditions and the following disclaimer. 4800552ebbSitojun * 2. Redistributions in binary form must reproduce the above copyright 4900552ebbSitojun * notice, this list of conditions and the following disclaimer in the 5000552ebbSitojun * documentation and/or other materials provided with the distribution. 5100552ebbSitojun * 3. All advertising materials mentioning features or use of this software 5200552ebbSitojun * must display the following acknowledgement: 5300552ebbSitojun * This product includes software developed by Niels Provos. 5400552ebbSitojun * 4. The name of the author may not be used to endorse or promote products 5500552ebbSitojun * derived from this software without specific prior written permission. 5600552ebbSitojun * 5700552ebbSitojun * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 5800552ebbSitojun * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 5900552ebbSitojun * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 6000552ebbSitojun * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 6100552ebbSitojun * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 6200552ebbSitojun * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 6300552ebbSitojun * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 6400552ebbSitojun * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 6500552ebbSitojun * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 6600552ebbSitojun * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 6700552ebbSitojun */ 6800552ebbSitojun 6900552ebbSitojun #ifndef _RANDOMID_H_ 7000552ebbSitojun #define _RANDOMID_H_ 7100552ebbSitojun 72*d151926dSdholland #include <stdint.h> 73*d151926dSdholland 7400552ebbSitojun struct randomid_ctx; 7500552ebbSitojun 7600552ebbSitojun typedef struct randomid_ctx *randomid_t; 7700552ebbSitojun 785f65228bSperry extern uint32_t randomid(randomid_t); 7900552ebbSitojun extern randomid_t randomid_new(int, long); 8000552ebbSitojun extern void randomid_delete(randomid_t); 8100552ebbSitojun 8200552ebbSitojun #define RANDOMID_TIMEO_MIN ((long)60) 8300552ebbSitojun #define RANDOMID_TIMEO_DEFAULT ((long)180) 8400552ebbSitojun 8500552ebbSitojun #endif /*_RANDOMID_H_*/ 86