libnx  v4.8.0
nxlink.h
Go to the documentation of this file.
1 /**
2  * @file nxlink.h
3  * @brief Netloader (nxlink) utilities
4  * @author WinterMute
5  * @copyright libnx Authors
6  */
7 #pragma once
8 #include "../types.h"
9 
10 struct in_addr;
11 
12 /// Address of the host connected through nxlink
13 extern struct in_addr __nxlink_host;
14 
15 #define NXLINK_SERVER_PORT 28280 ///< nxlink TCP server port
16 #define NXLINK_CLIENT_PORT 28771 ///< nxlink TCP client port
17 
18 /**
19  * @brief Connects to the nxlink host, setting up an output stream.
20  * @param[in] redirStdout Whether to redirect stdout to nxlink output.
21  * @param[in] redirStderr Whether to redirect stderr to nxlink output.
22  * @return Socket fd on success, negative number on failure.
23  * @note The socket should be closed with close() during application cleanup.
24  */
25 int nxlinkConnectToHost(bool redirStdout, bool redirStderr);
26 
27 /// Same as \ref nxlinkConnectToHost but redirecting both stdout/stderr.
29  return nxlinkConnectToHost(true, true);
30 }
31 
32 /// Same as \ref nxlinkConnectToHost but redirecting only stderr.
34  return nxlinkConnectToHost(false, true);
35 }
#define NX_INLINE
Flags a function as (always) inline.
Definition: types.h:86