Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #define SOCK_STREAM 1
  2. #define SOCK_DGRAM 2
  3.  
  4. #define AF_INET4 2
  5.  
  6. #define MSG_PEEK 0x02
  7. #define MSG_DONTWAIT 0x40
  8.  
  9. dword errorcode;
  10.  
  11. struct  sockaddr_in{
  12.         word    sin_family;
  13.         word    sin_port;
  14.         dword   sin_addr;
  15.         char    padding[8];
  16. };  
  17.  
  18. inline fastcall dword Socket(ECX, EDX, ESI)
  19. {
  20.         $push   ebx
  21.         $mov    eax, 75
  22.         $mov    ebx, 0
  23.         $int    0x40
  24.         errorcode = EBX;
  25.         $pop    ebx
  26. }
  27.  
  28. inline fastcall dword Close(ECX)
  29. {
  30.         $push   ebx
  31.         $mov    eax, 75
  32.         $mov    ebx, 1
  33.         $int    0x40
  34.         errorcode = EBX;
  35.         $pop    ebx    
  36. }
  37.  
  38. inline fastcall dword Bind(ECX, EDX, ESI)
  39. {
  40.         $push   ebx
  41.         $mov    eax, 75
  42.         $mov    ebx, 2
  43.         $int    0x40
  44.         errorcode = EBX;
  45.         $pop    ebx
  46. }
  47.  
  48. inline fastcall dword Listen(ECX, EDX)
  49. {
  50.         $push   ebx
  51.         $mov    eax, 75
  52.         $mov    ebx, 3
  53.         $int    0x40
  54.         errorcode = EBX;
  55.         $pop    ebx
  56. }
  57.  
  58. inline fastcall dword Connect(ECX, EDX, ESI)
  59. {
  60.         $push   ebx
  61.         $mov    eax, 75
  62.         $mov    ebx, 4
  63.         $int    0x40
  64.         errorcode = EBX;
  65.         $pop    ebx
  66. }
  67.  
  68. inline fastcall dword Accept(ECX, EDX, ESI)
  69. {
  70.         $push   ebx
  71.         $mov    eax, 75
  72.         $mov    ebx, 5
  73.         $int    0x40
  74.         errorcode = EBX;
  75.         $pop    ebx
  76. }
  77.  
  78. inline fastcall dword Send(ECX, EDX, ESI, EDI)
  79. {
  80.         $push   ebx
  81.         $mov    eax, 75
  82.         $mov    ebx, 6
  83.         $int    0x40
  84.         errorcode = EBX;
  85.         $pop    ebx
  86. }
  87.  
  88. inline fastcall dword Receive(ECX, EDX, ESI, EDI)
  89. {
  90.         $push   ebx
  91.         $mov    eax, 75
  92.         $mov    ebx, 7
  93.         $int    0x40
  94.         errorcode = EBX;
  95.         $pop    ebx
  96. }
  97.