1*47e81302Syasuoka /* $OpenBSD: addr_range.h,v 1.4 2017/05/30 17:22:00 yasuoka Exp $ */ 20fbf3537Syasuoka /*- 30fbf3537Syasuoka * Copyright (c) 2009 Internet Initiative Japan Inc. 40fbf3537Syasuoka * All rights reserved. 50fbf3537Syasuoka * 60fbf3537Syasuoka * Redistribution and use in source and binary forms, with or without 70fbf3537Syasuoka * modification, are permitted provided that the following conditions 80fbf3537Syasuoka * are met: 90fbf3537Syasuoka * 1. Redistributions of source code must retain the above copyright 100fbf3537Syasuoka * notice, this list of conditions and the following disclaimer. 110fbf3537Syasuoka * 2. Redistributions in binary form must reproduce the above copyright 120fbf3537Syasuoka * notice, this list of conditions and the following disclaimer in the 130fbf3537Syasuoka * documentation and/or other materials provided with the distribution. 140fbf3537Syasuoka * 150fbf3537Syasuoka * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 160fbf3537Syasuoka * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 170fbf3537Syasuoka * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 180fbf3537Syasuoka * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 190fbf3537Syasuoka * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 200fbf3537Syasuoka * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 210fbf3537Syasuoka * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 220fbf3537Syasuoka * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 230fbf3537Syasuoka * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 240fbf3537Syasuoka * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 250fbf3537Syasuoka * SUCH DAMAGE. 260fbf3537Syasuoka */ 270fbf3537Syasuoka #ifndef ADDR_RANGE_H 280fbf3537Syasuoka #define ADDR_RANGE_H 290fbf3537Syasuoka 300fbf3537Syasuoka struct in_addr_range { 310fbf3537Syasuoka u_int32_t addr; // !! host byte order 320fbf3537Syasuoka u_int32_t mask; // !! Host byte order 330fbf3537Syasuoka struct in_addr_range *next; 340fbf3537Syasuoka }; 350fbf3537Syasuoka 360fbf3537Syasuoka 370fbf3537Syasuoka #ifdef __cplusplus 380fbf3537Syasuoka extern "C" { 390fbf3537Syasuoka #endif 400fbf3537Syasuoka 41*47e81302Syasuoka struct in_addr_range *in_addr_range_create(void); 42*47e81302Syasuoka void in_addr_range_destroy(struct in_addr_range *); 43*47e81302Syasuoka void in_addr_range_list_remove_all(struct in_addr_range **); 44*47e81302Syasuoka int in_addr_range_list_includes(struct in_addr_range **, struct in_addr *); 45*47e81302Syasuoka int in_addr_range_list_add(struct in_addr_range **, const char *); 46*47e81302Syasuoka int main(int, char *[]); 470fbf3537Syasuoka 480fbf3537Syasuoka #ifdef __cplusplus 490fbf3537Syasuoka } 500fbf3537Syasuoka #endif 510fbf3537Syasuoka 520fbf3537Syasuoka #endif 53