KolibriLib
Loading...
Searching...
No Matches
network.hpp
1#ifndef __NETWORK_H__
2#define __NETWORK_H__
3
6namespace KolibriLib
7{
8
10 namespace Network
11 {
12
14 namespace Devices
15 {
16 /* bool ResetDevice(unsigned short Device)
17 {
18 int error;
19 void *ptr = malloc(64);
20 asm_inline(
21 "int $0x40"
22 :"=a"(error)
23 :"a"(74), "b"((2 << 16) + Device), "c"(*ptr)
24 );
25 return error;
26 } */
27 } // namespace Devices
28
29
31 namespace Socket
32 {
33 #include <sys/socket.h>
34
36 enum Domain
37 {
38 IPv4 = 2,
39 IPv6 = 10
40 };
43 {
44 Stream = 1,
45 DGram = 2,
46 RAW = 3
47 };
48
51 {
52 PROTOCOL_IP = 0,
53 PROTOCOL_CMP = 1,
54 PROTOCOL_TCP = 6,
55 PROTOCOL_UDP = 17,
56 PROTOCOL_RAW = 255
57 };
58
64 inline int OpenSocket(int domain = IPv4, int SocetType = Stream, int protocol = PROTOCOL_IP)
65 {
66 int Socket = socket(domain, SocetType, protocol);
67
68 return Socket;
69 }
70
74 int CloseSocket(int Socket)
75 {
76 return close(Socket);
77 }
78 } // namespace Socket
79
80 } // namespace network
81
82} // namespace KolibriLib
83
84
85#endif // __NETWORK_H__
int OpenSocket(int domain=IPv4, int SocetType=Stream, int protocol=PROTOCOL_IP)
Окрыть сокет
Definition network.hpp:64
int CloseSocket(int Socket)
Закрыть сокет
Definition network.hpp:74
SocetTypes
Список типов сокета
Definition network.hpp:43
Protocols
Список протоколов
Definition network.hpp:51
Основное пространство имён
Definition base.hpp:18