亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? tcp.inc

?? MenuetOS是一個用匯編開發的32/64位PC操作系統
?? INC
?? 第 1 頁 / 共 3 頁
字號:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                 ;;
;;  TCP.INC                                                        ;;
;;                                                                 ;;
;;  TCP Processes for Menuet OS  TCP/IP stack                      ;;
;;                                                                 ;;
;;  Version 0.6  4th July 2004                                       ;;
;;                                                                 ;;
;;  Copyright 2002 Mike Hibbett, mikeh@oceanfree.net               ;;
;;                                                                 ;;
;;  See file COPYING for details                                   ;;
;;  v0.6 : Added reset handling in the established state           ;;
;;         Added a timer per socket to allow delays when rx window ;;
;;         gets below 1KB                                          ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   
   
;*******************************************************************
;   Interface
;
;       tcp_tx_handler      Handles the TCP transmit queue
;       tcp_rx              The protocol handler for received data
;       buildTCPPacket      fills in the packet headers and data
;       tcpStateMachine     Main state machine for received TCP packets
;       tcp_tcb_handler     1s timer, to erase tcb's in TIME_WAIT state
;
;*******************************************************************
   


;***************************************************************************
;   Function
;      tcp_tcb_handler
;
;   Description
;       Handles sockets in the timewait state, closing them
;       when the TCB timer expires
;
;***************************************************************************
tcp_tcb_handler:
    ; scan through all the sockets, decrementing active timers
    
    mov     eax, SOCKETBUFFSIZE * NUM_SOCKETS
    mov     ecx, NUM_SOCKETS
   
tth1:
    sub     eax, SOCKETBUFFSIZE
    cmp     [eax + sockets + 32], dword 0
    jne     tth2

tth1a:
    cmp     [eax + sockets + 72], dword 0
    jne     tth4
        
    loop    tth1
    ret

tth2: 
    ; decrement it, delete socket if TCB timer = 0 & socket in timewait state
    pusha
    dec     dword [eax + sockets + 32]
    cmp     [eax + sockets + 32], dword 0
    jne     tth3
    
    cmp     [eax + sockets + 28], dword TCB_TIME_WAIT
    jne     tth3
    
    ; OK, delete socket
    mov     edi, eax
    add     edi, sockets
    
    xor     eax, eax
    mov     ecx, SOCKETHEADERSIZE
    cld
    rep     stosb
    
tth3:
    popa
    
    jmp     tth1a
    
    loop    tth1
    ret
    
    ; TODO - prove it works!
tth4:
    dec     dword [eax + sockets + 72]    
    loop    tth1
    ret
    
    
    

tth_exit:
    ret
    

;***************************************************************************
;   Function
;      tcp_tx_handler
;
;   Description
;       Handles queued TCP data
;       This is a kernel function, called by stack_handler
;
;***************************************************************************
tcp_tx_handler:
    ; decrement all resend buffers timers. If they
    ; expire, queue them for sending, and restart the timer.
    ; If the retries counter reach 0, delete the entry

    mov     esi, resendQ
    mov     ecx, 0
    
tth001:
    cmp     ecx, NUMRESENDENTRIES
    je      tth003              ; None left
    cmp     [esi], byte 0xFF
    jne      tth002             ; found one
    inc     ecx
    add     esi, 4
    jmp     tth001

tth002:    
    ; we have one. decrement it's timer by 1
    dec     word [esi+2]
    mov     ax, [esi+2]
    cmp     ax, 0
    je     tth002a
    inc     ecx
    add     esi, 4
    jmp     tth001              ; Timer not zero, so move on

tth002a:   
    mov     bl, 0xff 
    ; restart timer, and decrement retries
    ; After the first resend, back of on next, by a factor of 5
    mov     [esi+2], word TCP_TIMEOUT * 5
    dec     byte [esi+1]
    mov     al, [esi+1]
    cmp     al, 0
    jne     tth004
    
    ; retries now 0, so delete from queue
    xchg     [esi], bl
tth004:

    ; resend packet
    pusha   

    mov     eax, EMPTY_QUEUE
    call    dequeue
    cmp     ax, NO_BUFFER
    jne      tth004z              
    
    ; TODO - try again in 10ms.
    cmp     bl, 0xff
    jne     tth004za
    mov     [esi], bl
    
tth004za:    
    ; Mark it to expire in 10ms - 1 tick
    mov     [esi+1], byte 1
    mov     [esi+2], word 1
    jmp     tth005

tth004z:    
    ; we have a buffer # in ax
    
    push    eax
    push    ecx
    mov     ecx, IPBUFFSIZE
    mul     ecx
    add     eax, IPbuffs

    ; we have the buffer address in eax
    mov     edi, eax
    pop     ecx
    ; get resend data address
    inc     ecx
    ; Now get buffer location, and copy buffer across. argh! more copying,,
    mov     esi, resendBuffer - IPBUFFSIZE
