#ifndef FOUNDATION_SETTINGS_SYSINFO_H #define FOUNDATION_SETTINGS_SYSINFO_H namespace settings { namespace sysinfo { #define MAXBUFSIZE 1024 #define WAIT_SECOND 3 // 暂停时间,单位为“秒” typedef struct occupy { char name[20]; unsigned int user; unsigned int nice; unsigned int system; unsigned int idle; } CPU_OCCUPY; typedef struct PACKED { char name[20]; long total; char name2[20]; long free; } MEM_OCCUPY; double cal_occupy(CPU_OCCUPY *o, CPU_OCCUPY *n); void get_occupy(CPU_OCCUPY *o); void get_mem_occupy(MEM_OCCUPY *mem); float get_io_occupy(); void get_disk_occupy(char **reused); void getCurrentDownloadRates(long int *save_rate); /** * 设置IP */ int SetIfAddr(const char *ifname, const char *Ipaddr, const char *mask, const char *gateway); /* * 获取IP */ int GetIfAddr(const char *iface, char ipaddr[], char mask[], char gateway[]); /* * 获取IP */ bool GetLocalIp(const char *iface, char ipaddr[]); /* * 修改本机IP地址的函数 */ int SetLocalIp(const char *iface, const char *ipaddr); /* *获取子网掩码的函数 */ bool GetLocalNetMask(const char *ifname, char netmask_addr[]); /* * 修改子NETMASK的函数 */ bool SetLocalNetMask(const char *iface, const char *szNetMask); /* * 获去GateWay */ bool GetGateWay(char gateway[]); /* * 设置网关 */ int SetGateWay(const char *szGateWay); /* *获取本机MAC地址函数 */ bool GetLocalMac(const char *eth, char mac_addr[30]); } // namespace sysinfo } // namespace settings #endif