Rev 3626 | Rev 3908 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3626 | Rev 3725 | ||
---|---|---|---|
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: 3626 $ |
17 | $Revision: 3725 $ |
Line 18... | Line 18... | ||
18 | 18 | ||
Line 25... | Line 25... | ||
25 | Checksum dw ? |
25 | Checksum dw ? |
Line 26... | Line 26... | ||
26 | 26 | ||
Line 27... | Line -... | ||
27 | ends |
- | |
28 | 27 | ends |
|
- | 28 | ||
- | 29 | ||
29 | 30 | uglobal |
|
30 | align 4 |
31 | align 4 |
- | 32 | ||
31 | uglobal |
33 | UDP_PACKETS_TX rd NET_DEVICES_MAX |
Line 32... | Line 34... | ||
32 | UDP_PACKETS_TX rd NET_DEVICES_MAX |
34 | UDP_PACKETS_RX rd NET_DEVICES_MAX |
33 | UDP_PACKETS_RX rd NET_DEVICES_MAX |
35 | |
Line 112... | Line 114... | ||
112 | ; |
114 | ; |
113 | ; OUT: / |
115 | ; OUT: / |
114 | ; |
116 | ; |
115 | ;----------------------------------------------------------------- |
117 | ;----------------------------------------------------------------- |
116 | align 4 |
118 | align 4 |
- | 119 | diff16 "UDP packetgfgfgfgfs", 0, $ |
|
117 | UDP_input: |
120 | UDP_input: |
Line 118... | Line 121... | ||
118 | 121 | ||
Line 119... | Line 122... | ||
119 | DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_input: size=%u\n", ecx |
122 | DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_input: size=%u\n", ecx |
Line 137... | Line 140... | ||
137 | 140 | ||
138 | ; Look for a socket where |
141 | ; Look for a socket where |
139 | ; IP Packet UDP Destination Port = local Port |
142 | ; IP Packet UDP Destination Port = local Port |
Line -... | Line 143... | ||
- | 143 | ; IP Packet SA = Remote IP |
|
- | 144 | ||
- | 145 | pusha |
|
- | 146 | mov ecx, socket_mutex |
|
- | 147 | call mutex_lock |
|
140 | ; IP Packet SA = Remote IP |
148 | popa |
141 | 149 | ||
142 | mov cx, [esi + UDP_header.SourcePort] |
150 | mov cx, [esi + UDP_header.SourcePort] |
143 | mov dx, [esi + UDP_header.DestinationPort] |
151 | mov dx, [esi + UDP_header.DestinationPort] |
Line 144... | Line 152... | ||
144 | mov edi, [edi + 4] ; ipv4 source address |
152 | mov edi, [edi + 4] ; ipv4 source address |
145 | mov eax, net_sockets |
153 | mov eax, net_sockets |
146 | 154 | ||
147 | .next_socket: |
155 | .next_socket: |
Line 148... | Line 156... | ||
148 | mov eax, [eax + SOCKET.NextPtr] |
156 | mov eax, [eax + SOCKET.NextPtr] |
149 | or eax, eax |
157 | or eax, eax |
Line 150... | Line 158... | ||
150 | jz .dump |
158 | jz .dump_ |
Line 158... | Line 166... | ||
158 | cmp [eax + UDP_SOCKET.LocalPort], dx |
166 | cmp [eax + UDP_SOCKET.LocalPort], dx |
159 | jne .next_socket |
167 | jne .next_socket |
Line 160... | Line 168... | ||
160 | 168 | ||
Line -... | Line 169... | ||
- | 169 | DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_input: socket=%x\n", eax |
|
- | 170 | ||
- | 171 | pusha |
|
- | 172 | mov ecx, socket_mutex |
|
- | 173 | call mutex_unlock |
|
161 | DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_input: socket=%x\n", eax |
174 | popa |
Line 162... | Line 175... | ||
162 | 175 | ||
163 | ;;; TODO: when packet is processed, check more sockets! |
176 | ;;; TODO: when packet is processed, check more sockets! |
164 | 177 | ||
Line 180... | Line 193... | ||
180 | lea ecx, [eax + SOCKET.mutex] |
193 | lea ecx, [eax + SOCKET.mutex] |
181 | call mutex_lock |
194 | call mutex_lock |
182 | popa |
195 | popa |
Line 183... | Line 196... | ||
183 | 196 | ||
- | 197 | .updatesock: |
|
184 | .updatesock: |
198 | call NET_ptr_to_num4 |
Line 185... | Line 199... | ||
185 | inc [UDP_PACKETS_RX] ; Fixme: correct interface? |
199 | inc [UDP_PACKETS_RX + edi] |
186 | 200 | ||
187 | movzx ecx, [esi + UDP_header.Length] |
201 | movzx ecx, [esi + UDP_header.Length] |
Line 200... | Line 214... | ||
200 | mov [eax + UDP_SOCKET.RemotePort], cx |
214 | mov [eax + UDP_SOCKET.RemotePort], cx |
201 | inc [eax + UDP_SOCKET.firstpacket] |
215 | inc [eax + UDP_SOCKET.firstpacket] |
Line 202... | Line 216... | ||
202 | 216 | ||
Line -... | Line 217... | ||
- | 217 | jmp .updatesock |
|
- | 218 | ||
- | 219 | .dump_: |
|
- | 220 | ||
- | 221 | pusha |
|
- | 222 | mov ecx, socket_mutex |
|
- | 223 | call mutex_unlock |
|
- | 224 | popa |
|
- | 225 | ||
- | 226 | DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_input: no socket found\n" |
|
Line 203... | Line 227... | ||
203 | jmp .updatesock |
227 | |
204 | 228 | jmp .dump |
|
Line 205... | Line 229... | ||
205 | 229 | ||
Line 272... | Line 296... | ||
272 | 296 | ||
273 | DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_output: sending with device %x\n", ebx |
297 | DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_output: sending with device %x\n", ebx |
274 | call [ebx + NET_DEVICE.transmit] |
298 | call [ebx + NET_DEVICE.transmit] |
275 | test eax, eax |
299 | test eax, eax |
- | 300 | jnz @f |
|
276 | jnz @f |
301 | call NET_ptr_to_num4 |
277 | inc [UDP_PACKETS_TX] ; FIXME: correct device? |
302 | inc [UDP_PACKETS_TX + edi] |
Line 278... | Line 303... | ||
278 | @@: |
303 | @@: |
Line 279... | Line 304... | ||
279 | 304 |