Helper functions for Ethernet. More...
Go to the source code of this file.
Functions | |
error_t | ethPadFrame (NetBuffer *buffer, size_t *length) |
Ethernet frame padding. More... | |
error_t | ethEncodeVlanTag (NetBuffer *buffer, size_t *offset, uint16_t vlanId, int8_t vlanPcp, int8_t vlanDei, uint16_t type) |
VLAN tag encoding. More... | |
error_t | ethDecodeVlanTag (const uint8_t *frame, size_t length, uint16_t *vlanId, uint16_t *type) |
VLAN tag decoding. More... | |
error_t | ethCheckDestAddr (NetInterface *interface, const MacAddr *macAddr) |
Destination MAC address filtering. More... | |
bool_t | ethTrapIgmpPacket (EthHeader *header, uint8_t *data, size_t length) |
Trap IGMP packets. More... | |
void | ethUpdateInStats (NetInterface *interface, const MacAddr *destMacAddr) |
Update Ethernet input statistics. More... | |
void | ethUpdateOutStats (NetInterface *interface, const MacAddr *destMacAddr, size_t length) |
Update Ethernet output statistics. More... | |
void | ethUpdateErrorStats (NetInterface *interface, error_t error) |
Update Ethernet error statistics. More... | |
uint32_t | ethCalcCrc (const void *data, size_t length) |
Ethernet CRC calculation. More... | |
uint32_t | ethCalcCrcEx (const NetBuffer *buffer, size_t offset, size_t length) |
Calculate CRC over a multi-part buffer. More... | |
error_t | ethCheckCrc (NetInterface *interface, const uint8_t *frame, size_t length) |
Ethernet CRC verification. More... | |
Variables | |
const uint8_t | ethPadding [64] |
Detailed Description
Helper functions for Ethernet.
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.
- Version
- 2.4.4
Definition in file ethernet_misc.h.
Function Documentation
◆ ethCalcCrc()
uint32_t ethCalcCrc | ( | const void * | data, |
size_t | length | ||
) |
Ethernet CRC calculation.
- Parameters
-
[in] data Pointer to the data over which to calculate the CRC [in] length Number of bytes to process
- Returns
- Resulting CRC value
Definition at line 502 of file ethernet_misc.c.
◆ ethCalcCrcEx()
uint32_t ethCalcCrcEx | ( | const NetBuffer * | buffer, |
size_t | offset, | ||
size_t | length | ||
) |
Calculate CRC over a multi-part buffer.
- Parameters
-
[in] buffer Pointer to the multi-part buffer [in] offset Offset from the beginning of the buffer [in] length Number of bytes to process
- Returns
- Resulting CRC value
Definition at line 567 of file ethernet_misc.c.
◆ ethCheckCrc()
error_t ethCheckCrc | ( | NetInterface * | interface, |
const uint8_t * | frame, | ||
size_t | length | ||
) |
Ethernet CRC verification.
- Parameters
-
[in] interface Underlying network interface [in] frame Pointer to the received Ethernet frame [in] length Length of the frame, in bytes
- Returns
- Error code
Definition at line 644 of file ethernet_misc.c.
◆ ethCheckDestAddr()
error_t ethCheckDestAddr | ( | NetInterface * | interface, |
const MacAddr * | macAddr | ||
) |
Destination MAC address filtering.
- Parameters
-
[in] interface Underlying network interface [in] macAddr Destination MAC address to be checked
- Returns
- Error code
Definition at line 279 of file ethernet_misc.c.
◆ ethDecodeVlanTag()
error_t ethDecodeVlanTag | ( | const uint8_t * | frame, |
size_t | length, | ||
uint16_t * | vlanId, | ||
uint16_t * | type | ||
) |
VLAN tag decoding.
- Parameters
-
[in] frame Pointer to the received Ethernet frame [in] length Length of the frame, in bytes [out] vlanId VLAN identifier [out] type Ethernet type
- Returns
- Error code
Definition at line 243 of file ethernet_misc.c.
◆ ethEncodeVlanTag()
error_t ethEncodeVlanTag | ( | NetBuffer * | buffer, |
size_t * | offset, | ||
uint16_t | vlanId, | ||
int8_t | vlanPcp, | ||
int8_t | vlanDei, | ||
uint16_t | type | ||
) |
VLAN tag encoding.
- Parameters
-
[in] buffer Multi-part buffer containing the payload [in,out] offset Offset to the first payload byte [in] vlanId VLAN identifier [in] vlanPcp VLAN priority [in] vlanDei Drop eligible indicator [in] type Ethernet type
- Returns
- Error code
Definition at line 190 of file ethernet_misc.c.
◆ ethPadFrame()
Ethernet frame padding.
- Parameters
-
[in] buffer Multi-part buffer containing the Ethernet frame [in,out] length Length of the Ethernet frame, in bytes
- Returns
- Error code
Definition at line 147 of file ethernet_misc.c.
◆ ethTrapIgmpPacket()
Trap IGMP packets.
- Parameters
-
[in] header Pointer to the Ethernet header [in] data Pointer to the payload data [in] length Length of the payload data, in bytes
- Returns
- TRUE if the Ethernet frame contains an IGMP message, else FALSE
Definition at line 351 of file ethernet_misc.c.
◆ ethUpdateErrorStats()
void ethUpdateErrorStats | ( | NetInterface * | interface, |
error_t | error | ||
) |
Update Ethernet error statistics.
- Parameters
-
[in] interface Underlying network interface [in] error Status code describing the error
Definition at line 464 of file ethernet_misc.c.
◆ ethUpdateInStats()
void ethUpdateInStats | ( | NetInterface * | interface, |
const MacAddr * | destMacAddr | ||
) |
Update Ethernet input statistics.
- Parameters
-
[in] interface Underlying network interface [in] destMacAddr Destination MAC address
Definition at line 383 of file ethernet_misc.c.
◆ ethUpdateOutStats()
void ethUpdateOutStats | ( | NetInterface * | interface, |
const MacAddr * | destMacAddr, | ||
size_t | length | ||
) |
Update Ethernet output statistics.
- Parameters
-
[in] interface Underlying network interface [in] destMacAddr Destination MAC address [in] length Length of the Ethernet frame, in bytes
Definition at line 421 of file ethernet_misc.c.
Variable Documentation
◆ ethPadding
|
extern |
Definition at line 54 of file ethernet_misc.c.