raw_socket.h File Reference

TCP/IP raw sockets. More...

#include "core/net.h"
#include "core/ip.h"
#include "core/socket.h"

Go to the source code of this file.

Macros

#define RAW_SOCKET_SUPPORT   DISABLED
 
#define RAW_SOCKET_RX_QUEUE_SIZE   4
 

Functions

error_t rawSocketProcessIpPacket (NetInterface *interface, IpPseudoHeader *pseudoHeader, const NetBuffer *buffer, size_t offset)
 Process incoming IP packet. More...
 
void rawSocketProcessEthPacket (NetInterface *interface, EthHeader *ethFrame, size_t length)
 Process incoming Ethernet packet. More...
 
error_t rawSocketSendIpPacket (Socket *socket, const IpAddr *destIpAddr, const void *data, size_t length, size_t *written)
 Send an raw IP packet. More...
 
error_t rawSocketSendEthPacket (Socket *socket, const void *data, size_t length, size_t *written)
 Send an raw Ethernet packet. More...
 
error_t rawSocketReceiveIpPacket (Socket *socket, IpAddr *srcIpAddr, IpAddr *destIpAddr, void *data, size_t size, size_t *received, uint_t flags)
 Receive an IP packet from a raw socket. More...
 
error_t rawSocketReceiveEthPacket (Socket *socket, void *data, size_t size, size_t *received, uint_t flags)
 Receive an Ethernet packet from a raw socket. More...
 
void rawSocketUpdateEvents (Socket *socket)
 Update event state for raw sockets. More...
 

Detailed Description

TCP/IP raw sockets.

License

Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
1.9.0

Definition in file raw_socket.h.

Macro Definition Documentation

◆ RAW_SOCKET_RX_QUEUE_SIZE

#define RAW_SOCKET_RX_QUEUE_SIZE   4

Definition at line 46 of file raw_socket.h.

◆ RAW_SOCKET_SUPPORT

#define RAW_SOCKET_SUPPORT   DISABLED

Definition at line 39 of file raw_socket.h.

Function Documentation

◆ rawSocketProcessEthPacket()

void rawSocketProcessEthPacket ( NetInterface interface,
EthHeader ethFrame,
size_t  length 
)

Process incoming Ethernet packet.

Parameters
[in]interfaceUnderlying network interface
[in]ethFrameIncoming Ethernet frame to process
[in]lengthTotal frame length

Definition at line 269 of file raw_socket.c.

◆ rawSocketProcessIpPacket()

error_t rawSocketProcessIpPacket ( NetInterface interface,
IpPseudoHeader pseudoHeader,
const NetBuffer buffer,
size_t  offset 
)

Process incoming IP packet.

Parameters
[in]interfaceUnderlying network interface
[in]pseudoHeaderIPv4 or IPv6 pseudo header
[in]bufferMulti-part buffer containing the IP packet
[in]offsetOffset to the first byte of the IP packet
Returns
Error code

Definition at line 61 of file raw_socket.c.

◆ rawSocketReceiveEthPacket()

error_t rawSocketReceiveEthPacket ( Socket socket,
void *  data,
size_t  size,
size_t *  received,
uint_t  flags 
)

Receive an Ethernet packet from a raw socket.

Parameters
[in]socketHandle referencing the socket
[out]dataBuffer where to store the incoming data
[in]sizeMaximum number of bytes that can be received
[out]receivedNumber of bytes that have been received
[in]flagsSet of flags that influences the behavior of this function
Returns
Error code

Definition at line 683 of file raw_socket.c.

◆ rawSocketReceiveIpPacket()

error_t rawSocketReceiveIpPacket ( Socket socket,
IpAddr srcIpAddr,
IpAddr destIpAddr,
void *  data,
size_t  size,
size_t *  received,
uint_t  flags 
)

Receive an IP packet from a raw socket.

Parameters
[in]socketHandle referencing the socket
[out]srcIpAddrSource IP address (optional)
[out]destIpAddrDestination IP address (optional)
[out]dataBuffer where to store the incoming data
[in]sizeMaximum number of bytes that can be received
[out]receivedNumber of bytes that have been received
[in]flagsSet of flags that influences the behavior of this function
Returns
Error code

Definition at line 609 of file raw_socket.c.

◆ rawSocketSendEthPacket()

error_t rawSocketSendEthPacket ( Socket socket,
const void *  data,
size_t  length,
size_t *  written 
)

Send an raw Ethernet packet.

Parameters
[in]socketHandle referencing the socket
[in]dataPointer to raw data
[in]lengthLength of the raw data
[out]writtenActual number of bytes written (optional parameter)
Returns
Error code

Definition at line 492 of file raw_socket.c.

◆ rawSocketSendIpPacket()

error_t rawSocketSendIpPacket ( Socket socket,
const IpAddr destIpAddr,
const void *  data,
size_t  length,
size_t *  written 
)

Send an raw IP packet.

Parameters
[in]socketHandle referencing the socket
[in]destIpAddrIP address of the target host
[in]dataPointer to raw data
[in]lengthLength of the raw data
[out]writtenActual number of bytes written (optional parameter)
Returns
Error code

Definition at line 384 of file raw_socket.c.

◆ rawSocketUpdateEvents()

void rawSocketUpdateEvents ( Socket socket)

Update event state for raw sockets.

Parameters
[in]socketHandle referencing the socket

Definition at line 745 of file raw_socket.c.