libctru v2.5.0
Loading...
Searching...
No Matches
3dslink.h
Go to the documentation of this file.
1/**
2 * @file 3dslink.h
3 * @brief Netloader (3dslink) utilities
4 */
5
6#pragma once
7
8#include <stdbool.h>
9
10struct in_addr;
11
12/// Address of the host connected through 3dslink
13extern struct in_addr __3dslink_host;
14
15#define LINK3DS_COMM_PORT 17491 ///< 3dslink TCP server port
16
17/**
18 * @brief Connects to the 3dslink host, setting up an output stream.
19 * @param[in] redirStdout Whether to redirect stdout to nxlink output.
20 * @param[in] redirStderr Whether to redirect stderr to nxlink output.
21 * @return Socket fd on success, negative number on failure.
22 * @note The socket should be closed with close() during application cleanup.
23 */
24int link3dsConnectToHost(bool redirStdout, bool redirStderr);
25
26/// Same as \ref link3dsConnectToHost but redirecting both stdout/stderr.
27static inline int link3dsStdio(void) {
28 return link3dsConnectToHost(true, true);
29}
30
31/// Same as \ref link3dsConnectToHost but redirecting only stderr.
32static inline int link3dsStdioForDebug(void) {
33 return link3dsConnectToHost(false, true);
34}
Definition in.h:30