派生自 development/c++

pansen
2019-03-05 ed223aee5fe5f3b222488549597976f34c679c3d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/******************************************************************************
*    
*                
*******************************************************************************
*    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__*/