Subversion Repositories Kolibri OS

Rev

Rev 129 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 129 Rev 384
Line 19... Line 19...
19
;       udp_rx      Handles received IP packets with the UDP protocol
19
;       udp_rx      Handles received IP packets with the UDP protocol
20
;                   
20
;
21
;*******************************************************************
21
;*******************************************************************
Line -... Line 22...
-
 
22
 
-
 
23
 
-
 
24
;
-
 
25
;   UDP Payload ( Data field in IP datagram )
-
 
26
;
-
 
27
;    0                   1                   2                   3
-
 
28
;    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
-
 
29
;
-
 
30
;   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
 
31
;   |       Source Port             |      Destination Port         |
-
 
32
;   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
 
33
;   | Length ( UDP Header + Data )  |           Checksum            |
-
 
34
;   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
 
35
;   |       UDP Data                                                |
-
 
36
;   +-+-+-..........                                               -+
-
 
37
;
-
 
38
 
-
 
39
struc UDP_PACKET
-
 
40
{  .SourcePort       dw  ?  ;+00
-
 
41
   .DestinationPort  dw  ?  ;+02
-
 
42
   .Length           dw  ?  ;+04 - Length of (UDP Header + Data)
-
 
43
   .Checksum         dw  ?  ;+06
-
 
44
   .Data             db  ?  ;+08
-
 
45
}
-
 
46
 
-
 
47
virtual at 0
Line 22... Line 48...
22
   
48
  UDP_PACKET UDP_PACKET
23
   
49
end virtual
24
   
50
 
25
   
51
 
26
;***************************************************************************
52
;***************************************************************************
27
;   Function
53
;   Function
28
;      udp_rx
54
;      udp_rx  [by Johnny_B]
29
;
55
;
-
 
56
;   Description
30
;   Description
57
;       UDP protocol handler
31
;       UDP protocol handler
58
;       This is a kernel function, called by ip_rx
32
;       This is a kernel function, called by ip_rx
59
;       IP buffer address given in edx
33
;       IP buffer address given in edx
60
;          IP buffer number in eax
34
;          Free up (or re-use) IP buffer when finished
61
;          Free up (or re-use) IP buffer when finished
Line 112... Line 139...
112
    rep     movsb          ; copy the data across
139
    rep     movsb          ; copy the data across
Line 113... Line 140...
113
      
140
 
114
    ; flag an event to the application
141
    ; flag an event to the application
115
    pop     eax
142
    pop     eax
116
    mov     ecx,1
143
    mov     ecx,1
Line 117... Line 144...
117
    mov     esi,0x3020+TASKDATA.pid
144
    mov     esi,TASK_DATA+TASKDATA.pid
118
   
145
 
119
newsearch:
146
newsearch:
120
    cmp     [esi],eax
147
    cmp     [esi],eax
121
    je      foundPID
148
    je      foundPID
122
    inc     ecx
149
    inc     ecx
123
    add     esi,0x20
150
    add     esi,0x20
Line 124... Line 151...
124
    cmp     ecx,[0x3004]
151
    cmp     ecx,[TASK_COUNT]
125
    jbe     newsearch
152
    jbe     newsearch
126
              
153
 
Line 127... Line 154...
127
foundPID: 
154
foundPID:
Line 128... Line 155...
128
    shl     ecx,8
155
    shl     ecx,8
129
    or      dword [ecx+0x80000+APPDATA.event_mask],dword 10000000b ; stack event
156
    or      dword [ecx+SLOT_BASE+APPDATA.event_mask],dword 10000000b ; stack event
130
 
157
 
131
    mov     [check_idle_semaphore],200   
158
    mov     [check_idle_semaphore],200
132
 
-
 
133
udprx_001:
159