📄 crouteurlinux.cpp
字号:
#include "globals.h"#include "linuxconf.h"/*************************************************************************** crouteurlinux.cpp - description ------------------- begin : Tue Jun 19 2001 copyright : (C) 2001 by stephane (birdy57) email : birdy57@multimania.com ***************************************************************************//*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/#include "crouteurlinux.h"CRouteurLinux::CRouteurLinux(){ ifname = new char[30]; has_proxy_arp = 0; tune_kernel = 0;}CRouteurLinux::~CRouteurLinux(){}/** copie un fichier en ecrasant la destination */bool CRouteurLinux::FileCopy(char *sSource, char *sDestination){ char sBlock[1024]; int nEntree, nSortie; int nLu; bool bRet = false; if (FileExist(sSource)) { if (FileExist(sDestination)) unlink(sDestination); if ((nEntree = open(sSource, O_RDONLY)) > 0) if ((nSortie = open(sDestination, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) > 0) { while ((nLu = read(nEntree, sBlock, sizeof(sBlock))) > 0) write(nSortie, sBlock, nLu); close(nEntree); close(nSortie); bRet = true; } else close(nEntree); } return bRet;}/** Demmarre le routage */bool CRouteurLinux::Start(){ int GuidIn, GuidOut; bool bRet = false; char *Source = "/etc/resolv.conf"; char *Destination = "/etc/resolv.peng"; char cBuffer[200]; bool bDin = false; bool bDout = false; m_nErrorNbr = 0;// initialise le routage sys_init(); GuidIn = GetGuidIn(); GuidOut = GetGuidOut();// Teste si les drivers sont supporter// ici on place les drivers d'entree switch (GuidIn) { case Modem: case Cable: bDin = true; break; }// et ici de sortie switch (GuidOut) { case Ppp: case TunTap: bDout = true; break; }// Le switch permet d'en rajouter facilement if ((!bDin) || (!bDout)) m_nErrorNbr = 59; else { // on s'occupe d'abord de la table DNS commun
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -