Zen API
 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 {
39  kByte address[16];
40 } kIpAddress;
41 
49 kFx(kIpAddress) kIpAddress_Any(kIpVersion version);
50 
58 
66 
75 
83 
94 kFx(kStatus) kIpAddress_Parse(kIpAddress* address, const kChar* text);
95 
105 kFx(kStatus) kIpAddress_Format(kIpAddress address, kChar* text, kSize capacity);
106 
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 {
172 } kIpEndPoint;
173 
175 #define kIP_PORT_ANY (0)
176 
184 typedef struct kIpEntry
185 {
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
Represents a 32-bit unsigned integer.
kIpAddress kIpAddress_Any(kIpVersion version)
Gets an address representing an automatically-assigned address.
kIpAddress address
IP address.
Definition: kNetwork.h:170
Represents an Internet Protocol version.
k32u port
Port number.
Definition: kNetwork.h:171
kIpAddress kIpAddress_Loopback(kIpVersion version)
Gets the loopback address.
Represents an unsigned integer that can store a pointer address.
kIpAddress address
IP address.
Definition: kNetwork.h:186
Represents an IP address.
Definition: kNetwork.h:36
Represents a single unit (byte) in a UTF-8 character.
Represents a byte on the current platform.
kStatus kIpAddress_Format(kIpAddress address, kChar *text, kSize capacity)
Formats an IP address as a string.
kIpAddress kIpAddress_BroadcastV4()
Gets an address suitable for broadcasting IPv4 datagrams.
Represents a 128-unit, null-terminated, kChar sequence.
kBool kIpAddress_Equals(kIpAddress a, kIpAddress b)
Compares two addresses for equality.
k32u kIpAddress_ToNet32u(kIpAddress address)
Converts an IPv4 address to a network-endian 32-bit integer.
Core Zen type declarations.
Represents a 32-bit signed integer.
kBool kIpAddress_IsLoopback(kIpAddress address)
Reports whether the given address is a loopback address.
kIpAddress kIpAddress_LoopbackV4()
Gets the IpV4 loopback address.
kIpVersion version
Address version.
Definition: kNetwork.h:38
kText128 name
Host interface name.
Definition: kNetwork.h:187
kIpAddress kIpAddress_AnyV4()
Gets an address representing an automatically-assigned IPv4 address.
Represents a list implemented with a dynamic array.
kStatus kIpAddress_Parse(kIpAddress *address, const kChar *text)
Parses a text-formatted IP address.
Root of all Zen classes.
A collection of static network utility methods.
Represents an error code.
Represents an IP end point (address, port).
Definition: kNetwork.h:168
kIpAddress kIpAddress_FromHost32u(k32u address)
Converts a host-endian 32-bit integer to an IPv4 address.
Represents information about a local IP address.
Definition: kNetwork.h:184
k32u kIpAddress_ToHost32u(kIpAddress address)
Converts an IPv4 address to a host-endian 32-bit integer.
Represents a boolean value.
kIpAddress kIpAddress_FromNet32u(k32u address)
Converts a network-endian 32-bit integer to an IPv4 address.