1/* Copyright (C) 2008 The Android Open Source Project 2** 3** This software is licensed under the terms of the GNU General Public 4** License version 2, as published by the Free Software Foundation, and 5** may be copied, distributed, and modified under those terms. 6** 7** This program is distributed in the hope that it will be useful, 8** but WITHOUT ANY WARRANTY; without even the implied warranty of 9** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10** GNU General Public License for more details. 11*/ 12#ifndef _QEMU_TCPDUMP_H 13#define _QEMU_TCPDUMP_H 14 15#include <stdint.h> 16 17/* global flag, set to 1 when packet captupe is active */ 18extern int qemu_tcpdump_active; 19 20/* start a new packet capture, close the current one if any. 21 * returns 0 on success, and -1 on failure (see errno then) */ 22extern int qemu_tcpdump_start( const char* filepath ); 23 24/* stop the current packet capture, if any */ 25extern void qemu_tcpdump_stop( void ); 26 27/* send an ethernet packet to the packet capture file, if any */ 28extern void qemu_tcpdump_packet( const void* base, int len ); 29 30/* returns interesting stats, like the number of packets captures, 31 * and the total size of these packets. Note: the file will be larger 32 * due to global and packet headers. 33 */ 34extern void qemu_tcpdump_stats( uint64_t *pcount, uint64_t* psize ); 35 36#endif /* _QEMU_TCPDUMP_H */ 37