IPv4 and IPv6 common routines. More...
Go to the source code of this file.
Data Structures | |
| struct | IpAddr |
| IP network address. More... | |
| struct | IpPseudoHeader |
| IP pseudo header. More... | |
Macros | |
| #define | IP_DEFAULT_DF FALSE |
Enumerations | |
| enum | IpProtocol { IP_PROTOCOL_TCP = 6, IP_PROTOCOL_UDP = 17 } |
| IP supported protocols. More... | |
| enum | IpFilterMode { IP_FILTER_MODE_EXCLUDE = 0, IP_FILTER_MODE_INCLUDE = 1 } |
| Multicast filter mode. More... | |
| enum | IpFlags { IP_FLAG_DONT_ROUTE = 0x0400, IP_FLAG_TTL = 0x00FF, IP_FLAG_HOP_LIMIT = 0x00FF } |
| Flags used by I/O functions. More... | |
Functions | |
| error_t | ipSendDatagram (NetInterface *interface, const IpPseudoHeader *pseudoHeader, NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary) |
| Send an IP datagram. More... | |
| error_t | ipSelectSourceAddr (NetInterface **interface, const IpAddr *destAddr, IpAddr *srcAddr) |
| IP source address selection. More... | |
| bool_t | ipIsUnspecifiedAddr (const IpAddr *ipAddr) |
| Compare an IP address against the unspecified address. More... | |
| bool_t | ipIsLinkLocalAddr (const IpAddr *ipAddr) |
| Determine whether an IP address is a link-local address. More... | |
| bool_t | ipIsMulticastAddr (const IpAddr *ipAddr) |
| Determine whether an IP address is a multicast address. More... | |
| bool_t | ipIsBroadcastAddr (const IpAddr *ipAddr) |
| Determine whether an IP address is a broadcast address. More... | |
| bool_t | ipCompAddr (const IpAddr *ipAddr1, const IpAddr *ipAddr2) |
| Compare IP addresses. More... | |
| bool_t | ipCompPrefix (const IpAddr *ipAddr1, const IpAddr *ipAddr2, size_t length) |
| Compare IP address prefixes. More... | |
| void | ipUpdateMulticastFilter (NetInterface *interface, const IpAddr *groupAddr) |
| Update IP multicast filter table. More... | |
| uint16_t | ipCalcChecksum (const void *data, size_t length) |
| IP checksum calculation. More... | |
| uint16_t | ipCalcChecksumEx (const NetBuffer *buffer, size_t offset, size_t length) |
| Calculate IP checksum over a multi-part buffer. More... | |
| uint16_t | ipCalcUpperLayerChecksum (const void *pseudoHeader, size_t pseudoHeaderLen, const void *data, size_t dataLen) |
| Calculate IP upper-layer checksum. More... | |
| uint16_t | ipCalcUpperLayerChecksumEx (const void *pseudoHeader, size_t pseudoHeaderLen, const NetBuffer *buffer, size_t offset, size_t length) |
| Calculate IP upper-layer checksum over a multi-part buffer. More... | |
| NetBuffer * | ipAllocBuffer (size_t length, size_t *offset) |
| Allocate a buffer to hold an IP packet. More... | |
| error_t | ipStringToAddr (const char_t *str, IpAddr *ipAddr) |
| Convert a string representation of an IP address to a binary IP address. More... | |
| char_t * | ipAddrToString (const IpAddr *ipAddr, char_t *str) |
| Convert a binary IP address to a string representation. More... | |
Variables | |
| const IpAddr | IP_ADDR_ANY |
| const IpAddr | IP_ADDR_UNSPECIFIED |
Detailed Description
IPv4 and IPv6 common routines.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2025 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.5.4
Definition in file ip.h.
Macro Definition Documentation
◆ IP_DEFAULT_DF
Enumeration Type Documentation
◆ IpFilterMode
| enum IpFilterMode |
◆ IpFlags
| enum IpFlags |
◆ IpProtocol
| enum IpProtocol |
Function Documentation
◆ ipAddrToString()
◆ ipAllocBuffer()
| NetBuffer* ipAllocBuffer | ( | size_t | length, |
| size_t * | offset | ||
| ) |
◆ ipCalcChecksum()
| uint16_t ipCalcChecksum | ( | const void * | data, |
| size_t | length | ||
| ) |
◆ ipCalcChecksumEx()
| uint16_t ipCalcChecksumEx | ( | const NetBuffer * | buffer, |
| size_t | offset, | ||
| size_t | length | ||
| ) |
◆ ipCalcUpperLayerChecksum()
| uint16_t ipCalcUpperLayerChecksum | ( | const void * | pseudoHeader, |
| size_t | pseudoHeaderLen, | ||
| const void * | data, | ||
| size_t | dataLen | ||
| ) |
◆ ipCalcUpperLayerChecksumEx()
| uint16_t ipCalcUpperLayerChecksumEx | ( | const void * | pseudoHeader, |
| size_t | pseudoHeaderLen, | ||
| const NetBuffer * | buffer, | ||
| size_t | offset, | ||
| size_t | length | ||
| ) |
Calculate IP upper-layer checksum over a multi-part buffer.
- Parameters
-
[in] pseudoHeader Pointer to the pseudo header [in] pseudoHeaderLen Pseudo header length [in] buffer Multi-part buffer containing the upper-layer data [in] offset Offset from the first data byte to process [in] length Number of data bytes to process
- Returns
- Checksum value
◆ ipCompAddr()
◆ ipCompPrefix()
◆ ipIsBroadcastAddr()
◆ ipIsLinkLocalAddr()
◆ ipIsMulticastAddr()
◆ ipIsUnspecifiedAddr()
◆ ipSelectSourceAddr()
| error_t ipSelectSourceAddr | ( | NetInterface ** | interface, |
| const IpAddr * | destAddr, | ||
| IpAddr * | srcAddr | ||
| ) |
IP source address selection.
This function selects the source address and the relevant network interface to be used in order to join the specified destination address
- Parameters
-
[in,out] interface A pointer to a valid network interface may be provided as a hint. The function returns a pointer identifying the interface to be used [in] destAddr Destination IP address [out] srcAddr Local IP address to be used
- Returns
- Error code
◆ ipSendDatagram()
| error_t ipSendDatagram | ( | NetInterface * | interface, |
| const IpPseudoHeader * | pseudoHeader, | ||
| NetBuffer * | buffer, | ||
| size_t | offset, | ||
| NetTxAncillary * | ancillary | ||
| ) |
Send an IP datagram.
- Parameters
-
[in] interface Underlying network interface [in] pseudoHeader IP pseudo header [in] buffer Multi-part buffer containing the payload [in] offset Offset to the first payload byte [in] ancillary Additional options passed to the stack along with the packet
- Returns
- Error code
◆ ipStringToAddr()
◆ ipUpdateMulticastFilter()
| void ipUpdateMulticastFilter | ( | NetInterface * | interface, |
| const IpAddr * | groupAddr | ||
| ) |
