Compare commits
1 commit
Author | SHA1 | Date | |
---|---|---|---|
d1d9042807 |
4 changed files with 21 additions and 13 deletions
2
lib/dt_p2p/.gitignore
vendored
2
lib/dt_p2p/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
/target
|
||||
/Cargo.lock
|
|
@ -1,16 +1,26 @@
|
|||
use std::{
|
||||
ffi::{c_char, CString},
|
||||
sync::RwLock,
|
||||
};
|
||||
|
||||
mod stingray_sdk;
|
||||
|
||||
use std::ffi::c_char;
|
||||
use std::ffi::CString;
|
||||
|
||||
use stingray_sdk::GetApiFunction;
|
||||
use stingray_sdk::PluginApi;
|
||||
use stingray_sdk::PluginApiID;
|
||||
|
||||
use crate::stingray_sdk::LoggingApi;
|
||||
use crate::stingray_sdk::{GetApiFunction, LoggingApi, PluginApi, PluginApiID};
|
||||
|
||||
const PLUGIN_NAME: &str = "dt_p2p";
|
||||
|
||||
struct Plugin {
|
||||
log: Option<LoggingApi>,
|
||||
}
|
||||
|
||||
impl Plugin {
|
||||
pub const fn new() -> Self {
|
||||
Self { log: None }
|
||||
}
|
||||
}
|
||||
|
||||
static PLUGIN: RwLock<Plugin> = RwLock::new(Plugin::new());
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn get_name() -> *const c_char {
|
||||
let s = CString::new(PLUGIN_NAME).expect("Failed to create CString from plugin name");
|
||||
|
@ -21,7 +31,8 @@ pub extern "C" fn get_name() -> *const c_char {
|
|||
pub extern "C" fn setup_game(get_engine_api: GetApiFunction) {
|
||||
println!("setup_game");
|
||||
|
||||
let log = LoggingApi::get(get_engine_api);
|
||||
PLUGIN.log = Some(LoggingApi::get(get_engine_api));
|
||||
let log = PLUGIN.log.as_ref().unwrap();
|
||||
|
||||
log.info(
|
||||
PLUGIN_NAME,
|
||||
|
|
2
lib/nat_traversal/.gitignore
vendored
2
lib/nat_traversal/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
/target
|
||||
/Cargo.lock
|
1
lib/nat_traversal/src/ice/mod.rs
Normal file
1
lib/nat_traversal/src/ice/mod.rs
Normal file
|
@ -0,0 +1 @@
|
|||
|
Loading…
Add table
Reference in a new issue