Subversion Repositories Kolibri OS

Rev

Rev 5842 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3618 hidnplayr 1
; Socket types
3704 hidnplayr 2
SOCK_STREAM     = 1
3
SOCK_DGRAM      = 2
4
SOCK_RAW        = 3
3618 hidnplayr 5
 
6
; IP protocols
3704 hidnplayr 7
IPPROTO_IP      = 0
8
IPPROTO_ICMP    = 1
9
IPPROTO_TCP     = 6
10
IPPROTO_UDP     = 17
5842 hidnplayr 11
IPPROTO_RAW     = 255
3618 hidnplayr 12
 
5842 hidnplayr 13
; IP options
14
IP_TTL          = 2
15
 
3618 hidnplayr 16
; Address families
3704 hidnplayr 17
AF_UNSPEC       = 0
18
AF_LOCAL        = 1
19
AF_INET4        = 2     ; IPv4
6018 hidnplayr 20
AF_INET6        = 10    ; IPv6
3618 hidnplayr 21
 
3704 hidnplayr 22
PF_UNSPEC       = AF_UNSPEC
23
PF_LOCAL        = AF_LOCAL
24
PF_INET4        = AF_INET4
25
PF_INET6        = AF_INET6
3618 hidnplayr 26
 
27
; Flags for addrinfo
3704 hidnplayr 28
AI_PASSIVE      = 1
29
AI_CANONNAME    = 2
30
AI_NUMERICHOST  = 4
31
AI_NUMERICSERV  = 8
32
AI_ADDRCONFIG   = 0x400
3618 hidnplayr 33
 
34
; internal definition
3704 hidnplayr 35
AI_SUPPORTED    = 0x40F
3618 hidnplayr 36
 
37
; for system function 76
3704 hidnplayr 38
API_ETH         = 0 shl 16
39
API_IPv4        = 1 shl 16
40
API_ICMP        = 2 shl 16
41
API_UDP         = 3 shl 16
42
API_TCP         = 4 shl 16
43
API_ARP         = 5 shl 16
44
API_PPPOE       = 6 shl 16
3618 hidnplayr 45
 
3704 hidnplayr 46
; Socket flags for user calls
5842 hidnplayr 47
MSG_PEEK        = 0x02
48
MSG_DONTWAIT    = 0x40
3704 hidnplayr 49
 
5842 hidnplayr 50
; Socket levels
51
SOL_SOCKET      = 0xffff
52
 
53
; Socket options
54
SO_BINDTODEVICE = 1 shl 9
6018 hidnplayr 55
SO_NONBLOCK     = 1 shl 31
5842 hidnplayr 56
 
3618 hidnplayr 57
struct sockaddr_in
3704 hidnplayr 58
        sin_family      dw      ?       ; sa_family_t
59
        sin_port        dw      ?       ; in_port_t
60
        sin_addr        dd      ?       ; struct in_addr
61
        sin_zero        rb      8       ; zero
3618 hidnplayr 62
ends
63
 
64
struct addrinfo
3704 hidnplayr 65
        ai_flags        dd      ?       ; bitmask of AI_*
66
        ai_family       dd      ?       ; PF_*
67
        ai_socktype     dd      ?       ; SOCK_*
68
        ai_protocol     dd      ?       ; 0 or IPPROTO_*
69
        ai_addrlen      dd      ?       ; length of ai_addr
70
        ai_canonname    dd      ?       ; char*
71
        ai_addr         dd      ?       ; struct sockaddr*
72
        ai_next         dd      ?       ; struct addrinfo*
3618 hidnplayr 73
ends
74
 
3704 hidnplayr 75
EAI_ADDRFAMILY  = 1
76
EAI_AGAIN       = 2
77
EAI_BADFLAGS    = 3
78
EAI_FAIL        = 4
79
EAI_FAMILY      = 5
80
EAI_MEMORY      = 6
81
EAI_NONAME      = 8
82
EAI_SERVICE     = 9
83
EAI_SOCKTYPE    = 10
84
EAI_BADHINTS    = 12
85
EAI_PROTOCOL    = 13
86
EAI_OVERFLOW    = 14
3618 hidnplayr 87
 
3704 hidnplayr 88
socket          fix 75, 0
89
close           fix 75, 1
90
bind            fix 75, 2
91
listen          fix 75, 3
92
connect         fix 75, 4
93
accept          fix 75, 5
94
send            fix 75, 6
95
recv            fix 75, 7
96
setsockopt      fix 75, 8
97
getsockopt      fix 75, 9
98
socketpair      fix 75, 10
3618 hidnplayr 99
 
100
 
3704 hidnplayr 101
struct  ARP_entry
102
        IP      dd ?
103
        MAC     dp ?
104
        status  dw ?
105
        TTL     dw ?
3618 hidnplayr 106
ends
4208 hidnplayr 107
 
108
 
109
; Socket error codes
110
; Error Codes
111
ENOBUFS                 = 1
112
EINPROGRESS             = 2
113
EOPNOTSUPP              = 4
114
EWOULDBLOCK             = 6
115
ENOTCONN                = 9
116
EALREADY                = 10
117
EINVAL                  = 11
118
EMSGSIZE                = 12
119
ENOMEM                  = 18
120
EADDRINUSE              = 20
121
ECONNREFUSED            = 61
122
ECONNRESET              = 52
123
EISCONN                 = 56
124
ETIMEDOUT               = 60
125
ECONNABORTED            = 53