Clapkit
Loading...
Searching...
No Matches
ckNetworking.h
Go to the documentation of this file.
1/*
2 *
3 * Clapkit
4 * ----------------------------------------------------------------------
5 * A wrapper for creating a 'generalized' app for Classic MacOS
6 * that (hopefully) can be ported easily to other platforms.
7 *
8 * CKNetworking
9 * ----------------------------------------------------------------------
10 * Network related (MacTCP) functionality
11 *
12 */
13
14#pragma once
15
16#include "ckTypes.h"
17#include <MacTCP.h>
18#include <array>
19
20using CKIPAddress = std::array<unsigned char, 4>;
21
22class CKNetBaseSocket;
23
28namespace CKNetworking {
29
30bool IsAvailable();
31bool IsInitialized();
33bool Deinitialize();
34void Loop(std::vector<CKNetBaseSocket*> sockets);
36CKError ResolveName(const char* hostname, CKIPAddress* result);
37
38short GetDriverRefNum();
39
40}; // namespace CKNetworking
std::array< unsigned char, 4 > CKIPAddress
Definition ckNetworking.h:20
Defines the base of all TCP client/server sockets.
Definition ckNetBaseSocket.h:41
int32_t CKError
Return type for functions that might return an error. Also see: CKPass and CKErrorCode.
Definition ckTypes.h:26
Networking (MacTCP) functionality globals.
Definition ckNetworking.h:28
bool IsAvailable()
Check if MacTCP is installed and available.
Definition ckNetworking.cpp:31
bool Deinitialize()
Definition ckNetworking.cpp:75
bool IsInitialized()
Check if networking has been initialized by calling Initialize
Definition ckNetworking.cpp:45
CKError Initialize()
Try to open the MacTCP driver.
Definition ckNetworking.cpp:53
CKIPAddress GetLocalIP()
Return the IP Address of the current device.
Definition ckNetworking.cpp:89
CKError ResolveName(const char *hostname, CKIPAddress *result)
Definition ckNetworking.cpp:121
short GetDriverRefNum()
Definition ckNetworking.cpp:109
void Loop(std::vector< CKNetBaseSocket * > sockets)
Definition ckNetworking.cpp:201