Zen API

- Home
- Topics
- Types
- Files

All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kSocket.h
Go to the documentation of this file.
1
10 #ifndef K_API_SOCKET_H
11 #define K_API_SOCKET_H
12
13 #include <kApi/Io/kNetwork.h>
14
21 typedef k32s kSocketType;
22
24 #define kSOCKET_TYPE_TCP (0)
25 #define kSOCKET_TYPE_UDP (1)
26
33 typedef k32s kSocketEvent;
34
36 #define kSOCKET_EVENT_READ (1)
37 #define kSOCKET_EVENT_WRITE (2)
38 #define kSOCKET_EVENT_EXCEPT (4)
39
41 #include <kApi/Io/kSocket.x.h>
42
49 //typedef kObject kSocket; --forward-declared in kApiDef.x.h
50
66 kFx(kStatus) kSocket_WaitAny(const kSocket* sockets, kSize count, k64u timeout);
67
80 kFx(kStatus) kSocket_Construct(kSocket* socket, kIpVersion ipVersion, kSocketType socketType, kAlloc allocator);
81
91 kFx(kStatus) kSocket_Bind(kSocket socket, kIpAddress address, k32u port);
92
105 kFx(kStatus) kSocket_Connect(kSocket socket, kIpAddress address, k32u port, k64u timeout);
106
124 kFx(kStatus) kSocket_BeginConnect(kSocket socket, kIpAddress address, k32u port);
125
135 kFx(kStatus) kSocket_EndConnect(kSocket socket, k64u timeout);
136
145 kFx(kStatus) kSocket_Listen(kSocket socket, kSize backlog);
146
156 kFx(kStatus) kSocket_Accept(kSocket socket, kSocket* connection, kAlloc allocator);
157
181 kFx(kStatus) kSocket_JoinMulticastGroup(kSocket socket, kIpAddress group, kIpAddress iface);
182
192 kFx(kStatus) kSocket_LeaveMulticastGroup(kSocket socket, kIpAddress group, kIpAddress iface);
193
206 kFx(kStatus) kSocket_Shutdown(kSocket socket);
207
222 kFx(kStatus) kSocket_Wait(kSocket socket, k64u timeout);
223
241 kFx(kStatus) kSocket_Read(kSocket socket, void* buffer, kSize size, kSize* read);
242
258 kFx(kStatus) kSocket_ReadFrom(kSocket socket, kIpEndPoint *endPoint, void* buffer, kSize size, kSize* read);
259
280 kFx(kStatus) kSocket_ReadFromEx(kSocket socket, kIpEndPoint *endPoint, kSize* adapterId, void* buffer, kSize size, kSize* read);
281
298 kFx(kStatus) kSocket_Write(kSocket socket, const void* buffer, kSize size, kSize* written);
299
315 kFx(kStatus) kSocket_WriteTo(kSocket socket, kIpAddress address, k32u port, const void* buffer, kSize size);
316
327 kFx(kStatus) kSocket_SetEvents(kSocket socket, kSocketEvent events);
328
336 kFx(kSocketEvent) kSocket_Events(kSocket socket);
337
348 kFx(kStatus) kSocket_SetBlocking(kSocket socket, kBool isBlocking);
349
358 kFx(kStatus) kSocket_SetWriteBuffer(kSocket socket, kSize size);
359
368 kFx(kStatus) kSocket_SetReadBuffer(kSocket socket, kSize size);
369
380 kFx(kStatus) kSocket_SetWriteTimeout(kSocket socket, k64u timeout);
381
392 kFx(kStatus) kSocket_SetReadTimeout(kSocket socket, k64u timeout);
393
406 kFx(kStatus) kSocket_EnableBroadcast(kSocket socket, kBool broadcast);
407
422 kFx(kStatus) kSocket_EnableReuseAddress(kSocket socket, kBool reuse);
423
435 kFx(kStatus) kSocket_SetNoDelay(kSocket socket, kBool noDelay);
436
449 kFx(kStatus) kSocket_SetLingerTime(kSocket socket, k64u lingerTime);
450
462 kFx(kStatus) kSocket_EnablePacketInfo(kSocket socket, kBool enabled);
463
475 kFx(kStatus) kSocket_BindToDevice(kSocket socket, const kChar* interfaceName);
476
485 kFx(kStatus) kSocket_LocalEndPoint(kSocket socket, kIpEndPoint* endPoint);
486
495 kFx(kStatus) kSocket_RemoteEndPoint(kSocket socket, kIpEndPoint* endPoint);
496
504 kFx(kStatus) kSocket_Status(kSocket socket);
505
517 kFx(kSize) kSocket_Handle(kSocket socket);
518
519 #endif
kSocket::kSocket_BeginConnect
kStatus kSocket_BeginConnect(kSocket socket, kIpAddress address, k32u port)
Begins connecting the socket to a remote end point.
kSocket::kSocket_Write
kStatus kSocket_Write(kSocket socket, const void *buffer, kSize size, kSize *written)
Writes one or more bytes.
k32u
Represents a 32-bit unsigned integer.
kSocket::kSocket_Accept
kStatus kSocket_Accept(kSocket socket, kSocket *connection, kAlloc allocator)
Blocks until an incoming connection request is accepted.
kSocket::kSocket_BindToDevice
kStatus kSocket_BindToDevice(kSocket socket, const kChar *interfaceName)
Binds the socket to a specific network interface.
kSocket::kSocket_SetWriteTimeout
kStatus kSocket_SetWriteTimeout(kSocket socket, k64u timeout)
Sets the timeout duration for blocking write operations.
kSocket::kSocket_Events
kSocketEvent kSocket_Events(kSocket socket)
Gets the events detected during the most recent wait operation.
k64u
Represents a 64-bit unsigned integer.
kSocket::kSocket_SetEvents
kStatus kSocket_SetEvents(kSocket socket, kSocketEvent events)
Sets the event types that a socket will wait on.
kIpVersion
Represents an Internet Protocol version.
kSocket::kSocket_Handle
kSize kSocket_Handle(kSocket socket)
Provides access to the underlying O/S socket handle.
kSocket::kSocket_ReadFrom
kStatus kSocket_ReadFrom(kSocket socket, kIpEndPoint *endPoint, void *buffer, kSize size, kSize *read)
Reads a datagram.
kSocket::kSocket_ReadFromEx
kStatus kSocket_ReadFromEx(kSocket socket, kIpEndPoint *endPoint, kSize *adapterId, void *buffer, kSize size, kSize *read)
Reads a datagram and associated metadata.
kSize
Represents an unsigned integer that can store a pointer address.
kAlloc
Abstract base class for memory allocator types.
kSocketEvent
Represents a set of socket event types.
kSocket::kSocket_LocalEndPoint
kStatus kSocket_LocalEndPoint(kSocket socket, kIpEndPoint *endPoint)
Returns the local end point for a bound socket.
kSocket::kSocket_Shutdown
kStatus kSocket_Shutdown(kSocket socket)
Begins shutdown of socket communication.
kSocket::kSocket_SetNoDelay
kStatus kSocket_SetNoDelay(kSocket socket, kBool noDelay)
Can be used to disable the Nagle algorithm.
kIpAddress
Represents an IP address.
Definition: kNetwork.h:37
kChar
Represents a single unit (byte) in a UTF-8 character.
kSocket::kSocket_SetBlocking
kStatus kSocket_SetBlocking(kSocket socket, kBool isBlocking)
Determines whether the socket will block on read/write requests.
kSocket::kSocket_WaitAny
kStatus kSocket_WaitAny(const kSocket *sockets, kSize count, k64u timeout)
Waits until an event occurs on one or more sockets.
kSocket::kSocket_EnableReuseAddress
kStatus kSocket_EnableReuseAddress(kSocket socket, kBool reuse)
Enables or disables reuse of a local end point within a short period of time.
kSocket::kSocket_RemoteEndPoint
kStatus kSocket_RemoteEndPoint(kSocket socket, kIpEndPoint *endPoint)
Returns the remote end point for a connected socket.
kSocket::kSocket_Listen
kStatus kSocket_Listen(kSocket socket, kSize backlog)
Places the socket into a listening state, to monitor for incoming connection requests.
kSocket::kSocket_WriteTo
kStatus kSocket_WriteTo(kSocket socket, kIpAddress address, k32u port, const void *buffer, kSize size)
Sends a datagram.
kSocket::kSocket_JoinMulticastGroup
kStatus kSocket_JoinMulticastGroup(kSocket socket, kIpAddress group, kIpAddress iface)
Joins the specified multicast group on the specified interface.
kSocket::kSocket_Wait
kStatus kSocket_Wait(kSocket socket, k64u timeout)
Waits for a socket event.
kSocket::kSocket_Construct
kStatus kSocket_Construct(kSocket *socket, kIpVersion ipVersion, kSocketType socketType, kAlloc allocator)
Constructs a kSocket object.
kSocketType
Represents the underlying type of a socket.
kSocket::kSocket_SetLingerTime
kStatus kSocket_SetLingerTime(kSocket socket, k64u lingerTime)
Specifies the duration that a TCP connection can remain open when the socket is closed in order to en...
kSocket::kSocket_Connect
kStatus kSocket_Connect(kSocket socket, kIpAddress address, k32u port, k64u timeout)
Connects the socket to a remote end point.
k32s
Represents a 32-bit signed integer.
kSocket::kSocket_Read
kStatus kSocket_Read(kSocket socket, void *buffer, kSize size, kSize *read)
Reads one or more bytes.
kSocket::kSocket_Bind
kStatus kSocket_Bind(kSocket socket, kIpAddress address, k32u port)
Binds the socket to a local IP address and/or port.
kSocket::kSocket_Status
kStatus kSocket_Status(kSocket socket)
Reports any internal errors that will prevent success of future communication attempts.
kSocket::kSocket_SetWriteBuffer
kStatus kSocket_SetWriteBuffer(kSocket socket, kSize size)
Sets the size of the write buffer used by the underlying operating system.
kSocket::kSocket_SetReadTimeout
kStatus kSocket_SetReadTimeout(kSocket socket, k64u timeout)
Sets the timeout duration for blocking read operations.
kNetwork.h
IP networking definitions.
kSocket::kSocket_LeaveMulticastGroup
kStatus kSocket_LeaveMulticastGroup(kSocket socket, kIpAddress group, kIpAddress iface)
Leaves the specified multicast group on the specified interface.
kStatus
Represents an error code.
kSocket::kSocket_EnableBroadcast
kStatus kSocket_EnableBroadcast(kSocket socket, kBool broadcast)
Enables or disables datagram broadcasting.
kSocket::kSocket_SetReadBuffer
kStatus kSocket_SetReadBuffer(kSocket socket, kSize size)
Sets the size of the read buffer used by the underlying operating system.
kIpEndPoint
Represents an IP end point (address, port).
Definition: kNetwork.h:199
kSocket::kSocket_EndConnect
kStatus kSocket_EndConnect(kSocket socket, k64u timeout)
Completes a connection operation that was started with kSocket_BeginConnect.
kSocket
Represents a network socket.
kBool
Represents a boolean value.
kSocket::kSocket_EnablePacketInfo
kStatus kSocket_EnablePacketInfo(kSocket socket, kBool enabled)
Enables or disables interface index information for datagrams.