Subversion Repositories Kolibri OS

Rev

Rev 5984 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5984 Rev 6078
Line 14... Line 14...
14
;;          GNU GENERAL PUBLIC LICENSE                             ;;
14
;;          GNU GENERAL PUBLIC LICENSE                             ;;
15
;;             Version 2, June 1991                                ;;
15
;;             Version 2, June 1991                                ;;
16
;;                                                                 ;;
16
;;                                                                 ;;
17
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 18... Line 18...
18
 
18
 
Line 19... Line 19...
19
$Revision: 5984 $
19
$Revision: 6078 $
Line 20... Line 20...
20
 
20
 
Line 83... Line 83...
83
ICMP_PHOTURIS_UNKNOWN_INDEX     = 1                ; unknown sec index
83
ICMP_PHOTURIS_UNKNOWN_INDEX     = 1             ; unknown sec index
84
ICMP_PHOTURIS_AUTH_FAILED       = 2                ; auth failed
84
ICMP_PHOTURIS_AUTH_FAILED       = 2             ; auth failed
85
ICMP_PHOTURIS_DECRYPT_FAILED    = 3                ; decrypt failed
85
ICMP_PHOTURIS_DECRYPT_FAILED    = 3             ; decrypt failed
Line 86... Line -...
86
 
-
 
87
 
86
 
Line 88... Line 87...
88
 
87
 
89
struct  ICMP_header
88
struct  ICMP_header
90
 
89
 
Line 105... Line 104...
105
 
104
 
Line 106... Line 105...
106
endg
105
endg
107
 
-
 
-
 
106
 
108
 
107
 
109
 
-
 
-
 
108
 
110
;-----------------------------------------------------------------
109
;-----------------------------------------------------------------;
Line 111... Line 110...
111
;
110
;                                                                 ;
Line 112... Line 111...
112
; ICMP_init
111
; ICMP_init                                                       ;
113
;
112
;                                                                 ;
114
;-----------------------------------------------------------------
113
;-----------------------------------------------------------------;
115
 
114
 
Line 116... Line 115...
116
macro ICMP_init {
115
macro icmp_init {
Line 117... Line 116...
117
 
116
 
118
        xor     eax, eax
-
 
119
        mov     edi, ICMP_PACKETS_TX
117
        xor     eax, eax
120
        mov     ecx, 2*NET_DEVICES_MAX
-
 
121
        rep stosd
118
        mov     edi, ICMP_PACKETS_TX
122
 
119
        mov     ecx, 2*NET_DEVICES_MAX
123
}
-
 
-
 
120
        rep stosd
124
 
121
 
125
 
122
}
126
;-----------------------------------------------------------------
123
 
127
;
124
 
128
; ICMP_input:
125
;-----------------------------------------------------------------;
129
;
126
;                                                                 ;
130
;  This procedure will send reply's to ICMP echo's
-
 
-
 
127
; icmp_input: Send a reply's to an ICMP echo or insert packets    ;
131
;   and insert packets into sockets when needed
128
; into socket.                                                    ;
132
;
-
 
-
 
129
;                                                                 ;
133
;  IN:  Pointer to buffer in [esp]
130
;  IN:  [esp] = ptr to buffer                                     ;
134
;       ebx = pointer to device struct
131
;       ebx = ptr to device struct                                ;
135
;       ecx = ICMP Packet size
132
;       ecx = ICMP Packet size                                    ;
Line 136... Line 133...
136
;       edx = ptr to IPv4 header
133
;       edx = ptr to IPv4 header                                  ;
Line 137... Line 134...
137
;       esi = ptr to ICMP Packet data
134
;       esi = ptr to ICMP Packet data                             ;
138
;       edi = interface number*4
135
;       edi = interface number*4                                  ;
Line 202... Line 199...
202
        pusha
199
        pusha
203
        lea     ecx, [eax + SOCKET.mutex]
200
        lea     ecx, [eax + SOCKET.mutex]
204
        call    mutex_lock
201
        call    mutex_lock
205
        popa
202
        popa
Line 206... Line 203...
206
 
203
 
Line 207... Line 204...
207
        jmp     SOCKET_input
204
        jmp     socket_input
Line 272... Line 269...
272
        DEBUGF  DEBUG_NETWORK_VERBOSE, "ICMP transmitting reply\n"
269
        DEBUGF  DEBUG_NETWORK_VERBOSE, "ICMP transmitting reply\n"
273
        call    [ebx + NET_DEVICE.transmit]
270
        call    [ebx + NET_DEVICE.transmit]
274
        test    eax, eax
271
        test    eax, eax
275
        jnz     @f
272
        jnz     @f
276
        DEBUGF  DEBUG_NETWORK_VERBOSE, "ICMP transmit failed\n"
273
        DEBUGF  DEBUG_NETWORK_VERBOSE, "ICMP transmit failed\n"
277
        call    NET_ptr_to_num4
274
        call    net_ptr_to_num4
278
        inc     [ICMP_PACKETS_TX + edi]
275
        inc     [ICMP_PACKETS_TX + edi]
279
       @@:
276
       @@:
280
        ret
277
        ret
Line 281... Line 278...
281
 
278
 
Line 291... Line 288...
291
  .checksum_mismatch:
288
  .checksum_mismatch:
292
        DEBUGF  DEBUG_NETWORK_ERROR, "ICMP_input: checksum mismatch\n"
