/data/eng/docs/OPENDIAL.TXT |
---|
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. |
/data/it/docs/OPENDIAL.TXT |
---|
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. |
/data/it/docs/STACK.TXT |
---|
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. |
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 |
bh = device number, for all following functions ! |
E sono implementate le seguenti applicazioni: |
bl = 0 (Get device type) |
Server HTTP |
Telnet |
Client POP |
DNS Name resolver |
Server MP3 |
Client TFTP |
Client IRC |
out: |
eax = device type number |
Vi sono inoltre applicazioni sperimentali, per los terming di musica e |
per la comunicazione via socket, in fase di sviluppo vi è anche un |
browser web. |
bl = 1 (Get device name) |
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. |
Il layer IP non supporta il routing. |
Non è supportata la 'Packet fragmentation'. |
in |
none |
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 |
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. |
bl = 0 (Open Socket) |
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 |
hosts Kolibri has communicated with by running the ARPSTAT application. |
bl = 1 (Close Socket) |
Enabling Ethernet |
----------------- |
in: |
ecx = socket number |
out: |
eax = -1 on error |
Boot Kolibri, then select STACKCFG from the NET menu. |
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. |
bl = 2 (Bind) |
The stack is now running, which you can test by pinging Kolibri from a |
remote host. |
The simplest way to connect two PC's together is using a 'Null Modem' |
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. |
How to use TCP/IP locally, with no Network |
========================================== |
Kolibri supports a form of local loopback that means applications on the |
same PC can communicate with each other via sockets as though they |
were on separate hosts. To connect to an application on the same machine, |
specify the local IP address as the destination address. You do not even |
need to configure the stack for ethernet; local loopback will work without |
any network hardware. It's great for development and testing. |
Application Programming Interface |
================================= |
The developer can access the stack through interrupt 0x40, function 53. |
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. |
Sockets |
======= |
Applications connect to each other and pass information between themselves |
through a mechanism called a 'socket'. Sockets are end-points for |
communication; You need one at each application to communicate. |
Using sockets is a little like using files on an OS; You open them, read |
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. |
socket A unique identifier used by the application for communication. |
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 |
just the IP address, otherwise the remote stack will not know to which |
application it should send your data. You must fully qualify the address, |
which means you specify the IP address and the port number. This would be |
written like this |
192.168.1.10:80 ; Connect to port 80 on the machine 192.168.1.10 |
Port numbers are important. Some are 'well known' and provide access to |
common applications. For example port 80 is used by HTTP servers; That |
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, |
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. |
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. |
Get Local IP Address |
-------------------- |
eax = 52 |
ebx = 1 |
IP address returned in eax ( in internet byte order ) |
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. |
This interface is for slow network drivers only ( PPP, SLIP ) |
Read data from network output queue |
----------------------------------- |
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 ) |
Open a UDP socket |
----------------- |
eax = 53 |
ebx = 0 |
ecx = local port |
edx = remote port |
esi = remote ip address ( in internet byte order ) |
The socket number allocated is returned in eax. |
A return value of 0xFFFFFFFF means no socket could be opened. |
Open a TCP socket |
----------------- |
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 |
in: |
ecx = socket number |
edx = pointer to sockaddr structure |
esi = length of sockaddr structure |
out: |
eax = -1 on error |
On return, eax holds 0 for OK, or 0xFFFFFFFF for error. |
bl = 3 (Listen) |
Close a socket (TCP Only ) |
-------------------------- |
eax = 53 |
ebx = 8 |
in: |
ecx = socket number |
edx = backlog |
out: |
eax = -1 on error |
On return, eax holds 0 for OK, or 0xFFFFFFFF for error. |
bl = 4 (connect) |
Poll socket |
----------- |
eax = 53 |
ebx = 2 |
in: |
ecx = socket number |
edx = pointer to sockaddr structure |
esi = length of sockaddr structure |
out: |
eax = -1 on error |
On return, eax holds the number of bytes in the receive buffer. |
bl = 5 (accept) |
Read socket data |
---------------- |
eax = 53 |
ebx = 3 |
in: |
ecx = socket number |
edx = pointer to sockaddr structure |
esi = length of sockaddr structure |
out: |
eax = socket number, -1 on error |
On return, eax holds the number of bytes remaining, bl holds a data byte. |
bl = 6 (send) |
Write to socket ( UDP only ) |
---------------------------- |
eax = 53 |
ebx = 4 |
in: |
ecx = socket number |
edx = number of bytes to write |
esi = pointer to data ( in application space ) |
edx = pointer to buffer |
esi = length of buffer |
edi = flags |
out: |
eax = -1 on error |
On return, eax holds 0 for OK, or 0xFFFFFFFF for error. |
bl = 7 (receive) |
Return socket status ( TCP only ) |
--------------------------------- |
eax = 53 |
ebx = 6 |
in: |
ecx = socket number |
edx = pointer to buffer |
esi = length of buffer |
edi = flags |
out: |
eax = number of bytes copied, -1 on error |
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_ |
bl = 8 (set socket options) |
Write to socket ( TCP only ) |
---------------------------- |
eax = 53 |
ebx = 7 |
in: |
ecx = socket number |
edx = number of bytes to write |
esi = pointer to data ( in application space ) |
edx = level |
esi = optionname |
edi = ptr to buffer |
On return, eax holds 0 for OK, or 0xFFFFFFFF for error. |
The buffer's first dword is the length of the buffer, minus the first dword offcourse |
out: |
eax = -1 on error |
Check port number |
----------------- |
eax = 53 |
ebx = 9 |
ecx = port number |
bl = 9 (get socket options |
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. |
in: |
ecx = socket number |
edx = level |
esi = optionname |
edi = ptr to buffer |
On return, eax is 1 for port number not in use, 0 otherwise. |
The buffer's first dword is the length of the buffer, minus the first dword offcourse |
out: |
eax = -1 on error, socket option otherwise |
Opening a TCP socket in Kolibri |
=============================== |
TIP |
There are two ways to open a socket - Passive or Active. |
when you import 'network.inc' and 'macros.inc' into your source code, you can use the following syntax to work with sockets: |
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. |
for example, to open a socket |
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. |
mcall socket, AF_INET, SOCK_DGRAM,0 |
mov [socketnum], eax |
then to connect to a server |
How to find an unused local port number |
======================================= |
mcall connect, [socketnum], sockaddr, 18 |
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 |
eax = 76 - Work with protocols |
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 |
high half of ebx = protocol number (for all subfunctions!) |
bh = device number (for all subfunctions!) |
bl = subfunction number, depends on protocol type |
; ecx contains a free local port number |
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 |
Writing data to a socket |
======================== |
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 |
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. |
0 - Read # ICMP packets send |
1 - Read # ICMP packets received |
3 - enable/disable ICMP echo reply |
For UDP protocol |
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 ). |
0 - Read # UDP packets send |
1 - Read # UDP packets received |
For TCP protocol |
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. |
0 - Read # TCP packets send |
1 - Read # TCP packets received |
/data/rus/docs/STACK_RU.TXT |
---|
File deleted |
/data/rus/docs/OPENDIAL.TXT |
---|
0,0 → 1,26 |
OpenDialog - ¨ «®£ ®âªàëâ¨ï ä ©« : |
1) ¥à¥¬¥é¥¨¥ ªãàá®à ¯® ¯ ¥«¨: |
) áâ५ª¨ ¢¢¥àå ¨ ¢¨§ (¢ ⮬ ç¨á«¥ à ᯮ«®¦¥ë¥ ¢ ¤®¯®«¨â¥«ì®© ç á⨠ª« ¢¨ âãàë) - ¯¥à¥¬¥é¥¨¥ ªãàá®à ®¤ã ¯®§¨æ¨î ¢¢¥àå ¨«¨ ¢¨§. |
¡) PageUp - ¯®áâà ¨ç®¥ «¨áâ ¨¥ ¢¢¥àå. |
¢) PageDown - ¯®áâà ¨ç®¥ «¨áâ ¨¥ ¢¨§. |
£) Home - ¢ ç «® ª â «®£ á ä ©« ¬¨. |
¤) End - ¢ ª®¥æ ª â «®£ á ä ©« ¬¨. |
2) Enter - ¤¥©á⢨ï á ä ©«®¬ ¯®§¨æ¨¨ ª®â®à®£® 室¨âáï ªãàá®à ¢ë¤¥«¥¨ï: |
) ¢å®¤ ¢ ¯ ¯ªã. |
¡) ¢ë¡®à ä ©« . |
3) ¡®â á ¬¥î: |
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 - § ¢¥à襨¥ à ¡®âë ¯à®£à ¬¬ë, ¡¥§ ®âªàëâ¨ï ä ©« . |
/data/rus/docs/STACK.TXT |
---|
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 |
/data/sp/docs/OPENDIAL.TXT |
---|
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. |
/data/sp/docs/STACK.TXT |
---|
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. |
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 |
bh = device number, for all following functions ! |
And the following internet applcations are implemented |
bl = 0 (Get device type) |
HTTP Server |
Telnet |
POP Client |
DNS Name resolver |
MP3 Server |
TFTP Client |
IRC Client |
out: |
eax = device type number |
There are also a number of experimental applications for streaming music |
and performing interprocess communication via sockets. A Web broswer is in |
development |
bl = 1 (Get device name) |
in: |
ecx = pointer to 64 byte buffer |
out: |
name is copied into the buffer |
eax = -1 on error |
What is not implemented |
======================= |
bl = 2 (Reset the device) |
The IP layer does not process header options. |
The IP layer does not support routing. |
Packet fragmentation is not supported. |
in |
none |
out |
eax = -1 on error |
bl = 3 (Stop device) |
How to configure Kolibri for PPP |
=============================== |
in |
none |
out |
eax = -1 on error |
See ppp.txt |
TO BE FIGURED OUT |
eax = 75 - Work with Sockets |
How to configure Kolibri for Ethernet |
==================================== |
These functions work like the ones found in UNIX (and windows) |
for more info, please read http://beej.us/guide/bgnet/ |
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. |
bl = 0 (Open Socket) |
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 |
hosts Kolibri has communicated with by running the ARPSTAT application. |
bl = 1 (Close Socket) |
Enabling Ethernet |
----------------- |
in: |
ecx = socket number |
out: |
eax = -1 on error |
Boot Kolibri, then select STACKCFG from the NET menu. |
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. |
bl = 2 (Bind) |
The stack is now running, which you can test by pinging Kolibri from a |
remote host. |
The simplest way to connect two PC's together is using a 'Null Modem' |
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. |
How to use TCP/IP locally, with no Network |
========================================== |
Kolibri supports a form of local loopback that means applications on the |
same PC can communicate with each other via sockets as though they |
were on separate hosts. To connect to an application on the same machine, |
specify the local IP address as the destination address. You do not even |
need to configure the stack for ethernet; local loopback will work without |
any network hardware. It's great for development and testing. |
Application Programming Interface |
================================= |
The developer can access the stack through interrupt 0x40, function 53. |
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. |
Sockets |
======= |
Applications connect to each other and pass information between themselves |
through a mechanism called a 'socket'. Sockets are end-points for |
communication; You need one at each application to communicate. |
Using sockets is a little like using files on an OS; You open them, read |
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. |
socket A unique identifier used by the application for communication. |
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 |
just the IP address, otherwise the remote stack will not know to which |
application it should send your data. You must fully qualify the address, |
which means you specify the IP address and the port number. This would be |
written like this |
192.168.1.10:80 ; Connect to port 80 on the machine 192.168.1.10 |
Port numbers are important. Some are 'well known' and provide access to |
common applications. For example port 80 is used by HTTP servers; That |
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, |
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. |
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. |
Get Local IP Address |
-------------------- |
eax = 52 |
ebx = 1 |
IP address returned in eax ( in internet byte order ) |
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. |
This interface is for slow network drivers only ( PPP, SLIP ) |
Read data from network output queue |
----------------------------------- |
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 ) |
Open a UDP socket |
----------------- |
eax = 53 |
ebx = 0 |
ecx = local port |
edx = remote port |
esi = remote ip address ( in internet byte order ) |
The socket number allocated is returned in eax. |
A return value of 0xFFFFFFFF means no socket could be opened. |
Open a TCP socket |
----------------- |
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 |
in: |
ecx = socket number |
edx = pointer to sockaddr structure |
esi = length of sockaddr structure |
out: |
eax = -1 on error |
On return, eax holds 0 for OK, or 0xFFFFFFFF for error. |
bl = 3 (Listen) |
Close a socket (TCP Only ) |
-------------------------- |
eax = 53 |
ebx = 8 |
in: |
ecx = socket number |
edx = backlog |
out: |
eax = -1 on error |
On return, eax holds 0 for OK, or 0xFFFFFFFF for error. |
bl = 4 (connect) |
Poll socket |
----------- |
eax = 53 |
ebx = 2 |
in: |
ecx = socket number |
edx = pointer to sockaddr structure |
esi = length of sockaddr structure |
out: |
eax = -1 on error |
On return, eax holds the number of bytes in the receive buffer. |
bl = 5 (accept) |
Read socket data |
---------------- |
eax = 53 |
ebx = 3 |
in: |
ecx = socket number |
edx = pointer to sockaddr structure |
esi = length of sockaddr structure |
out: |
eax = socket number, -1 on error |
On return, eax holds the number of bytes remaining, bl holds a data byte. |
bl = 6 (send) |
Write to socket ( UDP only ) |
---------------------------- |
eax = 53 |
ebx = 4 |
in: |
ecx = socket number |
edx = number of bytes to write |
esi = pointer to data ( in application space ) |
edx = pointer to buffer |
esi = length of buffer |
edi = flags |
out: |
eax = -1 on error |
On return, eax holds 0 for OK, or 0xFFFFFFFF for error. |
bl = 7 (receive) |
Return socket status ( TCP only ) |
--------------------------------- |
eax = 53 |
ebx = 6 |
in: |
ecx = socket number |
edx = pointer to buffer |
esi = length of buffer |
edi = flags |
out: |
eax = number of bytes copied, -1 on error |
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_ |
bl = 8 (set socket options) |
Write to socket ( TCP only ) |
---------------------------- |
eax = 53 |
ebx = 7 |
in: |
ecx = socket number |
edx = number of bytes to write |
esi = pointer to data ( in application space ) |
edx = level |
esi = optionname |
edi = ptr to buffer |
On return, eax holds 0 for OK, or 0xFFFFFFFF for error. |
The buffer's first dword is the length of the buffer, minus the first dword offcourse |
out: |
eax = -1 on error |
Check port number |
----------------- |
eax = 53 |
ebx = 9 |
ecx = port number |
bl = 9 (get socket options |
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. |
in: |
ecx = socket number |
edx = level |
esi = optionname |
edi = ptr to buffer |
On return, eax is 1 for port number not in use, 0 otherwise. |
The buffer's first dword is the length of the buffer, minus the first dword offcourse |
out: |
eax = -1 on error, socket option otherwise |
Opening a TCP socket in Kolibri |
=============================== |
TIP |
There are two ways to open a socket - Passive or Active. |
when you import 'network.inc' and 'macros.inc' into your source code, you can use the following syntax to work with sockets: |
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. |
for example, to open a socket |
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. |
mcall socket, AF_INET, SOCK_DGRAM,0 |
mov [socketnum], eax |
then to connect to a server |
How to find an unused local port number |
======================================= |
mcall connect, [socketnum], sockaddr, 18 |
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 |
eax = 76 - Work with protocols |
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 |
high half of ebx = protocol number (for all subfunctions!) |
bh = device number (for all subfunctions!) |
bl = subfunction number, depends on protocol type |
; ecx contains a free local port number |
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 |
Writing data to a socket |
======================== |
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 |
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. |
0 - Read # ICMP packets send |
1 - Read # ICMP packets received |
3 - enable/disable ICMP echo reply |
For UDP protocol |
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 ). |
0 - Read # UDP packets send |
1 - Read # UDP packets received |
For TCP protocol |
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. |
0 - Read # TCP packets send |
1 - Read # TCP packets received |
/kernel/trunk/docs/sysfuncr.txt |
---|
2420,391 → 2420,6 |
* иначе 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 ===================== |
========== Начать проигрывать данные на встроенном спикере. ========== |
====================================================================== |
/kernel/trunk/docs/sysfuncs.txt |
---|
2411,408 → 2411,6 |
</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. |
====================================================================== |
Parameters: |
/programs/system/docpack/trunk/docpack.asm |
---|
180,13 → 180,13 |
embed_file 'MTDBG.TXT' ;e |
if lang eq ru |
embed_file 'SYSFUNCR.TXT' ;f |
embed_file 'STACK_RU.TXT' ;g |
else |
embed_file 'SYSFUNCS.TXT' ;f |
end if |
embed_file 'STACK.TXT' ;g |
end if |
embed_file 'KFAR_KEYS.TXT' ;h |
embed_file 'INI.TXT' ;i |
embed_file 'OPENDIAL.TXT' ;j |
; -- End of embedding area ------- |
dd 0 |