summaryrefslogblamecommitdiffstats
path: root/src/antireplay.h
blob: a903d586b3ab676bf045fa2cdcc4314f4d69de92 (plain) (tree)


























                                                                           

                                                     

                             
/*
 * Copyright (c) 2019 Matt Dunwoodie <ncon@noconroy.net>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef __ANTIREPLAY_H__
#define __ANTIREPLAY_H__

#define ARI_BITS (sizeof(uint64_t) * 8)
#define ARB_BITS (1<<10) /* 1024 bitmap (960 usable) */

struct antireplay {
	uint64_t	ar_head;
	uint64_t	ar_bitmap[ARB_BITS / ARI_BITS];
};

void antireplay_init(struct antireplay *);
int antireplay_update(struct antireplay *, uint64_t);

#endif /* __ANTIREPLAY_H__ */