Sergey Pastor / 1

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pcap_driver.h Source File

pcap_driver.h

Go to the documentation of this file.
00001 /**
00002  * @file pcap_driver.h
00003  * @brief PCAP driver
00004  *
00005  * @section License
00006  *
00007  * Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved.
00008  *
00009  * This file is part of CycloneTCP Open.
00010  *
00011  * This program is free software; you can redistribute it and/or
00012  * modify it under the terms of the GNU General Public License
00013  * as published by the Free Software Foundation; either version 2
00014  * of the License, or (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software Foundation,
00023  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00024  *
00025  * @author Oryx Embedded SARL (www.oryx-embedded.com)
00026  * @version 1.7.6
00027  **/
00028 
00029 #ifndef _PCAP_DRIVER_H
00030 #define _PCAP_DRIVER_H
00031 
00032 //Dependencies
00033 #include "core/nic.h"
00034 
00035 //Maximum packet size
00036 #ifndef PCAP_DRIVER_MAX_PACKET_SIZE
00037    #define PCAP_DRIVER_MAX_PACKET_SIZE 1536
00038 #elif (PCAP_DRIVER_MAX_PACKET_SIZE < 1)
00039    #error PCAP_DRIVER_MAX_PACKET_SIZE parameter is not valid
00040 #endif
00041 
00042 //Maximum number of packets in the receive queue
00043 #ifndef PCAP_DRIVER_QUEUE_SIZE
00044    #define PCAP_DRIVER_QUEUE_SIZE 64
00045 #elif (PCAP_DRIVER_QUEUE_SIZE < 1)
00046    #error PCAP_DRIVER_QUEUE_SIZE parameter is not valid
00047 #endif
00048 
00049 //Receive timeout in milliseconds
00050 #ifndef PCAP_DRIVER_TIMEOUT
00051    #define PCAP_DRIVER_TIMEOUT 1
00052 #elif (PCAP_DRIVER_TIMEOUT < 1)
00053    #error PCAP_DRIVER_TIMEOUT parameter is not valid
00054 #endif
00055 
00056 //PCAP driver
00057 extern const NicDriver pcapDriver;
00058 
00059 //PCAP related functions
00060 error_t pcapDriverInit(NetInterface *interface);
00061 
00062 void pcapDriverTick(NetInterface *interface);
00063 
00064 void pcapDriverEnableIrq(NetInterface *interface);
00065 void pcapDriverDisableIrq(NetInterface *interface);
00066 
00067 void pcapDriverEventHandler(NetInterface *interface);
00068 
00069 error_t pcapDriverSendPacket(NetInterface *interface,
00070    const NetBuffer *buffer, size_t offset);
00071 
00072 error_t pcapDriverSetMulticastFilter(NetInterface *interface);
00073 
00074 void pcapDriverTask(NetInterface *interface);
00075 
00076 #endif
00077