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