/** * Copyright (c) 2026 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #pragma once #include "error/error.h" #include "network/networkinfo.h" #include "system/systempsp.h" #include #include #include #include #include #include #include // #define NETWORK_HTTP_PENDING_MAX 4 // #define NETWORK_HTTP_URL_MAX 512 // #define NETWORK_HTTP_BODY_MAX 2048 // #define NETWORK_HTTP_RESPONSE_MAX 16384 // #define NETWORK_HTTP_HEADER_MAX 8 // #define NETWORK_HTTP_HEADER_KEY_MAX 64 // #define NETWORK_HTTP_HEADER_VAL_MAX 256 // #define NETWORK_ERROR_MESSAGE_MAX 256 // #define NETWORK_PSP_AGENT "DuskEngine/1.0" typedef struct { pspUtilityNetconfData dialogData; struct pspUtilityNetconfAdhoc dialogAdhoc; // Used during establishing connection void *onConnectedUser; void (*onConnected)(void *user); void (*onFailed)(errorret_t error, void *user); } networkpsp_t; /** * Initializes the PSP Network manager. This will NOT do network connecting, * only prep it for being able to connect in future. * * @return Error state (if any). */ errorret_t networkPSPInit(); /** * Called each frame for handling PSP requests, basically this is where all * communication between the HTTP thread and the main thread happens. * * @return Error state (if any). */ errorret_t networkPSPUpdate(); /** * Disposes the PSP Network manager, this will clean all resources and, if the * network is connected, it will disconnect it safely. * * @return Error state (if any). */ errorret_t networkPSPDispose(); /** * Checks if the PSP network is connected. * * @return True if the PSP is connected to a network, false otherwise. */ bool_t networkPSPIsConnected(); /** * Requests the PSP to connect to a network (Shows the Wi-Fi connected). * * @param onConnected Callback connected successfully. * @param onFailed Callback if the connection failed. * @param onDisconnect Callback when connection is lost. * @param user User data to pass to the callbacks. */ void networkPSPRequestConnection( void (*onConnected)(void *user), void (*onFailed)(errorret_t error, void *user), void (*onDisconnect)(errorret_t error, void *user), void *user ); /** * Requests the PSP to disconnect from the network. * * @param onComplete Callback when disconnection is complete. * @param user User data to pass to the callback. */ void networkPSPRequestDisconnection( void (*onComplete)(void *user), void *user ); /** * Disposes the PSP sce net libraries, doesn't unload the modules and won't * term the dialog if it's active. * * @return Error state (if any). */ errorret_t networkPSPTerm(); /** * Gets the network information for the currently active network connection. * * @return Network information for the currently active network connection. */ networkinfo_t networkPSPGetInfo();