1/** 2 * \file 3 * \brief Header file for helper and additional functions 4 */ 5/* 6 * Copyright (c) 2009, 2010, ETH Zurich. 7 * All rights reserved. 8 * 9 * This file is distributed under the terms in the attached LICENSE file. 10 * If you do not find this file, copies can be found by writing to: 11 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group. 12 */ 13 14#ifndef __TOOLS_H__ 15#define __TOOLS_H__ 16 17#ifndef DOXYGEN 18// exclude system headers from documentation 19 20//#include <strings.h> 21#include <stdint.h> 22#include <assert.h> 23 24#endif // DOXYGEN 25 26#include <bfdmuxtools/bfdmux.h> 27 28int find_msb(uint64_t value); 29 30//uint8_t *parse_hex_input(char *str); 31char *get_error_position_string(int pos); 32 33// Filter 34 35char *build_src_mac_filter(struct eth_addr src); 36char *build_dst_mac_filter(struct eth_addr dst); 37char *build_ipv4_filter(addr_t srcip, addr_t dstip); 38char *build_icmp_filter(void); 39char *build_tcp_filter(port_t srcport, port_t dstport); 40char *build_udp_filter(port_t srcport, port_t dstport); 41char *build_ipv4_icmp_filter(addr_t srcip, addr_t dstip); 42char *build_ipv4_tcp_filter(addr_t srcip, addr_t dstip, port_t srcport, 43 port_t dstport); 44char *build_ipv4_udp_filter(addr_t srcip, addr_t dstip, port_t srcport, 45 port_t dstport); 46char *build_ether_dst_ipv4_udp_filter(struct eth_addr dst, addr_t srcip, 47 addr_t dstip, port_t srcport, 48 port_t dstport); 49char *build_ether_dst_ipv4_tcp_filter(struct eth_addr dst, addr_t srcip, 50 addr_t dstip, port_t srcport, 51 port_t dstport); 52char *build_ether_src_ipv4_udp_filter(struct eth_addr src, addr_t srcip, 53 addr_t dstip, port_t srcport, 54 port_t dstport); 55char *build_ether_src_ipv4_tcp_filter(struct eth_addr src, addr_t srcip, 56 addr_t dstip, port_t srcport, 57 port_t dstport); 58char *build_generic_arp_reply_filter(void); 59char *build_arp_transmit_filter(struct eth_addr src); 60#endif 61