Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 6011 → Rev 6010

/kernel/trunk/network/PPPoE.inc
33,33 → 33,37
 
endg
 
;-----------------------------------------------------------------;
; ;
; pppoe_init: Reset all pppoe variables ;
; ;
;-----------------------------------------------------------------;
macro pppoe_init {
;-----------------------------------------------------------------
;
; PPPoE_init
;
; This function resets all IP variables
;
;-----------------------------------------------------------------
macro PPPoE_init {
 
call pppoe_stop_connection
call PPPoE_stop_connection
 
}
 
 
;-----------------------------------------------------------------;
; ;
; pppoe_discovery_input ;
; ;
; IN: [esp] = ptr to buffer ;
; [esp+4] = size of buffer ;
; ebx = ptr to device struct ;
; ecx = size of PPP packet ;
; edx = ptr to PPP header ;
; ;
; OUT: / ;
; ;
;-----------------------------------------------------------------;
;-----------------------------------------------------------------
;
; PPPoE discovery input
;
; Handler of received Ethernet packet with type = Discovery
;
;
; IN: Pointer to buffer in [esp]
; size of buffer in [esp+4]
; pointer to device struct in ebx
; pointer to PPP header in edx
; size of PPP packet in ecx
; OUT: /
;
;-----------------------------------------------------------------
align 4
pppoe_discovery_input:
PPPoE_discovery_input:
 
DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_discovery_input\n"
 
93,7 → 97,7
mov ecx, [esp + 4]
mov esi, [esp]
 
jmp socket_input
jmp SOCKET_input
 
.dump:
pusha
102,21 → 106,22
popa
 
DEBUGF DEBUG_NETWORK_VERBOSE, 'PPPoE_discovery_input: dumping\n'
call net_buff_free
call NET_BUFF_free
ret
 
 
;-----------------------------------------------------------------;
; ;
; pppoe_discovery_output ;
; ;
; IN: eax = socket pointer ;
; ecx = number of bytes to send ;
; esi = pointer to data ;
; ;
;-----------------------------------------------------------------;
;--------------------------------------
;
; Send discovery packet
;
; IN: eax = socket pointer
; ecx = number of bytes to send
; esi = pointer to data
;
;--------------------------------------
 
align 4
pppoe_discovery_output:
PPPoE_discovery_output:
 
DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_discovery_output: socket=%x buffer=%x size=%d\n", eax, esi, ecx
 
142,7 → 147,7
 
; Create packet.
push ecx esi
;;;; FIXME stdcall kernel_alloc, 1500
stdcall kernel_alloc, 1500
pop esi ecx
test eax, eax
jz .bad
180,21 → 185,23
ret
 
 
;-----------------------------------------------------------------;
; ;
; pppoe_session_input ;
; ;
; IN: [esp] = ptr to buffer ;
; [esp+4] = size of buffer ;
; ebx = ptr to device struct ;
; edx = ptr to PPP header ;
; ecx = size of PPP packet ;
; ;
; OUT: / ;
; ;
;-----------------------------------------------------------------;
;-----------------------------------------------------------------
;
; PPPoE session input
;
; Handler of received Ethernet packet with type = Session
;
;
; IN: Pointer to buffer in [esp]
; size of buffer in [esp+4]
; pointer to device struct in ebx
; pointer to PPP header in edx
; size of PPP packet in ecx
; OUT: /
;
;-----------------------------------------------------------------
align 4
pppoe_session_input:
PPPoE_session_input:
 
cmp [edx + PPPoE_frame.VersionAndType], 0x11
jne .dump
214,39 → 221,38
add edx, PPPoE_frame.Payload + 2
 
cmp ax, PPP_PROTO_IPv4
je ipv4_input
je IPv4_input
 
; cmp ax, PPP_PROTO_IPv6
; je ipv6_input
; je IPv6_input
 
jmp pppoe_discovery_input ; Send LCP,CHAP,CBCP,... packets to the PPP dialer
jmp PPPoE_discovery_input ; Send LCP,CHAP,CBCP,... packets to the PPP dialer
DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_input: Unknown protocol=%x\n", ax
 
.dump:
DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_input: dumping\n"
call net_buff_free
call NET_BUFF_free
ret
 
 
 
;-----------------------------------------------------------------;
; ;
; pppoe_output ;
; ;
; IN: ax = protocol ;
; ebx = device ptr ;
; ecx = packet size ;
; ;
; OUT: eax = buffer start ;
; eax = 0 on error ;
; ebx = device ptr ;
; ecx = packet size ;
; edx = size of complete buffer ;
; edi = start of PPP payload ;
; ;
;-----------------------------------------------------------------;
;-----------------------------------------------------------------
;
; PPPoE_output
;
; IN: ax = protocol
; ebx = device ptr
; ecx = packet size
;
; OUT: eax = buffer start / 0 on error
; ebx = device ptr
; ecx = packet size
; edx = size of complete buffer
; edi = start of PPP payload
;
;-----------------------------------------------------------------
align 4
pppoe_output:
PPPoE_output:
 
DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_output: size=%u device=%x\n", ecx, ebx
 
256,7 → 262,7
mov ax, ETHER_PROTO_PPP_SESSION
add ecx, PPPoE_frame.Payload + 2
lea edx, [PPPoE_MAC]
call eth_output
call ETH_output
jz .eth_error
 
sub ecx, PPPoE_frame.Payload
281,9 → 287,9
xor eax, eax
ret
 
align 4
pppoe_start_connection:
 
PPPoE_start_connection:
 
DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_start_connection: %x\n", cx
 
cmp [PPPoE_SID], 0
302,7 → 308,7
 
 
align 4
pppoe_stop_connection:
PPPoE_stop_connection:
 
DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_stop_connection\n"
 
314,19 → 320,21
ret
 
 
;-----------------------------------------------------------------;
; ;
; pppoe_api: Part of system function 76 ;
; ;
; IN: subfunction number in bl ;
; device number in bh ;
; ecx, edx, .. depends on subfunction ;
; ;
; OUT: ;
; ;
;-----------------------------------------------------------------;
;---------------------------------------------------------------------------
;
; PPPoE API
;
; This function is called by system function 75
;
; IN: subfunction number in bl
; device number in bh
; ecx, edx, .. depends on subfunction
;
; OUT:
;
;---------------------------------------------------------------------------
align 4
pppoe_api:
PPPoE_api:
 
movzx eax, bh
shl eax, 2
337,8 → 345,8
jmp dword [.table + 4*ebx]
 
.table:
dd pppoe_start_connection ; 0
dd pppoe_stop_connection ; 1
dd PPPoE_start_connection ; 0
dd PPPoE_stop_connection ; 1
.number = ($ - .table) / 4 - 1
 
.error: