fix port binding

This commit is contained in:
Maple 2026-03-24 15:48:56 +01:00
commit 785341e883
43 changed files with 1543 additions and 431 deletions

View file

@ -0,0 +1,4 @@
use macros::rmc_proto;
#[rmc_proto(25)]
pub trait AccountManagement {}

View file

@ -1,9 +1,21 @@
use crate::rmc::structures::connection_data::{ConnectionData, ConnectionDataOld};
use cfg_if::cfg_if;
use macros::{method_id, rmc_proto};
use rnex_core::PID;
use rnex_core::rmc::response::ErrorCode;
use rnex_core::rmc::structures::any::Any;
use rnex_core::rmc::structures::qresult::QResult;
cfg_if! {
if #[cfg(feature = "nx")]{
type LOGIN_EX_RET = (QResult, PID, Vec<u8>, ConnectionData, String, String);
type REQUEST_TICKET_RET = (QResult, Vec<u8>, String);
} else {
type LOGIN_EX_RET = (QResult, PID, Vec<u8>, ConnectionData, String);
type REQUEST_TICKET_RET = (QResult, Vec<u8>);
}
}
/// This is the representation for `Ticket Granting`(for details see the
/// [kinnay wiki entry](https://github.com/kinnay/NintendoClients/wiki/Authentication-Protocol))
#[rmc_proto(10)]
@ -14,25 +26,22 @@ pub trait Auth {
async fn login(
&self,
name: String,
) -> Result<(QResult, u32, Vec<u8>, ConnectionDataOld, String), ErrorCode>;
) -> Result<(QResult, PID, Vec<u8>, ConnectionDataOld, String), ErrorCode>;
/// representation of the `LoginEx` method(for details see the
/// [kinnay wiki entry](https://github.com/kinnay/NintendoClients/wiki/Authentication-Protocol))
#[method_id(2)]
async fn login_ex(
&self,
name: String,
extra_data: Any,
) -> Result<(QResult, u32, Vec<u8>, ConnectionData, String), ErrorCode>;
async fn login_ex(&self, name: String, extra_data: Any) -> Result<LOGIN_EX_RET, ErrorCode>;
/// representation of the `RequestTicket` method(for details see the
/// [kinnay wiki entry](https://github.com/kinnay/NintendoClients/wiki/Authentication-Protocol))
#[method_id(3)]
async fn request_ticket(
&self,
source_pid: u32,
destination_pid: u32,
) -> Result<(QResult, Vec<u8>), ErrorCode>;
source_pid: PID,
destination_pid: PID,
) -> Result<REQUEST_TICKET_RET, ErrorCode>;
/// representation of the `RequestTicket` method(for details see the
/// [kinnay wiki entry](https://github.com/kinnay/NintendoClients/wiki/Authentication-Protocol))
/// representation of the `GetPID` method(for details see the
/// [kinnay wiki entry](https://github.com/kinnay/NintendoClients/wiki/Authentication-Protocol))
@ -42,7 +51,7 @@ pub trait Auth {
/// representation of the `LoginWithContext` method(for details see the
/// [kinnay wiki entry](https://github.com/kinnay/NintendoClients/wiki/Authentication-Protocol))
#[method_id(5)]
async fn get_name(&self, pid: u32) -> Result<String, ErrorCode>;
async fn get_name(&self, pid: PID) -> Result<String, ErrorCode>;
// `LoginWithContext` is left out here because we don't need it right now and versioning still
// needs to be figured out

View file

@ -2,8 +2,10 @@ use macros::{method_id, rmc_proto};
use rnex_core::prudp::station_url::StationUrl;
use rnex_core::rmc::response::ErrorCode;
use rnex_core::PID;
#[rmc_proto(21)]
pub trait Matchmake{
pub trait Matchmake {
#[method_id(2)]
async fn unregister_gathering(&self, gid: u32) -> Result<bool, ErrorCode>;
#[method_id(41)]
@ -11,5 +13,10 @@ pub trait Matchmake{
#[method_id(42)]
async fn update_session_host(&self, gid: u32, change_owner: bool) -> Result<(), ErrorCode>;
#[method_id(44)]
async fn migrate_gathering_ownership(&self, gid: u32, candidates: Vec<u32>, participants_only: bool) -> Result<(), ErrorCode>;
}
async fn migrate_gathering_ownership(
&self,
gid: u32,
candidates: Vec<PID>,
participants_only: bool,
) -> Result<(), ErrorCode>;
}

View file

@ -1,5 +1,6 @@
#![allow(async_fn_in_trait)]
pub mod account_management;
pub mod auth;
pub mod friends;
pub mod matchmake;

View file

@ -1,19 +1,21 @@
use macros::{method_id, rmc_proto, rmc_struct, RmcSerialize};
use macros::{RmcSerialize, method_id, rmc_proto, rmc_struct};
pub mod notification_types{
use rnex_core::PID;
pub mod notification_types {
pub const OWNERSHIP_CHANGED: u32 = 4000;
pub const HOST_CHANGED: u32 = 110000;
}
#[derive(RmcSerialize, Debug, Default, Clone)]
#[rmc_struct(0)]
pub struct NotificationEvent{
pub pid_source: u32,
pub struct NotificationEvent {
pub pid_source: PID,
pub notif_type: u32,
pub param_1: u32,
pub param_2: u32,
pub param_1: PID,
pub param_2: PID,
pub str_param: String,
pub param_3: u32,
pub param_3: PID,
}
#[rmc_proto(14, NoReturn)]
@ -21,4 +23,3 @@ pub trait Notification {
#[method_id(1)]
async fn process_notification_event(&self, event: NotificationEvent);
}

View file

@ -12,6 +12,7 @@ pub trait Secure {
&self,
station_urls: Vec<StationUrl>,
) -> Result<(QResult, u32, StationUrl), ErrorCode>;
#[method_id(4)]
async fn register_ex(
&self,