1
10
13
14
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
115
116
117
118
119
120
121
123
124
125
126
127
128
129
130
131
132
...
...
...
#define NX_SOURCE_CODE
#include "nx_api.h"
#include "nx_packet.h"
...
...
UINT _nx_packet_data_retrieve(NX_PACKET *packet_ptr, VOID *buffer_start, ULONG *bytes_copied)
{
ULONG remaining_bytes;
UCHAR *destination_ptr;
ULONG bytes_to_copy;
NX_TRACE_IN_LINE_INSERT(NX_TRACE_PACKET_DATA_RETRIEVE, packet_ptr, buffer_start, bytes_copied, 0, NX_TRACE_PACKET_EVENTS, 0, 0);
destination_ptr = buffer_start;
*bytes_copied = packet_ptr -> nx_packet_length;
remaining_bytes = packet_ptr -> nx_packet_length;
#ifndef NX_DISABLE_PACKET_CHAIN
while (packet_ptr)
{
#endif
bytes_to_copy = (ULONG)(packet_ptr -> nx_packet_append_ptr - packet_ptr -> nx_packet_prepend_ptr);
memcpy(destination_ptr, packet_ptr -> nx_packet_prepend_ptr, bytes_to_copy);
remaining_bytes -= bytes_to_copy;
destination_ptr += bytes_to_copy;
#ifndef NX_DISABLE_PACKET_CHAIN
packet_ptr = packet_ptr -> nx_packet_next;
}/* ... */
while (packet_ptr) { ... }#endif
if (remaining_bytes)
{
/* ... */
*bytes_copied = *bytes_copied - remaining_bytes;
return(NX_INVALID_PACKET);
}if (remaining_bytes) { ... }
return(NX_SUCCESS);
}{ ... }