1 /* doscan - Denial Of Service Capable Auditing of Networks 2 * Copyright (C) 2003 Florian Weimer 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 */ 18 19 #ifndef SCAN_H 20 #define SCAN_H 21 22 #include "ipv4.h" 23 #include "subnets.h" 24 #include "ticks.h" 25 26 #include <sys/poll.h> 27 28 struct scan_host_t; 29 typedef void (*scan_callback_t) (struct scan_host_t *); 30 /* Called when a descriptor is ready for I/O, or is about to close. 31 Should change the state, io_callback and close_callback structure 32 fields as necessary. If io_callback or timeout are null pointers, 33 close_callback is called, and the socket is closed. 34 35 The callback should update the timeout field (it is measured in 36 milliseconds). If the timeout passes without further activity, 37 close_callback is called and the socket is closed. 38 39 The error field can be set to a non-zero errno value. In this 40 case, the socket is closed (and close_callback is called, but at 41 most once). 42 43 close_callback must not close the socket. The fields poll, 44 poll->sockfd and host must not be modified by any callback 45 routine. */ 46 47 typedef struct scan_host_t { 48 struct pollfd *poll; 49 ticks_t timeout; 50 ipv4_t host; 51 void *state; 52 scan_callback_t io_callback, close_callback; 53 } scan_host_t; 54 55 void scan(subnets&); 56 /* Starts TCP scanning, using the selected protocol module. */ 57 58 #endif 59