Webserver+3d print

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

ipv4.h File Reference

ipv4.h File Reference

IPv4 (Internet Protocol Version 4) More...

Go to the source code of this file.

Data Structures

struct  _Ipv4Header
 IPv4 header. More...
struct  _Ipv4PseudoHeader
 IPv4 pseudo header. More...
struct  Ipv4FilterEntry
 IPv4 multicast filter entry. More...
struct  Ipv4Context
 IPv4 context. More...

Typedefs

typedef uint32_t Ipv4Addr
 IPv4 network address.

Enumerations

enum  Ipv4AddrScope
 

IPv4 address scopes.

More...
enum  Ipv4AddrState { IPV4_ADDR_STATE_INVALID = 0, IPV4_ADDR_STATE_TENTATIVE = 1, IPV4_ADDR_STATE_VALID = 2 }
 

IPv4 address state.

More...
enum  Ipv4FragmentOffset
 

IPv4 fragment offset field.

More...
enum  Ipv4Protocol
 

IPv4 protocol field.

More...
enum  Ipv4OptionType
 

IPv4 option types.

More...

Functions

error_t ipv4Init (NetInterface *interface)
 IPv4 related initialization.
error_t ipv4SetHostAddr (NetInterface *interface, Ipv4Addr addr)
 Assign host address.
error_t ipv4GetHostAddr (NetInterface *interface, Ipv4Addr *addr)
 Retrieve host address.
error_t ipv4SetSubnetMask (NetInterface *interface, Ipv4Addr mask)
 Configure subnet mask.
error_t ipv4GetSubnetMask (NetInterface *interface, Ipv4Addr *mask)
 Retrieve subnet mask.
error_t ipv4SetDefaultGateway (NetInterface *interface, Ipv4Addr addr)
 Configure default gateway.
error_t ipv4GetDefaultGateway (NetInterface *interface, Ipv4Addr *addr)
 Retrieve default gateway.
error_t ipv4SetDnsServer (NetInterface *interface, uint_t index, Ipv4Addr addr)
 Configure DNS server.
error_t ipv4GetDnsServer (NetInterface *interface, uint_t index, Ipv4Addr *addr)
 Retrieve DNS server.
error_t ipv4GetBroadcastAddr (NetInterface *interface, Ipv4Addr *addr)
 Get IPv4 broadcast address.
void ipv4LinkChangeEvent (NetInterface *interface)
 Callback function for link change event.
void ipv4ProcessPacket (NetInterface *interface, Ipv4Header *packet, size_t length)
 Incoming IPv4 packet processing.
void ipv4ProcessDatagram (NetInterface *interface, const NetBuffer *buffer)
 Incoming IPv4 datagram processing.
error_t ipv4SendDatagram (NetInterface *interface, Ipv4PseudoHeader *pseudoHeader, NetBuffer *buffer, size_t offset, uint8_t ttl)
 Send an IPv4 datagram.
error_t ipv4SendPacket (NetInterface *interface, Ipv4PseudoHeader *pseudoHeader, uint16_t fragId, size_t fragOffset, NetBuffer *buffer, size_t offset, uint8_t ttl)
 Send an IPv4 packet.
error_t ipv4CheckSourceAddr (NetInterface *interface, Ipv4Addr ipAddr)
 Source IPv4 address filtering.
error_t ipv4CheckDestAddr (NetInterface *interface, Ipv4Addr ipAddr)
 Destination IPv4 address filtering.
error_t ipv4SelectSourceAddr (NetInterface **interface, Ipv4Addr destAddr, Ipv4Addr *srcAddr)
 IPv4 source address selection.
bool_t ipv4IsBroadcastAddr (NetInterface *interface, Ipv4Addr ipAddr)
 Check whether an IPv4 address is a broadcast address.
uint_t ipv4GetAddrScope (Ipv4Addr ipAddr)
 Retrieve the scope of an IPv4 address.
error_t ipv4JoinMulticastGroup (NetInterface *interface, Ipv4Addr groupAddr)
 Join the specified host group.
error_t ipv4LeaveMulticastGroup (NetInterface *interface, Ipv4Addr groupAddr)
 Leave the specified host group.
error_t ipv4MapMulticastAddrToMac (Ipv4Addr ipAddr, MacAddr *macAddr)
 Map an host group address to a MAC-layer multicast address.
error_t ipv4StringToAddr (const char_t *str, Ipv4Addr *ipAddr)
 Convert a dot-decimal string to a binary IPv4 address.
char_t * ipv4AddrToString (Ipv4Addr ipAddr, char_t *str)
 Convert a binary IPv4 address to dot-decimal notation.
void ipv4DumpHeader (const Ipv4Header *ipHeader)
 Dump IPv4 header for debugging purpose.

Detailed Description

IPv4 (Internet Protocol Version 4)

License

Copyright (C) 2010-2017 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.7.6

