kolibrios-fun/programs/cmm/lib/socket.h
pavelyakov 4e9602a915 CMM: update libraries
New lib: lexer.h

git-svn-id: svn://kolibrios.org@5598 a494cfbc-eb01-0410-851d-a64ba20cac60
2015-07-22 18:32:54 +00:00

106 lines
1.5 KiB
C

#ifndef INCLUDE_SOCKET_H
#define INCLUDE_SOCKET_H
#ifndef INCLUDE_KOLIBRI_H
#include "../lib/kolibri.h"
#endif
#define SOCK_STREAM 1
#define SOCK_DGRAM 2
#define AF_INET4 2
#define MSG_PEEK 0x02
#define MSG_DONTWAIT 0x40
dword errorcode;
struct sockaddr_in
{
word sin_family;
word sin_port;
dword sin_addr;
char padding[8];
};
inline fastcall dword Socket(ECX, EDX, ESI)
{
$push ebx
$mov eax, 75
$mov ebx, 0
$int 0x40
errorcode = EBX;
$pop ebx
}
inline fastcall dword Close(ECX)
{
$push ebx
$mov eax, 75
$mov ebx, 1
$int 0x40
errorcode = EBX;
$pop ebx
}
inline fastcall dword Bind(ECX, EDX, ESI)
{
$push ebx
$mov eax, 75
$mov ebx, 2
$int 0x40
errorcode = EBX;
$pop ebx
}
inline fastcall dword Listen(ECX, EDX)
{
$push ebx
$mov eax, 75
$mov ebx, 3
$int 0x40
errorcode = EBX;
$pop ebx
}
inline fastcall dword Connect(ECX, EDX, ESI)
{
$push ebx
$mov eax, 75
$mov ebx, 4
$int 0x40
errorcode = EBX;
$pop ebx
}
inline fastcall dword Accept(ECX, EDX, ESI)
{
$push ebx
$mov eax, 75
$mov ebx, 5
$int 0x40
errorcode = EBX;
$pop ebx
}
inline fastcall dword Send(ECX, EDX, ESI, EDI)
{
$push ebx
$mov eax, 75
$mov ebx, 6
$int 0x40
errorcode = EBX;
$pop ebx
}
inline fastcall dword Receive(ECX, EDX, ESI, EDI)
{
$push ebx
$mov eax, 75
$mov ebx, 7
$int 0x40
errorcode = EBX;
$pop ebx
}
#endif