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
31 /**************************************************************************/
32 /* */
33 /* FUNCTION RELEASE */
34 /* */
35 /* _nx_ip_fragment_enable PORTABLE C */
36 /* 6.1 */
37 /* AUTHOR */
38 /* */
39 /* Yuxin Zhou, Microsoft Corporation */
40 /* */
41 /* DESCRIPTION */
42 /* */
43 /* This function enables the IP fragment processing by setting up the */
44 /* function pointers responsible for fragmenting and unfragmenting IP */
45 /* packets. */
46 /* */
47 /* INPUT */
48 /* */
49 /* ip_ptr Pointer to IP instance */
50 /* */
51 /* OUTPUT */
52 /* */
53 /* status Completion status */
54 /* */
55 /* CALLS */
56 /* */
57 /* None */
58 /* */
59 /* CALLED BY */
60 /* */
61 /* Application */
62 /* */
63 /* RELEASE HISTORY */
64 /* */
65 /* DATE NAME DESCRIPTION */
66 /* */
67 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
68 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
69 /* resulting in version 6.1 */
70 /* */
71 /**************************************************************************/
_nx_ip_fragment_enable(NX_IP * ip_ptr)72 UINT _nx_ip_fragment_enable(NX_IP *ip_ptr)
73 {
74 #ifndef NX_DISABLE_FRAGMENTATION
75 TX_INTERRUPT_SAVE_AREA
76
77 /* If trace is enabled, insert this event into the trace buffer. */
78 NX_TRACE_IN_LINE_INSERT(NX_TRACE_IP_FRAGMENT_ENABLE, ip_ptr, 0, 0, 0, NX_TRACE_IP_EVENTS, 0, 0);
79
80 /* Disable interrupts temporarily. */
81 TX_DISABLE
82
83 /* Setup the IP fragment processing routine pointer. */
84 ip_ptr -> nx_ip_fragment_processing = _nx_ip_fragment_packet;
85
86 /* Setup the IP fragment assembly routine pointer. */
87 ip_ptr -> nx_ip_fragment_assembly = _nx_ip_fragment_assembly;
88
89 /* Setup the IP fragment timeout routine pointer. */
90 ip_ptr -> nx_ip_fragment_timeout_check = _nx_ip_fragment_timeout_check;
91
92 /* Restore interrupts. */
93 TX_RESTORE
94
95 /* Return success to the caller. */
96 return(NX_SUCCESS);
97
98 #else /* NX_DISABLE_FRAGMENTATION */
99 NX_PARAMETER_NOT_USED(ip_ptr);
100
101 return(NX_NOT_ENABLED);
102
103 #endif /* NX_DISABLE_FRAGMENTATION */
104 }
105
106