but the eth_api.table has only one function .read_mac.common subfunctions:
0 - Read # packets sent
1 - Read # packets received
The new network stack
-
hidnplayr, can you explain what it does mean in description of function 76
Common subfunctions for all protocols, except ethernet. Probably, the indent should be removed...
Yes, the indent may confuse someone.Pathoswithin wrote:Probably, the indent should be removed...
Also, it seems the .read_mac function yet not complete.
Can't find
In source only this2 - ICMP:
3 - enable/disable ICMP echo reply
Code: Select all
icmp_api:
movzx eax, bh
shl eax, 2
test bl, bl
jz .packets_tx ; 0
dec bl
jz .packets_rx ; 1
.error:
mov eax, -1
ret
It seems that the description of SysFn76 is not complete .
For example, 5-Remove ARP entry
How do you determine which entry will be removed?
For example, 5-Remove ARP entry
How do you determine which entry will be removed?
I have improved the documentation for sysfn 76.
PS: Thanks for reminding me, you are doing very useful work..
PS: Thanks for reminding me, you are doing very useful work..
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein
hidnplayr, thanx for the improved documentation.
I also doing wrappers for my KolibriOS library(260 functions). As about network part then this is it:What do you think about it?
I also doing wrappers for my KolibriOS library(260 functions). As about network part then this is it:
Spoiler:
Code: Select all
(* -------------------------------------------------------- *)
{74.-1} Function GetActiveNetworkDevices: Dword; StdCall;
Asm
push ebx
mov eax, 74
mov bl, -1
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{74.0} Function GetNetworkDeviceType(Device: Byte): Integer; StdCall;
Asm
push ebx
mov eax, 74
mov bl, 0
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{74.1} Function GetNetworkDeviceName(Device: Byte; Buffer: Pointer): Integer; StdCall;
Asm
push ebx
mov eax, 74
mov bl, 1
mov bh, Device
mov ecx, Buffer
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{74.2} Function ResetNetworkDevice(Device: Byte): Integer; StdCall;
Asm
push ebx
mov eax, 74
mov bl, 2
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{74.3} Function StopNetworkDevice(Device: Byte): Integer; StdCall;
Asm
push ebx
mov eax, 74
mov bl, 3
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{74.4} Function GetNetworkDevicePointer(Device: Byte): Pointer; StdCall;
Asm
push ebx
mov eax, 74
mov bl, 4
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{74.5} {UNDEFINED}
(* -------------------------------------------------------- *)
{74.6} Function GetSentPackets(Device: Byte): Integer; StdCall;
Asm
push ebx
mov eax, 74
mov bl, 6
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{74.7} Function GetReceivedPackets(Device: Byte): Integer; StdCall;
Asm
push ebx
mov eax, 74
mov bl, 7
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{74.8} Function GetSentBytes(Device: Byte): Integer; StdCall;
Asm
push ebx
mov eax, 74
mov bl, 8
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{74.9} Function GetReceivedBytes(Device: Byte): Integer; StdCall;
Asm
push ebx
mov eax, 74
mov bl, 9
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{74.10} Function GetLinkStatus(Device: Byte): Integer; StdCall;
Asm
push ebx
mov eax, 74
mov bl, 10
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{75.0} Function OpenSocket(Domain, Kind, Protocol: Dword): Dword; StdCall;
Asm
push ebx
push esi
mov eax, 75
mov bl, 0
mov ecx, Domain
mov edx, Kind
mov esi, Protocol
int 64
pop esi
pop ebx
End;
(* -------------------------------------------------------- *)
{75.1} Function CloseSocket(Socket: Dword): Integer; StdCall;
Asm
push ebx
mov eax, 75
mov bl, 1
mov ecx, Socket
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{75.2} Function SocketBind(Socket: Dword; SockAddr: Pointer; Size: Dword): Integer; StdCall;
Asm
push ebx
push esi
mov eax, 75
mov bl, 2
mov ecx, Socket
mov edx, SockAddr
mov esi, Size
int 64
pop esi
pop ebx
End;
(* -------------------------------------------------------- *)
{75.3} Function SocketListen(Socket: Dword; BackLog: Pointer): Integer; StdCall;
Asm
push ebx
mov eax, 75
mov bl, 3
mov ecx, Socket
mov edx, BackLog
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{75.4} Function SocketConnect(Socket: Dword; SockAddr: Pointer; Size: Dword): Integer; StdCall;
Asm
push ebx
push esi
mov eax, 75
mov bl, 4
mov ecx, Socket
mov edx, SockAddr
mov esi, Size
int 64
pop esi
pop ebx
End;
(* -------------------------------------------------------- *)
{75.5} Function SocketAccept(Socket: Dword; SockAddr: Pointer; Size: Dword): Dword; StdCall;
Asm
push ebx
push esi
mov eax, 75
mov bl, 5
mov ecx, Socket
mov edx, SockAddr
mov esi, Size
int 64
pop esi
pop ebx
End;
(* -------------------------------------------------------- *)
{75.6} Function SocketSend(Socket: Dword; Buffer: Pointer; Size, Flags: Dword): Integer; StdCall;
Asm
push ebx
push esi
push edi
mov eax, 75
mov bl, 6
mov ecx, Socket
mov edx, Buffer
mov esi, Size
mov edi, Flags
int 64
pop edi
pop esi
pop ebx
End;
(* -------------------------------------------------------- *)
{75.7} Function SocketReceive(Socket: Dword; Buffer: Pointer; Size, Flags: Dword): Integer; StdCall;
Asm
push ebx
push esi
push edi
mov eax, 75
mov bl, 7
mov ecx, Socket
mov edx, Buffer
mov esi, Size
mov edi, Flags
int 64
pop edi
pop esi
pop ebx
End;
(* -------------------------------------------------------- *)
{75.8} Function SetSocketOptions(Socket: Dword; OptStruct: Pointer): Integer; StdCall;
Asm
push ebx
mov eax, 75
mov bl, 8
mov ecx, Socket
mov edx, OptStruct
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{75.9} Function GetSocketOptions(Socket: Dword; OptStruct: Pointer): Integer; StdCall;
Asm
push ebx
mov eax, 75
mov bl, 9
mov ecx, Socket
mov edx, OptStruct
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{75.10} Function GetSocketPair(Var Socket1, Socket2: Dword): Integer; StdCall;
Asm
push ebx
mov eax, 75
mov bl, 10
int 64
mov ecx, Socket1
mov edx, Socket2
mov [ecx], eax
mov [edx], ebx
pop ebx
End;
(* -------------------------------------------------------- *)
{76.0.0} Function GetMAC(Device: Byte): Dword; StdCall;
Asm
push ebx
mov eax, 76
mov ebx, $00000000
mov bl, 0
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{76.1.0} Function GetIPv4SentPackets(Device: Byte): Dword; StdCall;
Asm
push ebx
mov eax, 76
mov ebx, $00010000
mov bl, 0
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{76.1.1} Function GetIPv4ReceivedPackets(Device: Byte): Dword; StdCall;
Asm
push ebx
mov eax, 76
mov ebx, $00010000
mov bl, 1
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{76.1.2} Function GetIPv4IP(Device: Byte): Dword; StdCall;
Asm
push ebx
mov eax, 76
mov ebx, $00010000
mov bl, 2
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{76.1.3} Function SetIPv4IP(Device: Byte; IP: Dword): Dword; StdCall;
Asm
push ebx
mov eax, 76
mov ebx, $00010000
mov bl, 3
mov bh, Device
mov ecx, IP
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{76.1.4} Function GetIPv4DNS(Device: Byte): Dword; StdCall;
Asm
push ebx
mov eax, 76
mov ebx, $00010000
mov bl, 4
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{76.1.5} Function SetIPv4DNS(Device: Byte; DNS: Dword): Dword; StdCall;
Asm
push ebx
mov eax, 76
mov ebx, $00010000
mov bl, 5
mov bh, Device
mov ecx, DNS
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{76.1.6} Function GetIPv4Subnet(Device: Byte): Dword; StdCall;
Asm
push ebx
mov eax, 76
mov ebx, $00010000
mov bl, 6
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{76.1.7} Function SetIPv4Subnet(Device: Byte; Subnet: Dword): Dword; StdCall;
Asm
push ebx
mov eax, 76
mov ebx, $00010000
mov bl, 7
mov bh, Device
mov ecx, Subnet
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{76.1.8} Function GetIPv4Gateway(Device: Byte): Dword; StdCall;
Asm
push ebx
mov eax, 76
mov ebx, $00010000
mov bl, 8
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{76.1.9} Function SetIPv4Gateway(Device: Byte; Gateway: Dword): Dword; StdCall;
Asm
push ebx
mov eax, 76
mov ebx, $00010000
mov bl, 9
mov bh, Device
mov ecx, Gateway
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{76.2.0} Function GetICMPSentPackets(Device: Byte): Dword; StdCall;
Asm
push ebx
mov eax, 76
mov ebx, $00020000
mov bl, 0
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{76.2.1} Function GetICMPReceivedPackets(Device: Byte): Dword; StdCall;
Asm
push ebx
mov eax, 76
mov ebx, $00020000
mov bl, 1
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{76.3.0} Function GetUDPSentPackets(Device: Byte): Dword; StdCall;
Asm
push ebx
mov eax, 76
mov ebx, $00030000
mov bl, 0
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{76.3.1} Function GetUDPReceivedPackets(Device: Byte): Dword; StdCall;
Asm
push ebx
mov eax, 76
mov ebx, $00030000
mov bl, 1
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{76.4.0} Function GetTCPSentPackets(Device: Byte): Dword; StdCall;
Asm
push ebx
mov eax, 76
mov ebx, $00040000
mov bl, 0
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{76.4.1} Function GetTCPReceivedPackets(Device: Byte): Dword; StdCall;
Asm
push ebx
mov eax, 76
mov ebx, $00040000
mov bl, 1
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{76.5.0} Function GetARPSentPackets(Device: Byte): Dword; StdCall;
Asm
push ebx
mov eax, 76
mov ebx, $00050000
mov bl, 0
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{76.5.1} Function GetARPReceivedPackets(Device: Byte): Dword; StdCall;
Asm
push ebx
mov eax, 76
mov ebx, $00050000
mov bl, 1
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{76.5.2} Function GetARPEntrys(Device: Byte): Dword; StdCall;
Asm
push ebx
mov eax, 76
mov ebx, $00050000
mov bl, 2
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{76.5.3} Function GetARPEntry(Device: Byte; Entry: Dword; Buffer: Pointer): Dword; StdCall;
Asm
push ebx
push edi
mov eax, 76
mov ebx, $00050000
mov bl, 3
mov bh, Device
mov ecx, Entry
mov edi, Buffer
int 64
pop edi
pop ebx
End;
(* -------------------------------------------------------- *)
{76.5.4} Function AddARPEntry(Device: Byte; Buffer: Pointer): Dword; StdCall;
Asm
push ebx
push esi
mov eax, 76
mov ebx, $00050000
mov bl, 4
mov bh, Device
mov esi, Buffer
int 64
pop esi
pop ebx
End;
(* -------------------------------------------------------- *)
{76.5.5} Function RemoveARPEntry(Device: Byte; Entry: Dword): Dword; StdCall;
Asm
push ebx
mov eax, 76
mov ebx, $00050000
mov bl, 5
mov bh, Device
mov ecx, Entry
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{76.5.6} Function SendARPAnnounce(Device: Byte): Dword; StdCall;
Asm
push ebx
mov eax, 76
mov ebx, $00050000
mov bl, 6
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
{76.5.7} Function GetARPConflicts(Device: Byte): Dword; StdCall;
Asm
push ebx
mov eax, 76
mov ebx, $00050000
mov bl, 7
mov bh, Device
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
I think it defeats the whole purpose of assembly language application development.0CodErr wrote:I also doing wrappers for my KolibriOS library(260 functions).
What do you think about it?
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein
hidnplayr, what is SockAddr structure? Can't find the description.
And also about OptStruct. Currently this isWhat means the ellipses in 'options...'? What size of structure?
And also about OptStruct. Currently this is
Code: Select all
Optstruct:
dd level
dd optionname
dd optlength
db options...
It seems that can be treated as "Array Of Byte"
But SockAddr structure is still not clear for me.
Code: Select all
db options...
But SockAddr structure is still not clear for me.
It is the same as on other platforms.
See for example http://beej.us/guide/bgnet/output/html/ ... inman.html
See for example http://beej.us/guide/bgnet/output/html/ ... inman.html
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein
Code: Select all
======================================================================
========== Function 74, Subfunction 8, Get TX byte counter. ==========
======================================================================
Parameters:
* eax = 74 - function number
* bl = 8 - subfunction number
* bh = device number
Returned value:
* eax = Number of bytes sent since device start (lower dword)
-1 on error
* ebx = Number of bytes sent since device start (higher dword)
======================================================================
========== Function 74, Subfunction 9, Get RX byte counter. ==========
======================================================================
Parameters:
* eax = 74 - function number
* bl = 9 - subfunction number
* bh = device number
Returned value:
* eax = Number of bytes received since device start (lower dword)
-1 on error
* ebx = Number of bytes received since device start (higher dword)
Also the function below may have the same problem.
Code: Select all
======================================================================
==== Function 76, Protocol 0 - Ethernet, Subfunction 0, Read MAC. ====
======================================================================
Parameters:
* eax = 76 - function number
* high half of ebx = 0 (Ethernet)
* bh = device number
* bl = 0 (Read MAC)
Returned value:
* eax = -1 on error, otherwise lower bits of MAC
* bx = upper bits of MAC
Do you suggest to use different register for the result of the operation?
I don't know, maybe just set to -1 both registers in case of an error?
Possible bug:
- click on IPV4tab
click back to Physical tab
and click on phantom button
Spoiler:
Who is online
Users browsing this forum: No registered users and 0 guests