Subversion Repositories Kolibri OS

Rev

Rev 5499 | Rev 5676 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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