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 /**   Internet Protocol (IP)                                              */
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_ip.h"
29 
30 /* Bring in externs for caller checking code.  */
31 
32 NX_CALLER_CHECKING_EXTERNS
33 
34 /**************************************************************************/
35 /*                                                                        */
36 /*  FUNCTION                                               RELEASE        */
37 /*                                                                        */
38 /*    _nxe_ip_link_status_change_notify_set                PORTABLE C     */
39 /*                                                           6.1          */
40 /*  AUTHOR                                                                */
41 /*                                                                        */
42 /*    Yuxin Zhou, Microsoft Corporation                                   */
43 /*                                                                        */
44 /*  DESCRIPTION                                                           */
45 /*                                                                        */
46 /*    This function is the error handling service for the link status     */
47 /*    change callback setting function.                                   */
48 /*                                                                        */
49 /*                                                                        */
50 /*  INPUT                                                                 */
51 /*                                                                        */
52 /*    ip_ptr                                Pointer to IP instance        */
53 /*    link_status_change_notify             Routine to call when link     */
54 /*                                            staus is change             */
55 /*                                                                        */
56 /*  OUTPUT                                                                */
57 /*                                                                        */
58 /*    status                                Actual completion status      */
59 /*                                                                        */
60 /*  CALLS                                                                 */
61 /*                                                                        */
62 /*    _nx_ip_link_status_change_notify_set  Actual callback set function  */
63 /*                                                                        */
64 /*  CALLED BY                                                             */
65 /*                                                                        */
66 /*    Application Code                                                    */
67 /*                                                                        */
68 /*  RELEASE HISTORY                                                       */
69 /*                                                                        */
70 /*    DATE              NAME                      DESCRIPTION             */
71 /*                                                                        */
72 /*  05-19-2020     Yuxin Zhou               Initial Version 6.0           */
73 /*  09-30-2020     Yuxin Zhou               Modified comment(s),          */
74 /*                                            resulting in version 6.1    */
75 /*                                                                        */
76 /**************************************************************************/
_nxe_ip_link_status_change_notify_set(NX_IP * ip_ptr,VOID (* link_status_change_notify)(NX_IP * ip_ptr,UINT interface_index,UINT link_up))77 UINT  _nxe_ip_link_status_change_notify_set(NX_IP *ip_ptr,  VOID (*link_status_change_notify)(NX_IP *ip_ptr, UINT interface_index, UINT link_up))
78 {
79 UINT status;
80 
81     if ((ip_ptr == NX_NULL) || (link_status_change_notify == NX_NULL))
82     {
83         return(NX_PTR_ERROR);
84     }
85 
86     /* Check for appropriate caller.  */
87     NX_INIT_AND_THREADS_CALLER_CHECKING
88 
89     status = _nx_ip_link_status_change_notify_set(ip_ptr, link_status_change_notify);
90 
91     return(status);
92 }
93 
94