pcap.h (1556B)
1 /* 2 * 3 * Wireless daemon for Linux 4 * 5 * Copyright (C) 2013-2019 Intel Corporation. All rights reserved. 6 * 7 * This library is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Lesser General Public 9 * License as published by the Free Software Foundation; either 10 * version 2.1 of the License, or (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this library; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 * 21 */ 22 23 #include <stdint.h> 24 #include <stdbool.h> 25 #include <sys/time.h> 26 27 #define PCAP_TYPE_INVALID 0 28 #define PCAP_TYPE_LINUX_SLL 113 29 #define PCAP_TYPE_NETLINK 253 30 31 struct pcap; 32 33 struct pcap *pcap_open(const char *pathname); 34 struct pcap *pcap_create(const char *pathname); 35 void pcap_close(struct pcap *pcap); 36 37 uint32_t pcap_get_type(struct pcap *pcap); 38 uint32_t pcap_get_snaplen(struct pcap *pcap); 39 size_t pcap_get_size(struct pcap *pcap); 40 41 bool pcap_read(struct pcap *pcap, struct timeval *tv, 42 void *data, uint32_t size, uint32_t *len, uint32_t *real_len); 43 44 bool pcap_write(struct pcap *pcap, const struct timeval *tv, 45 const void *phdr, uint32_t plen, 46 const void *data, uint32_t size);