Zen API

- Home
- Topics
- Types
- Files

All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kNetwork.h
Go to the documentation of this file.
1
10 #ifndef K_API_NETWORK_H
11 #define K_API_NETWORK_H
12
13 #include <kApi/kApiDef.h>
14
24 typedef k32s kIpVersion;
25
27 #define kIP_VERSION_4 (4)
28
36 typedef struct kIpAddress
37 {
38 kIpVersion version;
39 kByte address[16];
40 } kIpAddress;
41
49 kFx(kIpAddress) kIpAddress_Any(kIpVersion version);
50
57 kFx(kIpAddress) kIpAddress_AnyV4();
58
65 kFx(kIpAddress) kIpAddress_BroadcastV4();
66
74 kFx(kIpAddress) kIpAddress_Loopback(kIpVersion version);
75
82 kFx(kIpAddress) kIpAddress_LoopbackV4();
83
94 kFx(kStatus) kIpAddress_Parse(kIpAddress* address, const kChar* text);
95
105 kFx(kStatus) kIpAddress_Format(kIpAddress address, kChar* text, kSize capacity);
106
115 kFx(kBool) kIpAddress_Equals(kIpAddress a, kIpAddress b);
116
124 kFx(kBool) kIpAddress_IsLoopback(kIpAddress address);
125
133 kFx(k32u) kIpAddress_ToHost32u(kIpAddress address);
134
142 kFx(k32u) kIpAddress_ToNet32u(kIpAddress address);
143
151 kFx(kIpAddress) kIpAddress_FromHost32u(k32u address);
152
160 kFx(kIpAddress) kIpAddress_FromNet32u(k32u address);
161
168 typedef struct kIpEndPoint
169 {
170 kIpAddress address;
171 k32u port;
172 } kIpEndPoint;
173
175 #define kIP_PORT_ANY (0)
176
184 typedef struct kIpEntry
185 {
186 kIpAddress address;
187 kText128 name;
188 } kIpEntry;
189
190
191 #include <kApi/Io/kNetwork.x.h>
192
199 typedef kObject kNetwork;
200
211 kFx(kStatus) kNetwork_LocalIpInterfaces(kArrayList entries);
212
213 #endif
k32u
Represents a 32-bit unsigned integer.
kIpAddress::kIpAddress_Any
kIpAddress kIpAddress_Any(kIpVersion version)
Gets an address representing an automatically-assigned address.
kIpEndPoint::address
kIpAddress address
IP address.
Definition: kNetwork.h:170
kIpVersion
Represents an Internet Protocol version.
kIpEndPoint::port
k32u port
Port number.
Definition: kNetwork.h:171
kIpAddress::kIpAddress_Loopback
kIpAddress kIpAddress_Loopback(kIpVersion version)
Gets the loopback address.
kSize
Represents an unsigned integer that can store a pointer address.
kIpEntry::address
kIpAddress address
IP address.
Definition: kNetwork.h:186
kIpAddress
Represents an IP address.
Definition: kNetwork.h:36
kChar
Represents a single unit (byte) in a UTF-8 character.
kByte
Represents a byte on the current platform.
kIpAddress::kIpAddress_Format
kStatus kIpAddress_Format(kIpAddress address, kChar *text, kSize capacity)
Formats an IP address as a string.
kIpAddress::kIpAddress_BroadcastV4
kIpAddress kIpAddress_BroadcastV4()
Gets an address suitable for broadcasting IPv4 datagrams.
kText128
Represents a 128-unit, null-terminated, kChar sequence.
kIpAddress::kIpAddress_Equals
kBool kIpAddress_Equals(kIpAddress a, kIpAddress b)
Compares two addresses for equality.
kIpAddress::kIpAddress_ToNet32u
k32u kIpAddress_ToNet32u(kIpAddress address)
Converts an IPv4 address to a network-endian 32-bit integer.
kApiDef.h
Core Zen type declarations.
k32s
Represents a 32-bit signed integer.
kIpAddress::kIpAddress_IsLoopback
kBool kIpAddress_IsLoopback(kIpAddress address)
Reports whether the given address is a loopback address.
kIpAddress::kIpAddress_LoopbackV4
kIpAddress kIpAddress_LoopbackV4()
Gets the IpV4 loopback address.
kIpAddress::version
kIpVersion version
Address version.
Definition: kNetwork.h:38
kIpEntry::name
kText128 name
Host interface name.
Definition: kNetwork.h:187
kIpAddress::kIpAddress_AnyV4
kIpAddress kIpAddress_AnyV4()
Gets an address representing an automatically-assigned IPv4 address.
kArrayList
Represents a list implemented with a dynamic array.
kIpAddress::kIpAddress_Parse
kStatus kIpAddress_Parse(kIpAddress *address, const kChar *text)
Parses a text-formatted IP address.
kObject
Root of all Zen classes.
kNetwork
A collection of static network utility methods.
kStatus
Represents an error code.
kIpEndPoint
Represents an IP end point (address, port).
Definition: kNetwork.h:168
kIpAddress::kIpAddress_FromHost32u
kIpAddress kIpAddress_FromHost32u(k32u address)
Converts a host-endian 32-bit integer to an IPv4 address.
kIpEntry
Represents information about a local IP address.
Definition: kNetwork.h:184
kIpAddress::kIpAddress_ToHost32u
k32u kIpAddress_ToHost32u(kIpAddress address)
Converts an IPv4 address to a host-endian 32-bit integer.
kBool
Represents a boolean value.
kIpAddress::kIpAddress_FromNet32u
kIpAddress kIpAddress_FromNet32u(k32u address)
Converts a network-endian 32-bit integer to an IPv4 address.