tth004a:
    add     esi, IPBUFFSIZE
    loop    tth004a
   
    ; we have resend buffer location in esi
    mov     ecx, IPBUFFSIZE
    
    ; copy data across
    cld
    rep     movsb
    
    ; queue packet
    
    
    
    mov     eax, NET1OUT_QUEUE

    mov     edx, [stack_ip]
    mov     ecx, [ edi + 16 ]
    cmp     edx, ecx
    jne     tth004b
    mov     eax, IPIN_QUEUE
    
tth004b:
    pop     ebx
    
    call    queue
       

tth005:    
    popa    
    
    inc     ecx
    add     esi, 4
    jmp     tth001

tth003:    
    ret
    
    


;***************************************************************************
;   Function
;      tcp_rx
;
;   Description
;       TCP protocol handler
;       This is a kernel function, called by ip_rx
;       IP buffer address given in edx
;          IP buffer number in eax
;          Free up (or re-use) IP buffer when finished
;
;***************************************************************************
tcp_rx:
    ; The process is as follows.
    ; Look for a socket with matching remote IP, remote port, local port
    ; if not found, then
    ; look for remote IP + local port match ( where sockets remote port = 0)
    ; if not found, then
    ; look for a socket where local socket port == IP packets remote port
    ; where sockets remote port, remote IP = 0
    ; discard if not found
    ; Call sockets tcbStateMachine, with pointer to packet.
    ; the state machine will not delete the packet, so do that here.

    push        eax
    
    ; Look for a socket where
    ; IP Packet TCP Destination Port = local Port
    ; IP Packet SA = Remote IP
    ; IP Packet TCP Source Port = remote Port
   
    mov     eax, SOCKETBUFFSIZE * NUM_SOCKETS
    mov     ecx, NUM_SOCKETS
ss1:
    sub     eax, SOCKETBUFFSIZE    
    movzx   ebx, word [edx + 22]     ; get the dest. port from the TCP hdr
    cmp     [eax + sockets + 12], bx ; compare with socket's local port
    jnz     nxttst1                        ; different - try next socket        

    movzx   ebx, word [edx + 20]       ; get the source port from the TCP hdr
    cmp     [eax + sockets + 20], bx ; compare with socket's remote port
    jnz     nxttst1                        ; different - try next socket        


    mov     ebx, [edx + 12]           ; get the source IP Addr from the IP hdr
    cmp     [eax + sockets + 16], ebx ; compare with socket's remote IP
    jnz     nxttst1                        ; different - try next socket        

    ; We have a complete match - use this socket
    jmp     tcprx_001

nxttst1:
    loop    ss1                     ; Return back if no match
   
    ; If we got here, there was no match
    ; Look for a socket where
    ; IP Packet TCP Destination Port = local Port
    ; IP Packet SA = Remote IP
    ; socket remote Port = 0
   
    mov     eax, SOCKETBUFFSIZE * NUM_SOCKETS
    mov     ecx, NUM_SOCKETS
    
ss2:
    sub     eax, SOCKETBUFFSIZE

    movzx   ebx, word [edx + 22]     ; get the dest. port from the TCP hdr
    cmp     [eax + sockets + 12], bx ; compare with socket's local port
    jnz     nxttst2                        ; different - try next socket        

    mov     ebx, [edx + 12]          ; get the source IP Addr from the IP hdr
    cmp     [eax + sockets + 16], ebx ; compare with socket's remote IP
    jnz     nxttst2                        ; different - try next socket        

    mov     ebx, 0
    cmp     [eax + sockets + 20], bx ; only match a remote socket of 0
    jnz     nxttst2                        ; different - try next socket        

    ; We have a complete match - use this socket
    jmp     tcprx_001

nxttst2:
    loop    ss2                     ; Return back if no match

    ; If we got here, there was no match
    ; Look for a socket where
    ; IP Packet TCP Destination Port = local Port
    ; socket Remote IP = 0
    ; socket remote Port = 0
   
    mov     eax, SOCKETBUFFSIZE * NUM_SOCKETS
    mov     ecx, NUM_SOCKETS
    
ss3:
    sub     eax, SOCKETBUFFSIZE

    movzx   ebx, word [edx + 22]     ; get destination port from the TCP hdr
    cmp     [eax + sockets + 12], bx ; compare with socket's local port
    jnz     nxttst3                        ; different - try next socket        

    mov     ebx, 0
    cmp     [eax + sockets + 20], bx ; only match a remote socket of 0
    jnz     nxttst3                        ; different - try next socket        

    mov     ebx, 0
    cmp     [eax + sockets + 16], ebx ; only match a socket remote IP of 0
    jnz     nxttst3                        ; different - try next socket        

    ; We have a complete match - use this socket
    jmp     tcprx_001

