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, const IpPseudoHeader *pseudoHeader, const NetBuffer *buffer, size_t offset, const NetRxAncillary *ancillary)
 Process incoming IP packet. More...
 
void rawSocketProcessEthPacket (NetInterface *interface, const uint8_t *data, size_t length, const NetRxAncillary *ancillary)
 Process incoming Ethernet packet. More...
 
error_t rawSocketSendIpPacket (Socket *socket, const SocketMsg *message, uint_t flags)
 Send a raw IP packet. More...
 
error_t rawSocketSendEthPacket (Socket *socket, const SocketMsg *message, uint_t flags)
 Send a raw Ethernet packet. More...
 
error_t rawSocketReceiveIpPacket (Socket *socket, SocketMsg *message, uint_t flags)
 Receive an IP packet from a raw socket. More...
 
error_t rawSocketReceiveEthPacket (Socket *socket, SocketMsg *message, 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

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 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
2.4.4

Definition in file raw_socket.h.

Macro Definition Documentation

◆ RAW_SOCKET_RX_QUEUE_SIZE

#define RAW_SOCKET_RX_QUEUE_SIZE   4

Definition at line 48 of file raw_socket.h.

◆ RAW_SOCKET_SUPPORT

#define RAW_SOCKET_SUPPORT   DISABLED

Definition at line 41 of file raw_socket.h.

Function Documentation

◆ rawSocketProcessEthPacket()

void rawSocketProcessEthPacket ( NetInterface interface,
const uint8_t *  data,
size_t  length,
const NetRxAncillary ancillary 
)

Process incoming Ethernet packet.

Parameters
[in]interfaceUnderlying network interface
[in]dataPointer to the payload data
[in]lengthLength of the payload data, in bytes
[in]ancillaryAdditional options passed to the stack along with the packet

Definition at line 385 of file raw_socket.c.

◆ rawSocketProcessIpPacket()

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

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
[in]ancillaryAdditional options passed to the stack along with the packet
Returns
Error code

Definition at line 68 of file raw_socket.c.

◆ rawSocketReceiveEthPacket()

error_t rawSocketReceiveEthPacket ( Socket socket,
SocketMsg message,
uint_t  flags 
)

Receive an Ethernet packet from a raw socket.

Parameters
[in]socketHandle referencing the socket
[out]messageReceived Ethernet packet and ancillary data
[in]flagsSet of flags that influences the behavior of this function
Returns
Error code

Definition at line 930 of file raw_socket.c.

◆ rawSocketReceiveIpPacket()

error_t rawSocketReceiveIpPacket ( Socket socket,
SocketMsg message,
uint_t  flags 
)

Receive an IP packet from a raw socket.

Parameters
[in]socketHandle referencing the socket
[out]messageReceived IP packet and ancillary data
[in]flagsSet of flags that influences the behavior of this function
Returns
Error code

Definition at line 824 of file raw_socket.c.

◆ rawSocketSendEthPacket()

error_t rawSocketSendEthPacket ( Socket socket,
const SocketMsg message,
uint_t  flags 
)

Send a raw Ethernet packet.

Parameters
[in]socketHandle referencing the socket
[in]messagePointer to the structure describing the raw packet
[in]flagsSet of flags that influences the behavior of this function
Returns
Error code

Definition at line 732 of file raw_socket.c.

◆ rawSocketSendIpPacket()

error_t rawSocketSendIpPacket ( Socket socket,
const SocketMsg message,
uint_t  flags 
)

Send a raw IP packet.

Parameters
[in]socketHandle referencing the socket
[in]messagePointer to the structure describing the raw packet
[in]flagsSet of flags that influences the behavior of this function
Returns
Error code

Definition at line 538 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 1025 of file raw_socket.c.