1 /***************************************************************************
2 * Copyright (c) 2024 Microsoft Corporation
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the MIT License which is available at
6 * https://opensource.org/licenses/MIT.
7 *
8 * SPDX-License-Identifier: MIT
9 **************************************************************************/
10
11
12 /**************************************************************************/
13 /**************************************************************************/
14 /** */
15 /** NetX Component */
16 /** */
17 /** User Datagram Protocol (UDP) */
18 /** */
19 /**************************************************************************/
20 /**************************************************************************/
21
22 #define NX_SOURCE_CODE
23
24
25 /* Include necessary system files. */
26
27 #include "nx_api.h"
28 #include "nx_udp.h"
29
30
31 /**************************************************************************/
32 /* */
33 /* FUNCTION RELEASE */
34 /* */
35 /* _nxe_udp_socket_receive_notify PORTABLE C */
36 /* 6.1 */
37 /* AUTHOR */
38 /* */
39 /* Yuxin Zhou, Microsoft Corporation */
40 /* */
41 /* DESCRIPTION */
42 /* */
43 /* This function checks for errors in the UDP socket receive notify */
44 /* function call. */
45 /* */
46 /* INPUT */
47 /* */
48 /* socket_ptr Pointer to UDP socket */
49 /* udp_receive_notify Routine to call when one or */
50 /* more received packets are */
51 /* available for the socket */
52 /* */
53 /* OUTPUT */
54 /* */
55 /* status Completion status */
56 /* */
57 /* CALLS */
58 /* */
59 /* _nx_udp_socket_receive_notify Actual socket receive notify */
60 /* function */
61 /* */
62 /* CALLED BY */
63 /* */
64 /* Application Code */
65 /* */
66 /* RELEASE HISTORY */
67 /* */
68 /* DATE NAME DESCRIPTION */
69 /* */
70 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
71 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
72 /* resulting in version 6.1 */
73 /* */
74 /**************************************************************************/
_nxe_udp_socket_receive_notify(NX_UDP_SOCKET * socket_ptr,VOID (* udp_receive_notify)(NX_UDP_SOCKET * socket_ptr))75 UINT _nxe_udp_socket_receive_notify(NX_UDP_SOCKET *socket_ptr,
76 VOID (*udp_receive_notify)(NX_UDP_SOCKET *socket_ptr))
77 {
78
79 UINT status;
80
81 /* Check for invalid input pointers. */
82 if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_udp_socket_id != NX_UDP_ID))
83 {
84 return(NX_PTR_ERROR);
85 }
86
87 /* Call actual socket receive notify function. */
88 status = _nx_udp_socket_receive_notify(socket_ptr, udp_receive_notify);
89
90 /* Return to caller. */
91 return(status);
92 }
93
94