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

📄 osoperations.java

📁 UoB JADhoc is an AODV Implementation in Java. This is a GZIPed TAR file for the Linux/Unix environme
💻 JAVA
字号:
/*JAdhoc ver 0.11 - Java AODV (RFC 3561) Protocol HandlerCopyright 2003-2004 ComNets, University of BremenThis program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version 2of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.*/package jadhoc.os;import jadhoc.conf.*;import jadhoc.other.*;import jadhoc.net.*;/*** This class acts as the middleman between the route manager* and the specific object related to handling route environment* manipulation in a given operating system-IP version.** @author : Asanga Udugama* @date : 28-jul-2003* @email : adu@comnets.uni-bremen.de**/public class OSOperations {	public ConfigInfo cfgInfo;	public CurrentInfo curInfo;	public OSOperationsInterface osOps;	/**	* Constructor that creates the OS operations manipulation	* object	* @param ConfigInfo cfg - config info to decide the type	* 				of OS and IP version	* @param CurrentInfo cur - current info object	*/	public OSOperations(ConfigInfo cfg, CurrentInfo cur) {		cfgInfo = cfg;		curInfo = cur;		osOps = null;	}	/**	* Method that acts as the intermediary between the route manager	* and the OS/IPv specific object to initialize the route	* environment. Before initialization, it looks at OS and IP	* version being used from the config info, and creates the	* relevent OS/IPv object.	* @param int level - The initialization level	*			0 = full initialization level	*			1 - 100 = other init levels	* @return int - returns the success or failure	*/	public int initializeRouteEnvironment(int level) {		if(osOps == null) {			// create the OS-IPv specific OS operations object			if(cfgInfo.osInUseVal.trim().toLowerCase().equals(ConfigInfo.LINUX_OS)) {				if(cfgInfo.ipVersionVal == ConfigInfo.IPv4_VERSION_VAL) {// ipv4					osOps = new OSOperationsLinuxIPv4(cfgInfo, curInfo);				} else {// ipv6					//osOps = new OSOperationsLinuxIPv6(cfgInfo, curInfo);				}			} else if(cfgInfo.osInUseVal.trim().toLowerCase().equals(ConfigInfo.WINDOWS_OS)) {				if(cfgInfo.ipVersionVal == ConfigInfo.IPv4_VERSION_VAL) {// ipv4					osOps = new OSOperationsWindowsIPv4(cfgInfo, curInfo);				} else {// ipv6					//osOps = new OSOperationsWindowsIPv6(cfgInfo, curInfo);				}			 // add for other operating systems here			} else {				// log				curInfo.log.write(Logging.CRITICAL_LOGGING, "OS Init - Unupported OS");					return (-1);			}		}		return osOps.initializeRouteEnvironment(level);	}	/**	* Method that acts as the intermediary between the route manager	* and the OS/IPv specific object to set a route	* @param RouteEntry rtEntry - the route entry from which to get	*				information	* @return int - returns the success or failure	*/	public int addRoute(RouteEntry rtEntry) {		return osOps.addRoute(rtEntry);	}	/**	* Method that acts as the intermediary between the route manager	* and the OS/IPv specific object to remove a route	* @param RouteEntry rtEntry - the route entry from which to get	*				information	* @return int - returns the success or failure	*/	public int deleteRoute(RouteEntry rtEntry) {		return osOps.deleteRoute(rtEntry);	}	/**	* Method that acts as the intermediary between the route manager	* and the OS/IPv specific object to bring back the route	* environment to the original state, when stoping protocol	* handler.	* @return int - returns the success or failure	*/	public int finalizeRouteEnvironment() {		int rtn = osOps.finalizeRouteEnvironment();		osOps = null;		return rtn;	}}

⌨️ 快捷键说明

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