Definition in file ipv4.h.


Typedef Documentation

typedef uint32_t Ipv4Addr

IPv4 network address.

Definition at line 225 of file ipv4.h.


Enumeration Type Documentation

IPv4 address scopes.

Definition at line 163 of file ipv4.h.

IPv4 address state.

Enumerator:
IPV4_ADDR_STATE_INVALID 

An address that is not assigned to any interface.

IPV4_ADDR_STATE_TENTATIVE 

An address whose uniqueness on a link is being verified.

IPV4_ADDR_STATE_VALID 

An address assigned to an interface whose use is unrestricted.

Definition at line 175 of file ipv4.h.

IPv4 fragment offset field.

Definition at line 187 of file ipv4.h.

IPv4 option types.

Definition at line 213 of file ipv4.h.

IPv4 protocol field.

Definition at line 200 of file ipv4.h.


Function Documentation

char_t* ipv4AddrToString ( Ipv4Addr  ipAddr,
char_t *  str 
)

Convert a binary IPv4 address to dot-decimal notation.

Parameters:
[in]ipAddrBinary representation of the IPv4 address
[out]strNULL-terminated string representing the IPv4 address
Returns:
Pointer to the formatted string

Definition at line 1534 of file ipv4.c.

error_t ipv4CheckDestAddr ( NetInterface *  interface,
Ipv4Addr  ipAddr 
)

Destination IPv4 address filtering.

Parameters:
[in]interfaceUnderlying network interface
[in]ipAddrDestination IPv4 address to be checked
Returns:
Error code

Definition at line 983 of file ipv4.c.

error_t ipv4CheckSourceAddr ( NetInterface *  interface,
Ipv4Addr  ipAddr 
)

Source IPv4 address filtering.

Parameters:
[in]interfaceUnderlying network interface
[in]ipAddrSource IPv4 address to be checked
Returns:
Error code

Definition at line 959 of file ipv4.c.

void ipv4DumpHeader ( const Ipv4Header *  ipHeader )

Dump IPv4 header for debugging purpose.

Parameters:
[in]ipHeaderPointer to the IPv4 header

Definition at line 1558 of file ipv4.c.

uint_t ipv4GetAddrScope ( Ipv4Addr  ipAddr )

Retrieve the scope of an IPv4 address.

Parameters:
[in]ipAddrIPv4 address
Returns:
IPv4 address scope

Definition at line 1203 of file ipv4.c.

error_t ipv4GetBroadcastAddr ( NetInterface *  interface,
Ipv4Addr addr 
)

Get IPv4 broadcast address.

Parameters:
[in]interfacePointer to the desired network interface
[out]addrIPv4 broadcast address

Definition at line 366 of file ipv4.c.

error_t ipv4GetDefaultGateway ( NetInterface *  interface,
Ipv4Addr addr 
)

Retrieve default gateway.

Parameters:
[in]interfacePointer to the desired network interface
[out]addrDefault gateway address
Returns:
Error code

Definition at line 273 of file ipv4.c.

error_t ipv4GetDnsServer ( NetInterface *  interface,
uint_t  index,
Ipv4Addr addr 
)

Retrieve DNS server.

Parameters:
[in]interfacePointer to the desired network interface
[in]indexThis parameter selects between the primary and secondary DNS server
[out]addrDNS server address
Returns:
Error code

Definition at line 333 of file ipv4.c.

error_t ipv4GetHostAddr ( NetInterface *  interface,
Ipv4Addr addr 
)

Retrieve host address.

Parameters:
[in]interfacePointer to the desired network interface
[out]addrIPv4 host address
Returns:
Error code

Definition at line 158 of file ipv4.c.

error_t ipv4GetSubnetMask ( NetInterface *  interface,
Ipv4Addr mask 
)

Retrieve subnet mask.

Parameters:
[in]interfacePointer to the desired network interface
[out]maskSubnet mask
Returns:
Error code

Definition at line 219 of file ipv4.c.

error_t ipv4Init ( NetInterface *  interface )

IPv4 related initialization.

Parameters:
[in]interfaceUnderlying network interface
Returns:
Error code

Definition at line 68 of file ipv4.c.

bool_t ipv4IsBroadcastAddr ( NetInterface *  interface,
Ipv4Addr  ipAddr 
)

Check whether an IPv4 address is a broadcast address.

Parameters:
[in]interfaceUnderlying network interface
[in]ipAddrIPv4 address to be checked
Returns:
TRUE if the IPv4 address is a broadcast address, else FALSE

Definition at line 1174 of file ipv4.c.

error_t ipv4JoinMulticastGroup ( NetInterface *  interface,
Ipv4Addr  groupAddr 
)

Join the specified host group.

Parameters:
[in]interfaceUnderlying network interface
[in]groupAddrIPv4 address identifying the host group to join
Returns:
Error code

Definition at line 1268 of file ipv4.c.

