pcap_driver.h
Go to the documentation of this file.
1 /**
2  * @file pcap_driver.h
3  * @brief PCAP driver
4  *
5  * @section License
6  *
7  * Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.
8  *
9  * This file is part of CycloneTCP Open.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24  *
25  * @author Oryx Embedded SARL (www.oryx-embedded.com)
26  * @version 1.9.0
27  **/
28 
29 #ifndef _PCAP_DRIVER_H
30 #define _PCAP_DRIVER_H
31 
32 //Dependencies
33 #include "core/nic.h"
34 
35 //Maximum packet size
36 #ifndef PCAP_DRIVER_MAX_PACKET_SIZE
37  #define PCAP_DRIVER_MAX_PACKET_SIZE 1536
38 #elif (PCAP_DRIVER_MAX_PACKET_SIZE < 1)
39  #error PCAP_DRIVER_MAX_PACKET_SIZE parameter is not valid
40 #endif
41 
42 //Maximum number of packets in the receive queue
43 #ifndef PCAP_DRIVER_QUEUE_SIZE
44  #define PCAP_DRIVER_QUEUE_SIZE 64
45 #elif (PCAP_DRIVER_QUEUE_SIZE < 1)
46  #error PCAP_DRIVER_QUEUE_SIZE parameter is not valid
47 #endif
48 
49 //Receive timeout in milliseconds
50 #ifndef PCAP_DRIVER_TIMEOUT
51  #define PCAP_DRIVER_TIMEOUT 1
52 #elif (PCAP_DRIVER_TIMEOUT < 1)
53  #error PCAP_DRIVER_TIMEOUT parameter is not valid
54 #endif
55 
56 //C++ guard
57 #ifdef __cplusplus
58  extern "C" {
59 #endif
60 
61 //PCAP driver
62 extern const NicDriver pcapDriver;
63 
64 //PCAP related functions
66 
67 void pcapDriverTick(NetInterface *interface);
68 
69 void pcapDriverEnableIrq(NetInterface *interface);
70 void pcapDriverDisableIrq(NetInterface *interface);
71 
72 void pcapDriverEventHandler(NetInterface *interface);
73 
75  const NetBuffer *buffer, size_t offset);
76 
78 
79 void pcapDriverTask(NetInterface *interface);
80 
81 //C++ guard
82 #ifdef __cplusplus
83  }
84 #endif
85 
86 #endif
void pcapDriverTick(NetInterface *interface)
PCAP timer handler.
Definition: pcap_driver.c:320
error_t pcapDriverSendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset)
Send a packet.
Definition: pcap_driver.c:387
error_t pcapDriverInit(NetInterface *interface)
PCAP driver initialization.
Definition: pcap_driver.c:107
error_t pcapDriverUpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
Definition: pcap_driver.c:433
void pcapDriverTask(NetInterface *interface)
PCAP receive task.
Definition: pcap_driver.c:445
void pcapDriverEnableIrq(NetInterface *interface)
Enable interrupts.
Definition: pcap_driver.c:331
NIC driver.
Definition: nic.h:161
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:86
error_t
Error codes.
Definition: error.h:40
#define NetInterface
Definition: net.h:34
const NicDriver pcapDriver
PCAP driver.
Definition: pcap_driver.c:80
void pcapDriverDisableIrq(NetInterface *interface)
Disable interrupts.
Definition: pcap_driver.c:342
void pcapDriverEventHandler(NetInterface *interface)
PCAP event handler.
Definition: pcap_driver.c:353
Network interface controller abstraction layer.