IPv4 (Internet Protocol Version 4) More...
#include "core/net.h"#include "core/ethernet.h"#include "core/ip.h"#include "core/udp.h"#include "core/tcp_fsm.h"#include "core/raw_socket.h"#include "ipv4/arp_cache.h"#include "ipv4/ipv4.h"#include "ipv4/ipv4_multicast.h"#include "ipv4/ipv4_routing.h"#include "ipv4/ipv4_misc.h"#include "ipv4/icmp.h"#include "ipv4/auto_ip_misc.h"#include "igmp/igmp_host.h"#include "dhcp/dhcp_client_misc.h"#include "nat/nat_misc.h"#include "mdns/mdns_responder.h"#include "mibs/mib2_module.h"#include "mibs/ip_mib_module.h"#include "debug.h"#include "ipsec/ipsec.h"#include "ipsec/ipsec_inbound.h"#include "ipsec/ipsec_outbound.h"#include "ah/ah.h"#include "esp/esp.h"Go to the source code of this file.
Macros | |
| #define | TRACE_LEVEL IPV4_TRACE_LEVEL |
Functions | |
| error_t | ipv4Init (NetInterface *interface) |
| IPv4 related initialization. More... | |
| error_t | ipv4SetDefaultTtl (NetInterface *interface, uint8_t ttl) |
| Set default TTL value for outgoing IPv4 packets. More... | |
| error_t | ipv4SetHostAddr (NetInterface *interface, Ipv4Addr addr) |
| Assign host address. More... | |
| error_t | ipv4SetHostAddrEx (NetInterface *interface, uint_t index, Ipv4Addr addr) |
| Assign host address. More... | |
| error_t | ipv4GetHostAddr (NetInterface *interface, Ipv4Addr *addr) |
| Retrieve host address. More... | |
| error_t | ipv4GetHostAddrEx (NetInterface *interface, uint_t index, Ipv4Addr *addr) |
| Retrieve host address. More... | |
| error_t | ipv4SetSubnetMask (NetInterface *interface, Ipv4Addr mask) |
| Configure subnet mask. More... | |
| error_t | ipv4SetSubnetMaskEx (NetInterface *interface, uint_t index, Ipv4Addr mask) |
| Configure subnet mask. More... | |
| error_t | ipv4GetSubnetMask (NetInterface *interface, Ipv4Addr *mask) |
| Retrieve subnet mask. More... | |
| error_t | ipv4GetSubnetMaskEx (NetInterface *interface, uint_t index, Ipv4Addr *mask) |
| Retrieve subnet mask. More... | |
| error_t | ipv4SetDefaultGateway (NetInterface *interface, Ipv4Addr addr) |
| Configure default gateway. More... | |
| error_t | ipv4SetDefaultGatewayEx (NetInterface *interface, uint_t index, Ipv4Addr addr) |
| Configure default gateway. More... | |
| error_t | ipv4GetDefaultGateway (NetInterface *interface, Ipv4Addr *addr) |
| Retrieve default gateway. More... | |
| error_t | ipv4GetDefaultGatewayEx (NetInterface *interface, uint_t index, Ipv4Addr *addr) |
| Retrieve default gateway. More... | |
| error_t | ipv4SetDnsServer (NetInterface *interface, uint_t index, Ipv4Addr addr) |
| Configure DNS server. More... | |
| error_t | ipv4GetDnsServer (NetInterface *interface, uint_t index, Ipv4Addr *addr) |
| Retrieve DNS server. More... | |
| void | ipv4LinkChangeEvent (NetInterface *interface) |
| Callback function for link change event. More... | |
| void | ipv4ProcessPacket (NetInterface *interface, Ipv4Header *packet, size_t length, NetRxAncillary *ancillary) |
| Incoming IPv4 packet processing. More... | |
| void | ipv4ProcessDatagram (NetInterface *interface, const NetBuffer *buffer, size_t offset, NetRxAncillary *ancillary) |
| Incoming IPv4 datagram processing. More... | |
| error_t | ipv4SendDatagram (NetInterface *interface, const Ipv4PseudoHeader *pseudoHeader, NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary) |
| Send an IPv4 datagram. More... | |
| error_t | ipv4SendPacket (NetInterface *interface, const Ipv4PseudoHeader *pseudoHeader, uint16_t fragId, size_t fragOffset, NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary) |
| Send an IPv4 packet. More... | |
| error_t | ipv4StringToAddr (const char_t *str, Ipv4Addr *ipAddr) |
| Convert a dot-decimal string to a binary IPv4 address. More... | |
| char_t * | ipv4AddrToString (Ipv4Addr ipAddr, char_t *str) |
| Convert a binary IPv4 address to dot-decimal notation. More... | |
| void | ipv4DumpHeader (const Ipv4Header *ipHeader) |
| Dump IPv4 header for debugging purpose. More... | |
Detailed Description
IPv4 (Internet Protocol Version 4)
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.
Description
The Internet Protocol (IP) provides the functions necessary to deliver a datagram from a source to a destination over an interconnected system of networks. Refer to RFC 791 for complete details
- Version
- 2.5.4
Definition in file ipv4.c.
Macro Definition Documentation
◆ TRACE_LEVEL
Function Documentation
◆ ipv4AddrToString()
◆ ipv4DumpHeader()
| void ipv4DumpHeader | ( | const Ipv4Header * | ipHeader | ) |
◆ ipv4GetDefaultGateway()
| error_t ipv4GetDefaultGateway | ( | NetInterface * | interface, |
| Ipv4Addr * | addr | ||
| ) |
◆ ipv4GetDefaultGatewayEx()
| error_t ipv4GetDefaultGatewayEx | ( | NetInterface * | interface, |
| uint_t | index, | ||
| Ipv4Addr * | addr | ||
| ) |
◆ ipv4GetDnsServer()
| error_t ipv4GetDnsServer | ( | NetInterface * | interface, |
| uint_t | index, | ||
| Ipv4Addr * | addr | ||
| ) |
◆ ipv4GetHostAddr()
| error_t ipv4GetHostAddr | ( | NetInterface * | interface, |
| Ipv4Addr * | addr | ||
| ) |
◆ ipv4GetHostAddrEx()
| error_t ipv4GetHostAddrEx | ( | NetInterface * | interface, |
| uint_t | index, | ||
| Ipv4Addr * | addr | ||
| ) |
◆ ipv4GetSubnetMask()
| error_t ipv4GetSubnetMask | ( | NetInterface * | interface, |
| Ipv4Addr * | mask | ||
| ) |
◆ ipv4GetSubnetMaskEx()
| error_t ipv4GetSubnetMaskEx | ( | NetInterface * | interface, |
| uint_t | index, | ||
| Ipv4Addr * | mask | ||
| ) |
◆ ipv4Init()
| error_t ipv4Init | ( | NetInterface * | interface | ) |
◆ ipv4LinkChangeEvent()
| void ipv4LinkChangeEvent | ( | NetInterface * | interface | ) |
◆ ipv4ProcessDatagram()
| void ipv4ProcessDatagram | ( | NetInterface * | interface, |
| const NetBuffer * | buffer, | ||
| size_t | offset, | ||
| NetRxAncillary * | ancillary | ||
| ) |
Incoming IPv4 datagram processing.
- Parameters
-
[in] interface Underlying network interface [in] buffer Multi-part buffer that holds the incoming IPv4 datagram [in] offset Offset from the beginning of the buffer [in] ancillary Additional options passed to the stack along with the packet
◆ ipv4ProcessPacket()
| void ipv4ProcessPacket | ( | NetInterface * | interface, |
| Ipv4Header * | packet, | ||
| size_t | length, | ||
| NetRxAncillary * | ancillary | ||
| ) |
◆ ipv4SendDatagram()
| error_t ipv4SendDatagram | ( | NetInterface * | interface, |
| const Ipv4PseudoHeader * | pseudoHeader, | ||
| NetBuffer * | buffer, | ||
| size_t | offset, | ||
| NetTxAncillary * | ancillary | ||
| ) |
Send an IPv4 datagram.
- Parameters
-
[in] interface Underlying network interface [in] pseudoHeader IPv4 pseudo header [in] buffer Multi-part buffer containing the payload [in] offset Offset to the first byte of the payload [in] ancillary Additional options passed to the stack along with the packet
- Returns
- Error code
◆ ipv4SendPacket()
| error_t ipv4SendPacket | ( | NetInterface * | interface, |
| const Ipv4PseudoHeader * | pseudoHeader, | ||
| uint16_t | fragId, | ||
| size_t | fragOffset, | ||
| NetBuffer * | buffer, | ||
| size_t | offset, | ||
| NetTxAncillary * | ancillary | ||
| ) |
Send an IPv4 packet.
- Parameters
-
[in] interface Underlying network interface [in] pseudoHeader IPv4 pseudo header [in] fragId Fragment identification field [in] fragOffset Fragment offset field [in] buffer Multi-part buffer containing the payload [in] offset Offset to the first byte of the payload [in] ancillary Additional options passed to the stack along with the packet
- Returns
- Error code
◆ ipv4SetDefaultGateway()
| error_t ipv4SetDefaultGateway | ( | NetInterface * | interface, |
| Ipv4Addr | addr | ||
| ) |
◆ ipv4SetDefaultGatewayEx()
| error_t ipv4SetDefaultGatewayEx | ( | NetInterface * | interface, |
| uint_t | index, | ||
| Ipv4Addr | addr | ||
| ) |
◆ ipv4SetDefaultTtl()
| error_t ipv4SetDefaultTtl | ( | NetInterface * | interface, |
| uint8_t | ttl | ||
| ) |
◆ ipv4SetDnsServer()
| error_t ipv4SetDnsServer | ( | NetInterface * | interface, |
| uint_t | index, | ||
| Ipv4Addr | addr | ||
| ) |
◆ ipv4SetHostAddr()
| error_t ipv4SetHostAddr | ( | NetInterface * | interface, |
| Ipv4Addr | addr | ||
| ) |
◆ ipv4SetHostAddrEx()
| error_t ipv4SetHostAddrEx | ( | NetInterface * | interface, |
| uint_t | index, | ||
| Ipv4Addr | addr | ||
| ) |
◆ ipv4SetSubnetMask()
| error_t ipv4SetSubnetMask | ( | NetInterface * | interface, |
| Ipv4Addr | mask | ||
| ) |
◆ ipv4SetSubnetMaskEx()
| error_t ipv4SetSubnetMaskEx | ( | NetInterface * | interface, |
| uint_t | index, | ||
| Ipv4Addr | mask | ||
| ) |