nxttst3:
    loop    ss3                     ; Return back if no match

    ; If we got here, we need to reject the packet
    inc     dword [dumped_rx_count]
    jmp     tcprx_exit
   
tcprx_001:   
    ; We have a valid socket/TCB, so call the TCB State Machine for that skt.
    ; socket is pointed to by [eax + sockets]
    ; IP packet is pointed to by [edx]
    ; IP buffer number is on stack ( it will be popped at the end)
    call    tcpStateMachine

tcprx_exit:    
    pop     eax
    call    freeBuff

    ret



;***************************************************************************
;   Function
;      buildTCPPacket
;
;   Description
;       builds an IP Packet with TCP data fully populated for transmission
;       You may destroy any and all registers
;          TCP control flags specified in bl
;          This TCB is in [sktAddr]
;          User data pointed to by esi
;       Data length in ecx
;          Transmit buffer number in eax
;
;***************************************************************************
buildTCPPacket:
    push    ecx                        ; Save data length
   
    ; convert buffer pointer eax to the absolute address
    mov     ecx, IPBUFFSIZE
    mul     ecx
    add     eax, IPbuffs

    mov     edx, eax

    mov     [edx + 33], bl            ; TCP flags
       
    mov     ebx, [sktAddr]
   
    ; So, ebx holds the socket ptr, edx holds the IPbuffer ptr
   
    ; Fill in the IP header ( some data is in the socket descriptor)
    mov     eax, [ebx + 8]
    mov     [edx + 12], eax      ; source IP
    mov     eax, [ebx + 16]
    mov     [edx + 16], eax      ; Destination IP
   
    mov     al, 0x45
    mov     [edx], al         ; Version, IHL
    xor     al, al   
    mov     [edx + 1], al     ; Type of service
   
    pop     eax                   ; Get the TCP data length
    push    eax
   
    add     eax, 20 + 20           ; add IP header and TCP header lengths
    mov     [edx + 2], ah
    mov     [edx + 3], al
    xor     al, al   
    mov     [edx + 4], al
    mov     [edx + 5], al
    mov     al, 0x40
    mov     [edx + 6], al
    xor     al, al  
    mov     [edx + 7], al
    mov     al, 0x20
    mov     [edx + 8], al
    mov     al, 6                         ; TCP protocol
    mov     [edx + 9], al

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩欧美中文字幕一区| 欧美一级二级三级乱码| 精品国产伦理网| 一区二区三区国产精华| 国产成人午夜高潮毛片| 日韩欧美不卡在线观看视频| 一区二区三区在线视频观看| 国产.欧美.日韩| 日韩欧美电影一区| 午夜不卡av在线| 91捆绑美女网站| 亚洲国产成人一区二区三区| 久久激五月天综合精品| 欧美三级中文字幕| 亚洲免费观看高清完整| 波多野洁衣一区| 国产欧美日韩亚州综合| 精品制服美女丁香| 欧美一区二区精美| 午夜精品一区二区三区电影天堂 | 一级女性全黄久久生活片免费| 国产69精品久久久久777| 精品国产一区二区三区av性色| 婷婷丁香激情综合| 欧美在线你懂得| 一区二区三区鲁丝不卡| eeuss鲁片一区二区三区 | 欧美日韩国产欧美日美国产精品| 亚洲日穴在线视频| 99视频国产精品| 国产精品久久网站| 成人免费视频播放| 国产精品成人在线观看| 丁香激情综合国产| 国产精品另类一区| 成人免费毛片a| 国产精品久久精品日日| 大白屁股一区二区视频| 亚洲国产精品黑人久久久| 国产成人精品影视| 国产精品午夜春色av| 成人美女在线视频| 中文字幕一区二区三区在线不卡 | 欧美在线观看一区二区| 亚洲在线视频免费观看| 欧美日韩综合不卡| 视频精品一区二区| 91精品国产免费| 精品一区二区三区在线观看国产 | 精品欧美乱码久久久久久| 久久成人综合网| 久久品道一品道久久精品| 国产精品一区二区在线观看不卡| 国产欧美日韩在线看| caoporen国产精品视频| 亚洲精品一二三| 欧美日韩精品二区第二页| 轻轻草成人在线| 久久中文字幕电影| www.欧美日韩国产在线| 亚洲精品国产精品乱码不99| 欧美亚洲国产一区在线观看网站| 亚洲国产精品久久久久秋霞影院| 欧美日韩精品高清| 国内精品视频666| 中文字幕欧美区| 色婷婷综合中文久久一本| 亚洲福中文字幕伊人影院| 日韩精品一区二区三区老鸭窝| 国产精品1024| 一区二区三区四区在线播放| 8v天堂国产在线一区二区| 麻豆精品视频在线观看| 国产精品美女久久福利网站 | 国产福利一区二区三区视频在线| 国产精品嫩草99a| 色婷婷久久99综合精品jk白丝| 亚洲一二三级电影| 欧美精品一区二| 99久久久无码国产精品| 亚洲a一区二区| 久久久久青草大香线综合精品| 成人综合婷婷国产精品久久| 亚洲精品国产第一综合99久久 | 欧美性感一类影片在线播放| 欧美96一区二区免费视频| 亚洲国产成人午夜在线一区 | 成人污污视频在线观看| 亚洲狠狠爱一区二区三区| 精品剧情v国产在线观看在线| av亚洲精华国产精华| 午夜欧美大尺度福利影院在线看| 久久久久久久综合日本| 欧美影片第一页| 国产精品一卡二| 亚洲午夜av在线| 国产欧美日韩久久| 欧美精品日韩一区| 成人免费视频app| 蜜桃视频在线一区| 一区二区三区蜜桃网| 久久久噜噜噜久噜久久综合| 欧美日韩在线播放三区四区| 国产风韵犹存在线视精品| 日韩av不卡在线观看| 最新中文字幕一区二区三区| 亚洲精品一区二区精华| 波多野结衣的一区二区三区| 美女视频一区在线观看| 亚洲欧美欧美一区二区三区| 久久综合狠狠综合久久综合88 | 国产成人精品www牛牛影视| 午夜精品久久久久久| **网站欧美大片在线观看| 精品国产乱码91久久久久久网站| 欧美午夜理伦三级在线观看| 不卡的av在线| 国产精品18久久久久久久久| 手机精品视频在线观看| 亚洲免费色视频| 国产精品蜜臀av| xvideos.蜜桃一区二区| 欧美卡1卡2卡| 色婷婷综合久久| 成人av影视在线观看| 精品中文字幕一区二区小辣椒| 日韩精品电影在线| 亚洲国产aⅴ成人精品无吗| 国产精品传媒入口麻豆| 国产欧美一区二区在线观看| 日韩欧美第一区| 欧美精品黑人性xxxx| 欧美影院精品一区| 91久久精品网| 日本乱人伦aⅴ精品| 91偷拍与自偷拍精品| 成人丝袜高跟foot| 风间由美中文字幕在线看视频国产欧美| 喷水一区二区三区| 日韩主播视频在线| 亚洲成人激情社区| 亚洲成人av免费| 亚洲成人7777| 亚洲成人av电影| 亚洲国产精品麻豆| 午夜精品福利久久久| 亚洲成人高清在线| 视频在线观看一区二区三区| 视频一区视频二区中文字幕| 天天综合色天天综合色h| 亚洲国产精品一区二区www| 亚洲国产日日夜夜| 午夜国产精品一区| 视频在线观看91| 免费观看91视频大全| 久久99深爱久久99精品| 韩国女主播一区| 国产精品亚洲人在线观看| 国产成人自拍网| www.欧美.com| 欧美综合色免费| 在线播放欧美女士性生活| 日韩三级高清在线| 亚洲精品在线免费观看视频| 久久日韩粉嫩一区二区三区| 久久久久高清精品| 国产精品无遮挡| 亚洲人成亚洲人成在线观看图片| 亚洲欧洲韩国日本视频| 亚洲综合一区在线| 婷婷久久综合九色国产成人 | 亚洲影院在线观看| 亚洲午夜精品一区二区三区他趣| 五月天激情小说综合| 美国十次综合导航| 狠狠色伊人亚洲综合成人| 国产成人在线免费| 91一区在线观看| 欧美日韩视频一区二区| 欧美xxxxxxxxx| 中文无字幕一区二区三区| 亚洲视频免费在线观看| 亚洲午夜精品网| 精品一区二区三区在线观看国产 | 五月天亚洲婷婷| 久久99国产精品久久99果冻传媒| 国产999精品久久久久久| 91蝌蚪porny| 91精品国产综合久久精品麻豆| 精品国产凹凸成av人导航| 中文字幕制服丝袜成人av| 亚洲成人在线网站| 国产综合色产在线精品| 99re成人在线| 欧美一级片在线| 中文字幕中文乱码欧美一区二区| 午夜电影久久久| 国产+成+人+亚洲欧洲自线| 精品视频在线看| 国产欧美精品国产国产专区|