error_t ipv4LeaveMulticastGroup ( NetInterface *  interface,
Ipv4Addr  groupAddr 
)

Leave the specified host group.

Parameters:
[in]interfaceUnderlying network interface
[in]groupAddrIPv4 address identifying the host group to leave
Returns:
Error code

Definition at line 1353 of file ipv4.c.

void ipv4LinkChangeEvent ( NetInterface *  interface )

Callback function for link change event.

Parameters:
[in]interfaceUnderlying network interface

Definition at line 387 of file ipv4.c.

error_t ipv4MapMulticastAddrToMac ( Ipv4Addr  ipAddr,
MacAddr *  macAddr 
)

Map an host group address to a MAC-layer multicast address.

Parameters:
[in]ipAddrIPv4 host group address
[out]macAddrCorresponding MAC-layer multicast address
Returns:
Error code

Definition at line 1415 of file ipv4.c.

void ipv4ProcessDatagram ( NetInterface *  interface,
const NetBuffer buffer 
)

Incoming IPv4 datagram processing.

Parameters:
[in]interfaceUnderlying network interface
[in]bufferMulti-part buffer that holds the incoming IPv4 datagram

Definition at line 577 of file ipv4.c.

void ipv4ProcessPacket ( NetInterface *  interface,
Ipv4Header *  packet,
size_t  length 
)

Incoming IPv4 packet processing.

Parameters:
[in]interfaceUnderlying network interface
[in]packetIncoming IPv4 packet
[in]lengthPacket length including header and payload

Definition at line 431 of file ipv4.c.

error_t ipv4SelectSourceAddr ( NetInterface **  interface,
Ipv4Addr  destAddr,
Ipv4Addr srcAddr 
)

IPv4 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]interfaceA pointer to a valid network interface may be provided as a hint. The function returns a pointer identifying the interface to be used
[in]destAddrDestination IPv4 address
[out]srcAddrLocal IPv4 address to be used
Returns:
Error code

Definition at line 1055 of file ipv4.c.

error_t ipv4SendDatagram ( NetInterface *  interface,
Ipv4PseudoHeader *  pseudoHeader,
NetBuffer buffer,
size_t  offset,
uint8_t  ttl 
)

Send an IPv4 datagram.

Parameters:
[in]interfaceUnderlying network interface
[in]pseudoHeaderIPv4 pseudo header
[in]bufferMulti-part buffer containing the payload
[in]offsetOffset to the first byte of the payload
[in]ttlTTL value. Default Time-To-Live is used when this parameter is zero
Returns:
Error code

Definition at line 718 of file ipv4.c.

error_t ipv4SendPacket ( NetInterface *  interface,
Ipv4PseudoHeader *  pseudoHeader,
uint16_t  fragId,
size_t  fragOffset,
NetBuffer buffer,
size_t  offset,
uint8_t  ttl 
)

Send an IPv4 packet.

Parameters:
[in]interfaceUnderlying network interface
[in]pseudoHeaderIPv4 pseudo header
[in]fragIdFragment identification field
[in]fragOffsetFragment offset field
[in]bufferMulti-part buffer containing the payload
[in]offsetOffset to the first byte of the payload
[in]ttlTime-To-Live value
Returns:
Error code

Definition at line 782 of file ipv4.c.

error_t ipv4SetDefaultGateway ( NetInterface *  interface,
Ipv4Addr  addr 
)

Configure default gateway.

Parameters:
[in]interfacePointer to the desired network interface
[in]addrDefault gateway address
Returns:
Error code

Definition at line 244 of file ipv4.c.

error_t ipv4SetDnsServer ( NetInterface *  interface,
uint_t  index,
Ipv4Addr  addr 
)

Configure DNS server.

Parameters:
[in]interfacePointer to the desired network interface
[in]indexThis parameter selects between the primary and secondary DNS server
[in]addrDNS server address
Returns:
Error code

Definition at line 299 of file ipv4.c.

error_t ipv4SetHostAddr ( NetInterface *  interface,
Ipv4Addr  addr 
)

Assign host address.

Parameters:
[in]interfacePointer to the desired network interface
[in]addrIPv4 host address
Returns:
Error code

Definition at line 108 of file ipv4.c.

error_t ipv4SetSubnetMask ( NetInterface *  interface,
Ipv4Addr  mask 
)

Configure subnet mask.

Parameters:
[in]interfacePointer to the desired network interface
[in]maskSubnet mask
Returns:
Error code

Definition at line 194 of file ipv4.c.

error_t ipv4StringToAddr ( const char_t *  str,
Ipv4Addr ipAddr 
)

Convert a dot-decimal string to a binary IPv4 address.

Parameters:
[in]strNULL-terminated string representing the IPv4 address
[out]ipAddrBinary representation of the IPv4 address
Returns:
Error code

Definition at line 1449 of file ipv4.c.