randomize_fd.h revision 110723
1110723Sseanc/* 2110723Sseanc * Copyright (C) 2003 Sean Chittenden <seanc@FreeBSD.org> 3110723Sseanc * All rights reserved. 4110723Sseanc * 5110723Sseanc * Redistribution and use in source and binary forms, with or without 6110723Sseanc * modification, are permitted provided that the following conditions 7110723Sseanc * are met: 8110723Sseanc * 1. Redistributions of source code must retain the above copyright 9110723Sseanc * notice, this list of conditions and the following disclaimer. 10110723Sseanc * 2. Redistributions in binary form must reproduce the above copyright 11110723Sseanc * notice, this list of conditions and the following disclaimer in the 12110723Sseanc * documentation and/or other materials provided with the distribution. 13110723Sseanc * 14110723Sseanc * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 15110723Sseanc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16110723Sseanc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17110723Sseanc * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 18110723Sseanc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19110723Sseanc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20110723Sseanc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21110723Sseanc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22110723Sseanc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23110723Sseanc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24110723Sseanc * SUCH DAMAGE. 25110723Sseanc * 26110723Sseanc * $FreeBSD: head/games/random/randomize_fd.h 110723 2003-02-11 19:32:18Z seanc $ 27110723Sseanc */ 28110723Sseanc 29110723Sseanc#ifndef __RANDOMIZE_FD__ 30110723Sseanc#define __RANDOMIZE_FD__ 31110723Sseanc 32110723Sseanc#include <ctype.h> 33110723Sseanc#include <err.h> 34110723Sseanc#include <errno.h> 35110723Sseanc#include <sys/param.h> 36110723Sseanc#include <sys/types.h> 37110723Sseanc#include <sys/uio.h> 38110723Sseanc#include <stdio.h> 39110723Sseanc#include <stdlib.h> 40110723Sseanc#include <string.h> 41110723Sseanc#include <unistd.h> 42110723Sseanc 43110723Sseanc#define RANDOM_TYPE_UNSET 0 44110723Sseanc#define RANDOM_TYPE_LINES 1 45110723Sseanc#define RANDOM_TYPE_WORDS 2 46110723Sseanc 47110723Sseanc/* The multiple instance single integer key */ 48110723Sseancstruct rand_node { 49110723Sseanc u_char *cp; 50110723Sseanc u_int len; 51110723Sseanc struct rand_node *next; 52110723Sseanc}; 53110723Sseanc 54110723Sseancint randomize_fd(int fd, int type, int unique, double denom); 55110723Sseanc 56110723Sseanc#endif 57