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
101
102
103
107
108
109
113
114
115
119
120
121
122
126
127
128
129
133
134
135
136
137
138
139
140
141
149
150
151
152
153
159
160
161
...
...
...
#define NX_SOURCE_CODE
#include "nx_api.h"
#include "nx_ip.h"
#include "nx_packet.h"
NX_CALLER_CHECKING_EXTERNS
...
...
UINT _nxe_ip_raw_packet_send(NX_IP *ip_ptr, NX_PACKET **packet_ptr_ptr,
ULONG destination_ip, ULONG type_of_service)
{
#ifndef NX_DISABLE_IPV4
UINT status;
NX_PACKET *packet_ptr;
packet_ptr = *packet_ptr_ptr;
if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID) ||
(packet_ptr == NX_NULL) || (packet_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next != ((NX_PACKET *)NX_PACKET_ALLOCATED)))
{
return(NX_PTR_ERROR);
}if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID) || (packet_ptr == NX_NULL) || (packet_ptr -> nx_packet_union_next.nx_packet_tcp_queue_next != ((NX_PACKET *)NX_PACKET_ALLOCATED))) { ... }
if (!ip_ptr -> nx_ip_raw_ip_processing)
{
return(NX_NOT_ENABLED);
}if (!ip_ptr -> nx_ip_raw_ip_processing) { ... }
if (!destination_ip)
{
return(NX_IP_ADDRESS_ERROR);
}if (!destination_ip) { ... }
if (type_of_service & ~(NX_IP_TOS_MASK))
{
return(NX_OPTION_ERROR);
}if (type_of_service & ~(NX_IP_TOS_MASK)) { ... }
if ((packet_ptr -> nx_packet_prepend_ptr - sizeof(NX_IPV4_HEADER)) < packet_ptr -> nx_packet_data_start)
{
return(NX_UNDERFLOW);
}if ((packet_ptr -> nx_packet_prepend_ptr - sizeof(NX_IPV4_HEADER)) < packet_ptr -> nx_packet_data_start) { ... }
if (packet_ptr -> nx_packet_append_ptr > packet_ptr -> nx_packet_data_end)
{
return(NX_OVERFLOW);
}if (packet_ptr -> nx_packet_append_ptr > packet_ptr -> nx_packet_data_end) { ... }
NX_THREADS_ONLY_CALLER_CHECKING
status = _nx_ip_raw_packet_send(ip_ptr, packet_ptr, destination_ip, type_of_service);
if (status == NX_SUCCESS)
{
/* ... */
*packet_ptr_ptr = NX_NULL;
}if (status == NX_SUCCESS) { ... }
return(status);/* ... */
#else
NX_PARAMETER_NOT_USED(ip_ptr);
NX_PARAMETER_NOT_USED(packet_ptr_ptr);
NX_PARAMETER_NOT_USED(destination_ip);
NX_PARAMETER_NOT_USED(type_of_service);
return(NX_NOT_SUPPORTED);/* ... */
#endif
}{ ... }