libgui 2.01
libgui is a GUI library for the GameCube, Wii, and Wii U
 
Loading...
Searching...
No Matches
OgcSmbDriver.h
1/****************************************************************************
2 * Platform Abstraction Layer (OGC driver)
3 * Daryl Borth 2026
4 * OgcSmbDriver.h
5 *
6 * Wii / GameCube SmbDriver. libsmb2 is a plain client library with no
7 * devoptab of its own: it hands back a struct smb2_context* and POSIX-shaped
8 * calls, so this class registers a "smb:/" newlib devoptab on top of it
9 * (see OgcSmbDriver.cpp).
10 *
11 * Bringing the network interface itself up is a precondition for any SMB
12 * connection but isn't this class's job
13 ***************************************************************************/
14#pragma once
15#include "../SmbDriver.h"
16
17struct smb2_context;
18
22class OgcSmbDriver : public SmbDriver
23{
24 public:
25 void init() override;
26 void shutdown() override;
27
28 SmbConnectResult connect(const SmbShareInfo & info) override;
29 void disconnect() override;
30 bool isConnected() const override { return ctx != nullptr; }
31
32 const char * getMountPath() const override { return ctx ? "smb:/" : ""; }
33 const char * connectResultMessage(SmbConnectResult result) const override;
34 const char * getLastError() const override;
35
38 static smb2_context * getContext() { return ctx; }
39
40 bool isNetworkUp() const override;
41
45 bool ensureNetworkUp() override;
46
47 private:
48 static smb2_context * ctx;
49 SmbShareInfo current = {};
50 bool devoptabAdded = false;
51};
Wraps libsmb2 behind a "smb:/" devoptab.
void shutdown() override
Disconnects if connected and releases whatever init() set up.
bool ensureNetworkUp() override
Ensures the network is up via the platform's network helper (WiiNetwork or GameCubeNetwork).
SmbConnectResult connect(const SmbShareInfo &info) override
Attempts to connect and mount in one call.
const char * connectResultMessage(SmbConnectResult result) const override
Short, user-displayable reason for a non-Success SmbConnectResult.
void disconnect() override
Unmounts and drops the connection.
const char * getMountPath() const override
devoptab-style mount path (eg.
bool isConnected() const override
static smb2_context * getContext()
The active context, used by the free-function devoptab callbacks in OgcSmbDriver.cpp.
void init() override
One-time setup.
bool isNetworkUp() const override
True if the network is already up, i.e.
const char * getLastError() const override
Raw, implementation-specific detail behind the last failure.
Network-share driver.
Definition SmbDriver.h:43
SmbConnectResult
Result of a single connect() attempt.
Definition SmbDriver.h:33
Credentials/target for a single SMB share.
Definition SmbDriver.h:20