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
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
59 kFx(kIpAddress) kIpAddress_AnyV4();
60
67 kFx(kIpAddress) kIpAddress_BroadcastV4();
68
76 kFx(kIpAddress) kIpAddress_Loopback(kIpVersion version);
77
84 kFx(kIpAddress) kIpAddress_LoopbackV4();
85
96 kFx(kStatus) kIpAddress_Parse(kIpAddress* address, const kChar* text);
97
107 kFx(kStatus) kIpAddress_Format(kIpAddress address, kChar* text, kSize capacity);
108
117 kFx(kBool) kIpAddress_Equals(kIpAddress a, kIpAddress b);
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 {
172 kIpAddress address;
173 k32u port;
174 } kIpEndPoint;
175
177 #define kIP_PORT_ANY (0)
178
186 typedef struct kIpEntry
187 {
188 kIpAddress address;
189 kText128 name;
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
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:172
kIpVersion
Represents an Internet Protocol version.
kIpEndPoint::port
k32u port
Port number.
Definition: kNetwork.h:173
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:188
kIpAddress
Represents an IP address.
Definition: kNetwork.h:38
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:40
kIpEntry::name
kText128 name
Host interface name.
Definition: kNetwork.h:189
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:170
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:186
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.