Subversion Repositories Kolibri OS

Rev

Rev 8343 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8343 Rev 8522
Line 19... Line 19...
19
#define IP_TTL 2
19
#define IP_TTL 2
Line 20... Line 20...
20
 
20
 
21
// Address families
21
// Address families
22
#define AF_UNSPEC 0
22
#define AF_UNSPEC 0
-
 
23
#define AF_LOCAL 1
23
#define AF_LOCAL 1
24
#define AF_INET  2     // Default INET=IPv4
24
#define AF_INET4 2     // IPv4
25
#define AF_INET4 2     // IPv4
Line 25... Line 26...
25
#define AF_INET6 10    // IPv6
26
#define AF_INET6 10    // IPv6
26
 
27
 
Line 73... Line 74...
73
 
74
 
74
#define PORT(X) (X<<8)
75
#define PORT(X) (X<<8)
Line 75... Line 76...
75
int err_code;
76
int err_code;
76
 
77
 
77
#pragma pack(push,1)
78
#pragma pack(push,1)
78
typedef struct{
79
struct sockaddr{
79
    unsigned short sin_family;
80
    unsigned short sin_family;
80
    unsigned short sin_port; 
81
    unsigned short sin_port; 
81
    unsigned int sin_addr;
82
    unsigned int sin_addr;
82
    unsigned long long sin_zero;
83
    unsigned long long sin_zero;
Line 83... Line 84...
83
}sockaddr; 
84
}; 
84
#pragma pack(pop)
85
#pragma pack(pop)
85
 
86
 
Line 111... Line 112...
111
    :"=b"(err_code), "=a"(status)
112
    :"=b"(err_code), "=a"(status)
112
    :"a"(75), "b"(1), "c"(socket)
113
    :"a"(75), "b"(1), "c"(socket)
113
    );
114
    );
114
    return status;
115
    return status;
115
}
116
}
-
 
117
 
116
static inline int bind(int socket, const sockaddr *addres, int addres_len)
118
static inline int bind(int socket, const struct sockaddr *addres, int addres_len)
117
{
119
{
118
    int status;
120
    int status;
119
    asm volatile(
121
    asm volatile(
120
    "int $0x40"
122
    "int $0x40"
121
    :"=b"(err_code), "=a"(status)
123
    :"=b"(err_code), "=a"(status)
Line 133... Line 135...
133
    :"a"(75), "b"(3), "c"(socket), "d"(backlog)
135
    :"a"(75), "b"(3), "c"(socket), "d"(backlog)
134
    );
136
    );
135
    return status;
137
    return status;
136
}
138
}
Line 137... Line 139...
137
 
139
 
138
static inline int connect(int socket,const sockaddr* address, int socket_len)
140
static inline int connect(int socket, const struct sockaddr* address, int socket_len)
139
{
141
{
140
    int status;
142
    int status;
141
    asm volatile(
143
    asm volatile(
142
    "int $0x40"
144
    "int $0x40"
143
    :"=b"(err_code), "=a"(status)
145
    :"=b"(err_code), "=a"(status)
144
    :"a"(75), "b"(4), "c"(socket), "d"(address), "S"(socket_len)
146
    :"a"(75), "b"(4), "c"(socket), "d"(address), "S"(socket_len)
145
    );
147
    );
146
    return status;
148
    return status;
Line 147... Line 149...
147
}
149
}
148
 
150
 
149
static inline int accept(int socket, const sockaddr *address, int address_len)
151
static inline int accept(int socket, const struct sockaddr *address, int address_len)
150
{
152
{
151
    int new_socket;
153
    int new_socket;
152
    asm volatile(
154
    asm volatile(