⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 networkhelp.h

📁 270的linux说明
💻 H
字号:
/*

Copyright (c) 2008, Intel Corporation. 

All rights reserved.

 

Redistribution and use in source and binary forms, with or without modification, 
are permitted provided that the following conditions are met:


    * Redistributions of source code must retain the above copyright notice, 
this list of conditions and the following disclaimer.

    * Redistributions in binary form must reproduce the above copyright notice, 
this list of conditions and the following disclaimer in the documentation and/or 
other materials provided with the distribution.

    * Neither the name of Intel Corporation nor the names of its contributors 
may be used to endorse or promote products derived from this software without 
specific prior written permission.

 

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
OF SUCH DAMAGE.

*/#ifndef _NETWORKHELP_H#define _NETWORKHELP_H#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <sys/types.h>#include <sys/param.h>#include <sys/ioctl.h>#include <sys/socket.h>//#include <net/if.h>#include <netinet/in.h>#include <net/if_arp.h>#include <arpa/inet.h>#include <iostream>#include  <string.h>#include <ctype.h>#include <math.h>#include "wireless_utility.h"#define MAXINTERFACES 16#define MAXFILENAME 256#define MAXLINE 256#define MAXADAPTER 5 #define R_OK 0#define R_FAILE 1#define R_ERROR -1using namespace std;typedef struct adapter{	char *device;//device[MAXLINE];	char *driver;//driver[MAXLINE];	char *desc;//desc[256];	int vendorId;	int deviceId;	}adapter_T;struct link_stats{	unsigned long rec_bytes;	unsigned long rec_packets;	unsigned long rec_errs;	unsigned long rec_drop;	unsigned long rec_fifo;	unsigned long rec_frame;	unsigned long rec_compressed;	unsigned long rec_multicast;	unsigned long tran_bytes;	unsigned long tran_packets;	unsigned long tran_errs;	unsigned long tran_drop;	unsigned long tran_fifo;	unsigned long tran_colls;	unsigned long tran_carrier;	unsigned long tran_compressed;};void GetAdapterType (char *ifname, char* type);int GetIpAddress (char *pInterface, char* ip);bool CheckMuticast(char *pInterface);int GetMuticastAddress(char *pInterface,char *ip);int GetMacAddress (char *pInterface, unsigned char mac[6]);int GetAutoSense(char *pInterface,bool sense);int GetDescription(char *pInterface,char *dess);int GetAdapter(adapter_T adapter[MAXADAPTER]);bool GetConnectStatus(char *pInterface);int GetNetworkTypes(char *pInterface,char *type);int GetLinkSpeed(char *pInterface,int *speed);bool GetEnable(char *ifname);int GetInterfaceCount(int *ifcount);int GetInterfaceName(int ifindex, char *pName, unsigned int len);unsigned int GetNameToIndex(char *ifname);int GetStats (char *ifname, struct link_stats *stats);//wirelessstruct wireless_stat {    char			iface[32];    unsigned long	status;    	unsigned long   quality_link;	unsigned long	quality_level;	unsigned long	quality_noise;    unsigned long   dp_nwid;	unsigned long	dp_crypt;	unsigned long	dp_frag;	unsigned long	dp_retry;	unsigned long	dp_misc;    unsigned long   mbeacon;	unsigned long	WE16;    };int OpenSocket();void CloseSocket();int GetWirelessName(char *ifname,char*name);int GetFrequency(char *pInterfaceName,double *freq);int GetBitRate(char *InterfaceName,iw_param bitrate);int GetESSID(char *InterfaceName,char *outessid);int GetNWID(char *InterfaceName,/*iwparam nwid*/int *nwidValue);int GetSensitivity(char *InterfaceName,iw_param sens);int GetEncryption(char *InterfaceName,unsigned char* key,int key_size,int key_flags);int GetAPAddress(char *InterfaceName,sockaddr ap_addr);int GetNickName(char *InterfaceName,char *nickname);int GetTRSThreshold(char *InterfaceName,iw_param rts);int GetFragmentation(char *pInterfaceName,/*iwparam frag*/int *fragValue);int GetMode(char *InterfaceName,int mode);int GetPowerManager(char *InterfaceName,int *powerValue);int GetRange(char *  InterfaceName,iw_range * range);int GetWirelessStats( char *ifname,struct wireless_stat *stat );#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -