Webserver+3d print

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers raw_socket.h Source File

raw_socket.h

Go to the documentation of this file.
00001 /**
00002  * @file raw_socket.h
00003  * @brief TCP/IP raw sockets
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 _RAW_SOCKET_H
00030 #define _RAW_SOCKET_H
00031 
00032 //Dependencies
00033 #include "core/net.h"
00034 #include "core/ip.h"
00035 #include "core/socket.h"
00036 
00037 //Raw socket support
00038 #ifndef RAW_SOCKET_SUPPORT
00039    #define RAW_SOCKET_SUPPORT DISABLED
00040 #elif (RAW_SOCKET_SUPPORT != ENABLED && RAW_SOCKET_SUPPORT != DISABLED)
00041    #error RAW_SOCKET_SUPPORT parameter is not valid
00042 #endif
00043 
00044 //Receive queue depth for raw sockets
00045 #ifndef RAW_SOCKET_RX_QUEUE_SIZE
00046    #define RAW_SOCKET_RX_QUEUE_SIZE 4
00047 #elif (RAW_SOCKET_RX_QUEUE_SIZE < 1)
00048    #error RAW_SOCKET_RX_QUEUE_SIZE parameter is not valid
00049 #endif
00050 
00051 //Raw socket related functions
00052 error_t rawSocketProcessIpPacket(NetInterface *interface,
00053    IpPseudoHeader *pseudoHeader, const NetBuffer *buffer, size_t offset);
00054 
00055 void rawSocketProcessEthPacket(NetInterface *interface,
00056    EthHeader *ethFrame, size_t length);
00057 
00058 error_t rawSocketSendIpPacket(Socket *socket, const IpAddr *destIpAddr,
00059    const void *data, size_t length, size_t *written);
00060 
00061 error_t rawSocketSendEthPacket(Socket *socket,
00062    const void *data, size_t length, size_t *written);
00063 
00064 error_t rawSocketReceiveIpPacket(Socket *socket, IpAddr *srcIpAddr,
00065    IpAddr *destIpAddr, void *data, size_t size, size_t *received, uint_t flags);
00066 
00067 error_t rawSocketReceiveEthPacket(Socket *socket,
00068    void *data, size_t size, size_t *received, uint_t flags);
00069 
00070 void rawSocketUpdateEvents(Socket *socket);
00071 
00072 #endif
00073