Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4973 | right-hear | 1 | #include |
2 | |||
3 | __u32 __menuet__open_UDP_socket(__u32 local_port,__u32 remote_port,__u32 remote_ip) |
||
4 | { |
||
5 | __u32 __ret; |
||
6 | __asm__("int $0x40":"=a"(__ret):"a"(__NET_socket),"b"(__NET_sock_open_UDP), |
||
7 | "c"(local_port),"d"(remote_port),"S"(remote_ip)); |
||
8 | return __ret; |
||
9 | } |
||
10 | |||
11 | __u32 __menuet__open_TCP_socket(__u32 local_port,__u32 remote_port,__u32 remote_ip,int mode) |
||
12 | { |
||
13 | __u32 __ret; |
||
14 | __asm__("int $0x40":"=a"(__ret):"a"(__NET_socket),"b"(__NET_sock_open_TCP), |
||
15 | "c"(local_port),"d"(remote_port),"S"(remote_ip),"D"(mode)); |
||
16 | return __ret; |
||
17 | } |
||
18 | |||
19 | int __menuet__close_UDP_socket(int socket) |
||
20 | { |
||
21 | int __ret; |
||
22 | __asm__("int $0x40":"=a"(__ret):"a"(__NET_socket),"b"(__NET_sock_close_UDP), |
||
23 | "c"(socket)); |
||
24 | return __ret; |
||
25 | } |
||
26 | |||
27 | int __menuet__close_TCP_socket(int socket) |
||
28 | { |
||
29 | int __ret; |
||
30 | __asm__("int $0x40":"=a"(__ret):"a"(__NET_socket),"b"(__NET_sock_close_TCP), |
||
31 | "c"(socket)); |
||
32 | return __ret; |
||
33 | } |
||
34 | |||
35 | int __menuet__poll_socket(int sock) |
||
36 | { |
||
37 | int __ret; |
||
38 | __asm__("int $0x40":"=a"(__ret):"a"(__NET_socket),"b"(__NET_sock_poll), |
||
39 | "c"(sock)); |
||
40 | return __ret; |
||
41 | } |
||
42 | |||
43 | int __menuet__read_socket(int sock,__u8 * return_data) |
||
44 | { |
||
45 | int data_remaining; |
||
46 | __u8 data_byte; |
||
47 | __asm__("int $0x40":"=a"(data_remaining),"=b"(data_byte):"a"(__NET_socket), |
||
48 | "b"(__NET_sock_poll),"c"(sock)); |
||
49 | if(return_data) *return_data=data_byte; |
||
50 | return data_remaining; |
||
51 | } |
||
52 | |||
53 | int __menuet__get_TCP_socket_status(int sock) |
||
54 | { |
||
55 | int __ret; |
||
56 | __asm__("int $0x40":"=a"(__ret):"a"(__NET_socket),"b"(__NET_sock_get_status), |
||
57 | "c"(sock)); |
||
58 | return __ret; |
||
59 | } |
||
60 | |||
61 | int __menuet__write_UDP_socket(int sock,int count,void * buffer) |
||
62 | { |
||
63 | int __ret; |
||
64 | __asm__("int $0x40":"=a"(__ret):"a"(__NET_socket),"b"(__NET_sock_write_UDP), |
||
65 | "c"(sock),"d"(count),"S"((__u32)buffer)); |
||
66 | return __ret; |
||
67 | } |
||
68 | |||
69 | int __menuet__write_TCP_socket(int sock,int count,void * buffer) |
||
70 | { |
||
71 | int __ret; |
||
72 | __asm__("int $0x40":"=a"(__ret):"a"(__NET_socket),"b"(__NET_sock_write_TCP), |
||
73 | "c"(sock),"d"(count),"S"((__u32)buffer)); |
||
74 | return __ret; |
||
75 | } |
||
76 | |||
77 | int __menuet__check_net_port_availability(int port) |
||
78 | { |
||
79 | int __ret; |
||
80 | __asm__("int $0x40":"=a"(__ret):"a"(__NET_socket),"b"(__NET_sock_check_port), |
||
81 | "c"(port)); |
||
82 | return __ret; |
||
83 | } |