pub const IPMSG_VERSION: u32 = 0x0001;
pub const IPMSG_DEFAULT_PORT: u32 = 0x0979;
pub const IPMSG_NOOPERATION: u32 = 0x00000000;
pub const IPMSG_BR_ENTRY: u32 = 0x00000001;
pub const IPMSG_BR_EXIT: u32 = 0x00000002;
pub const IPMSG_ANSENTRY: u32 = 0x00000003;
pub const IPMSG_BR_ABSENCE: u32 = 0x00000004;
pub const IPMSG_BR_ISGETLIST: u32 = 0x00000010;
pub const IPMSG_OKGETLIST: u32 = 0x00000011;
pub const IPMSG_GETLIST: u32 = 0x00000012;
pub const IPMSG_ANSLIST: u32 = 0x00000013;
pub const IPMSG_BR_ISGETLIST2: u32 = 0x00000018;
pub const IPMSG_SENDMSG: u32 = 0x00000020;
pub const IPMSG_RECVMSG: u32 = 0x00000021;
pub const IPMSG_READMSG: u32 = 0x00000030;
pub const IPMSG_DELMSG: u32 = 0x00000031;
pub const IPMSG_ANSREADMSG: u32 = 0x00000032;
pub const IPMSG_GETINFO: u32 = 0x00000040;
pub const IPMSG_SENDINFO: u32 = 0x00000041;
pub const IPMSG_GETABSENCEINFO: u32 = 0x00000050;
pub const IPMSG_SENDABSENCEINFO: u32 = 0x00000051;
pub const IPMSG_GETFILEDATA: u32 = 0x00000060;
pub const IPMSG_RELEASEFILES: u32 = 0x00000061;
pub const IPMSG_GETDIRFILES: u32 = 0x00000062;
pub const IPMSG_GETPUBKEY: u32 = 0x00000072;
pub const IPMSG_ANSPUBKEY: u32 = 0x00000073;
pub const IPMSG_FILE_REGULAR: u32 = 0x00000001;
pub const IPMSG_FILE_DIR: u32 = 0x00000002;
pub const IPMSG_FILE_RETPARENT: u32 = 0x00000003;pub const IPMSG_FILE_SYMLINK: u32 = 0x00000004;
pub const IPMSG_FILE_CDEV: u32 = 0x00000005;pub const IPMSG_FILE_BDEV: u32 = 0x00000006;pub const IPMSG_FILE_FIFO: u32 = 0x00000007;pub const IPMSG_FILE_RESFORK: u32 = 0x00000010;
pub const IPMSG_FILE_RONLYOPT: u32 = 0x00000100;
pub const IPMSG_FILE_HIDDENOPT: u32 = 0x00001000;
pub const IPMSG_FILE_EXHIDDENOPT: u32 = 0x00002000;pub const IPMSG_FILE_ARCHIVEOPT: u32 = 0x00004000;
pub const IPMSG_FILE_SYSTEMOPT: u32 = 0x00008000;
pub const IPMSG_FILE_CREATETIME: u32 = 0x00000016;
pub const IPMSG_FILE_MTIME: u32 = 0x00000014;
pub const FILELIST_SEPARATOR: char = '\u{7}';
pub const HOSTLIST_SEPARATOR: char = '\u{7}';
pub const IPMSG_ABSENCEOPT: u32 = 0x00000100;
pub const IPMSG_SERVEROPT: u32 = 0x00000200;
pub const IPMSG_DIALUPOPT: u32 = 0x00010000;
pub const IPMSG_FILEATTACHOPT: u32 = 0x00200000;
pub const IPMSG_ENCRYPTOPT: u32 = 0x00400000;
pub const IPMSG_UTF8OPT: u32 = 0x00800000;
pub const IPMSG_CAPUTF8OPT: u32 = 0x01000000;
pub const IPMSG_ENCEXTMSGOPT: u32 = 0x04000000;
pub const IPMSG_CLIPBOARDOPT: u32 = 0x08000000;
pub const IPMSG_CAPFILEENC_OBSLT: u32 = 0x00001000;
pub const IPMSG_CAPFILEENCOPT: u32 = 0x00040000;
pub const IPMSG_SENDCHECKOPT: u32 = 0x00000100;
pub const IPMSG_SECRETOPT: u32 = 0x00000200;
pub const IPMSG_BROADCASTOPT: u32 = 0x00000400;
pub const IPMSG_MULTICASTOPT: u32 = 0x00000800;
pub const IPMSG_AUTORETOPT: u32 = 0x00002000;
pub const IPMSG_RETRYOPT: u32 = 0x00004000;
pub const IPMSG_PASSWORDOPT: u32 = 0x00008000;
pub const IPMSG_NOLOGOPT: u32 = 0x00020000;
pub const IPMSG_NOADDLISTOPT: u32 = 0x00080000;
pub const IPMSG_READCHECKOPT: u32 = 0x00100000;
pub const IPMSG_SECRETEXOPT: u32 = IPMSG_READCHECKOPT|IPMSG_SECRETOPT;
pub const IPMSG_LIMITED_BROADCAST: &'static str = "255.255.255.255";
pub fn get_mode(command: u32) -> u32 {
command & 0x000000ff
}
pub fn get_opt(command: u32) -> u32 {
command & 0xffffff00
}
use ::hostname as host_name;
use local_ip;
use std::net::IpAddr;
use lazy_static::lazy_static;
pub fn get_local_ip() -> Option<IpAddr> {
local_ip::get()
}
pub fn get_host_name() -> String {
host_name::get().unwrap().into_string().unwrap()
}
lazy_static! {
pub static ref hostname: String = get_host_name();
pub static ref localip: String = get_local_ip().unwrap().to_string();
pub static ref addr: String = format!("{}{}", "0.0.0.0:", IPMSG_DEFAULT_PORT);
}