/******************************************************************************
|
*
|
*
|
*******************************************************************************
|
* File name: net.h
|
* Purpose:
|
* Author: Felix(HuangFei)
|
* Version: v01.00
|
* Compiler: arm-linux-gcc
|
* Created on: 2014-11-28
|
*******************************************************************************
|
* Note:
|
* Revision history:
|
* Created by HuangFei 2014-11-28
|
******************************************************************************/
|
|
#ifndef __NET_CONFIG_H__
|
#define __NET_CONFIG_H__
|
#include <string>
|
|
#define NET_IFNAME "eth0"
|
|
bool checkip(std::string ip);
|
|
bool checkMask(std::string mask);
|
|
bool SetMacAddress(char *pInterface,char *pMacAddress);
|
|
bool SetIpAddress(char *pInterface,const char* IpAddress);
|
|
bool SetMaskAddress(char *pInterface,const char* IpMask);
|
|
bool DelGateWay(char *pInterface,unsigned int DelGateWay);
|
|
bool AddGateWay(char *pInterface,unsigned int NewGateWay);
|
|
bool SetGateWay(char *pInterface,const char* DelGateWay,const char* NewGateWay);
|
|
bool GetMacAddress (char* ifaceName, unsigned char* hwAddr);
|
|
bool GetIpAddress(char* ifaceName,unsigned char *IpAddress);
|
|
bool GetMaskAddress(char* ifaceName,unsigned char *MaskAddress);
|
|
bool GetGateWay(char *pInterface,unsigned char *pGateWay);
|
|
bool SetSock_reUse(int sockfd);
|
|
bool SetSock_NoCheck(int sockfd);
|
|
bool SetMutiCastLoop(int sockfd,int val);
|
|
bool SetMutiCastTTl(int sockfd,int ttl);
|
|
bool AddIpAddr_ToMultiCast(int sockfd,unsigned int ip,unsigned int multi_ip,int ttl);
|
|
bool BindSockDevice(unsigned char*ifaceNmae,int sockfd);
|
|
void DisplayInterfaceStatus(char* ifaceName);
|
|
#endif/*__NET_CONFIG_H__*/
|