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 
15 kBeginHeader()
16 
17 
26 typedef k32s kIpVersion;
27 
29 #define kIP_VERSION_4 (4)
30 
38 typedef struct kIpAddress
39 {
40  kIpVersion version;
41  kByte address[16];
42 } kIpAddress;
43 
51 kFx(kIpAddress) kIpAddress_Any(kIpVersion version);
52 
60 
68 
76 kFx(kIpAddress) kIpAddress_Loopback(kIpVersion version);
77 
85 
96 kFx(kStatus) kIpAddress_Parse(kIpAddress* address, const kChar* text);
97 
107 kFx(kStatus) kIpAddress_Format(kIpAddress address, kChar* text, kSize capacity);
108 
118 
126 kFx(kBool) kIpAddress_IsLoopback(kIpAddress address);
127 
135 kFx(k32u) kIpAddress_ToHost32u(kIpAddress address);
136 
144 kFx(k32u) kIpAddress_ToNet32u(kIpAddress address);
145 
153 kFx(kIpAddress) kIpAddress_FromHost32u(k32u address);
154 
162 kFx(kIpAddress) kIpAddress_FromNet32u(k32u address);
163 
170 typedef struct kIpEndPoint
171 {
174 } kIpEndPoint;
175 
177 #define kIP_PORT_ANY (0)
178 
186 typedef struct kIpEntry
187 {
190 } kIpEntry;
191 
198 typedef kObject kNetwork;
199 
210 kFx(kStatus) kNetwork_LocalIpInterfaces(kArrayList entries);
211 
212 kEndHeader()
213 
214 #include <kApi/Io/kNetwork.x.h>
215 
216 #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:172
Represents an Internet Protocol version.
k32u port
Port number.
Definition: kNetwork.h:173
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:188
Represents an IP address.
Definition: kNetwork.h:38
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:40
kText128 name
Host interface name.
Definition: kNetwork.h:189
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:170
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:186
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.