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 /**   Internet Control Message Protocol (ICMP)                            */
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_icmp.h"
30 
31 /**************************************************************************/
32 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _nx_icmp_enable                                     PORTABLE C      */
36 /*                                                           6.1          */
37 /*  AUTHOR                                                                */
38 /*                                                                        */
39 /*    Yuxin Zhou, Microsoft Corporation                                   */
40 /*                                                                        */
41 /*  DESCRIPTION                                                           */
42 /*                                                                        */
43 /*    This function enables the ICMP management component for the         */
44 /*    specified IP instance.                                              */
45 /*                                                                        */
46 /*  INPUT                                                                 */
47 /*                                                                        */
48 /*    ip_ptr                                IP instance pointer           */
49 /*                                                                        */
50 /*  OUTPUT                                                                */
51 /*                                                                        */
52 /*    status                                Completion status             */
53 /*                                                                        */
54 /*  CALLS                                                                 */
55 /*                                                                        */
56 /*    None                                                                */
57 /*                                                                        */
58 /*  CALLED BY                                                             */
59 /*                                                                        */
60 /*    Application Code                                                    */
61 /*                                                                        */
62 /*  RELEASE HISTORY                                                       */
63 /*                                                                        */
64 /*    DATE              NAME                      DESCRIPTION             */
65 /*                                                                        */
66 /*  05-19-2020     Yuxin Zhou               Initial Version 6.0           */
67 /*  09-30-2020     Yuxin Zhou               Modified comment(s),          */
68 /*                                            resulting in version 6.1    */
69 /*                                                                        */
70 /**************************************************************************/
_nx_icmp_enable(NX_IP * ip_ptr)71 UINT  _nx_icmp_enable(NX_IP *ip_ptr)
72 {
73 
74 #ifndef NX_DISABLE_IPV4
75     /* If trace is enabled, insert this event into the trace buffer.  */
76     NX_TRACE_IN_LINE_INSERT(NX_TRACE_ICMP_ENABLE, ip_ptr, 0, 0, 0, NX_TRACE_ICMP_EVENTS, 0, 0);
77 
78     /* Setup the ICMP packet queue processing routine.  */
79     ip_ptr -> nx_ip_icmp_queue_process =  _nx_icmp_queue_process;
80 
81     /* Setup the ICMP packet receiving routine, thereby enabling ICMP traffic.  */
82     ip_ptr -> nx_ip_icmp_packet_receive =  _nx_icmp_packet_receive;
83 
84     /* Setup the ICMPv4 packet process routine */
85     ip_ptr -> nx_ip_icmpv4_packet_process = _nx_icmpv4_packet_process;
86 
87     /* Return a successful status!  */
88     return(NX_SUCCESS);
89 #else /* NX_DISABLE_IPV4  */
90     NX_PARAMETER_NOT_USED(ip_ptr);
91 
92     return(NX_NOT_SUPPORTED);
93 #endif /* !NX_DISABLE_IPV4  */
94 }
95 
96