1 /* This program is free software; you can redistribute it and/or modify 2 * it under the terms of the GNU General Public License as published by 3 * the Free Software Foundation; version 2 of the License. For a copy, 4 * see http://www.gnu.org/licenses/gpl-2.0.html. 5 * 6 * This program is distributed in the hope that it will be useful, 7 * but WITHOUT ANY WARRANTY; without even the implied warranty of 8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9 * GNU General Public License for more details. 10 */ 11 12 #ifndef _TOMAHAWK_H 13 #define _TOMAHAWK_H 14 15 #include "config.h" 16 17 #ifdef ENABLE_TOMAHAWK 18 19 #include <poll.h> 20 #include "serverconfig.h" 21 #include "ip.h" 22 #include "liblist.h" 23 24 #define cc_OKE 0 25 #define cc_DISCONNECT 1 26 27 #define COUNTER_CLIENT 0 28 #define COUNTER_FILE 1 29 #define COUNTER_CGI 2 30 #define COUNTER_INDEX 3 31 #define COUNTER_BAN 4 32 #define COUNTER_DENY 5 33 #define COUNTER_EXPLOIT 6 34 #define COUNTER_MAX 7 35 36 #define TRANSFER_SEND 0 37 #define TRANSFER_RECEIVED 1 38 #define TRANSFER_MAX 2 39 40 typedef struct type_admin { 41 int socket; 42 struct pollfd *poll_data; 43 FILE *fp; 44 bool authenticated; 45 int timer; 46 bool show_requests; 47 48 struct type_admin *next; 49 } t_admin; 50 51 void increment_counter(int counter); 52 void increment_transfer(int counter, long bytes); 53 void show_request_to_admins(char *method, char *uri, char *http_version, t_ip_addr *ip_addr, 54 t_http_header *header, int response_code, off_t bytes_sent); 55 56 int init_tomahawk_module(void); 57 int add_admin(int sock); 58 void disconnect_admins(void); 59 void check_admin_list(void); 60 int prepare_admins_for_poll(struct pollfd *current_poll); 61 void handle_admins(t_config *config); 62 63 #endif 64 65 #endif 66