forked from KolibriOS/kolibrios
Update documentation for night build
git-svn-id: svn://kolibrios.org@3835 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
fff65aab13
commit
e1ffb37233
26
data/eng/docs/OPENDIAL.TXT
Normal file
26
data/eng/docs/OPENDIAL.TXT
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
OpenDialog - file open dialog:
|
||||||
|
1) Move the cursor inside the panel:
|
||||||
|
a) up and down arrows (including add. keyb.) - move the cursor one position up or down.
|
||||||
|
b) PageUp - list page up.
|
||||||
|
c) PageDown - list page down.
|
||||||
|
d) Home - move to the top of directory.
|
||||||
|
e) End - move to the end of directory.
|
||||||
|
2) Enter - operations with the selected file:
|
||||||
|
a) enter the folder.
|
||||||
|
b) choose a file.
|
||||||
|
3) Using the menu:
|
||||||
|
Alt+F1 - call disk selection menu.
|
||||||
|
Alt+F2 - call sort menu.
|
||||||
|
Alt+F3 - call filter menu.
|
||||||
|
Inside the menu:
|
||||||
|
Arrow cursor up and down - move to item.
|
||||||
|
Esc - close the window.
|
||||||
|
Enter - close the window with confirmation.
|
||||||
|
Arrow cursor left and right - move into the adjacent menu.
|
||||||
|
4) Ctrl+R - update the contents of a directory.
|
||||||
|
5) Backspace - exit from the directory.
|
||||||
|
6) Insert - highlighted by red color the file at the cursor and move the cursor one position down.
|
||||||
|
7) Ctrl+A and Ctrl+(NumPad(+) Up) - select all files and directories in the active panel, with the exception of the directory '..'
|
||||||
|
8) Ctrl+(NumPad(-) Up) - deselect all files and directories in the active panel with the exception of the directory '..'
|
||||||
|
9) Ctrl+(NumPad(*) Up) - invert the selection of all files and directories in the active panel, with the exception of the directory '..'
|
||||||
|
10) Esc - shutdown the program, without opening of a file.
|
26
data/it/docs/OPENDIAL.TXT
Normal file
26
data/it/docs/OPENDIAL.TXT
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
OpenDialog - file open dialog:
|
||||||
|
1) Move the cursor inside the panel:
|
||||||
|
a) up and down arrows (including add. keyb.) - move the cursor one position up or down.
|
||||||
|
b) PageUp - list page up.
|
||||||
|
c) PageDown - list page down.
|
||||||
|
d) Home - move to the top of directory.
|
||||||
|
e) End - move to the end of directory.
|
||||||
|
2) Enter - operations with the selected file:
|
||||||
|
a) enter the folder.
|
||||||
|
b) choose a file.
|
||||||
|
3) Using the menu:
|
||||||
|
Alt+F1 - call disk selection menu.
|
||||||
|
Alt+F2 - call sort menu.
|
||||||
|
Alt+F3 - call filter menu.
|
||||||
|
Inside the menu:
|
||||||
|
Arrow cursor up and down - move to item.
|
||||||
|
Esc - close the window.
|
||||||
|
Enter - close the window with confirmation.
|
||||||
|
Arrow cursor left and right - move into the adjacent menu.
|
||||||
|
4) Ctrl+R - update the contents of a directory.
|
||||||
|
5) Backspace - exit from the directory.
|
||||||
|
6) Insert - highlighted by red color the file at the cursor and move the cursor one position down.
|
||||||
|
7) Ctrl+A and Ctrl+(NumPad(+) Up) - select all files and directories in the active panel, with the exception of the directory '..'
|
||||||
|
8) Ctrl+(NumPad(-) Up) - deselect all files and directories in the active panel with the exception of the directory '..'
|
||||||
|
9) Ctrl+(NumPad(*) Up) - invert the selection of all files and directories in the active panel, with the exception of the directory '..'
|
||||||
|
10) Esc - shutdown the program, without opening of a file.
|
@ -1,387 +1,203 @@
|
|||||||
Cosaè implementato
|
eax = 74 - Work directly with network interface
|
||||||
==================
|
ebx = -1 (Get number of active network devices)
|
||||||
|
|
||||||
Le seguenti feature sono presenti nel codice stack TCP/IP:
|
out:
|
||||||
|
eax = number of active network devices
|
||||||
|
|
||||||
IP layer.
|
bh = device number, for all following functions !
|
||||||
ICMP.
|
|
||||||
TCP layer.
|
|
||||||
UDP layer.
|
|
||||||
local loopback.
|
|
||||||
Realtek 8029 PCI ethernet interface.
|
|
||||||
Realtek 8139 PCI ethernet interface.
|
|
||||||
Intel i8255x PCI ethernet interface.
|
|
||||||
Dynamic ARP table.
|
|
||||||
PPP dialer
|
|
||||||
|
|
||||||
E sono implementate le seguenti applicazioni:
|
bl = 0 (Get device type)
|
||||||
|
|
||||||
Server HTTP
|
out:
|
||||||
Telnet
|
eax = device type number
|
||||||
Client POP
|
|
||||||
DNS Name resolver
|
|
||||||
Server MP3
|
|
||||||
Client TFTP
|
|
||||||
Client IRC
|
|
||||||
|
|
||||||
Vi sono inoltre applicazioni sperimentali, per los terming di musica e
|
bl = 1 (Get device name)
|
||||||
per la comunicazione via socket, in fase di sviluppo vi è anche un
|
|
||||||
browser web.
|
|
||||||
|
|
||||||
|
in:
|
||||||
|
ecx = pointer to 64 byte buffer
|
||||||
|
out:
|
||||||
|
name is copied into the buffer
|
||||||
|
eax = -1 on error
|
||||||
|
|
||||||
Cosa non è implementato
|
bl = 2 (Reset the device)
|
||||||
=======================
|
|
||||||
|
|
||||||
Il layer IP non processa le opzioni dello header.
|
in
|
||||||
Il layer IP non supporta il routing.
|
none
|
||||||
Non è supportata la 'Packet fragmentation'.
|
out
|
||||||
|
eax = -1 on error
|
||||||
|
|
||||||
|
bl = 3 (Stop device)
|
||||||
|
|
||||||
Come configurare Kolibri per il PPP
|
in
|
||||||
===================================
|
none
|
||||||
|
out
|
||||||
|
eax = -1 on error
|
||||||
|
|
||||||
Vedi ppp.txt
|
TO BE FIGURED OUT
|
||||||
|
|
||||||
|
eax = 75 - Work with Sockets
|
||||||
|
|
||||||
Come configurare Kolibri per l'Ethernet
|
These functions work like the ones found in UNIX (and windows)
|
||||||
=======================================
|
for more info, please read http://beej.us/guide/bgnet/
|
||||||
|
|
||||||
Inanzitutto è necessario possedere una scheda ethernet supportata e
|
bl = 0 (Open Socket)
|
||||||
installata, o presente sulla scheda madre. Se non si è certi del tipo di
|
|
||||||
hardware, si può provare a configurare lo stack. Se l'hardware è
|
|
||||||
supportato allora verrà notificato e configurato correttamente.
|
|
||||||
|
|
||||||
Setting Up the ARP Table
|
in:
|
||||||
------------------------
|
ecx = domain
|
||||||
|
edx = type
|
||||||
|
esi = protocol
|
||||||
|
out:
|
||||||
|
eax = socket number, -1 on error
|
||||||
|
|
||||||
Kolibri's ARP table is dynamically created and maintained; You can see what
|
bl = 1 (Close Socket)
|
||||||
hosts Kolibri has communicated with by running the ARPSTAT application.
|
|
||||||
|
|
||||||
Enabling Ethernet
|
in:
|
||||||
-----------------
|
ecx = socket number
|
||||||
|
out:
|
||||||
|
eax = -1 on error
|
||||||
|
|
||||||
Boot Kolibri, then select STACKCFG from the NET menu.
|
bl = 2 (Bind)
|
||||||
Press the 'Read' Button, then select 'Packet Driver'.
|
|
||||||
Press 'Change' next to the IP address, and enter the IP address you want
|
|
||||||
to use. Make sure it is on the same sub-net as the LAN to which you are
|
|
||||||
connected.
|
|
||||||
Press 'Apply' to action the changes.
|
|
||||||
Close the program.
|
|
||||||
|
|
||||||
|
in:
|
||||||
|
ecx = socket number
|
||||||
|
edx = pointer to sockaddr structure
|
||||||
|
esi = length of sockaddr structure
|
||||||
|
out:
|
||||||
|
eax = -1 on error
|
||||||
|
|
||||||
The stack is now running, which you can test by pinging Kolibri from a
|
bl = 3 (Listen)
|
||||||
remote host.
|
|
||||||
|
|
||||||
|
in:
|
||||||
|
ecx = socket number
|
||||||
|
edx = backlog
|
||||||
|
out:
|
||||||
|
eax = -1 on error
|
||||||
|
|
||||||
The simplest way to connect two PC's together is using a 'Null Modem'
|
bl = 4 (connect)
|
||||||
Ethernet cable. These simply cross certain wires over. They can be
|
|
||||||
purchased from PC stores, but are simple to make. Details can be found
|
|
||||||
on the web. Look on google for 'ethernet cross over cable' or similar.
|
|
||||||
|
|
||||||
|
in:
|
||||||
|
ecx = socket number
|
||||||
|
edx = pointer to sockaddr structure
|
||||||
|
esi = length of sockaddr structure
|
||||||
|
out:
|
||||||
|
eax = -1 on error
|
||||||
|
|
||||||
How to use TCP/IP locally, with no Network
|
bl = 5 (accept)
|
||||||
==========================================
|
|
||||||
|
|
||||||
Kolibri supports a form of local loopback that means applications on the
|
in:
|
||||||
same PC can communicate with each other via sockets as though they
|
ecx = socket number
|
||||||
were on separate hosts. To connect to an application on the same machine,
|
edx = pointer to sockaddr structure
|
||||||
specify the local IP address as the destination address. You do not even
|
esi = length of sockaddr structure
|
||||||
need to configure the stack for ethernet; local loopback will work without
|
out:
|
||||||
any network hardware. It's great for development and testing.
|
eax = socket number, -1 on error
|
||||||
|
|
||||||
|
bl = 6 (send)
|
||||||
|
|
||||||
Application Programming Interface
|
in:
|
||||||
=================================
|
ecx = socket number
|
||||||
|
edx = pointer to buffer
|
||||||
|
esi = length of buffer
|
||||||
|
edi = flags
|
||||||
|
out:
|
||||||
|
eax = -1 on error
|
||||||
|
|
||||||
The developer can access the stack through interrupt 0x40, function 53.
|
bl = 7 (receive)
|
||||||
The file TFTPC.ASM gives a good example of how to use the programming
|
|
||||||
interface ( at least, for UDP), but as network communication is complex
|
|
||||||
I'll give an overview.
|
|
||||||
|
|
||||||
|
in:
|
||||||
|
ecx = socket number
|
||||||
|
edx = pointer to buffer
|
||||||
|
esi = length of buffer
|
||||||
|
edi = flags
|
||||||
|
out:
|
||||||
|
eax = number of bytes copied, -1 on error
|
||||||
|
|
||||||
Sockets
|
bl = 8 (set socket options)
|
||||||
=======
|
|
||||||
|
|
||||||
Applications connect to each other and pass information between themselves
|
in:
|
||||||
through a mechanism called a 'socket'. Sockets are end-points for
|
ecx = socket number
|
||||||
communication; You need one at each application to communicate.
|
edx = level
|
||||||
|
esi = optionname
|
||||||
|
edi = ptr to buffer
|
||||||
|
|
||||||
Using sockets is a little like using files on an OS; You open them, read
|
The buffer's first dword is the length of the buffer, minus the first dword offcourse
|
||||||
and write to them, then close them. The only thing that makes life slightly
|
|
||||||
more complicated is that unlike with a file, you have something intelligent
|
|
||||||
at the other end ( which for example may not want to close when you do! )
|
|
||||||
|
|
||||||
Lets deal with the terminology before we go any further.
|
out:
|
||||||
|
eax = -1 on error
|
||||||
|
|
||||||
socket A unique identifier used by the application for communication.
|
bl = 9 (get socket options
|
||||||
local port A number that identifies this application on the local host.
|
|
||||||
Ports are a way to allow multiple applications to communicate
|
|
||||||
with other hosts without the data becoming mixed up. ( The
|
|
||||||
technical term is 'multiplex' ). Port numbers are 16 bit.
|
|
||||||
remote port A number that identifies the application on the remote host
|
|
||||||
to which we are communicating with. To the remote host, this is
|
|
||||||
it's 'local port'. Port numbers are 16 bit.
|
|
||||||
IP Address A 32 bit number that identifies the remote host PC that we are
|
|
||||||
communicating with.
|
|
||||||
Passive Refers to the mode by which a socket is opened; When opening in
|
|
||||||
passive mode, the local PC is awaiting an incoming connection.
|
|
||||||
Active Refers to the mode by which a socket is opened; When opening in
|
|
||||||
active mode, the local PC will attempt to connect to a remote
|
|
||||||
PC.
|
|
||||||
|
|
||||||
When you connect to a socket on a remote PC, you need to specify more than
|
in:
|
||||||
just the IP address, otherwise the remote stack will not know to which
|
ecx = socket number
|
||||||
application it should send your data. You must fully qualify the address,
|
edx = level
|
||||||
which means you specify the IP address and the port number. This would be
|
esi = optionname
|
||||||
written like this
|
edi = ptr to buffer
|
||||||
|
|
||||||
192.168.1.10:80 ; Connect to port 80 on the machine 192.168.1.10
|
The buffer's first dword is the length of the buffer, minus the first dword offcourse
|
||||||
|
|
||||||
Port numbers are important. Some are 'well known' and provide access to
|
out:
|
||||||
common applications. For example port 80 is used by HTTP servers; That
|
eax = -1 on error, socket option otherwise
|
||||||
way I can connect to a webserver on a host without having to find out
|
|
||||||
what port number the application is listening on.
|
|
||||||
|
|
||||||
This brings me to the way in which you open a socket; As I said earlier,
|
TIP
|
||||||
there are two modes, Passive and Active. A webserver would open a passive
|
|
||||||
socket, as it is waiting for incoming connection requests. A web browser
|
|
||||||
would open an active socket because it is attempting to connect to a
|
|
||||||
specified remote host.
|
|
||||||
|
|
||||||
|
when you import 'network.inc' and 'macros.inc' into your source code, you can use the following syntax to work with sockets:
|
||||||
|
|
||||||
Access to programming interface
|
|
||||||
===============================
|
|
||||||
The developer accesses the stack functions through interrupt 0x40,
|
|
||||||
function 53. Some functions may be accessed through function 52, but these
|
|
||||||
are mainly for stack configuration.
|
|
||||||
Here is a summary of the functions that you may use and the parameter
|
|
||||||
definitions.
|
|
||||||
|
|
||||||
|
for example, to open a socket
|
||||||
|
|
||||||
Get Local IP Address
|
mcall socket, AF_INET, SOCK_DGRAM,0
|
||||||
--------------------
|
mov [socketnum], eax
|
||||||
eax = 52
|
|
||||||
ebx = 1
|
|
||||||
|
|
||||||
IP address returned in eax ( in internet byte order )
|
then to connect to a server
|
||||||
|
|
||||||
|
mcall connect, [socketnum], sockaddr, 18
|
||||||
|
|
||||||
Write to stack input queue
|
|
||||||
--------------------------
|
|
||||||
eax = 52
|
|
||||||
ebx = 6
|
|
||||||
edx = number of bytes to write
|
|
||||||
esi = pointer to data ( in application space )
|
|
||||||
|
|
||||||
On return, eax holds 0 for OK, or 0xFFFFFFFF for error.
|
eax = 76 - Work with protocols
|
||||||
This interface is for slow network drivers only ( PPP, SLIP )
|
|
||||||
|
|
||||||
|
high half of ebx = protocol number (for all subfunctions!)
|
||||||
|
bh = device number (for all subfunctions!)
|
||||||
|
bl = subfunction number, depends on protocol type
|
||||||
|
|
||||||
Read data from network output queue
|
For Ethernet protocol
|
||||||
-----------------------------------
|
|
||||||
eax = 52
|
|
||||||
ebx = 8
|
|
||||||
esi = pointer to data ( in application space )
|
|
||||||
|
|
||||||
On return, eax holds number of bytes transferred.
|
0 - Read # Packets send
|
||||||
This interface is for slow network drivers only ( PPP, SLIP )
|
1 - Read # Packets received
|
||||||
|
2 - Read # Bytes send
|
||||||
|
3 - Read # Bytes received
|
||||||
|
4 - Read MAC
|
||||||
|
5 - Write MAC
|
||||||
|
6 - Read IN-QUEUE size
|
||||||
|
7 - Read OUT-QUEUE size
|
||||||
|
For IPv4 protocol
|
||||||
|
|
||||||
|
0 - Read # IP packets send
|
||||||
|
1 - Read # IP packets received
|
||||||
|
2 - Read IP
|
||||||
|
3 - Write IP
|
||||||
|
4 - Read DNS
|
||||||
|
5 - Write DNS
|
||||||
|
6 - Read subnet
|
||||||
|
7 - Write subnet
|
||||||
|
8 - Read gateway
|
||||||
|
9 - Write gateway
|
||||||
|
For ARP protocol
|
||||||
|
|
||||||
Open a UDP socket
|
0 - Read # ARP packets send
|
||||||
-----------------
|
1 - Read # ARP packets received
|
||||||
eax = 53
|
2 - Get # ARP entry's
|
||||||
ebx = 0
|
3 - Read ARP entry
|
||||||
ecx = local port
|
4 - Add static ARP entry
|
||||||
edx = remote port
|
5 - Remove ARP entry (-1 = remove all)
|
||||||
esi = remote ip address ( in internet byte order )
|
For ICMP protocol
|
||||||
|
|
||||||
The socket number allocated is returned in eax.
|
0 - Read # ICMP packets send
|
||||||
A return value of 0xFFFFFFFF means no socket could be opened.
|
1 - Read # ICMP packets received
|
||||||
|
3 - enable/disable ICMP echo reply
|
||||||
|
For UDP protocol
|
||||||
|
|
||||||
|
0 - Read # UDP packets send
|
||||||
|
1 - Read # UDP packets received
|
||||||
|
For TCP protocol
|
||||||
|
|
||||||
Open a TCP socket
|
0 - Read # TCP packets send
|
||||||
-----------------
|
1 - Read # TCP packets received
|
||||||
eax = 53
|
|
||||||
ebx = 5
|
|
||||||
ecx = local port
|
|
||||||
edx = remote port
|
|
||||||
esi = remote ip address ( in internet byte order )
|
|
||||||
edi = mode : SOCKET_PASSIVE or SOCKET_ACTIVE ( defined in stack.inc )
|
|
||||||
|
|
||||||
The socket number allocated is returned in eax.
|
|
||||||
A return value of 0xFFFFFFFF means no socket could be opened.
|
|
||||||
|
|
||||||
|
|
||||||
Close a socket (UDP Only )
|
|
||||||
--------------------------
|
|
||||||
eax = 53
|
|
||||||
ebx = 1
|
|
||||||
ecx = socket number
|
|
||||||
|
|
||||||
On return, eax holds 0 for OK, or 0xFFFFFFFF for error.
|
|
||||||
|
|
||||||
|
|
||||||
Close a socket (TCP Only )
|
|
||||||
--------------------------
|
|
||||||
eax = 53
|
|
||||||
ebx = 8
|
|
||||||
ecx = socket number
|
|
||||||
|
|
||||||
On return, eax holds 0 for OK, or 0xFFFFFFFF for error.
|
|
||||||
|
|
||||||
|
|
||||||
Poll socket
|
|
||||||
-----------
|
|
||||||
eax = 53
|
|
||||||
ebx = 2
|
|
||||||
ecx = socket number
|
|
||||||
|
|
||||||
On return, eax holds the number of bytes in the receive buffer.
|
|
||||||
|
|
||||||
|
|
||||||
Read socket data
|
|
||||||
----------------
|
|
||||||
eax = 53
|
|
||||||
ebx = 3
|
|
||||||
ecx = socket number
|
|
||||||
|
|
||||||
On return, eax holds the number of bytes remaining, bl holds a data byte.
|
|
||||||
|
|
||||||
|
|
||||||
Write to socket ( UDP only )
|
|
||||||
----------------------------
|
|
||||||
eax = 53
|
|
||||||
ebx = 4
|
|
||||||
ecx = socket number
|
|
||||||
edx = number of bytes to write
|
|
||||||
esi = pointer to data ( in application space )
|
|
||||||
|
|
||||||
On return, eax holds 0 for OK, or 0xFFFFFFFF for error.
|
|
||||||
|
|
||||||
|
|
||||||
Return socket status ( TCP only )
|
|
||||||
---------------------------------
|
|
||||||
eax = 53
|
|
||||||
ebx = 6
|
|
||||||
ecx = socket number
|
|
||||||
|
|
||||||
On return, eax holds the sockets TCP status.
|
|
||||||
This function can be used to determine when a socket has actually connected
|
|
||||||
to another socket - data cannot be written to a socket until the connection
|
|
||||||
is established (TCB_ESTABLISHED). The states a socket can be in are defined
|
|
||||||
in stack.inc as TCB_
|
|
||||||
|
|
||||||
|
|
||||||
Write to socket ( TCP only )
|
|
||||||
----------------------------
|
|
||||||
eax = 53
|
|
||||||
ebx = 7
|
|
||||||
ecx = socket number
|
|
||||||
edx = number of bytes to write
|
|
||||||
esi = pointer to data ( in application space )
|
|
||||||
|
|
||||||
On return, eax holds 0 for OK, or 0xFFFFFFFF for error.
|
|
||||||
|
|
||||||
|
|
||||||
Check port number
|
|
||||||
-----------------
|
|
||||||
eax = 53
|
|
||||||
ebx = 9
|
|
||||||
ecx = port number
|
|
||||||
|
|
||||||
This function is used to determine if a port number
|
|
||||||
is in use by any sockets as a local port number. Local
|
|
||||||
port numbers are normally unique.
|
|
||||||
|
|
||||||
On return, eax is 1 for port number not in use, 0 otherwise.
|
|
||||||
|
|
||||||
|
|
||||||
Opening a TCP socket in Kolibri
|
|
||||||
===============================
|
|
||||||
|
|
||||||
There are two ways to open a socket - Passive or Active.
|
|
||||||
|
|
||||||
In a Passive connection your application 'listens' for incoming
|
|
||||||
requests from remote applications. Typically this will be done when
|
|
||||||
you are implementing a server application that allows any other
|
|
||||||
application to connect to it. You would specify a 'known' local
|
|
||||||
port number, such as 80 for a web server. You would leave the
|
|
||||||
remote IP and remote port number as 0, which indicates any
|
|
||||||
remote application may connect.
|
|
||||||
|
|
||||||
Once the socket has been opened you would wait for an incoming
|
|
||||||
connection before doing anything. This can be by either checking
|
|
||||||
the socket status for TCB_ESTABLISHED, or waiting for data in the
|
|
||||||
receive buffer.
|
|
||||||
|
|
||||||
In an Active connection, you are making a connection to a specified
|
|
||||||
remote port. The remote IP and remote port parameters must be filled
|
|
||||||
in with non-zero values ( otherwise, what are you connecting to? ).
|
|
||||||
You also specify a unique local port number so the remote application
|
|
||||||
can uniquely identify you - after all, there may be several applications
|
|
||||||
on your machine connected to the same remote host. See below for finding
|
|
||||||
a unique port number.
|
|
||||||
|
|
||||||
|
|
||||||
How to find an unused local port number
|
|
||||||
=======================================
|
|
||||||
|
|
||||||
Typically when you are creating an active connection to a remote
|
|
||||||
socket you will want to choose a unique local port number. Local
|
|
||||||
port numbers normally start from 1000; The following code may
|
|
||||||
be used to obtain an unused port number prior to making the
|
|
||||||
open socket call.
|
|
||||||
|
|
||||||
mov ecx, 1000 ; local port starting at 1000
|
|
||||||
|
|
||||||
getlp:
|
|
||||||
inc ecx
|
|
||||||
push ecx
|
|
||||||
mov eax, 53
|
|
||||||
mov ebx, 9
|
|
||||||
int 0x40
|
|
||||||
pop ecx
|
|
||||||
cmp eax, 0 ; is this local port in use?
|
|
||||||
jz getlp ; yes - so try next
|
|
||||||
|
|
||||||
; ecx contains a free local port number
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Writing data to a socket
|
|
||||||
========================
|
|
||||||
|
|
||||||
There are two functions available depending on whether the socket
|
|
||||||
was opened for TCP or UDP protocol; The call parameters are the
|
|
||||||
same however. When the socket is being opened for TCP, use the
|
|
||||||
status function to poll for a connection - data cannot be written
|
|
||||||
to a socket until another socket has connected to it, and the
|
|
||||||
state of the socket is TCB_ESTABLISHED.
|
|
||||||
|
|
||||||
When you write data, the call results in a single IP packet being
|
|
||||||
created and transmitted. Thus the user application is responsible for
|
|
||||||
the size of transmitted packets. Keep the packet sizes under 768 bytes.
|
|
||||||
If you are writing a terminal program like telnet, you may want to send
|
|
||||||
a packet for each keystroke ( inefficient ) or use a timer to send data
|
|
||||||
periodically ( say, every second ).
|
|
||||||
|
|
||||||
|
|
||||||
Reading data from a socket
|
|
||||||
==========================
|
|
||||||
|
|
||||||
There is one function to read data from a sockets receive buffer. This
|
|
||||||
function retrieves one byte at a time. You can use the poll function to
|
|
||||||
test the receive buffer for data.
|
|
||||||
|
|
||||||
|
|
||||||
Closing a socket
|
|
||||||
================
|
|
||||||
|
|
||||||
Simply call the appropriate function - there is one for TCP, and another
|
|
||||||
for UDP. When closing a TCP socket, don't forget that the other end
|
|
||||||
may continue to send data, so the socket may remain active for a
|
|
||||||
few seconds after your call.
|
|
||||||
|
|
||||||
|
|
||||||
If you have any questions or have suggestions for improving this
|
|
||||||
document please contact me at mikeh@oceanfree.net.
|
|
26
data/rus/docs/OPENDIAL.TXT
Normal file
26
data/rus/docs/OPENDIAL.TXT
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
OpenDialog - „¨ «®£ ®âªàëâ¨ï ä ©« :
|
||||||
|
1) <20>¥à¥¬¥é¥¨¥ ªãàá®à ¯® ¯ ¥«¨:
|
||||||
|
) áâ५ª¨ ¢¢¥àå ¨ ¢¨§ (¢ ⮬ ç¨á«¥ à ᯮ«®¦¥ë¥ ¢ ¤®¯®«¨â¥«ì®© ç á⨠ª« ¢¨ âãàë) - ¯¥à¥¬¥é¥¨¥ ªãàá®à ®¤ã ¯®§¨æ¨î ¢¢¥àå ¨«¨ ¢¨§.
|
||||||
|
¡) PageUp - ¯®áâà ¨ç®¥ «¨áâ ¨¥ ¢¢¥àå.
|
||||||
|
¢) PageDown - ¯®áâà ¨ç®¥ «¨áâ ¨¥ ¢¨§.
|
||||||
|
£) Home - ¢ ç «® ª â «®£ á ä ©« ¬¨.
|
||||||
|
¤) End - ¢ ª®¥æ ª â «®£ á ä ©« ¬¨.
|
||||||
|
2) Enter - ¤¥©á⢨ï á ä ©«®¬ ¯®§¨æ¨¨ ª®â®à®£® 室¨âáï ªãàá®à ¢ë¤¥«¥¨ï:
|
||||||
|
) ¢å®¤ ¢ ¯ ¯ªã.
|
||||||
|
¡) ¢ë¡®à ä ©« .
|
||||||
|
3) <20> ¡®â á ¬¥î:
|
||||||
|
Alt+F1 - ¢ë§®¢ ¬¥î ¢ë¡®à ¤¨áª .
|
||||||
|
Alt+F2 - ¢ë§®¢ ¬¥î á®àâ¨à®¢ª¨.
|
||||||
|
Alt+F3 - ¢ë§®¢ ¬¥î 䨫ìâà 樨.
|
||||||
|
‚ ¬¥î:
|
||||||
|
‘â५ª¨ ªãàá®à ¢¢¥àå ¨ ¢¨§ ¯¥à¥¬¥é¥¨¥ ¯® ¯ãªâ ¬.
|
||||||
|
Esc - § ªàëâì ®ª®.
|
||||||
|
Enter - ‡ ªàëâì ®ª® á ¯®¤â¢¥à¦¤¥¨¥¬ ¯ãªâ .
|
||||||
|
‘â५ª¨ ªãàá®à ¢«¥¢® ¨ ¢¯à ¢® ¯¥à¥¬¥é¥¨¥ ¢ á®á¥¤¥¥ ¬¥î.
|
||||||
|
4) Ctrl+R - ®¡®¢¨âì ᮤ¥à¦¨¬®£® ¤¨à¥ªâ®à¨¨.
|
||||||
|
5) Backspace (áâ५ª ¢«¥¢® à冷¬ á Insert) - ¢ë室 ¨§ ¤¨à¥ªâ®à¨¨.
|
||||||
|
6) Insert - ¢ë¤¥«¥¨¥ ªà áë¬ æ¢¥â®¬ ä ©« ª®â®à®¬ 室¨âáï ªãàá®à ¨ ¯¥à¥¬¥é¥¨¥ ªãàá®à 1 ¯®§¨æ¨î ¢¨§.
|
||||||
|
7) Ctrl+A ¨ Ctrl+(NumPad(+) Up) - ¢ë¤¥«¥¨¥ ¢á¥å ä ©«®¢ ¨ ¤¨à¥ªâ®à¨© ¢ ªâ¨¢®© ¯ ¥«¨, § ¨áª«î票¥¬ ¤¨à¥ªâ®à¨¨ '..'
|
||||||
|
8) Ctrl+(NumPad(-) Up) - áïâì ¢ë¤¥«¥¨¥ ¢á¥å ä ©«®¢ ¨ ¤¨à¥ªâ®à¨© ¢ ªâ¨¢®© ¯ ¥«¨, § ¨áª«î票¥¬ ¤¨à¥ªâ®à¨¨ '..'
|
||||||
|
9) Ctrl+(NumPad(*) Up) - ¨¢¥àâ¨à®¢ âì ¢ë¤¥«¥¨¥ ¢á¥å ä ©«®¢ ¨ ¤¨à¥ªâ®à¨© ¢ ªâ¨¢®© ¯ ¥«¨, § ¨áª«î票¥¬ ¤¨à¥ªâ®à¨¨ '..'
|
||||||
|
10) Esc - § ¢¥à襨¥ à ¡®âë ¯à®£à ¬¬ë, ¡¥§ ®âªàëâ¨ï ä ©« .
|
203
data/rus/docs/STACK.TXT
Normal file
203
data/rus/docs/STACK.TXT
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
eax = 74 - Work directly with network interface
|
||||||
|
ebx = -1 (Get number of active network devices)
|
||||||
|
|
||||||
|
out:
|
||||||
|
eax = number of active network devices
|
||||||
|
|
||||||
|
bh = device number, for all following functions !
|
||||||
|
|
||||||
|
bl = 0 (Get device type)
|
||||||
|
|
||||||
|
out:
|
||||||
|
eax = device type number
|
||||||
|
|
||||||
|
bl = 1 (Get device name)
|
||||||
|
|
||||||
|
in:
|
||||||
|
ecx = pointer to 64 byte buffer
|
||||||
|
out:
|
||||||
|
name is copied into the buffer
|
||||||
|
eax = -1 on error
|
||||||
|
|
||||||
|
bl = 2 (Reset the device)
|
||||||
|
|
||||||
|
in
|
||||||
|
none
|
||||||
|
out
|
||||||
|
eax = -1 on error
|
||||||
|
|
||||||
|
bl = 3 (Stop device)
|
||||||
|
|
||||||
|
in
|
||||||
|
none
|
||||||
|
out
|
||||||
|
eax = -1 on error
|
||||||
|
|
||||||
|
TO BE FIGURED OUT
|
||||||
|
|
||||||
|
eax = 75 - Work with Sockets
|
||||||
|
|
||||||
|
These functions work like the ones found in UNIX (and windows)
|
||||||
|
for more info, please read http://beej.us/guide/bgnet/
|
||||||
|
|
||||||
|
bl = 0 (Open Socket)
|
||||||
|
|
||||||
|
in:
|
||||||
|
ecx = domain
|
||||||
|
edx = type
|
||||||
|
esi = protocol
|
||||||
|
out:
|
||||||
|
eax = socket number, -1 on error
|
||||||
|
|
||||||
|
bl = 1 (Close Socket)
|
||||||
|
|
||||||
|
in:
|
||||||
|
ecx = socket number
|
||||||
|
out:
|
||||||
|
eax = -1 on error
|
||||||
|
|
||||||
|
bl = 2 (Bind)
|
||||||
|
|
||||||
|
in:
|
||||||
|
ecx = socket number
|
||||||
|
edx = pointer to sockaddr structure
|
||||||
|
esi = length of sockaddr structure
|
||||||
|
out:
|
||||||
|
eax = -1 on error
|
||||||
|
|
||||||
|
bl = 3 (Listen)
|
||||||
|
|
||||||
|
in:
|
||||||
|
ecx = socket number
|
||||||
|
edx = backlog
|
||||||
|
out:
|
||||||
|
eax = -1 on error
|
||||||
|
|
||||||
|
bl = 4 (connect)
|
||||||
|
|
||||||
|
in:
|
||||||
|
ecx = socket number
|
||||||
|
edx = pointer to sockaddr structure
|
||||||
|
esi = length of sockaddr structure
|
||||||
|
out:
|
||||||
|
eax = -1 on error
|
||||||
|
|
||||||
|
bl = 5 (accept)
|
||||||
|
|
||||||
|
in:
|
||||||
|
ecx = socket number
|
||||||
|
edx = pointer to sockaddr structure
|
||||||
|
esi = length of sockaddr structure
|
||||||
|
out:
|
||||||
|
eax = socket number, -1 on error
|
||||||
|
|
||||||
|
bl = 6 (send)
|
||||||
|
|
||||||
|
in:
|
||||||
|
ecx = socket number
|
||||||
|
edx = pointer to buffer
|
||||||
|
esi = length of buffer
|
||||||
|
edi = flags
|
||||||
|
out:
|
||||||
|
eax = -1 on error
|
||||||
|
|
||||||
|
bl = 7 (receive)
|
||||||
|
|
||||||
|
in:
|
||||||
|
ecx = socket number
|
||||||
|
edx = pointer to buffer
|
||||||
|
esi = length of buffer
|
||||||
|
edi = flags
|
||||||
|
out:
|
||||||
|
eax = number of bytes copied, -1 on error
|
||||||
|
|
||||||
|
bl = 8 (set socket options)
|
||||||
|
|
||||||
|
in:
|
||||||
|
ecx = socket number
|
||||||
|
edx = level
|
||||||
|
esi = optionname
|
||||||
|
edi = ptr to buffer
|
||||||
|
|
||||||
|
The buffer's first dword is the length of the buffer, minus the first dword offcourse
|
||||||
|
|
||||||
|
out:
|
||||||
|
eax = -1 on error
|
||||||
|
|
||||||
|
bl = 9 (get socket options
|
||||||
|
|
||||||
|
in:
|
||||||
|
ecx = socket number
|
||||||
|
edx = level
|
||||||
|
esi = optionname
|
||||||
|
edi = ptr to buffer
|
||||||
|
|
||||||
|
The buffer's first dword is the length of the buffer, minus the first dword offcourse
|
||||||
|
|
||||||
|
out:
|
||||||
|
eax = -1 on error, socket option otherwise
|
||||||
|
|
||||||
|
TIP
|
||||||
|
|
||||||
|
when you import 'network.inc' and 'macros.inc' into your source code, you can use the following syntax to work with sockets:
|
||||||
|
|
||||||
|
|
||||||
|
for example, to open a socket
|
||||||
|
|
||||||
|
mcall socket, AF_INET, SOCK_DGRAM,0
|
||||||
|
mov [socketnum], eax
|
||||||
|
|
||||||
|
then to connect to a server
|
||||||
|
|
||||||
|
mcall connect, [socketnum], sockaddr, 18
|
||||||
|
|
||||||
|
|
||||||
|
eax = 76 - Work with protocols
|
||||||
|
|
||||||
|
high half of ebx = protocol number (for all subfunctions!)
|
||||||
|
bh = device number (for all subfunctions!)
|
||||||
|
bl = subfunction number, depends on protocol type
|
||||||
|
|
||||||
|
For Ethernet protocol
|
||||||
|
|
||||||
|
0 - Read # Packets send
|
||||||
|
1 - Read # Packets received
|
||||||
|
2 - Read # Bytes send
|
||||||
|
3 - Read # Bytes received
|
||||||
|
4 - Read MAC
|
||||||
|
5 - Write MAC
|
||||||
|
6 - Read IN-QUEUE size
|
||||||
|
7 - Read OUT-QUEUE size
|
||||||
|
For IPv4 protocol
|
||||||
|
|
||||||
|
0 - Read # IP packets send
|
||||||
|
1 - Read # IP packets received
|
||||||
|
2 - Read IP
|
||||||
|
3 - Write IP
|
||||||
|
4 - Read DNS
|
||||||
|
5 - Write DNS
|
||||||
|
6 - Read subnet
|
||||||
|
7 - Write subnet
|
||||||
|
8 - Read gateway
|
||||||
|
9 - Write gateway
|
||||||
|
For ARP protocol
|
||||||
|
|
||||||
|
0 - Read # ARP packets send
|
||||||
|
1 - Read # ARP packets received
|
||||||
|
2 - Get # ARP entry's
|
||||||
|
3 - Read ARP entry
|
||||||
|
4 - Add static ARP entry
|
||||||
|
5 - Remove ARP entry (-1 = remove all)
|
||||||
|
For ICMP protocol
|
||||||
|
|
||||||
|
0 - Read # ICMP packets send
|
||||||
|
1 - Read # ICMP packets received
|
||||||
|
3 - enable/disable ICMP echo reply
|
||||||
|
For UDP protocol
|
||||||
|
|
||||||
|
0 - Read # UDP packets send
|
||||||
|
1 - Read # UDP packets received
|
||||||
|
For TCP protocol
|
||||||
|
|
||||||
|
0 - Read # TCP packets send
|
||||||
|
1 - Read # TCP packets received
|
@ -1,378 +0,0 @@
|
|||||||
—â® ®áãé¥á⢫¥®
|
|
||||||
==================
|
|
||||||
|
|
||||||
‘«¥¤ãî騥 ®á®¡¥®á⨠¯à¨áãâáâ¢ãîâ ¢ ª®¤¥ TCP/IP á⥪ :
|
|
||||||
|
|
||||||
|
|
||||||
“஢¥ì IP.
|
|
||||||
ICMP.
|
|
||||||
“஢¥ì TCP.
|
|
||||||
“஢¥ì UDP.
|
|
||||||
‹®ª «ìë© ¢®§¢à â 横« .
|
|
||||||
Realtek 8029 ¨â¥à䥩ᮢ á¥â¨ áâ ¤ àâ Ethernet PCI.
|
|
||||||
Realtek 8139 ¨â¥à䥩ᮢ á¥â¨ áâ ¤ àâ Ethernet PCI.
|
|
||||||
Intel i8255x PCI ¨â¥à䥩á á¥â¨ áâ ¤ àâ Ethernet.
|
|
||||||
„¨ ¬¨ç¥áª ï â ¡«¨æ ¯à®â®ª®« ®¯à¥¤¥«¥¨ï ¤à¥á®¢.
|
|
||||||
Point-to-point ¯à®â®ª®«(PPP)
|
|
||||||
|
|
||||||
ˆ á«¥¤ãî騥 ˆâ¥à¥â ¯à®£à ¬¬ë:
|
|
||||||
|
|
||||||
HTTP á¥à¢¥à
|
|
||||||
POP ª«¨¥â
|
|
||||||
Telnet
|
|
||||||
DNS Name resolver
|
|
||||||
Mp3 á¥à¢¥à
|
|
||||||
TFTP ª«¨¥â
|
|
||||||
IRC ª«¨¥â
|
|
||||||
FTP ª«¨¥â
|
|
||||||
PPP - §¢®¨«ª
|
|
||||||
|
|
||||||
…áâì àï¤ íªá¯¥à¨¬¥â «ìëå ¯à¨«®¦¥¨© ¤«ï ¯à®¨£àë¢ ¨ï ¯®â®ª®¢®© ¬ã§ëª¨ ¨
|
|
||||||
¢ë¯®«¥¨ï ¢§ ¨¬®¤¥©áâ¢¨ï ¯à®æ¥áᮢ ç¥à¥§ ᮪¥âë. ’ ª¦¥ ¥áâì ¯à®áâ¥ìª¨©
|
|
||||||
¡à 㧥à, ¯®§¢®«ïî騩 « §¨âì ¯® ¢á¥¬¨à®© ¯ ã⨥(WWW).
|
|
||||||
|
|
||||||
|
|
||||||
—â® ¥ ®áãé¥á⢫¥®
|
|
||||||
===================
|
|
||||||
|
|
||||||
“஢¥ì IP ¥ ®¡à ¡ âë¢ ¥â ®¯æ¨¨ § £®«®¢ª .
|
|
||||||
“஢¥ì IP ¥ ¯®¤¤¥à¦¨¢ ¥â ¬ àèàã⨧ æ¨î.
|
|
||||||
”à £¬¥â æ¨ï ¯ ª¥â ¥ ¯®¤¤¥à¦¨¢ ¥âáï.
|
|
||||||
|
|
||||||
|
|
||||||
Š®ä¨£ãà æ¨ï PPP ¢ Š®«¨¡à¨
|
|
||||||
===========================
|
|
||||||
|
|
||||||
‘¬®âà¨â¥ ppp.txt(¨«¨ ppp_rus.txt á àãá᪨¬ ¯¥à¥¢®¤®¬)
|
|
||||||
|
|
||||||
|
|
||||||
Š ª ᪮䨣ãà¨à®¢ âì Š®«¨¡à¨ ¤«ï «®ª «ì®© á¥â¨
|
|
||||||
==============================================
|
|
||||||
|
|
||||||
„«ï ç « ã ¢ á ¤®«¦ ¡ëâì á¥â¥¢ ï ª àâ áâ ¤ àâ Ethernet ¨«¨, ¥á«¨ ¥ñ ¥â,
|
|
||||||
¢áâ஥ãî ¢ ¢ èã á¨á⥬ãî ¯« âã. …᫨ ¢ë, ¥ § ¥â¥, ¥áâì «¨ ã ¢ á á¥â¥¢ ï
|
|
||||||
ª àâ , â® ¯à®¡ã©â¥ ᪮䨣ãà¨à®¢ âì á⥪. …᫨ ® ¥áâì ¨ ¯®¤¤¥à¦¨¢ ¥âáï, â®
|
|
||||||
ᬮ¦¥â¥ ¨á¯®«ì§®¢ âì ¥ñ.
|
|
||||||
|
|
||||||
“áâ ®¢ª â ¡«¨æë ¯à®â®ª®« ®¯à¥¤¥«¥¨ï ¤à¥á®¢
|
|
||||||
-----------------------------------------------
|
|
||||||
|
|
||||||
’ ¡«¨æ ¯à®â®ª®« ®¯à¥¤¥«¥¨ï ¤à¥á®¢ ¢ Š®«¨¡à¨ 㦥 ¤¨ ¬¨ç¥áª¨ ᮧ¤ ¨
|
|
||||||
᪮䨣ãà¨à®¢ . ‚ë ¬®¦¥â¥ ¯®á¬®âà¥âì, á ª ª¨¬¨ ª®¬¯ìîâ¥à ¬¨ Š®«¨¡à¨ à ¡®â ¥â,
|
|
||||||
¢ë¯®«¨¢ ¯à¨«®¦¥¨¥ ARPSTAT.
|
|
||||||
|
|
||||||
<EFBFBD>®¤ª«î票¥ ª «®ª «ì®© á¥â¨
|
|
||||||
---------------------------
|
|
||||||
|
|
||||||
‡ £à㧨⥠Š®«¨¡à¨, § ⥬ ¢ë¡¥à¨â¥ STACKCFG(ª®ä¨£ãà æ¨ï á⥪ ) ¢ ¬¥î NET(á¥âì).
|
|
||||||
|
|
||||||
<EFBFBD> ¦¬¨â¥ Š®¯ªã '—⥨ï', § ⥬ ¢ë¡¥à¨â¥ '„à ©¢¥à <20> ª¥â '.
|
|
||||||
<EFBFBD> ¦¬¨â¥ "Change"(¢ë¡®à) à冷¬ á ¤à¥á®¬ IP, ¨ ¢¢¥¤¨â¥ ã¦ë© IP, ª®â®àë© ¢ë
|
|
||||||
å®â¨â¥ ¨á¯®«ì§®¢ âì. “¤®á⮢¥àìâ¥áì, çâ® ® 室¨âáï ¢ ⮩ ¦¥ á ¬®© ¯®¤á¥â¨,
|
|
||||||
çâ® ¨ á ¬ «®ª «ì ï á¥âì, ª ª®â®à®© ¢ë ¯®¤ª«îç¥ë. <20> ¦¬¨â¥ "Apply"(¯à¨¬¥¨âì)
|
|
||||||
¤«ï ¯®¤â¢¥à¦¤¥¨ï ¨§¬¥¥¨©.
|
|
||||||
‡ ªà®©â¥ ¯à®£à ¬¬ã.
|
|
||||||
|
|
||||||
‘⥪ ᪮䨣ãà¨à®¢ ¨ § ¯ãé¥. ‚ë ¬®¦¥â¥ ¯à®¢¥à¨âì ¥£® à ¡®âã, ¯à®¯¨£®¢ ¢
|
|
||||||
Š®«¨¡à¨ á 㤠«¥®£® ª®¬¯ìîâ¥à .
|
|
||||||
|
|
||||||
‘ ¬ë© ¯à®á⮩ ᯮᮡ ¯®¤ª«îç¨âì ¤¢ PC ¢¬¥á⥠- íâ® ¨á¯®«ì§®¢ âì ã«¥¢®¥
|
|
||||||
¬®¤¥¬®¥ ᮥ¤¨¥¨¥. <20>â® ®¡ë箥 ᮥ¤¨¥¨¥ ª®¬¯ìîâ¥à®¢ ¯®á।á⢮¬ ª ¡¥«ï. Ž¨
|
|
||||||
¬®£ãâ ¡ëâì ªã¯«¥ë ¢¬¥áâ¥ á ¯ ¬ïâìî ¨«¨ ¯à®á⮠ᤥ« ë. <20>®¤à®¡®á⨠¬®¦® ©â¨
|
|
||||||
¢ ˆâ¥à¥â¥. ˆé¨â¥ ¯®¨áª®¢¨ª å, ( ¯à¨¬¥à www.gogle.ru) ¢¢¥¤ï ¢ áâபã
|
|
||||||
¯®¨áª : '®à£ ¨§ æ¨ï ᮥ¤¨¥¨ï ª®¬¯ìîâ¥à®¢ á ¯®¬®éìî ª ¡¥«ï' ¨«¨ ¯®¤®¡ë¥.
|
|
||||||
|
|
||||||
Š ª ¨á¯®«ì§®¢ âì TCP/IP ¡¥§ ¯®¤ª«îç¥¨ï ª á¥â¨
|
|
||||||
=============================================
|
|
||||||
|
|
||||||
Š®«¨¡à¨ ¯®¤¤¥à¦¨¢ ¥â ä®à¬ã «®ª «ì®£® ¢®§¢à â 横« , íâ® § ç¨â, çâ®
|
|
||||||
¯à¨«®¦¥¨ï ®¤®¬ ¨ ⮬ ¦¥ á ¬®¬ PC ¬®£ãâ ®¡é âìáï ¤àã£ á ¤à㣮¬ ç¥à¥§
|
|
||||||
᮪¥âë, ª ª ¥á«¨ ¡ë ®¨ 室¨«¨áì 㤠«ñëå ª®¬¯ìîâ¥à å. —⮡ë ᮥ¤¨ïâìáï
|
|
||||||
á ¯à¨«®¦¥¨¥¬ «®ª «ì®© ¬ 訥, ®¯à¥¤¥«¨â¥ «®ª «ìë© ¤à¥á IP ª ª ¤à¥á
|
|
||||||
§ 票ï. ‚ë ¤ ¦¥ ¥ ¤®«¦ë ª®ä¨£ãà¨à®¢ âì á⥪ ¤«ï á¥â¨ áâ ¤ àâ Ethernet,
|
|
||||||
«®ª «ìë© ¢®§¢à â 横« ¡ã¤¥â à ¡®â âì ¡¥§ «î¡ëå á¥â¥¢ëå, ¯¯ à âëå á।áâ¢.
|
|
||||||
•®à®è® ¯®¤å®¤¨â ¤«ï ¯à®¢¥àª¨ ¨ ®â« ¤ª¨ á¥â¥¢ëå ¯à¨«®¦¥¨©.
|
|
||||||
|
|
||||||
<EFBFBD>ਪ« ¤®© ¯à®£à ¬¬ë© ¨â¥à䥩á
|
|
||||||
================================
|
|
||||||
|
|
||||||
<EFBFBD> §à ¡®â稪 ¬®¦¥â ®¡à â¨âìáï ª á⥪ã ç¥à¥§ ¯à¥àë¢ ¨¥ 0x40, äãªæ¨¨ 53. ” ©«
|
|
||||||
TFTPC.ASM - å®à®è¨© ¯à¨¬¥à ⮣®, ª ª ¬®¦® ¨á¯®«ì§®¢ âì ¯à®£à ¬¬ë© ¨â¥à䥩á
|
|
||||||
(¯® ªà ©¥© ¬¥à¥, ¤«ï UDP), ® ª ª á¥â¥¢ ï ª®¬¬ã¨ª æ¨ï, ¤®¢®«ì® á«®¦¥. Ÿ ¤ ¬
|
|
||||||
ªà ⪨© ®¡§®à.
|
|
||||||
|
|
||||||
‘®ª¥âë
|
|
||||||
=======
|
|
||||||
|
|
||||||
<EFBFBD>ਫ®¦¥¨ï ᮥ¤¨ïîâáï ¤àã£ á ¤à㣮¬ ¨ ¯¥à¥¤ îâ ¨ä®à¬ æ¨î ¬¥¦¤ã ᮡ®© ç¥à¥§
|
|
||||||
¬¥å ¨§¬, §¢ ë© '᮪¥â®¬'. ‘®ª¥âë - ®ª®¥çë¥ â®çª¨ ¤«ï ª®¬¬ã¨ª 樨. „«ï
|
|
||||||
ª ¦¤®£® 㦮£® á¥â¥¢®£® ¯à¨«®¦¥¨ï ¤®«¦¥ ¡ëâì ®âªàëâ å®âï ¡ë ®¤¨ ᮪¥â.
|
|
||||||
|
|
||||||
ˆá¯®«ì§®¢ ¨¥ ᮪¥â®¢ ¥¬®£® ¯®å®¤¨â ¨á¯®«ì§®¢ ¨ï ä ©«®¢ ¢ Ž‘. ‚ë
|
|
||||||
®âªàë¢ ¥â¥, ç¨â ¥â¥ ¨ ¯¨è¥â¥ ¢ ¨å, § ⥬ § ªàë¢ ¥â¥. …¤¨á⢥ ï ¢¥éì,
|
|
||||||
ª®â®à ï ¤¥« ¥â ¦¨§ì ¥¬®£® ¡®«¥¥ á«®¦®© - íâ® â®, çâ® ¢ ®â«¨ç¨¥ ®â à ¡®âë á
|
|
||||||
ä ©« ¬¨, ã ¢ á ¯®ï¢¨âáï âà㤮á⨠á à ¡®â®© ᮪¥â®¢ ( ¯à¨¬¥à, ¥ § å®ç¥â
|
|
||||||
§ ªàë¢ âìáï)
|
|
||||||
|
|
||||||
<EFBFBD>®§ ª®¬¨¬áï á â¥à¬¨®«®£¨¥© ¯à¥¦¤¥, 祬 ¬ë ¯®©¤ñ¬ ¤ «ìè¥.
|
|
||||||
|
|
||||||
*‘®ª¥â “¨ª «ìë© ¨¤¥â¨ä¨ª â®à, ¨á¯®«ì§ã¥¬ë© ¯à¨«®¦¥¨¥¬ ¤«ï
|
|
||||||
ª®¬¬ã¨ª 樨.
|
|
||||||
|
|
||||||
*‹®ª «ìë© ¯®àâ —¨á«®, ª®â®à®¥ ¨¤¥â¨ä¨æ¨àã¥â 㦮¥ ¯à¨«®¦¥¨¥
|
|
||||||
«®ª «ì®¬ ª®¬¯ìîâ¥à¥. <20>®àâë - ᯮᮡ, ¯®§¢®«ïîé¨å ¬®¦¥á⢠¬ ¯à¨«®¦¥¨©
|
|
||||||
®¡é âìáï á ¤à㣨¬¨ ª®¬¯ìîâ¥à ¬¨, ¡« £®¤ àï 祬㠥⠯ãâ ¨æë ¢ ¯¥à¥¤ ¢ ¥¬ëå
|
|
||||||
¤ ëå (’¥å¨ç¥áª®¥ ®¯à¥¤¥«¥¨¥ '¬ã«ì⨯«¥ªáë¥'). —¨á«® ¯®àâ - 16 ¡¨â.
|
|
||||||
|
|
||||||
*“¤ «ñë© ¯®àâ —¨á«®, ª®â®à®¥ ¨¤¥â¨ä¨æ¨àã¥â ¯à¨«®¦¥¨¥ 㤠«ñ®¬
|
|
||||||
ª®¬¯ìîâ¥à¥, ª ª®â®à®¬ã ¬ë ®¡à é ¥¬áï. <20> 㤠«ñ®¬ ª®¬¯ìîâ¥à¥ - íâ® '«®ª «ìë©
|
|
||||||
¯®àâ'. —¨á«® ¯®àâ - 16 ¡¨â.
|
|
||||||
|
|
||||||
*€¤à¥á IP <20>â® 32 ¡¨â®¥ ç¨á«®, ª®â®à®¥ ¨¤¥â¨ä¨æ¨àã¥â 㤠«ñë© PC,
|
|
||||||
á ª®â®àë¬ ¬ë ®¡é ¥¬áï.
|
|
||||||
|
|
||||||
*<2A> áá¨¢ë© à¥¦¨¬ <20>⮠०¨¬, ¢ ª®â®à®¬ ᮪¥â ®âªàëâ, «®ª «ìë© PC ¦¤ñâ
|
|
||||||
ᮥ¤¨¥¨ï.
|
|
||||||
|
|
||||||
*€ªâ¨¢ë© ०¨¬ <20>⮠०¨¬, ¢ ª®â®à®¬ ᮪¥â ®âªàëâ, «®ª «ìë© PC ¯ëâ ¥âáï
|
|
||||||
ᮥ¤¨¨âìáï á 㤠«ñë¬ PC.
|
|
||||||
|
|
||||||
‘®¥¤¨ïïáì á ᮪¥â®¬ 㤠«¥®¬ PC, ¢ë ¤®«¦ë ¥ ⮫쪮 ®¯à¥¤¥«¨âì IP ¤à¥á,
|
|
||||||
® ¨ ¯®«®áâìî ª¢ «¨ä¨æ¨à®¢ âì ¥£®, â.¥. ®¯à¥¤¥«¨âì IP ¤à¥á ¨ ç¨á«® ¯®àâ .
|
|
||||||
ˆ ç¥ á⥪ 㤠«ñ®¬ PC ¥ ¡ã¤¥â § âì, ª ª®¬ã ¯à¨«®¦¥¨î ¯à¥¤ § ç îâáï
|
|
||||||
¯®á« ë¥ ¤ ë¥. ‚®â ¥¡®«ì让 ¯à¨¬¥à:
|
|
||||||
|
|
||||||
192.168.1.10:80 ;Œë ¯à¨á®¥¤¨ï¥¬áï ª ª®¬¯ìîâ¥àã á IP ¤à¥á®¬ 192.168.1.10 ª
|
|
||||||
80 ¯®àâã.
|
|
||||||
|
|
||||||
—¨á« ¯®àâ ïîâáï ¢ ¦ë¬¨. <20>¥ª®â®àë¥ '¨§¢¥áâë' ¨ ®¡¥á¯¥ç¨¢ îâ ¤®áâ㯠ª
|
|
||||||
®¡é¨¬ ¯à¨«®¦¥¨ï¬. <20> ¯à¨¬¥à, ¯®àâ 80 ¨á¯®«ì§ã¥âáï á¥à¢¥à ¬¨ £¨¯¥à⥪á⮢®£®
|
|
||||||
âà ᯮà⮣® ¯à®â®ª®« (HTTP). ’ ª¨¬ ¯ãâñ¬ ï ¬®£ã ᮥ¤¨¨âìáï á ¢¥¡á¥à¢¥à®¬
|
|
||||||
㦮¬ ª®¬¯ìîâ¥à¥ ¡¥§ ¥®¡å®¤¨¬®á⨠㧠¢ âì ¯à®á«ã訢 ¥¬ë© ¯à¨«®¦¥¨¥¬ ®¬¥à
|
|
||||||
¯®àâ .
|
|
||||||
|
|
||||||
Š ª ¢ë § ¥â¥, ¥áâì ¤¢ ०¨¬ : <20> áá¨¢ë© ¨ €ªâ¨¢ë©. ‚¥¡á¥à¢¥à ®âªàë«
|
|
||||||
¯ áá¨¢ë© á®ª¥â, ¯®áª®«ìªã ® ¦¤¥â ¢å®¤ïé¨å § ¯à®á®¢ ¯®¤ª«î票¥.
|
|
||||||
Web-¡à®ã§¥à ®âªàë« ªâ¨¢ë© ᮪¥â, ¯®â®¬ã çâ® ® ¯ëâ ¥âáï ᮥ¤¨¨âìáï á
|
|
||||||
㪠§ ë¬ ã¤ «ñë¬ ª®¬¯ìîâ¥à®¬.
|
|
||||||
|
|
||||||
„®áâ㯠ª ¯à®£à ¬¬¨à®¢ ¨î ¨â¥à䥩á
|
|
||||||
====================================
|
|
||||||
<EFBFBD> §à ¡®â稪 ®¡à é ¥âáï ª äãªæ¨ï¬ á⥪ ç¥à¥§ ¯à¥àë¢ ¨¥ 0x40, äãªæ¨¨ 53. Š
|
|
||||||
¥ª®â®àë¬ äãªæ¨ï¬ ¬®¦® ®¡à â¨âìáï ç¥à¥§ äãªæ¨î 52, ® ®¨ £« ¢ë¬ ®¡à §®¬
|
|
||||||
¯à¥¤ § ç¥ë ¤«ï ª®ä¨£ãà 樨 á⥪ .
|
|
||||||
‚®â äãªæ¨©, ª®â®àë¥ ¢ë ¬®¦¥â¥ ¨á¯®«ì§®¢ âì:
|
|
||||||
|
|
||||||
<EFBFBD>®«ãç ¥¬ «®ª «ìë© IP ¤à¥á
|
|
||||||
---------------------------
|
|
||||||
eax = 52
|
|
||||||
ebx = 1
|
|
||||||
|
|
||||||
IP ¤à¥á ¢®§¢à ⨫áï ¢ eax (¢ ¢¨¤¥ ¡ ©â®¢, ¨§ ª®â®àëå á®á⮨⠈â¥à¥â ¤à¥á)
|
|
||||||
|
|
||||||
‡ ¯¨áì ¤«ï à ᯮ«®¦¥¨ï ¢ á⥪¥ ¢å®¤®© ®ç¥à¥¤¨
|
|
||||||
-----------------------------------------------
|
|
||||||
eax = 52
|
|
||||||
ebx = 6
|
|
||||||
edx = ç¨á«® ¡ ©â®¢ ¤«ï § ¯¨á¨
|
|
||||||
esi = 㪠§ â¥«ì ¤ ë¥ (¢ ¯à¨ª« ¤®¬ ¯à®áâà á⢥)
|
|
||||||
|
|
||||||
<EFBFBD>® ¢®§¢à 饨î, ¢ eax ᮤ¥à¦¨âáï 0, ¥á«¨ OK, ¨«¨ 0xFFFFFFFF, ¥á«¨ ®è¨¡ª .
|
|
||||||
<EFBFBD>â®â ¨â¥à䥩á - ⮫쪮 ¤«ï ¬¥¤«¥ëå á¥â¥¢ëå ¤à ©¢¥à®¢ (PPP, SLIP)
|
|
||||||
|
|
||||||
—⥨¥ ¤ ëå ¨§ á¥â¥¢®© ®ç¥à¥¤¨ ¢ë¢®¤
|
|
||||||
---------------------------------------
|
|
||||||
eax = 52
|
|
||||||
ebx = 8
|
|
||||||
esi = 㪠§ â¥«ì ¤ ë¥ (¢ ¯à¨ª« ¤®¬ ¯à®áâà á⢥)
|
|
||||||
|
|
||||||
<EFBFBD>® ¢®§¢à 饨î, eax áç¨â ¥â ç¨á«® ¡ ©â®¢ ¯¥à¥¤ ë¬.
|
|
||||||
<EFBFBD>â®â ¨â¥à䥩á - ⮫쪮 ¤«ï ¬¥¤«¥ëå á¥â¥¢ëå ¤à ©¢¥à®¢ (PPP, SLIP)
|
|
||||||
|
|
||||||
Žâªàë¢ ¥¬ UDP ᮪¥â
|
|
||||||
-------------------
|
|
||||||
eax = 53
|
|
||||||
ebx = 0
|
|
||||||
ecx = «®ª «ìë© ¯®àâ
|
|
||||||
edx = 㤠«¥ë© ¯®àâ
|
|
||||||
esi = 㤠«¥ë© ip ¤à¥á (¢ ¢¨¤¥ ¡ ©â®¢, ¨§ ª®â®àëå á®á⮨⠈â¥à¥â ¤à¥á)
|
|
||||||
|
|
||||||
<EFBFBD>®¬¥à ᮪¥â ¢®§¢à éñ ¢ eax.
|
|
||||||
‚®§¢à é ¥¬®¥ § 票¥ 0xFFFFFFFF ®§ ç ¥â, ç⮠᮪¥âë ¥ ®âªà뫨áì.
|
|
||||||
|
|
||||||
Žâªàë¢ ¥¬ TCP ᮪¥â
|
|
||||||
-------------------
|
|
||||||
eax = 53
|
|
||||||
ebx = 5
|
|
||||||
ecx = «®ª «ìë© ¯®àâ
|
|
||||||
edx = 㤠«¥ë© ¯®àâ
|
|
||||||
esi = 㤠«¥ë© ip ¤à¥á (¢ ¢¨¤¥ ¡ ©â®¢, ¨§ ª®â®àëå á®á⮨⠈â¥à¥â ¤à¥á)
|
|
||||||
edi = ०¨¬: SOCKET_PASSIVE ¨«¨ SOCKET_ACTIVE (®¯à¥¤¥«ñ ¢ stack.inc)
|
|
||||||
|
|
||||||
<EFBFBD>®¬¥à ᮪¥â ¢®§¢à é ¥âáï ¢ eax.
|
|
||||||
‚®§¢à é ¥¬®¥ § 票¥ 0xFFFFFFFF ®§ ç ¥â, ç⮠᮪¥âë ¥ ®âªà뫨áì.
|
|
||||||
|
|
||||||
‡ ªàë⨥ ᮪¥â (’®«ìª® UDP)
|
|
||||||
----------------------------
|
|
||||||
eax = 53
|
|
||||||
ebx = 1
|
|
||||||
ecx = ®¬¥à ᮪¥â
|
|
||||||
|
|
||||||
<EFBFBD>® ¢®§¢à 饨î, ¢ eax ᮤ¥à¦¨âáï 0, ¥á«¨ OK, ¨«¨ 0xFFFFFFFF, ¥á«¨ ®è¨¡ª .
|
|
||||||
|
|
||||||
‡ ªàë⨥ ᮪¥â (’®«ìª® TCP)
|
|
||||||
----------------------------
|
|
||||||
eax = 53
|
|
||||||
ebx = 8
|
|
||||||
ecx = ç¨á«® ᮪¥â
|
|
||||||
|
|
||||||
<EFBFBD>® ¢®§¢à 饨î, ¢ eax ᮤ¥à¦¨âáï 0, ¥á«¨ OK, ¨«¨ 0xFFFFFFFF, ¥á«¨ ®è¨¡ª .
|
|
||||||
|
|
||||||
Ž¯à®á ᮪¥â
|
|
||||||
-------------
|
|
||||||
eax = 53
|
|
||||||
ebx = 2
|
|
||||||
ecx = ®¬¥à ᮪¥â
|
|
||||||
|
|
||||||
<EFBFBD>® ¢®§¢à 饨î, eax á®åà ï¥â ç¨á«® ¡ ©â®¢ ¢ ¢®§¢à éñ®¬ ¡ãä¥à¥.
|
|
||||||
|
|
||||||
—⥨¥ ¤ ëå á ᮪¥â
|
|
||||||
----------------------
|
|
||||||
eax = 53
|
|
||||||
ebx = 3
|
|
||||||
ecx = ç¨á«® ᮪¥â
|
|
||||||
|
|
||||||
<EFBFBD>® ¢®§¢à 饨î, eax ᮤ¥à¦¨â ç¨á«® á®åà ñëå ¡ ©â, bl ᮤ¥à¦¨â ¡ ©â ¤ ëå.
|
|
||||||
|
|
||||||
‡ ¯¨áì ¢ ᮪¥â (’®«ìª® UDP)
|
|
||||||
---------------------------
|
|
||||||
eax = 53
|
|
||||||
ebx = 4
|
|
||||||
ecx = ç¨á«® ᮪¥â
|
|
||||||
edx = ç¨á«® ¡ ©â®¢ ¤«ï § ¯¨á¨
|
|
||||||
esi = 㪠§ â¥«ì ¤ ë¥ (¢ ¯à¨ª« ¤®¬ ¯à®áâà á⢥)
|
|
||||||
|
|
||||||
<EFBFBD>® ¢®§¢à 饨î, ¢ eax ᮤ¥à¦¨âáï 0, ¥á«¨ OK, ¨«¨ 0xFFFFFFFF, ¥á«¨ ®è¨¡ª .
|
|
||||||
|
|
||||||
‚®§¢à 饨¥ á®áâ®ï¨ï ᮪¥â (’®«ìª® TCP)
|
|
||||||
-----------------------------------------
|
|
||||||
eax = 53
|
|
||||||
ebx = 6
|
|
||||||
ecx = ®¬¥à ᮪¥â
|
|
||||||
|
|
||||||
<EFBFBD>® ¢®§¢à 饨î, ¢ eax ᮤ¥à¦¨âáï á®áâ®ï¨¥ TCP ᮪¥â®¢.
|
|
||||||
|
|
||||||
<EFBFBD>â äãªæ¨ï ¬®¦¥â ¨á¯®«ì§®¢ âìáï, çâ®¡ë ®¯à¥¤¥«¨âì, ª®£¤ ᮪¥â ä ªâ¨ç¥áª¨
|
|
||||||
ᮥ¤¨¨«áï á ¤à㣨¬ ᮪¥â®¬. ‚®®¡é¥, ¤ ë¥ ¥ ¬®£ãâ ¡ëâì § ¯¨á ë ¢ ᮪¥â,
|
|
||||||
¯®ª ¯®¤ª«î票¥ ¥ ãáâ ®¢«¥® (TCB_ESTABLISHED). ‘®áâ®ï¨ï ᮪¥â®¢ ®¯à¥¤¥«¥ë
|
|
||||||
¢ ä ©«¥ stack.inc, ª ª TCB_
|
|
||||||
|
|
||||||
‡ ¯¨áì ¢ ᮪¥â (’®«ìª® TCP)
|
|
||||||
---------------------------
|
|
||||||
eax = 53
|
|
||||||
ebx = 7
|
|
||||||
ecx = ®¬¥à ᮪¥â
|
|
||||||
edx = ç¨á«® ¡ ©â, ã¦ëå ¤«ï § ¯¨á¨
|
|
||||||
esi = 㪠§ â¥«ì ¤ ë¥ (¢ ¯à¨ª« ¤®¬ ¯à®áâà á⢥)
|
|
||||||
|
|
||||||
<EFBFBD>® ¢®§¢à 饨î, ¢ eax ᮤ¥à¦¨âáï 0, ¥á«¨ OK, ¨«¨ 0xFFFFFFFF, ¥á«¨ ®è¨¡ª .
|
|
||||||
|
|
||||||
<EFBFBD>஢¥àª ®¬¥à ¯®àâ
|
|
||||||
---------------------
|
|
||||||
eax = 53
|
|
||||||
ebx = 9
|
|
||||||
ecx = ®¬¥à ¯®àâ
|
|
||||||
|
|
||||||
<EFBFBD>â äãªæ¨ï ¨á¯®«ì§ã¥âáï, çâ®¡ë ®¯à¥¤¥«¨âì, ¨á¯®«ì§ã¥âáï «¨ ®¬¥à ¯®àâ ª ª¨¬¨
|
|
||||||
- «¨¡® ᮪¥â ¬¨. ‹®ª «ìë© ®¬¥à ¯®àâ ®¡ëç® ã¨ª «¥.
|
|
||||||
|
|
||||||
<EFBFBD>® ¢®§¢à 饨î, eax = - 1 ¤«ï ®¬¥à ¯®àâ , ª®â®àë© ¨á¯®«ì§ã¥âáï, ¨ ç¥
|
|
||||||
¢®§¢à é ¥âáï 0.
|
|
||||||
|
|
||||||
|
|
||||||
Žâªàë⨥ TCP ᮪¥â ¢ Š®«¨¡à¨
|
|
||||||
=============================
|
|
||||||
|
|
||||||
…áâì ¤¢ ᯮᮡ ®âªàëâ¨ï ᮪¥â - <20> áá¨¢ë© ¨«¨ €ªâ¨¢ë©.
|
|
||||||
|
|
||||||
<EFBFBD>ਠ<20> áᨢ®¬ ¯®¤ª«î票¨, ¯à¨«®¦¥¨¥ 'á«ãè ¥â' ¢å®¤ï騥 § ¯à®áë ®â 㤠«¥ëå
|
|
||||||
¯à¨«®¦¥¨©. Ž¡ëç® ¢ë íâ® ¤¥« ¥â¥, ®áãé¥á⢫ïï ®¯¥à æ¨î ª«¨¥â - á¥à¢¥à. Ž
|
|
||||||
¯®§¢®«ï¥â «î¡®¬ã ¤à㣮¬ã ¯à¨«®¦¥¨î ᮥ¤¨ïâìáï á ¤ ë¬. „«ï í⮣® 㦮
|
|
||||||
®¯à¥¤¥«¨âì '¨§¢¥áâë©' ®¬¥à «®ª «ì®£® ¯®àâ (80 ¤«ï ‚¥¡-á¥à¢¥à ), ¯®áâ ¢¨âì
|
|
||||||
㤠«¥ë© IP ¨ 㤠«¥®¥ ®¬¥à ¯®àâ à ¢ë¬ 0(㪠§ë¢ ¥â, çâ® «î¡®¥ 㤠«¥®¥
|
|
||||||
¯à¨«®¦¥¨¥ ¬®¦¥â ᮥ¤¨¨âìáï).
|
|
||||||
|
|
||||||
Š ª ⮫쪮 ᮪¥â ¡ã¤¥â ®âªàëâ, ¯à¨¤ñâáï ¦¤ âì ¢å®¤ï饣® ¯®¤ª«îç¥¨ï ¯¥à¥¤
|
|
||||||
¢ë¯®«¥¨¥¬ 祣® - «¨¡®. <20>â® ¬®¦¥â ¡ëâì ¯à®¢¥àª®© á®áâ®ï¨ï à §ê¥¬ ¤«ï
|
|
||||||
TCB_ESTABLISHED ¨«¨ ®¦¨¤ ¨¥¬ ¤ ëå ¢ ¯®«ãç î饬áï ¡ãä¥à¥.
|
|
||||||
|
|
||||||
<EFBFBD> €ªâ¨¢®¬ ¯®¤ª«î票¨ ¢ë ᮥ¤¨ï¥â¥áì á 㪠§ ë¬ ã¤ «¥ë¬ ¯®à⮬. “¤ «¥ë©
|
|
||||||
IP ¨ 㤠«¥ë¥ ¯ à ¬¥âàë ¯®àâ ¤®«¦ë ¡ëâì ¯¥à¥¢¥¤¥ë ¢ ¥ã«¥¢ë¥ § 票ﬨ
|
|
||||||
(¨ ç¥, á 祬 ᮥ¤¨ïâáï?). ’ ª¦¥, ®¯à¥¤¥«¨â¥ 㨪 «ìë© ®¬¥à «®ª «ì®£®
|
|
||||||
¯®àâ , â ª ç⮡ë 㤠«¥®¥ ¯à¨«®¦¥¨¥ ¬®£«® ©â¨ ã¦ãî ¯à®£à ¬¬ã ¨ ãáâ ®¢¨âì
|
|
||||||
á ¥© ᮥ¤¨¥¨¥. ‚¥¤ì, ¬®£ãâ ¡ëâì ¥áª®«ìª® ¯à®£à ¬¬ ¢ 襩 ¬ 訥,
|
|
||||||
¯®¤ª«îç¥ë¥ ª ®¤®¬ã ¨ ⮬㠦¥ 㤠«ñ®¬ã ª®¬¯ìîâ¥àã.
|
|
||||||
<EFBFBD>¨¦¥ ¯¨á ®, ª ª ©â¨ 㨪 «ìë© ®¬¥à ¯®àâ .
|
|
||||||
|
|
||||||
Š ª 室¨âì ¥¨á¯®«ì§®¢ ë© ®¬¥à «®ª «ì®£® ¯®àâ
|
|
||||||
====================================================
|
|
||||||
|
|
||||||
‘®§¤ ¢ ï ªâ¨¢®¥ ¯®¤ª«î票¥ á 㤠«¥ë¬ ᮪¥â®¬, ã ¢ á ¬®¦¥â ¯®ï¢¨âìáï
|
|
||||||
¦¥« ¨¥ ¢ë¡à âì 㨪 «ìë© ®¬¥à «®ª «ì®£® ¯®àâ . Ž¡ëç®, ®¬¥à «®ª «ì®£®
|
|
||||||
¯®àâ ç¨ îâáï á 1000. ‘«¥¤ãî騩 ª®¤ ¬®¦¥â ¨á¯®«ì§®¢ âìáï, çâ®¡ë ¯®«ãç¨âì
|
|
||||||
¥¨á¯®«ì§®¢ ë© ®¬¥à ¯®àâ ¤® ᮧ¤ ¨ï ᮪¥â .
|
|
||||||
|
|
||||||
mov ecx, 1000 ; Ž¯à¥¤¥«ï¥¬ «®ª «ìë© ¯®àâ, ç¨ ¥¬ á 1000
|
|
||||||
|
|
||||||
getlp:
|
|
||||||
inc ecx
|
|
||||||
push ecx
|
|
||||||
mov eax, 53
|
|
||||||
mov ebx, 9
|
|
||||||
int 0x40
|
|
||||||
pop ecx
|
|
||||||
cmp eax, 0 ; íâ®â «®ª «ìë© ¯®à⠨ᯮ«ì§ã¥âáï?
|
|
||||||
jz getlp ; ¤ - ¯à®¤®«¦ ¥¬ ¯¥à¥¡¨à âì
|
|
||||||
|
|
||||||
; ecx ᮤ¥à¦¨â ®¬¥à ᢮¡®¤®£® «®ª «ì®£® ¯®àâ
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
‡ ¯¨áì ¤ ëå ¢ ᮪¥â
|
|
||||||
=====================
|
|
||||||
|
|
||||||
…áâì ¤¢¥ äãªæ¨¨, § ¢¨áï騥 ®â ⮣®, ¡ë« «¨ à §ê¥¬ ®âªàëâ ¤«ï ¯à®â®ª®« TCP ¨«¨
|
|
||||||
UDP. ¯ à ¬¥âàë § ¯à®á - â® ¦¥ á ¬®¥ ª ª ¡ë â® ¨ ¡ë«®. Š®£¤ ᮪¥â ®âªàë¢ ¥âáï
|
|
||||||
¤«ï TCP, ¨á¯®«ì§ã©â¥ äãªæ¨î á®áâ®ï¨ï, çâ®¡ë ®¯à®á¨âì ¤«ï ¯®¤ª«î票ï - ¤ ë¥
|
|
||||||
¥ ¬®£ãâ ¡ëâì ¯¥à¥¤ ë ᮪¥âã, ¯®ª ¤à㣮© ¥ ᮥ¤¨¨«áï á í⨬. ‘®áâ®ï¨¥
|
|
||||||
᮪¥â - TCB_ESTABLISHED.
|
|
||||||
|
|
||||||
Š®£¤ ¢ë ¯®áë« ¥â¥ ¤ ë¥, ¯à®¨á室¨â ᮧ¤ ¨¥ ¨ ®â¯à ¢ª ®¤®£® IP ¯ ª¥â . €
|
|
||||||
íâ® § ç¨â, çâ® ¯®«ì§®¢ ⥫ì᪮¥ ¯à¨«®¦¥¨¥ ®â¢¥ç ¥â § à §¬¥à ¯¥à¥¤ ¢ ¥¬ëå
|
|
||||||
¯ ª¥â®¢. ‘®åà ï¥âáï ¬¥¥¥ 祬 768 ¡ ©â®¢ à §¬¥à ¯ ª¥â . …᫨ ¢ë ¯¨è¥â¥
|
|
||||||
®ª®ç¥ãî ¯à®£à ¬¬ã (â ªãî, ª ª telnet), â® ¬®¦¥â¥ § å®â¥âì ®â¯à ¢«ïâì ¯ ª¥â
|
|
||||||
§ ª ¦¤®¥ (¥íä䥪⨢®¥) ¦ ⨥ ª« ¢¨è¨. Œ®¦® ¨á¯®«ì§®¢ âì â ©¬¥à, ç⮡ë
|
|
||||||
®â¯à ¢«ïâì ¤ ë¥ ¯¥à¨®¤¨ç¥áª¨ (᪠¦¥¬, ª ¦¤ãî ᥪã¤ã).
|
|
||||||
|
|
||||||
—⥨¥ ¤ ëå ¨§ ᮪¥â
|
|
||||||
=======================
|
|
||||||
|
|
||||||
…áâì ®¤ äãªæ¨ï ¤«ï çâ¥¨ï ¤ ëå ¨§ ᮪¥â , ¢®§¢à é îé ï ¤ ë¥ ¢ ¡ãä¥à. <20>â
|
|
||||||
äãªæ¨ï ®¤®¢à¥¬¥® ¢®ááâ ¢«¨¢ ¥â ®¤¨ ¡ ©â. ‚ë ¬®¦¥â¥ ¨á¯®«ì§®¢ âì äãªæ¨î
|
|
||||||
®¯à®á , çâ®¡ë ¯à®¢¥à¨âì ¯®«ãç î騩áï ¡ãä¥à ¤ ë¥.
|
|
||||||
|
|
||||||
‡ ªàë⨥ ᮪¥â
|
|
||||||
================
|
|
||||||
|
|
||||||
<EFBFBD>à®áâ® ¢ë§®¢¨â¥ ᮮ⢥âáâ¢ãîéãî äãªæ¨î (¤«ï TCP ¨«¨ UDP, ᮮ⢥âá⢥®).
|
|
||||||
‡ ªàë¢ ï TCP ᮪¥â, ¥ § ¡ã¤ìâ¥, çâ® ¤à㣮© ª®æ¥ ᮥ¤¨¥¨ï, ᮪¥â ¬®¦¥â
|
|
||||||
¯à®¤®«¦¨âì ®â¯à ¢«ïâì ¤ ë¥, â ª çâ® ® ®áâ ñâáï ªâ¨¢ë¬ ¢ â¥ç¥¨¥ ¥áª®«ìª¨å
|
|
||||||
ᥪ㤠¯®á«¥ ¢ 襣® § ¯à®á .
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
…᫨ ã ¢ á ¥áâì ¢®¯à®áë ¨«¨ ¯à¥¤«®¦¥¨ï ¯® ã«ãç襨î í⮣® ¤®ªã¬¥â , â®
|
|
||||||
¯®è«¨â¥ ¬¥ ¯¨á쬮 mikeh@oceanfree.net.
|
|
||||||
<EFBFBD>¥à¥¢ñ« ¤®ªã¬¥â Hex.
|
|
||||||
…᫨ ¥áâì ¢®¯à®áë ¨«¨ ¯à¥¤«®¦¥¨ï ¯® ᮤ¥à¦ ¨î, â® ¯à®áì¡ ¯¨á âì ¬¥
|
|
||||||
mestack@yandex.ru ¨«¨ è ä®àã¬: http://meos.sysbin.com
|
|
26
data/sp/docs/OPENDIAL.TXT
Normal file
26
data/sp/docs/OPENDIAL.TXT
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
OpenDialog - file open dialog:
|
||||||
|
1) Move the cursor inside the panel:
|
||||||
|
a) up and down arrows (including add. keyb.) - move the cursor one position up or down.
|
||||||
|
b) PageUp - list page up.
|
||||||
|
c) PageDown - list page down.
|
||||||
|
d) Home - move to the top of directory.
|
||||||
|
e) End - move to the end of directory.
|
||||||
|
2) Enter - operations with the selected file:
|
||||||
|
a) enter the folder.
|
||||||
|
b) choose a file.
|
||||||
|
3) Using the menu:
|
||||||
|
Alt+F1 - call disk selection menu.
|
||||||
|
Alt+F2 - call sort menu.
|
||||||
|
Alt+F3 - call filter menu.
|
||||||
|
Inside the menu:
|
||||||
|
Arrow cursor up and down - move to item.
|
||||||
|
Esc - close the window.
|
||||||
|
Enter - close the window with confirmation.
|
||||||
|
Arrow cursor left and right - move into the adjacent menu.
|
||||||
|
4) Ctrl+R - update the contents of a directory.
|
||||||
|
5) Backspace - exit from the directory.
|
||||||
|
6) Insert - highlighted by red color the file at the cursor and move the cursor one position down.
|
||||||
|
7) Ctrl+A and Ctrl+(NumPad(+) Up) - select all files and directories in the active panel, with the exception of the directory '..'
|
||||||
|
8) Ctrl+(NumPad(-) Up) - deselect all files and directories in the active panel with the exception of the directory '..'
|
||||||
|
9) Ctrl+(NumPad(*) Up) - invert the selection of all files and directories in the active panel, with the exception of the directory '..'
|
||||||
|
10) Esc - shutdown the program, without opening of a file.
|
@ -1,387 +1,203 @@
|
|||||||
What is implemented
|
eax = 74 - Work directly with network interface
|
||||||
===================
|
ebx = -1 (Get number of active network devices)
|
||||||
|
|
||||||
The following features are present in the TCP/IP stack code:
|
out:
|
||||||
|
eax = number of active network devices
|
||||||
|
|
||||||
IP layer.
|
bh = device number, for all following functions !
|
||||||
ICMP.
|
|
||||||
TCP layer.
|
|
||||||
UDP layer.
|
|
||||||
local loopback.
|
|
||||||
Realtek 8029 PCI ethernet interface.
|
|
||||||
Realtek 8139 PCI ethernet interface.
|
|
||||||
Intel i8255x PCI ethernet interface.
|
|
||||||
Dynamic ARP table.
|
|
||||||
PPP dialer
|
|
||||||
|
|
||||||
And the following internet applcations are implemented
|
|
||||||
|
|
||||||
HTTP Server
|
bl = 0 (Get device type)
|
||||||
Telnet
|
|
||||||
POP Client
|
|
||||||
DNS Name resolver
|
|
||||||
MP3 Server
|
|
||||||
TFTP Client
|
|
||||||
IRC Client
|
|
||||||
|
|
||||||
There are also a number of experimental applications for streaming music
|
|
||||||
and performing interprocess communication via sockets. A Web broswer is in
|
|
||||||
development
|
|
||||||
|
|
||||||
|
out:
|
||||||
|
eax = device type number
|
||||||
|
|
||||||
What is not implemented
|
bl = 1 (Get device name)
|
||||||
=======================
|
|
||||||
|
|
||||||
The IP layer does not process header options.
|
in:
|
||||||
The IP layer does not support routing.
|
ecx = pointer to 64 byte buffer
|
||||||
Packet fragmentation is not supported.
|
out:
|
||||||
|
name is copied into the buffer
|
||||||
|
eax = -1 on error
|
||||||
|
|
||||||
|
bl = 2 (Reset the device)
|
||||||
|
|
||||||
How to configure Kolibri for PPP
|
in
|
||||||
===============================
|
none
|
||||||
|
out
|
||||||
|
eax = -1 on error
|
||||||
|
|
||||||
See ppp.txt
|
bl = 3 (Stop device)
|
||||||
|
|
||||||
|
in
|
||||||
|
none
|
||||||
|
out
|
||||||
|
eax = -1 on error
|
||||||
|
|
||||||
How to configure Kolibri for Ethernet
|
TO BE FIGURED OUT
|
||||||
====================================
|
|
||||||
|
|
||||||
First, you need to have a supported ethernet card fitted, or present
|
|
||||||
on your motherboard. If you are uncertain what type of hardware you
|
|
||||||
have, try to configue the stack. If you have supported hardware it
|
|
||||||
will be found, and enabled.
|
|
||||||
|
|
||||||
Setting Up the ARP Table
|
eax = 75 - Work with Sockets
|
||||||
------------------------
|
|
||||||
|
|
||||||
Kolibri's ARP table is dynamically created and maintained; You can see what
|
|
||||||
hosts Kolibri has communicated with by running the ARPSTAT application.
|
|
||||||
|
|
||||||
Enabling Ethernet
|
These functions work like the ones found in UNIX (and windows)
|
||||||
-----------------
|
for more info, please read http://beej.us/guide/bgnet/
|
||||||
|
|
||||||
Boot Kolibri, then select STACKCFG from the NET menu.
|
bl = 0 (Open Socket)
|
||||||
Press the 'Read' Button, then select 'Packet Driver'.
|
|
||||||
Press 'Change' next to the IP address, and enter the IP address you want
|
|
||||||
to use. Make sure it is on the same sub-net as the LAN to which you are
|
|
||||||
connected.
|
|
||||||
Press 'Apply' to action the changes.
|
|
||||||
Close the program.
|
|
||||||
|
|
||||||
|
in:
|
||||||
|
ecx = domain
|
||||||
|
edx = type
|
||||||
|
esi = protocol
|
||||||
|
out:
|
||||||
|
eax = socket number, -1 on error
|
||||||
|
|
||||||
The stack is now running, which you can test by pinging Kolibri from a
|
bl = 1 (Close Socket)
|
||||||
remote host.
|
|
||||||
|
|
||||||
|
in:
|
||||||
|
ecx = socket number
|
||||||
|
out:
|
||||||
|
eax = -1 on error
|
||||||
|
|
||||||
The simplest way to connect two PC's together is using a 'Null Modem'
|
bl = 2 (Bind)
|
||||||
Ethernet cable. These simply cross certain wires over. They can be
|
|
||||||
purchased from PC stores, but are simple to make. Details can be found
|
|
||||||
on the web. Look on google for 'ethernet cross over cable' or similar.
|
|
||||||
|
|
||||||
|
in:
|
||||||
|
ecx = socket number
|
||||||
|
edx = pointer to sockaddr structure
|
||||||
|
esi = length of sockaddr structure
|
||||||
|
out:
|
||||||
|
eax = -1 on error
|
||||||
|
|
||||||
How to use TCP/IP locally, with no Network
|
bl = 3 (Listen)
|
||||||
==========================================
|
|
||||||
|
|
||||||
Kolibri supports a form of local loopback that means applications on the
|
in:
|
||||||
same PC can communicate with each other via sockets as though they
|
ecx = socket number
|
||||||
were on separate hosts. To connect to an application on the same machine,
|
edx = backlog
|
||||||
specify the local IP address as the destination address. You do not even
|
out:
|
||||||
need to configure the stack for ethernet; local loopback will work without
|
eax = -1 on error
|
||||||
any network hardware. It's great for development and testing.
|
|
||||||
|
|
||||||
|
bl = 4 (connect)
|
||||||
|
|
||||||
Application Programming Interface
|
in:
|
||||||
=================================
|
ecx = socket number
|
||||||
|
edx = pointer to sockaddr structure
|
||||||
|
esi = length of sockaddr structure
|
||||||
|
out:
|
||||||
|
eax = -1 on error
|
||||||
|
|
||||||
The developer can access the stack through interrupt 0x40, function 53.
|
bl = 5 (accept)
|
||||||
The file TFTPC.ASM gives a good example of how to use the programming
|
|
||||||
interface ( at least, for UDP), but as network communication is complex
|
|
||||||
I'll give an overview.
|
|
||||||
|
|
||||||
|
in:
|
||||||
|
ecx = socket number
|
||||||
|
edx = pointer to sockaddr structure
|
||||||
|
esi = length of sockaddr structure
|
||||||
|
out:
|
||||||
|
eax = socket number, -1 on error
|
||||||
|
|
||||||
Sockets
|
bl = 6 (send)
|
||||||
=======
|
|
||||||
|
|
||||||
Applications connect to each other and pass information between themselves
|
in:
|
||||||
through a mechanism called a 'socket'. Sockets are end-points for
|
ecx = socket number
|
||||||
communication; You need one at each application to communicate.
|
edx = pointer to buffer
|
||||||
|
esi = length of buffer
|
||||||
|
edi = flags
|
||||||
|
out:
|
||||||
|
eax = -1 on error
|
||||||
|
|
||||||
Using sockets is a little like using files on an OS; You open them, read
|
bl = 7 (receive)
|
||||||
and write to them, then close them. The only thing that makes life slightly
|
|
||||||
more complicated is that unlike with a file, you have something intelligent
|
|
||||||
at the other end ( which for example may not want to close when you do! )
|
|
||||||
|
|
||||||
Lets deal with the terminology before we go any further.
|
in:
|
||||||
|
ecx = socket number
|
||||||
|
edx = pointer to buffer
|
||||||
|
esi = length of buffer
|
||||||
|
edi = flags
|
||||||
|
out:
|
||||||
|
eax = number of bytes copied, -1 on error
|
||||||
|
|
||||||
socket A unique identifier used by the application for communication.
|
bl = 8 (set socket options)
|
||||||
local port A number that identifies this application on the local host.
|
|
||||||
Ports are a way to allow multiple applications to communicate
|
|
||||||
with other hosts without the data becoming mixed up. ( The
|
|
||||||
technical term is 'multiplex' ). Port numbers are 16 bit.
|
|
||||||
remote port A number that identifies the application on the remote host
|
|
||||||
to which we are communicating with. To the remote host, this is
|
|
||||||
it's 'local port'. Port numbers are 16 bit.
|
|
||||||
IP Address A 32 bit number that identifies the remote host PC that we are
|
|
||||||
communicating with.
|
|
||||||
Passive Refers to the mode by which a socket is opened; When opening in
|
|
||||||
passive mode, the local PC is awaiting an incoming connection.
|
|
||||||
Active Refers to the mode by which a socket is opened; When opening in
|
|
||||||
active mode, the local PC will attempt to connect to a remote
|
|
||||||
PC.
|
|
||||||
|
|
||||||
When you connect to a socket on a remote PC, you need to specify more than
|
in:
|
||||||
just the IP address, otherwise the remote stack will not know to which
|
ecx = socket number
|
||||||
application it should send your data. You must fully qualify the address,
|
edx = level
|
||||||
which means you specify the IP address and the port number. This would be
|
esi = optionname
|
||||||
written like this
|
edi = ptr to buffer
|
||||||
|
|
||||||
192.168.1.10:80 ; Connect to port 80 on the machine 192.168.1.10
|
The buffer's first dword is the length of the buffer, minus the first dword offcourse
|
||||||
|
|
||||||
Port numbers are important. Some are 'well known' and provide access to
|
out:
|
||||||
common applications. For example port 80 is used by HTTP servers; That
|
eax = -1 on error
|
||||||
way I can connect to a webserver on a host without having to find out
|
|
||||||
what port number the application is listening on.
|
|
||||||
|
|
||||||
This brings me to the way in which you open a socket; As I said earlier,
|
bl = 9 (get socket options
|
||||||
there are two modes, Passive and Active. A webserver would open a passive
|
|
||||||
socket, as it is waiting for incoming connection requests. A web browser
|
|
||||||
would open an active socket because it is attempting to connect to a
|
|
||||||
specified remote host.
|
|
||||||
|
|
||||||
|
in:
|
||||||
|
ecx = socket number
|
||||||
|
edx = level
|
||||||
|
esi = optionname
|
||||||
|
edi = ptr to buffer
|
||||||
|
|
||||||
Access to programming interface
|
The buffer's first dword is the length of the buffer, minus the first dword offcourse
|
||||||
===============================
|
|
||||||
The developer accesses the stack functions through interrupt 0x40,
|
|
||||||
function 53. Some functions may be accessed through function 52, but these
|
|
||||||
are mainly for stack configuration.
|
|
||||||
Here is a summary of the functions that you may use and the parameter
|
|
||||||
definitions.
|
|
||||||
|
|
||||||
|
out:
|
||||||
|
eax = -1 on error, socket option otherwise
|
||||||
|
|
||||||
Get Local IP Address
|
TIP
|
||||||
--------------------
|
|
||||||
eax = 52
|
|
||||||
ebx = 1
|
|
||||||
|
|
||||||
IP address returned in eax ( in internet byte order )
|
when you import 'network.inc' and 'macros.inc' into your source code, you can use the following syntax to work with sockets:
|
||||||
|
|
||||||
|
|
||||||
Write to stack input queue
|
for example, to open a socket
|
||||||
--------------------------
|
|
||||||
eax = 52
|
|
||||||
ebx = 6
|
|
||||||
edx = number of bytes to write
|
|
||||||
esi = pointer to data ( in application space )
|
|
||||||
|
|
||||||
On return, eax holds 0 for OK, or 0xFFFFFFFF for error.
|
mcall socket, AF_INET, SOCK_DGRAM,0
|
||||||
This interface is for slow network drivers only ( PPP, SLIP )
|
mov [socketnum], eax
|
||||||
|
|
||||||
|
then to connect to a server
|
||||||
|
|
||||||
Read data from network output queue
|
mcall connect, [socketnum], sockaddr, 18
|
||||||
-----------------------------------
|
|
||||||
eax = 52
|
|
||||||
ebx = 8
|
|
||||||
esi = pointer to data ( in application space )
|
|
||||||
|
|
||||||
On return, eax holds number of bytes transferred.
|
|
||||||
This interface is for slow network drivers only ( PPP, SLIP )
|
|
||||||
|
|
||||||
|
eax = 76 - Work with protocols
|
||||||
|
|
||||||
Open a UDP socket
|
high half of ebx = protocol number (for all subfunctions!)
|
||||||
-----------------
|
bh = device number (for all subfunctions!)
|
||||||
eax = 53
|
bl = subfunction number, depends on protocol type
|
||||||
ebx = 0
|
|
||||||
ecx = local port
|
|
||||||
edx = remote port
|
|
||||||
esi = remote ip address ( in internet byte order )
|
|
||||||
|
|
||||||
The socket number allocated is returned in eax.
|
For Ethernet protocol
|
||||||
A return value of 0xFFFFFFFF means no socket could be opened.
|
|
||||||
|
|
||||||
|
0 - Read # Packets send
|
||||||
|
1 - Read # Packets received
|
||||||
|
2 - Read # Bytes send
|
||||||
|
3 - Read # Bytes received
|
||||||
|
4 - Read MAC
|
||||||
|
5 - Write MAC
|
||||||
|
6 - Read IN-QUEUE size
|
||||||
|
7 - Read OUT-QUEUE size
|
||||||
|
For IPv4 protocol
|
||||||
|
|
||||||
Open a TCP socket
|
0 - Read # IP packets send
|
||||||
-----------------
|
1 - Read # IP packets received
|
||||||
eax = 53
|
2 - Read IP
|
||||||
ebx = 5
|
3 - Write IP
|
||||||
ecx = local port
|
4 - Read DNS
|
||||||
edx = remote port
|
5 - Write DNS
|
||||||
esi = remote ip address ( in internet byte order )
|
6 - Read subnet
|
||||||
edi = mode : SOCKET_PASSIVE or SOCKET_ACTIVE ( defined in stack.inc )
|
7 - Write subnet
|
||||||
|
8 - Read gateway
|
||||||
|
9 - Write gateway
|
||||||
|
For ARP protocol
|
||||||
|
|
||||||
The socket number allocated is returned in eax.
|
0 - Read # ARP packets send
|
||||||
A return value of 0xFFFFFFFF means no socket could be opened.
|
1 - Read # ARP packets received
|
||||||
|
2 - Get # ARP entry's
|
||||||
|
3 - Read ARP entry
|
||||||
|
4 - Add static ARP entry
|
||||||
|
5 - Remove ARP entry (-1 = remove all)
|
||||||
|
For ICMP protocol
|
||||||
|
|
||||||
|
0 - Read # ICMP packets send
|
||||||
|
1 - Read # ICMP packets received
|
||||||
|
3 - enable/disable ICMP echo reply
|
||||||
|
For UDP protocol
|
||||||
|
|
||||||
Close a socket (UDP Only )
|
0 - Read # UDP packets send
|
||||||
--------------------------
|
1 - Read # UDP packets received
|
||||||
eax = 53
|
For TCP protocol
|
||||||
ebx = 1
|
|
||||||
ecx = socket number
|
|
||||||
|
|
||||||
On return, eax holds 0 for OK, or 0xFFFFFFFF for error.
|
0 - Read # TCP packets send
|
||||||
|
1 - Read # TCP packets received
|
||||||
|
|
||||||
Close a socket (TCP Only )
|
|
||||||
--------------------------
|
|
||||||
eax = 53
|
|
||||||
ebx = 8
|
|
||||||
ecx = socket number
|
|
||||||
|
|
||||||
On return, eax holds 0 for OK, or 0xFFFFFFFF for error.
|
|
||||||
|
|
||||||
|
|
||||||
Poll socket
|
|
||||||
-----------
|
|
||||||
eax = 53
|
|
||||||
ebx = 2
|
|
||||||
ecx = socket number
|
|
||||||
|
|
||||||
On return, eax holds the number of bytes in the receive buffer.
|
|
||||||
|
|
||||||
|
|
||||||
Read socket data
|
|
||||||
----------------
|
|
||||||
eax = 53
|
|
||||||
ebx = 3
|
|
||||||
ecx = socket number
|
|
||||||
|
|
||||||
On return, eax holds the number of bytes remaining, bl holds a data byte.
|
|
||||||
|
|
||||||
|
|
||||||
Write to socket ( UDP only )
|
|
||||||
----------------------------
|
|
||||||
eax = 53
|
|
||||||
ebx = 4
|
|
||||||
ecx = socket number
|
|
||||||
edx = number of bytes to write
|
|
||||||
esi = pointer to data ( in application space )
|
|
||||||
|
|
||||||
On return, eax holds 0 for OK, or 0xFFFFFFFF for error.
|
|
||||||
|
|
||||||
|
|
||||||
Return socket status ( TCP only )
|
|
||||||
---------------------------------
|
|
||||||
eax = 53
|
|
||||||
ebx = 6
|
|
||||||
ecx = socket number
|
|
||||||
|
|
||||||
On return, eax holds the sockets TCP status.
|
|
||||||
This function can be used to determine when a socket has actually connected
|
|
||||||
to another socket - data cannot be written to a socket until the connection
|
|
||||||
is established (TCB_ESTABLISHED). The states a socket can be in are defined
|
|
||||||
in stack.inc as TCB_
|
|
||||||
|
|
||||||
|
|
||||||
Write to socket ( TCP only )
|
|
||||||
----------------------------
|
|
||||||
eax = 53
|
|
||||||
ebx = 7
|
|
||||||
ecx = socket number
|
|
||||||
edx = number of bytes to write
|
|
||||||
esi = pointer to data ( in application space )
|
|
||||||
|
|
||||||
On return, eax holds 0 for OK, or 0xFFFFFFFF for error.
|
|
||||||
|
|
||||||
|
|
||||||
Check port number
|
|
||||||
-----------------
|
|
||||||
eax = 53
|
|
||||||
ebx = 9
|
|
||||||
ecx = port number
|
|
||||||
|
|
||||||
This function is used to determine if a port number
|
|
||||||
is in use by any sockets as a local port number. Local
|
|
||||||
port numbers are normally unique.
|
|
||||||
|
|
||||||
On return, eax is 1 for port number not in use, 0 otherwise.
|
|
||||||
|
|
||||||
|
|
||||||
Opening a TCP socket in Kolibri
|
|
||||||
===============================
|
|
||||||
|
|
||||||
There are two ways to open a socket - Passive or Active.
|
|
||||||
|
|
||||||
In a Passive connection your application 'listens' for incoming
|
|
||||||
requests from remote applications. Typically this will be done when
|
|
||||||
you are implementing a server application that allows any other
|
|
||||||
application to connect to it. You would specify a 'known' local
|
|
||||||
port number, such as 80 for a web server. You would leave the
|
|
||||||
remote IP and remote port number as 0, which indicates any
|
|
||||||
remote application may connect.
|
|
||||||
|
|
||||||
Once the socket has been opened you would wait for an incoming
|
|
||||||
connection before doing anything. This can be by either checking
|
|
||||||
the socket status for TCB_ESTABLISHED, or waiting for data in the
|
|
||||||
receive buffer.
|
|
||||||
|
|
||||||
In an Active connection, you are making a connection to a specified
|
|
||||||
remote port. The remote IP and remote port parameters must be filled
|
|
||||||
in with non-zero values ( otherwise, what are you connecting to? ).
|
|
||||||
You also specify a unique local port number so the remote application
|
|
||||||
can uniquely identify you - after all, there may be several applications
|
|
||||||
on your machine connected to the same remote host. See below for finding
|
|
||||||
a unique port number.
|
|
||||||
|
|
||||||
|
|
||||||
How to find an unused local port number
|
|
||||||
=======================================
|
|
||||||
|
|
||||||
Typically when you are creating an active connection to a remote
|
|
||||||
socket you will want to choose a unique local port number. Local
|
|
||||||
port numbers normally start from 1000; The following code may
|
|
||||||
be used to obtain an unused port number prior to making the
|
|
||||||
open socket call.
|
|
||||||
|
|
||||||
mov ecx, 1000 ; local port starting at 1000
|
|
||||||
|
|
||||||
getlp:
|
|
||||||
inc ecx
|
|
||||||
push ecx
|
|
||||||
mov eax, 53
|
|
||||||
mov ebx, 9
|
|
||||||
int 0x40
|
|
||||||
pop ecx
|
|
||||||
cmp eax, 0 ; is this local port in use?
|
|
||||||
jz getlp ; yes - so try next
|
|
||||||
|
|
||||||
; ecx contains a free local port number
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Writing data to a socket
|
|
||||||
========================
|
|
||||||
|
|
||||||
There are two functions available depending on whether the socket
|
|
||||||
was opened for TCP or UDP protocol; The call parameters are the
|
|
||||||
same however. When the socket is being opened for TCP, use the
|
|
||||||
status function to poll for a connection - data cannot be written
|
|
||||||
to a socket until another socket has connected to it, and the
|
|
||||||
state of the socket is TCB_ESTABLISHED.
|
|
||||||
|
|
||||||
When you write data, the call results in a single IP packet being
|
|
||||||
created and transmitted. Thus the user application is responsible for
|
|
||||||
the size of transmitted packets. Keep the packet sizes under 768 bytes.
|
|
||||||
If you are writing a terminal program like telnet, you may want to send
|
|
||||||
a packet for each keystroke ( inefficient ) or use a timer to send data
|
|
||||||
periodically ( say, every second ).
|
|
||||||
|
|
||||||
|
|
||||||
Reading data from a socket
|
|
||||||
==========================
|
|
||||||
|
|
||||||
There is one function to read data from a sockets receive buffer. This
|
|
||||||
function retrieves one byte at a time. You can use the poll function to
|
|
||||||
test the receive buffer for data.
|
|
||||||
|
|
||||||
|
|
||||||
Closing a socket
|
|
||||||
================
|
|
||||||
|
|
||||||
Simply call the appropriate function - there is one for TCP, and another
|
|
||||||
for UDP. When closing a TCP socket, don't forget that the other end
|
|
||||||
may continue to send data, so the socket may remain active for a
|
|
||||||
few seconds after your call.
|
|
||||||
|
|
||||||
|
|
||||||
If you have any questions or have suggestions for improving this
|
|
||||||
document please contact me at mikeh@oceanfree.net.
|
|
@ -2419,391 +2419,6 @@ dword-значение цвета 0x00RRGGBB
|
|||||||
* eax = -1 - ошибка (в системе слишком много потоков)
|
* eax = -1 - ошибка (в системе слишком много потоков)
|
||||||
* иначе eax = TID - идентификатор потока
|
* иначе eax = TID - идентификатор потока
|
||||||
|
|
||||||
======================================================================
|
|
||||||
= Функция 52, подфункция 0 - получить конфигурацию сетевого драйвера.
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 52 - номер функции
|
|
||||||
* ebx = 0 - номер подфункции
|
|
||||||
Возвращаемое значение:
|
|
||||||
* eax = двойное слово конфигурации
|
|
||||||
Замечания:
|
|
||||||
* Слово конфигурации можно установить подфункцией 2.
|
|
||||||
* Ядро не использует соответствующую переменную.
|
|
||||||
Ценность этой переменной и работающих с ней подфункций 0 и 2
|
|
||||||
представляется сомнительной.
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
======= Функция 52, подфункция 1 - получить локальный IP-адрес. ======
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 52 - номер функции
|
|
||||||
* ebx = 1 - номер подфункции
|
|
||||||
Возвращаемое значение:
|
|
||||||
* eax = IP-адрес (4 байта)
|
|
||||||
Замечания:
|
|
||||||
* Локальный IP-адрес устанавливается подфункцией 3.
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
Функция 52, подфункция 2 - установить конфигурацию сетевого драйвера.
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 52 - номер функции
|
|
||||||
* ebx = 2 - номер подфункции
|
|
||||||
* ecx = двойное слово конфигурации; если младшие 7 бит образуют
|
|
||||||
число 3, это воспринимается как запрос на [пере-]инициализацию
|
|
||||||
Ethernet-карты, в противном случае Ethernet выключается
|
|
||||||
Возвращаемое значение:
|
|
||||||
* если не запрошен Ethernet-интерфейс, то возвращается eax=2,
|
|
||||||
но это может измениться в будущих версиях ядра
|
|
||||||
* если запрошен Ethernet-интерфейс, то eax=0 означает ошибку
|
|
||||||
(отсутствие Ethernet-карты), а ненулевое значение - успех
|
|
||||||
Замечания:
|
|
||||||
* Слово конфигурации можно прочитать подфункцией 0.
|
|
||||||
* Ядро не использует соответствующую переменную.
|
|
||||||
Ценность этой переменной, подфункции 0 и части подфункции 2,
|
|
||||||
устанавливающей эту переменную, представляется сомнительной.
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
====== Функция 52, подфункция 3 - установить локальный IP-адрес. =====
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 52 - номер функции
|
|
||||||
* ebx = 3 - номер подфункции
|
|
||||||
* ecx = IP-адрес (4 байта)
|
|
||||||
Возвращаемое значение:
|
|
||||||
* текущая реализация возвращает eax=3, но это может быть изменено
|
|
||||||
в будущих версиях
|
|
||||||
Замечания:
|
|
||||||
* Локальный IP-адрес можно получить подфункцией 1.
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
= Функция 52, подфункция 6 - добавить данные в стек входной очереди. =
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 52 - номер функции
|
|
||||||
* ebx = 6 - номер подфункции
|
|
||||||
* edx = размер данных
|
|
||||||
* esi = указатель на данные
|
|
||||||
Возвращаемое значение:
|
|
||||||
* eax = -1 - ошибка
|
|
||||||
* eax = 0 - успешно
|
|
||||||
Замечания:
|
|
||||||
* Эта функция предназначена только для медленных сетевых драйверов
|
|
||||||
(PPP, SLIP).
|
|
||||||
* Размер данных не должен превосходить 1500 байт,
|
|
||||||
хотя проверок корректности не делается.
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
====================== Функция 52, подфункция 8 ======================
|
|
||||||
============= Прочитать данные из сетевой очереди вывода. ============
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 52 - номер функции
|
|
||||||
* ebx = 8 - номер подфункции
|
|
||||||
* esi = указатель на буфер размером 1500 байт
|
|
||||||
Возвращаемое значение:
|
|
||||||
* eax = число прочитанных байт (в текущей реализации
|
|
||||||
либо 0 = нет данных, либо 1500)
|
|
||||||
* данные скопированы в буфер
|
|
||||||
Замечания:
|
|
||||||
* Эта функция предназначена только для медленных сетевых драйверов
|
|
||||||
(PPP, SLIP).
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
=========== Функция 52, подфункция 9 - получить gateway IP. ==========
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 52 - номер функции
|
|
||||||
* ebx = 9 - номер подфункции
|
|
||||||
Возвращаемое значение:
|
|
||||||
* eax = gateway IP (4 байта)
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
========= Функция 52, подфункция 10 - получить маску подсети. ========
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 52 - номер функции
|
|
||||||
* ebx = 10 - номер подфункции
|
|
||||||
Возвращаемое значение:
|
|
||||||
* eax = маска подсети
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
========= Функция 52, подфункция 11 - установить gateway IP. =========
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 52 - номер функции
|
|
||||||
* ebx = 11 - номер подфункции
|
|
||||||
* ecx = gateway IP (4 байта)
|
|
||||||
Возвращаемое значение:
|
|
||||||
* текущая реализация возвращает eax=11, но это может быть изменено
|
|
||||||
в будущих реализациях
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
======== Функция 52, подфункция 12 - установить маску подсети. =======
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 52 - номер функции
|
|
||||||
* ebx = 12 - номер подфункции
|
|
||||||
* ecx = маска подсети
|
|
||||||
Возвращаемое значение:
|
|
||||||
* текущая реализация возвращает eax=12, но это может быть изменено
|
|
||||||
в будущих версиях
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
============ Функция 52, подфункция 13 - получить DNS IP. ============
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 52 - номер функции
|
|
||||||
* ebx = 13 - номер подфункции
|
|
||||||
Возвращаемое значение:
|
|
||||||
* eax = DNS IP (4 байта)
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
=========== Функция 52, подфункция 14 - установить DNS IP. ===========
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 52 - номер функции
|
|
||||||
* ebx = 14 - номер подфункции
|
|
||||||
* ecx = DNS IP (4 байта)
|
|
||||||
Возвращаемое значение:
|
|
||||||
* текущая реализация возвращает eax=14, но это может быть изменено
|
|
||||||
в следующих версиях
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
====== Функция 52, подфункция 15 - получить локальный MAC-адрес. =====
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 52 - номер функции
|
|
||||||
* ebx = 15 - номер подфункции
|
|
||||||
* ecx = 0 - читать первые 4 байта,
|
|
||||||
ecx = 4 - читать последние 2 байта
|
|
||||||
Возвращаемое значение:
|
|
||||||
* для ecx=0: eax = первые 4 байта MAC-адреса
|
|
||||||
* для ecx=4: ax = последние 2 байта MAC-адреса,
|
|
||||||
старшая половина eax разрушается
|
|
||||||
* для других ecx: eax = -1 как признак ошибки
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
============ Функция 53, подфункция 0 - открыть UDP-сокет. ===========
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 53 - номер функции
|
|
||||||
* ebx = 0 - номер подфункции
|
|
||||||
* ecx = локальный порт (учитывается только младшее слово),
|
|
||||||
ecx = 0 - предоставить системе выбор локального порта
|
|
||||||
* edx = удалённый порт (учитывается только младшее слово)
|
|
||||||
* esi = удалённый IP
|
|
||||||
Возвращаемое значение:
|
|
||||||
* eax = -1 = 0xFFFFFFFF - ошибка; ebx разрушается
|
|
||||||
* eax = хэндл сокета (некоторое число, однозначно идентифицирующее
|
|
||||||
сокет и имеющее смысл только для системы) - успешно;
|
|
||||||
ebx разрушается
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
============ Функция 53, подфункция 1 - закрыть UDP-сокет. ===========
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 53 - номер функции
|
|
||||||
* ebx = 1 - номер подфункции
|
|
||||||
* ecx = хэндл сокета
|
|
||||||
Возвращаемое значение:
|
|
||||||
* eax = -1 - неверный хэндл
|
|
||||||
* eax = 0 - успешно
|
|
||||||
* ebx разрушается
|
|
||||||
Замечания:
|
|
||||||
* Текущая реализация не закрывает автоматически все сокеты потока
|
|
||||||
при его завершении. В частности, не следует прибивать поток
|
|
||||||
с кучей открытых сокетов - будет утечка ресурсов.
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
============== Функция 53, подфункция 2 - опрос сокета. ==============
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 53 - номер функции
|
|
||||||
* ebx = 2 - номер подфункции
|
|
||||||
* ecx = хэндл сокета
|
|
||||||
Возвращаемое значение:
|
|
||||||
* eax = число полученных байт, 0 для неверного хэндла
|
|
||||||
* ebx разрушается
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
======== Функция 53, подфункция 3 - прочитать байт из сокета. ========
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 53 - номер функции
|
|
||||||
* ebx = 3 - номер подфункции
|
|
||||||
* ecx = хэндл сокета
|
|
||||||
Возвращаемое значение:
|
|
||||||
* если нет принятых данных или указан неверный хэндл:
|
|
||||||
eax=0, bl=0, прочие байты ebx разрушаются
|
|
||||||
* если были принятые данные: eax=число оставшихся байт
|
|
||||||
(возможно, 0), bl=прочитанный байт, прочие байты ebx разрушаются
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
========== Функция 53, подфункция 4 - записать в UDP-сокет. ==========
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 53 - номер функции
|
|
||||||
* ebx = 4 - номер подфункции
|
|
||||||
* ecx = хэндл сокета
|
|
||||||
* edx = число байт для записи
|
|
||||||
* esi = указатель на данные для записи
|
|
||||||
Возвращаемое значение:
|
|
||||||
* eax = 0xffffffff - ошибка (неверный хэндл или недостаточно памяти)
|
|
||||||
* eax = 0 - успешно
|
|
||||||
* ebx разрушается
|
|
||||||
Замечания:
|
|
||||||
* Число байт для записи не может превышать 1500-28, хотя
|
|
||||||
соответствующей проверки не делается.
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
============ Функция 53, подфункция 5 - открыть TCP-сокет. ===========
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 53 - номер функции
|
|
||||||
* ebx = 5 - номер подфункции
|
|
||||||
* ecx = локальный порт (учитывается только младшее слово),
|
|
||||||
ecx = 0 - предоставить системе выбор локального порта
|
|
||||||
* edx = удалённый порт (учитывается только младшее слово)
|
|
||||||
* esi = удалённый IP
|
|
||||||
* edi = режим открытия: SOCKET_PASSIVE=0 или SOCKET_ACTIVE=1
|
|
||||||
Возвращаемое значение:
|
|
||||||
* eax = -1 = 0xFFFFFFFF - ошибка; ebx разрушается
|
|
||||||
* eax = хэндл сокета (некоторое число, однозначно идентифицирующее
|
|
||||||
сокет и имеющее смысл только для системы) - успешно;
|
|
||||||
ebx разрушается
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
====== Функция 53, подфункция 6 - получить состояние TCP-сокета. =====
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 53 - номер функции
|
|
||||||
* ebx = 6 - номер подфункции
|
|
||||||
* ecx = хэндл сокета
|
|
||||||
Возвращаемое значение:
|
|
||||||
* eax = 0 для неверного сокета или статус: одно из
|
|
||||||
* TCB_LISTEN = 1
|
|
||||||
* TCB_SYN_SENT = 2
|
|
||||||
* TCB_SYN_RECEIVED = 3
|
|
||||||
* TCB_ESTABLISHED = 4
|
|
||||||
* TCB_FIN_WAIT_1 = 5
|
|
||||||
* TCB_FIN_WAIT_2 = 6
|
|
||||||
* TCB_CLOSE_WAIT = 7
|
|
||||||
* TCB_CLOSING = 8
|
|
||||||
* TCB_LAST_ASK = 9
|
|
||||||
* TCB_TIME_WAIT = 10
|
|
||||||
* TCB_CLOSED = 11
|
|
||||||
* ebx разрушается
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
========== Функция 53, подфункция 7 - записать в TCP-сокет. ==========
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 53 - номер функции
|
|
||||||
* ebx = 7 - номер подфункции
|
|
||||||
* ecx = хэндл сокета
|
|
||||||
* edx = число байт для записи
|
|
||||||
* esi = указатель на данные для записи
|
|
||||||
Возвращаемое значение:
|
|
||||||
* eax = 0xffffffff - ошибка (неверный хэндл или недостаточно памяти)
|
|
||||||
* eax = 0 - успешно
|
|
||||||
* ebx разрушается
|
|
||||||
Замечания:
|
|
||||||
* Число байт для записи не может превышать 1500-40,
|
|
||||||
хотя соответствующей проверки не делается.
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
============ Функция 53, подфункция 8 - закрыть TCP-сокет. ===========
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 53 - номер функции
|
|
||||||
* ebx = 8 - номер подфункции
|
|
||||||
* ecx = хэндл сокета
|
|
||||||
Возвращаемое значение:
|
|
||||||
* eax = -1 - ошибка (неверный хэндл или
|
|
||||||
недостаточно памяти для пакета закрытия сокета)
|
|
||||||
* eax = 0 - успешно
|
|
||||||
* ebx разрушается
|
|
||||||
Замечания:
|
|
||||||
* Текущая реализация не закрывает автоматически все сокеты потока
|
|
||||||
при его завершении. В частности, не следует прибивать поток
|
|
||||||
с кучей открытых сокетов - будет утечка ресурсов.
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
== Функция 53, подфункция 9 - проверить, свободен ли локальный порт. =
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 53 - номер функции
|
|
||||||
* ebx = 9 - номер подфункции
|
|
||||||
* ecx = номер локального порта (используются только младшие 16 бит)
|
|
||||||
Возвращаемое значение:
|
|
||||||
* eax = 0 - порт используется
|
|
||||||
* eax = 1 - порт свободен
|
|
||||||
* ebx разрушается
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
==== Функция 53, подфункция 10 - получить статус кабеля Ethernet. ====
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 53 - номер функции
|
|
||||||
* ebx = 10 - номер подфункции
|
|
||||||
Возвращаемое значение:
|
|
||||||
* al = -1 - драйвер сетевой карты не загружен или
|
|
||||||
не поддерживает эту функцию
|
|
||||||
* al = 0 - кабель не подключён
|
|
||||||
* al = 1 - кабель подключён
|
|
||||||
* ebx разрушается
|
|
||||||
Замечания:
|
|
||||||
* Текущая реализация ядра поддерживает эту функцию
|
|
||||||
только для сетевых карт RTL8139.
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
==== Функция 53, подфункция 11 - прочитать данные сетевого стека. ====
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 53 - номер функции
|
|
||||||
* ebx = 11 - номер подфункции
|
|
||||||
* ecx = хэндл сокета
|
|
||||||
* edx = указатель на буфер
|
|
||||||
* esi = число байт для чтения;
|
|
||||||
* esi = 0 - читать все данные (максимум 4096 байт)
|
|
||||||
Возвращаемое значение:
|
|
||||||
* eax = число прочитанных байт (0 при неверном хэндле)
|
|
||||||
* ebx разрушается
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
Функция 53, подфункция 255 - отладочная информация сетевого драйвера.
|
|
||||||
======================================================================
|
|
||||||
Параметры:
|
|
||||||
* eax = 53 - номер функции
|
|
||||||
* ebx = 255 - номер подфункции
|
|
||||||
* ecx = тип запрашиваемой информации (смотри ниже)
|
|
||||||
Возвращаемое значение:
|
|
||||||
* eax = запрошенная информация
|
|
||||||
* ebx разрушается
|
|
||||||
Возможные значения ecx:
|
|
||||||
* 100: длина очереди 0 (empty queue)
|
|
||||||
* 101: длина очереди 1 (ip-out queue)
|
|
||||||
* 102: длина очереди 2 (ip-in queue)
|
|
||||||
* 103: длина очереди 3 (net1out queue)
|
|
||||||
* 200: число элементов в таблице ARP
|
|
||||||
* 201: размер таблицы ARP (в элементах) (20 в текущей версии)
|
|
||||||
* 202: прочитать элемент edx таблицы ARP во временный буфер, откуда
|
|
||||||
берут информацию 5 последующих типов;
|
|
||||||
в этом случае eax неопределён
|
|
||||||
* 203: IP-адрес, запомненный типом 202
|
|
||||||
* 204: старшее dword MAC-адреса, запомненного типом 202
|
|
||||||
* 205: младшее word MAC-адреса, запомненного типом 202
|
|
||||||
* 206: слово статуса, запомненное типом 202
|
|
||||||
* 207: слово ttl, запомненное типом 202
|
|
||||||
* 2: общее число полученных IP-пакетов
|
|
||||||
* 3: общее число переданных IP-пакетов
|
|
||||||
* 4: общее число сдампленных полученных пакетов
|
|
||||||
* 5: общее число полученных ARP-пакетов
|
|
||||||
* 6: статус драйвера пакетов, 0=неактивен,
|
|
||||||
ненулевое значение=активен
|
|
||||||
|
|
||||||
======================================================================
|
======================================================================
|
||||||
====================== Функция 55, подфункция 55 =====================
|
====================== Функция 55, подфункция 55 =====================
|
||||||
========== Начать проигрывать данные на встроенном спикере. ==========
|
========== Начать проигрывать данные на встроенном спикере. ==========
|
||||||
|
@ -2410,408 +2410,6 @@ Returned value:
|
|||||||
* otherwise eax = TID - thread identifier
|
* otherwise eax = TID - thread identifier
|
||||||
</UL>
|
</UL>
|
||||||
|
|
||||||
======================================================================
|
|
||||||
=========================== Function 52 ==============================
|
|
||||||
======================================================================
|
|
||||||
|
|
||||||
WARNING: This function is obsolete and is only present in the
|
|
||||||
documentation as a guide to understand/port the older network
|
|
||||||
applications. For new programs, use function 74
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
=== Function 52, subfunction 0 - get network driver configuration. ===
|
|
||||||
======================================================================
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
* eax = 52 - function number
|
|
||||||
* ebx = 0 - subfunction number
|
|
||||||
Returned value:
|
|
||||||
* eax = configuration dword
|
|
||||||
Remarks:
|
|
||||||
* Configuration dword can be set by subfunction 2.
|
|
||||||
* The kernel does not use this variable. The value of this
|
|
||||||
variable and working with it subfunctions 0 and 2 is represented
|
|
||||||
doubtful.
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
========= Function 52, subfunction 1 - get local IP-address. =========
|
|
||||||
======================================================================
|
|
||||||
Parameters:
|
|
||||||
* eax = 52 - function number
|
|
||||||
* ebx = 1 - subfunction number
|
|
||||||
Returned value:
|
|
||||||
* eax = IP-address (4 bytes)
|
|
||||||
Remarks:
|
|
||||||
* Local IP-address is set by subfunction 3.
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
=== Function 52, subfunction 2 - set network driver configuration. ===
|
|
||||||
======================================================================
|
|
||||||
Parameters:
|
|
||||||
* eax = 52 - function number
|
|
||||||
* ebx = 2 - subfunction number
|
|
||||||
* ecx = configuration dword; if low 7 bits derivate the number 3,
|
|
||||||
function [re-]initializes Ethernet-card, otherwise
|
|
||||||
Ethernet turns off
|
|
||||||
Returned value:
|
|
||||||
* if Ethernet-interface is not requested, function returns eax=2,
|
|
||||||
but this can be changed in future kernel versions
|
|
||||||
* if Ethernet-interface is requested, eax=0 means error
|
|
||||||
(absence of Ethernet-card), and nonzero value - success
|
|
||||||
Remarks:
|
|
||||||
* Configuration dword can be read by subfunction 0.
|
|
||||||
* The kernel does not use this variable. The value of this
|
|
||||||
variable, subfunction 0 and part of subfunction 2, which set it,
|
|
||||||
is represented doubtful.
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
========= Function 52, subfunction 3 - set local IP-address. =========
|
|
||||||
======================================================================
|
|
||||||
Parameters:
|
|
||||||
* eax = 52 - function number
|
|
||||||
* ebx = 3 - subfunction number
|
|
||||||
* ecx = IP-address (4 bytes)
|
|
||||||
Returned value:
|
|
||||||
* the current implementation returns eax=3, but this can be changed
|
|
||||||
in future versions
|
|
||||||
Remarks:
|
|
||||||
* Local IP-address can be get by subfunction 1.
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
= Function 52, subfunction 6 - add data to the stack of input queue. =
|
|
||||||
======================================================================
|
|
||||||
Parameters:
|
|
||||||
* eax = 52 - function number
|
|
||||||
* ebx = 6 - subfunction number
|
|
||||||
* edx = data size
|
|
||||||
* esi = data pointer
|
|
||||||
Returned value:
|
|
||||||
* eax = -1 - error
|
|
||||||
* eax = 0 - success
|
|
||||||
Remarks:
|
|
||||||
* This function is intended only for slow network drivers
|
|
||||||
(PPP, SLIP).
|
|
||||||
* Data size must not exceed 1500 bytes, though function
|
|
||||||
performs no checks on correctness.
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
Function 52, subfunction 8 - read data from the network output queue.
|
|
||||||
======================================================================
|
|
||||||
Parameters:
|
|
||||||
* eax = 52 - function number
|
|
||||||
* ebx = 8 - subfunction number
|
|
||||||
* esi = pointer to 1500-byte buffer
|
|
||||||
Returned value:
|
|
||||||
* eax = number of read bytes (in the current implementation
|
|
||||||
either 0 = no data or 1500)
|
|
||||||
* data was copied in buffer
|
|
||||||
Remarks:
|
|
||||||
* This function is intended only for slow network drivers
|
|
||||||
(PPP, SLIP).
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
============ Function 52, subfunction 9 - get gateway IP. ============
|
|
||||||
======================================================================
|
|
||||||
Parameters:
|
|
||||||
* eax = 52 - function number
|
|
||||||
* ebx = 9 - subfunction number
|
|
||||||
Returned value:
|
|
||||||
* eax = gateway IP (4 bytes)
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
=========== Function 52, subfunction 10 - get subnet mask. ===========
|
|
||||||
======================================================================
|
|
||||||
Parameters:
|
|
||||||
* eax = 52 - function number
|
|
||||||
* ebx = 10 - subfunction number
|
|
||||||
Returned value:
|
|
||||||
* eax = subnet mask
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
============ Function 52, subfunction 11 - set gateway IP. ===========
|
|
||||||
======================================================================
|
|
||||||
Parameters:
|
|
||||||
* eax = 52 - function number
|
|
||||||
* ebx = 11 - subfunction number
|
|
||||||
* ecx = gateway IP (4 bytes)
|
|
||||||
Returned value:
|
|
||||||
* the current implementation returns eax=11, but this can be changed
|
|
||||||
in future versions
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
=========== Function 52, subfunction 12 - set subnet mask. ===========
|
|
||||||
======================================================================
|
|
||||||
Parameters:
|
|
||||||
* eax = 52 - function number
|
|
||||||
* ebx = 12 - subfunction number
|
|
||||||
* ecx = subnet mask
|
|
||||||
Returned value:
|
|
||||||
* the current implementation returns eax=12, but this can be changed
|
|
||||||
in future versions
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
============== Function 52, subfunction 13 - get DNS IP. =============
|
|
||||||
======================================================================
|
|
||||||
Parameters:
|
|
||||||
* eax = 52 - function number
|
|
||||||
* ebx = 13 - subfunction number
|
|
||||||
Returned value:
|
|
||||||
* eax = DNS IP (4 bytes)
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
============== Function 52, subfunction 14 - set DNS IP. =============
|
|
||||||
======================================================================
|
|
||||||
Parameters:
|
|
||||||
* eax = 52 - function number
|
|
||||||
* ebx = 14 - subfunction number
|
|
||||||
* ecx = DNS IP (4 bytes)
|
|
||||||
Returned value:
|
|
||||||
* the current implementation returns eax=14, but this can be changed
|
|
||||||
in future versions
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
======== Function 52, subfunction 15 - get local MAC address. ========
|
|
||||||
======================================================================
|
|
||||||
Parameters:
|
|
||||||
* eax = 52 - function number
|
|
||||||
* ebx = 15 - subfunction number
|
|
||||||
* ecx = 0 - read first 4 bytes,
|
|
||||||
ecx = 4 - read last 2 bytes
|
|
||||||
Returned value:
|
|
||||||
* for ecx=0: eax = first 4 bytes of MAC address
|
|
||||||
* for ecx=4: ax = last 2 bytes of MAC address,
|
|
||||||
high half of eax is destroyed
|
|
||||||
* for other ecx: eax = -1 indicates an error
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
=========================== Function 53 ==============================
|
|
||||||
======================================================================
|
|
||||||
|
|
||||||
WARNING: This function is obsolete and is only present in the
|
|
||||||
documentation as a guide to understand/port the older network
|
|
||||||
applications. For new programs, use function 75.
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
============ Function 53, subfunction 0 - open UDP-socket. ===========
|
|
||||||
======================================================================
|
|
||||||
Parameters:
|
|
||||||
* eax = 53 - function number
|
|
||||||
* ebx = 0 - subfunction number
|
|
||||||
* ecx = local port (only low word is taken into account),
|
|
||||||
ecx = 0 - let the system choose a port
|
|
||||||
* edx = remote port (only low word is taken into account)
|
|
||||||
* esi = remote IP
|
|
||||||
Returned value:
|
|
||||||
* eax = -1 = 0xFFFFFFFF - error; ebx destroyed
|
|
||||||
* eax = socket handle (some number which unambiguously identifies
|
|
||||||
socket and have sense only for the system) - success;
|
|
||||||
ebx destroyed
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
=========== Function 53, subfunction 1 - close UDP-socket. ===========
|
|
||||||
======================================================================
|
|
||||||
Parameters:
|
|
||||||
* eax = 53 - function number
|
|
||||||
* ebx = 1 - subfunction number
|
|
||||||
* ecx = socket handle
|
|
||||||
Returned value:
|
|
||||||
* eax = -1 - incorrect handle
|
|
||||||
* eax = 0 - success
|
|
||||||
* ebx destroyed
|
|
||||||
Remarks:
|
|
||||||
* The current implementation does not close automatically all
|
|
||||||
sockets of a thread at termination. In particular, one should not
|
|
||||||
kill a thread with many opened sockets - there will be an outflow
|
|
||||||
of resources.
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
============== Function 53, subfunction 2 - poll socket. =============
|
|
||||||
======================================================================
|
|
||||||
Parameters:
|
|
||||||
* eax = 53 - function number
|
|
||||||
* ebx = 2 - subfunction number
|
|
||||||
* ecx = socket handle
|
|
||||||
Returned value:
|
|
||||||
* eax = number of read bytes, 0 for incorrect handle
|
|
||||||
* ebx destroyed
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
========= Function 53, subfunction 3 - read byte from socket. ========
|
|
||||||
======================================================================
|
|
||||||
Parameters:
|
|
||||||
* eax = 53 - function number
|
|
||||||
* ebx = 3 - subfunction number
|
|
||||||
* ecx = socket handle
|
|
||||||
Returned value:
|
|
||||||
* if there is no read data or handle is incorrect: eax=0, bl=0,
|
|
||||||
other bytes of ebx are destroyed
|
|
||||||
* if there are read data: eax=number of rest bytes
|
|
||||||
(possibly 0), bl=read byte, other bytes of ebx are destroyed
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
========== Function 53, subfunction 4 - write to UDP-socket. =========
|
|
||||||
======================================================================
|
|
||||||
Parameters:
|
|
||||||
* eax = 53 - function number
|
|
||||||
* ebx = 4 - subfunction number
|
|
||||||
* ecx = socket handle
|
|
||||||
* edx = number of bytes to write
|
|
||||||
* esi = pointer to data to write
|
|
||||||
Returned value:
|
|
||||||
* eax = 0xffffffff - error (invalid handle or not enough memory)
|
|
||||||
* eax = 0 - success
|
|
||||||
* ebx destroyed
|
|
||||||
Remarks:
|
|
||||||
* Number of bytes to write must not exceed 1500-28, though
|
|
||||||
the appropriate check is not made.
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
============ Function 53, subfunction 5 - open TCP-socket. ===========
|
|
||||||
======================================================================
|
|
||||||
Parameters:
|
|
||||||
* eax = 53 - function number
|
|
||||||
* ebx = 5 - subfunction number
|
|
||||||
* ecx = local port (only low word is taken into account),
|
|
||||||
ecx = 0 - let the system choose a port
|
|
||||||
* edx = remote port (only low word is taken into account)
|
|
||||||
* esi = remote IP
|
|
||||||
* edi = open mode: SOCKET_PASSIVE=0 or SOCKET_ACTIVE=1
|
|
||||||
Returned value:
|
|
||||||
* eax = -1 = 0xFFFFFFFF - error; ebx destroys
|
|
||||||
* eax = socket handle (some number which unambiguously identifies
|
|
||||||
socket and have sense only for the system) - success;
|
|
||||||
ebx destroyed
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
========= Function 53, subfunction 6 - get TCP-socket status. ========
|
|
||||||
======================================================================
|
|
||||||
Parameters:
|
|
||||||
* eax = 53 - function number
|
|
||||||
* ebx = 6 - subfunction number
|
|
||||||
* ecx = socket handle
|
|
||||||
Returned value:
|
|
||||||
* eax = 0 for incorrect handle or socket status: one of
|
|
||||||
* TCB_LISTEN = 1
|
|
||||||
* TCB_SYN_SENT = 2
|
|
||||||
* TCB_SYN_RECEIVED = 3
|
|
||||||
* TCB_ESTABLISHED = 4
|
|
||||||
* TCB_FIN_WAIT_1 = 5
|
|
||||||
* TCB_FIN_WAIT_2 = 6
|
|
||||||
* TCB_CLOSE_WAIT = 7
|
|
||||||
* TCB_CLOSING = 8
|
|
||||||
* TCB_LAST_ASK = 9
|
|
||||||
* TCB_TIME_WAIT = 10
|
|
||||||
* TCB_CLOSED = 11
|
|
||||||
* ebx destroyed
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
========== Function 53, subfunction 7 - write to TCP-socket. =========
|
|
||||||
======================================================================
|
|
||||||
Parameters:
|
|
||||||
* eax = 53 - function number
|
|
||||||
* ebx = 7 - subfunction number
|
|
||||||
* ecx = socket handle
|
|
||||||
* edx = number of bytes to write
|
|
||||||
* esi = pointer to data to write
|
|
||||||
Returned value:
|
|
||||||
* eax = 0xffffffff - error (invalid handle or not enough memory)
|
|
||||||
* eax = 0 - success
|
|
||||||
* ebx destroyed
|
|
||||||
Remarks:
|
|
||||||
* Number of bytes to write must not exceed 1500-40, though
|
|
||||||
the appropriate check is not made.
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
=========== Function 53, subfunction 8 - close TCP-socket. ===========
|
|
||||||
======================================================================
|
|
||||||
Parameters:
|
|
||||||
* eax = 53 - function number
|
|
||||||
* ebx = 8 - subfunction number
|
|
||||||
* ecx = socket handle
|
|
||||||
Returned value:
|
|
||||||
* eax = -1 - error (invalid handle or
|
|
||||||
not enough memory for socket close packet)
|
|
||||||
* eax = 0 - success
|
|
||||||
* ebx destroyed
|
|
||||||
Remarks:
|
|
||||||
* The current implementation does not close automatically all
|
|
||||||
sockets of a thread at termination. In particular, one should not
|
|
||||||
kill a thread with many opened sockets - there will be an outflow
|
|
||||||
of resources.
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
=== Function 53, subfunction 9 - check whether local port is free. ===
|
|
||||||
======================================================================
|
|
||||||
Parameters:
|
|
||||||
* eax = 53 - function number
|
|
||||||
* ebx = 9 - subfunction number
|
|
||||||
* ecx = local port number (low 16 bits are used only)
|
|
||||||
Returned value:
|
|
||||||
* eax = 0 - port is used
|
|
||||||
* eax = 1 - port is free
|
|
||||||
* ebx destroyed
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
===== Function 53, subfunction 10 - query Ethernet cable status. =====
|
|
||||||
======================================================================
|
|
||||||
Parameters:
|
|
||||||
* eax = 53 - function number
|
|
||||||
* ebx = 10 - subfunction number
|
|
||||||
Returned value:
|
|
||||||
* al = -1 - a network driver is not loaded or
|
|
||||||
does not support this function
|
|
||||||
* al = 0 - Ethernet cable is unplugged
|
|
||||||
* al = 1 - Ethernet cable is plugged
|
|
||||||
* ebx destroyed
|
|
||||||
Remarks:
|
|
||||||
* The current kernel implementation supports this function
|
|
||||||
only for RTL8139 network cards.
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
======= Function 53, subfunction 11 - read network stack data. =======
|
|
||||||
======================================================================
|
|
||||||
Paramters:
|
|
||||||
* eax = 53 - function number
|
|
||||||
* ebx = 11 - subfunction number
|
|
||||||
* ecx = socket handle
|
|
||||||
* edx = pointer to buffer
|
|
||||||
* esi = number of bytes to read;
|
|
||||||
* esi = 0 - read all data (maximum 4096 bytes)
|
|
||||||
Returned value:
|
|
||||||
* eax = number of bytes read (0 for incorrect handle)
|
|
||||||
* ebx destroyed
|
|
||||||
|
|
||||||
======================================================================
|
|
||||||
= Function 53, subfunction 255 - debug information of network driver.
|
|
||||||
======================================================================
|
|
||||||
Parameters:
|
|
||||||
* eax = 53 - function number
|
|
||||||
* ebx = 255 - subfunction number
|
|
||||||
* ecx = type of requested information (see below)
|
|
||||||
Returned value:
|
|
||||||
* eax = requested information
|
|
||||||
* ebx destroyed
|
|
||||||
Possible values for ecx:
|
|
||||||
* 100: length of queue 0 (empty queue)
|
|
||||||
* 101: length of queue 1 (ip-out queue)
|
|
||||||
* 102: length of queue 2 (ip-in queue)
|
|
||||||
* 103: length of queue 3 (net1out queue)
|
|
||||||
* 200: number of items in the ARP table
|
|
||||||
* 201: size of the ARP table (in items) (20 for current version)
|
|
||||||
* 202: read item at edx of the ARP table to the temporary buffer,
|
|
||||||
whence 5 following types take information;
|
|
||||||
in this case eax is not defined
|
|
||||||
* 203: IP-address saved by type 202
|
|
||||||
* 204: high dword of MAC-address saved by type 202
|
|
||||||
* 205: low word of MAC-address saved by type 202
|
|
||||||
* 206: status word saved by type 202
|
|
||||||
* 207: ttl word saved by type 202
|
|
||||||
* 2: total number of received IP-packets
|
|
||||||
* 3: total number of transferred IP-packets
|
|
||||||
* 4: total number of dumped received packets
|
|
||||||
* 5: total number of received ARP-packets
|
|
||||||
* 6: status of packet driver, 0=inactive, nonzero=active
|
|
||||||
|
|
||||||
======================================================================
|
======================================================================
|
||||||
Function 55, subfunction 55 - begin to play data on built-in speaker.
|
Function 55, subfunction 55 - begin to play data on built-in speaker.
|
||||||
======================================================================
|
======================================================================
|
||||||
|
@ -180,13 +180,13 @@ end if
|
|||||||
embed_file 'MTDBG.TXT' ;e
|
embed_file 'MTDBG.TXT' ;e
|
||||||
if lang eq ru
|
if lang eq ru
|
||||||
embed_file 'SYSFUNCR.TXT' ;f
|
embed_file 'SYSFUNCR.TXT' ;f
|
||||||
embed_file 'STACK_RU.TXT' ;g
|
|
||||||
else
|
else
|
||||||
embed_file 'SYSFUNCS.TXT' ;f
|
embed_file 'SYSFUNCS.TXT' ;f
|
||||||
embed_file 'STACK.TXT' ;g
|
|
||||||
end if
|
end if
|
||||||
|
embed_file 'STACK.TXT' ;g
|
||||||
embed_file 'KFAR_KEYS.TXT' ;h
|
embed_file 'KFAR_KEYS.TXT' ;h
|
||||||
embed_file 'INI.TXT' ;i
|
embed_file 'INI.TXT' ;i
|
||||||
|
embed_file 'OPENDIAL.TXT' ;j
|
||||||
; -- End of embedding area -------
|
; -- End of embedding area -------
|
||||||
|
|
||||||
dd 0
|
dd 0
|
||||||
|
Loading…
Reference in New Issue
Block a user