131921Sbrian/*- 2330449Seadler * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3330449Seadler * 431921Sbrian * Copyright (c) 1997 Brian Somers <brian@Awfulhak.org> 531921Sbrian * All rights reserved. 631921Sbrian * 731921Sbrian * Redistribution and use in source and binary forms, with or without 831921Sbrian * modification, are permitted provided that the following conditions 931921Sbrian * are met: 1031921Sbrian * 1. Redistributions of source code must retain the above copyright 1131921Sbrian * notice, this list of conditions and the following disclaimer. 1231921Sbrian * 2. Redistributions in binary form must reproduce the above copyright 1331921Sbrian * notice, this list of conditions and the following disclaimer in the 1431921Sbrian * documentation and/or other materials provided with the distribution. 1531921Sbrian * 1631921Sbrian * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1731921Sbrian * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1831921Sbrian * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1931921Sbrian * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2031921Sbrian * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2131921Sbrian * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2231921Sbrian * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2331921Sbrian * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2431921Sbrian * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2531921Sbrian * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2631921Sbrian * SUCH DAMAGE. 2731921Sbrian * 2850479Speter * $FreeBSD: stable/11/usr.sbin/ppp/iplist.h 330449 2018-03-05 07:26:05Z eadler $ 2931690Sbrian */ 3031690Sbrian 3137210Sbrianstruct iplist_cur { 3237210Sbrian struct in_addr ip; 3337210Sbrian int pos; 3437210Sbrian char *srcptr; 3537210Sbrian u_long srcitem; 3637210Sbrian u_int32_t lstart; 3737210Sbrian u_long nItems; 3837210Sbrian}; 3937210Sbrian 4031690Sbrianstruct iplist { 4137210Sbrian struct iplist_cur cur; 4237210Sbrian u_long nItems; 4331690Sbrian char src[LINE_LEN]; 4431690Sbrian}; 4531690Sbrian 4631690Sbrianextern int iplist_setsrc(struct iplist *, const char *); 4731690Sbrianextern void iplist_reset(struct iplist *); 4837210Sbrianextern struct in_addr iplist_setcurpos(struct iplist *, long); 4931690Sbrianextern struct in_addr iplist_setrandpos(struct iplist *); 5031690Sbrianextern int iplist_ip2pos(struct iplist *, struct in_addr); 5131690Sbrianextern struct in_addr iplist_next(struct iplist *); 5231690Sbrian 5331690Sbrian#define iplist_isvalid(x) ((x)->src[0] != '\0') 54