Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
udp.c File Reference
UDP (User Datagram Protocol) More...
Go to the source code of this file.
Functions | |
error_t | udpInit (void) |
UDP related initialization. | |
uint16_t | udpGetDynamicPort (void) |
Get an ephemeral port number. | |
error_t | udpProcessDatagram (NetInterface *interface, IpPseudoHeader *pseudoHeader, const NetBuffer *buffer, size_t offset) |
Incoming UDP datagram processing. | |
error_t | udpSendDatagram (Socket *socket, const IpAddr *destIpAddr, uint16_t destPort, const void *data, size_t length, size_t *written) |
Send a UDP datagram. | |
error_t | udpSendDatagramEx (NetInterface *interface, uint16_t srcPort, const IpAddr *destIpAddr, uint16_t destPort, NetBuffer *buffer, size_t offset, uint8_t ttl) |
Send a UDP datagram (raw interface) | |
error_t | udpReceiveDatagram (Socket *socket, IpAddr *srcIpAddr, uint16_t *srcPort, IpAddr *destIpAddr, void *data, size_t size, size_t *received, uint_t flags) |
Receive data from a UDP socket. | |
NetBuffer * | udpAllocBuffer (size_t length, size_t *offset) |
Allocate a buffer to hold a UDP packet. | |
void | udpUpdateEvents (Socket *socket) |
Update UDP related events. | |
error_t | udpAttachRxCallback (NetInterface *interface, uint16_t port, UdpRxCallback callback, void *params) |
Register user callback. | |
error_t | udpDetachRxCallback (NetInterface *interface, uint16_t port) |
Unregister user callback. | |
error_t | udpInvokeRxCallback (NetInterface *interface, const IpPseudoHeader *pseudoHeader, const UdpHeader *header, const NetBuffer *buffer, size_t offset) |
Invoke user callback. | |
void | udpDumpHeader (const UdpHeader *datagram) |
Dump UDP header for debugging purpose. |
Detailed Description
UDP (User Datagram Protocol)
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.
- Version:
- 1.7.6
Definition in file udp.c.
Function Documentation
NetBuffer* udpAllocBuffer | ( | size_t | length, |
size_t * | offset | ||
) |
error_t udpAttachRxCallback | ( | NetInterface * | interface, |
uint16_t | port, | ||
UdpRxCallback | callback, | ||
void * | params | ||
) |
error_t udpDetachRxCallback | ( | NetInterface * | interface, |
uint16_t | port | ||
) |
void udpDumpHeader | ( | const UdpHeader * | datagram ) |
uint16_t udpGetDynamicPort | ( | void | ) |
error_t udpInit | ( | void | ) |
error_t udpInvokeRxCallback | ( | NetInterface * | interface, |
const IpPseudoHeader * | pseudoHeader, | ||
const UdpHeader * | header, | ||
const NetBuffer * | buffer, | ||
size_t | offset | ||
) |
error_t udpProcessDatagram | ( | NetInterface * | interface, |
IpPseudoHeader * | pseudoHeader, | ||
const NetBuffer * | buffer, | ||
size_t | offset | ||
) |
error_t udpReceiveDatagram | ( | Socket * | socket, |
IpAddr * | srcIpAddr, | ||
uint16_t * | srcPort, | ||
IpAddr * | destIpAddr, | ||
void * | data, | ||
size_t | size, | ||
size_t * | received, | ||
uint_t | flags | ||
) |
Receive data from a UDP socket.
- Parameters:
-
[in] socket Handle referencing the socket [out] srcIpAddr Source IP address (optional) [out] srcPort Source port number (optional) [out] destIpAddr Destination IP address (optional) [out] data Buffer where to store the incoming data [in] size Maximum number of bytes that can be received [out] received Number of bytes that have been received [in] flags Set of flags that influences the behavior of this function
- Returns:
- Error code
error_t udpSendDatagram | ( | Socket * | socket, |
const IpAddr * | destIpAddr, | ||
uint16_t | destPort, | ||
const void * | data, | ||
size_t | length, | ||
size_t * | written | ||
) |
Send a UDP datagram.
- Parameters:
-
[in] socket Handle referencing the socket [in] destIpAddr IP address of the target host [in] destPort Target port number [in] data Pointer to data payload [in] length Length of the payload data [out] written Actual number of bytes written (optional parameter)
- Returns:
- Error code
error_t udpSendDatagramEx | ( | NetInterface * | interface, |
uint16_t | srcPort, | ||
const IpAddr * | destIpAddr, | ||
uint16_t | destPort, | ||
NetBuffer * | buffer, | ||
size_t | offset, | ||
uint8_t | ttl | ||
) |
Send a UDP datagram (raw interface)
- Parameters:
-
[in] interface Underlying network interface [in] srcPort Source port [in] destIpAddr IP address of the target host [in] destPort Target port number [in] buffer Multi-part buffer containing the payload [in] offset Offset to the first payload byte [in] ttl TTL value. Default Time-To-Live is used when this parameter is zero
- Returns:
- Error code
Generated on Tue Jul 12 2022 17:10:23 by
