Rev 1249 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1249 | Rev 1251 | ||
---|---|---|---|
Line 12... | Line 12... | ||
12 | ;; GNU GENERAL PUBLIC LICENSE ;; |
12 | ;; GNU GENERAL PUBLIC LICENSE ;; |
13 | ;; Version 2, June 1991 ;; |
13 | ;; Version 2, June 1991 ;; |
14 | ;; ;; |
14 | ;; ;; |
15 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
15 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 16... | Line 16... | ||
16 | 16 | ||
Line 17... | Line 17... | ||
17 | $Revision: 1249 $ |
17 | $Revision: 1251 $ |
18 | 18 | ||
19 | 19 | ||
Line 208... | Line 208... | ||
208 | sub esp, 8 ; reserve some place in stack for later |
208 | sub esp, 8 ; reserve some place in stack for later |
Line 209... | Line 209... | ||
209 | 209 | ||
210 | ; Create the pseudoheader in stack, |
210 | ; Create the pseudoheader in stack, |
211 | ; (now that we still have all the variables that are needed.) |
211 | ; (now that we still have all the variables that are needed.) |
212 | push dword IP_PROTO_UDP shl 8 |
- | |
213 | push eax |
- | |
Line 214... | Line 212... | ||
214 | push ebx |
212 | push dword IP_PROTO_UDP shl 8 |
Line 215... | Line 213... | ||
215 | 213 | ||
Line 216... | Line 214... | ||
216 | add ecx, UDP_Packet.Data |
214 | add ecx, UDP_Packet.Data |
217 | 215 | ||
218 | ; TODO: fill in: dx = fragment id |
216 | ; TODO: fill in: dx = fragment id |
219 | 217 | ||
Line 220... | Line 218... | ||
220 | push edx esi |
218 | push edx esi |
221 | call IPv4_create_packet ; TODO: figure out a way to choose between IPv4 and IPv6 |
219 | call IPv4_create_packet ; TODO: figure out a way to choose between IPv4 and IPv6 |
Line 222... | Line 220... | ||
222 | cmp edi, -1 |
220 | cmp edi, -1 |
223 | je .fail |
221 | je .fail |
224 | 222 | ||
225 | mov [esp + 8 + 12], eax ; pointer to buffer start |
223 | mov [esp + 8 + 4], eax ; pointer to buffer start |
Line 226... | Line 224... | ||
226 | mov [esp + 8 + 12 + 4], edx ; buffer size |
224 | mov [esp + 8 + 4 + 4], edx ; buffer size |
227 | 225 | ||
228 | rol cx, 8 |
226 | rol cx, 8 |
229 | mov [edi + UDP_Packet.Length], cx |
227 | mov [edi + UDP_Packet.Length], cx |
230 | mov [esp + 8 + 10], cx |
228 | mov [esp + 8 + 2], cx |
231 | ror cx, 8 |
229 | ror cx, 8 |
232 | 230 | ||
233 | pop esi |
231 | pop esi |
234 | push edi ecx |
232 | push edi ecx |
235 | sub ecx, UDP_Packet.Data |
233 | sub ecx, UDP_Packet.Data |
Line 236... | Line 234... | ||
236 | add edi, UDP_Packet.Data |
234 | add edi, UDP_Packet.Data |
237 | shr ecx, 2 |
235 | shr ecx, 2 |
Line 247... | Line 245... | ||
247 | ; Checksum for UDP header + data |
245 | ; Checksum for UDP header + data |
248 | xor edx, edx |
246 | xor edx, edx |
249 | mov esi, edi |
247 | mov esi, edi |
250 | call checksum_1 |
248 | call checksum_1 |
251 | ; Checksum for pseudoheader |
249 | ; Checksum for pseudoheader |
- | 250 | pushd [edi-4] ; destination address |
|
- | 251 | pushd [edi-8] ; source address |
|
252 | mov ecx, 12 |
252 | mov ecx, 12 |
253 | mov esi, esp |
253 | mov esi, esp |
254 | call checksum_1 |
254 | call checksum_1 |
255 | add esp, 12 ; remove the pseudoheader from stack |
255 | add esp, 12 ; remove the pseudoheader from stack |
256 | ; Now create the final checksum and store it in UDP header |
256 | ; Now create the final checksum and store it in UDP header |