Helper functions for sockets. More...
Go to the source code of this file.
Functions | |
Socket * | socketAllocate (uint_t type, uint_t protocol) |
Allocate a socket. More... | |
void | socketRegisterEvents (Socket *socket, OsEvent *event, uint_t eventMask) |
Subscribe to the specified socket events. More... | |
void | socketUnregisterEvents (Socket *socket) |
Unsubscribe previously registered events. More... | |
uint_t | socketGetEvents (Socket *socket) |
Retrieve event flags for a specified socket. More... | |
bool_t | socketMulticastFilter (Socket *socket, const IpAddr *destAddr, const IpAddr *srcAddr) |
Filter out incoming multicast traffic. More... | |
SocketMulticastGroup * | socketCreateMulticastGroupEntry (Socket *socket, const IpAddr *groupAddr) |
Create a new multicast group. More... | |
SocketMulticastGroup * | socketFindMulticastGroupEntry (Socket *socket, const IpAddr *groupAddr) |
Search the list of multicast groups for a given group address. More... | |
void | socketDeleteMulticastGroupEntry (SocketMulticastGroup *group) |
Delete a multicast group. More... | |
error_t | socketAddMulticastSrcAddr (SocketMulticastGroup *group, const IpAddr *srcAddr) |
Add an address to the multicast source filter. More... | |
void | socketRemoveMulticastSrcAddr (SocketMulticastGroup *group, const IpAddr *srcAddr) |
Remove an address from the multicast source filter. More... | |
int_t | socketFindMulticastSrcAddr (SocketMulticastGroup *group, const IpAddr *srcAddr) |
Search the list of multicast sources for a given IP address. More... | |
Detailed Description
Helper functions for sockets.
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 socket_misc.h.
Function Documentation
◆ socketAddMulticastSrcAddr()
error_t socketAddMulticastSrcAddr | ( | SocketMulticastGroup * | group, |
const IpAddr * | srcAddr | ||
) |
Add an address to the multicast source filter.
- Parameters
-
[in] group Pointer to the multicast group [in] srcAddr IP address to be added to the list
- Returns
- Error code
Definition at line 485 of file socket_misc.c.
◆ socketAllocate()
Allocate a socket.
- Parameters
-
[in] type Type specification for the new socket [in] protocol Protocol to be used
- Returns
- Handle referencing the new socket
Definition at line 52 of file socket_misc.c.
◆ socketCreateMulticastGroupEntry()
SocketMulticastGroup* socketCreateMulticastGroupEntry | ( | Socket * | socket, |
const IpAddr * | groupAddr | ||
) |
Create a new multicast group.
- Parameters
-
[in] socket Handle to a socket [in] groupAddr IP address identifying a multicast group
- Returns
- Pointer to the newly created multicast group
Definition at line 386 of file socket_misc.c.
◆ socketDeleteMulticastGroupEntry()
void socketDeleteMulticastGroupEntry | ( | SocketMulticastGroup * | group | ) |
Delete a multicast group.
- Parameters
-
[in] group Pointer to the multicast group
Definition at line 471 of file socket_misc.c.
◆ socketFindMulticastGroupEntry()
SocketMulticastGroup* socketFindMulticastGroupEntry | ( | Socket * | socket, |
const IpAddr * | groupAddr | ||
) |
Search the list of multicast groups for a given group address.
- Parameters
-
[in] socket Handle to a socket [in] groupAddr IP address identifying a multicast group
- Returns
- A pointer to the matching multicast group is returned. NULL is returned if the specified group address cannot be found
Definition at line 435 of file socket_misc.c.
◆ socketFindMulticastSrcAddr()
int_t socketFindMulticastSrcAddr | ( | SocketMulticastGroup * | group, |
const IpAddr * | srcAddr | ||
) |
Search the list of multicast sources for a given IP address.
- Parameters
-
[in] socket Handle to a socket [in] srcAddr Source IP address
- Returns
- Index of the matching IP address is returned. -1 is returned if the specified IP address cannot be found
Definition at line 564 of file socket_misc.c.
◆ socketGetEvents()
Retrieve event flags for a specified socket.
- Parameters
-
[in] socket Handle that identifies a socket
- Returns
- Logic OR of events in the signaled state
Definition at line 273 of file socket_misc.c.
◆ socketMulticastFilter()
Filter out incoming multicast traffic.
- Parameters
-
[in] socket Handle that identifies a socket [in] destAddr Destination IP address of the received packet [in] srcAddr Source IP address of the received packet
- Returns
- Return TRUE if the multicast packet should be accepted, else FALSE
Definition at line 308 of file socket_misc.c.
◆ socketRegisterEvents()
Subscribe to the specified socket events.
- Parameters
-
[in] socket Handle that identifies a socket [in] event Event object used to receive notifications [in] eventMask Logic OR of the requested socket events
Definition at line 195 of file socket_misc.c.
◆ socketRemoveMulticastSrcAddr()
void socketRemoveMulticastSrcAddr | ( | SocketMulticastGroup * | group, |
const IpAddr * | srcAddr | ||
) |
Remove an address from the multicast source filter.
- Parameters
-
[in] group Pointer to the multicast group [in] srcAddr IP address to be removed from the list
Definition at line 526 of file socket_misc.c.
◆ socketUnregisterEvents()
void socketUnregisterEvents | ( | Socket * | socket | ) |
Unsubscribe previously registered events.
- Parameters
-
[in] socket Handle that identifies a socket
Definition at line 250 of file socket_misc.c.