289
        DEBUGF  DEBUG_NETWORK_ERROR, "ICMP_input: checksum mismatch\n"
Line 293... Line 290...
293
 
290
 
294
  .dump:
291
  .dump:
295
        DEBUGF  DEBUG_NETWORK_VERBOSE, "ICMP_input: dumping\n"
292
        DEBUGF  DEBUG_NETWORK_VERBOSE, "ICMP_input: dumping\n"
296
        call    NET_BUFF_free
293
        call    net_buff_free
Line 297... Line 294...
297
        ret
294
        ret
298
 
295
 
299
 
-
 
-
 
296
 
300
if 0
297
if 0
301
;-----------------------------------------------------------------
-
 
-
 
298
;-----------------------------------------------------------------;
302
;
299
;                                                                 ;
303
; ICMP_output
300
; icmp_output                                                     ;
304
;
301
;                                                                 ;
305
; IN:  eax = dest ip
302
; IN:   eax = dest ip                                             ;
306
;      bh  = type
303
;       bh  = type                                                ;
307
;      bl  = code
304
;       bl  = code                                                ;
308
;      ecx = data length
305
;       ecx = data length                                         ;
309
;      edx = source ip
-
 
-
 
306
;       edx = source ip                                           ;
310
;      esi = data offset
307
;       esi = data offset                                         ;
311
;      edi = identifier shl 16 + sequence number
308
;       edi = identifier shl 16 + sequence number                 ;
312
;
309
;                                                                 ;
Line 313... Line 310...
313
;-----------------------------------------------------------------
310
;-----------------------------------------------------------------;
Line 314... Line 311...
314
align 4
311
align 4
315
ICMP_output:
312
icmp_output:
Line 362... Line 359...
362
end if
359
end if
Line 363... Line 360...
363
 
360
 
364
 
-
 
-
 
361
 
365
 
362
 
366
 
-
 
-
 
363
 
367
;-----------------------------------------------------------------
364
;-----------------------------------------------------------------;
368
;
365
;                                                                 ;
369
; ICMP_output_raw
366
; icmp_output_raw                                                 ;
370
;
-
 
-
 
367
;                                                                 ;
371
; IN:  eax = socket ptr
368
;  IN:  eax = socket ptr                                          ;
372
;      ecx = data length
369
;       ecx = data length                                         ;
373
;      edx = data pointer
370
;       edx = data pointer                                        ;
Line 374... Line 371...
374
;
371
;                                                                 ;
Line 375... Line 372...
375
;-----------------------------------------------------------------
372
;-----------------------------------------------------------------;
376
align 4
373
align 4
377
ICMP_output_raw:
374
icmp_output_raw:
378
 
375
 
379
        DEBUGF  DEBUG_NETWORK_VERBOSE, "Creating ICMP Packet for socket %x, data ptr=%x\n", eax, edx
376
        DEBUGF  DEBUG_NETWORK_VERBOSE, "Creating ICMP Packet for socket %x, data ptr=%x\n", eax, edx
380
 
377
 
381
        push    edx
378
        push    edx
382
        mov     ebx, [eax + IP_SOCKET.device]
379
        mov     ebx, [eax + IP_SOCKET.device]
Line 383... Line 380...
383
        mov     edx, [eax + IP_SOCKET.LocalIP]
380
        mov     edx, [eax + IP_SOCKET.LocalIP]
384
        mov     edi, [eax + IP_SOCKET.RemoteIP]
381
        mov     edi, [eax + IP_SOCKET.RemoteIP]
Line 405... Line 402...
405
 
402
 
406
        DEBUGF  DEBUG_NETWORK_VERBOSE, "Sending ICMP Packet\n"
403
        DEBUGF  DEBUG_NETWORK_VERBOSE, "Sending ICMP Packet\n"
407
        call    [ebx + NET_DEVICE.transmit]
404
        call    [ebx + NET_DEVICE.transmit]
408
        test    eax, eax
405
        test    eax, eax
409
        jnz     @f
406
        jnz     @f
410
        call    NET_ptr_to_num4
407
        call    net_ptr_to_num4
411
        inc     [ICMP_PACKETS_TX + edi]
408
        inc     [ICMP_PACKETS_TX + edi]
412
  @@:
409
  @@:
Line 413... Line 410...
413
        ret
410
        ret
Line 420... Line 417...
420
        ret
417
        ret
Line 421... Line 418...
421
 
418
 
422
 
-
 
423
 
-
 
424
 
-
 
-
 
419
 
425
;-----------------------------------------------------------------
420
 
426
;
-
 
-
 
421
 
427
; ICMP_API
422
;-----------------------------------------------------------------;
428
;
423
;                                                                 ;
429
; This function is called by system function 75
424
; icmp_api: Part of system function 76.                           ;
430
;
-
 
-
 
425
;                                                                 ;
431
; IN:  subfunction number in bl
426
;  IN:  bl = subfunction number                                   ;
432
;      device number in bh
-
 
-
 
427
;       bh = device number                                        ;
433
;      ecx, edx, .. depends on subfunction
428
;       ecx, edx, .. depends on subfunction                       ;
434
;
429
;                                                                 ;
435
; OUT:
430
; OUT:  depends on subfunction                                    ;
Line 436... Line 431...
436
;
431
;                                                                 ;
437
;-----------------------------------------------------------------
432
;-----------------------------------------------------------------;
Line 438... Line 433...
438
align 4
433
align 4