📄 sim_x86.c
字号:
/*
* OSPFD routing simulation controller
* Linux-specific portion
* Copyright (C) 1999 by John T. Moy
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/param.h>
#include <unistd.h>
#include <tcl.h>
#include <tk.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <signal.h>
#include <syslog.h>
#include "../src/ospfinc.h"
#include "../src/monitor.h"
#include "../src/system.h"
#include "tcppkt.h"
#include "linux.h"
#include "sim.h"
#include "simctl.h"
#include <time.h>
#include <process.h>
// External references
extern SimCtl *sim;
/* Start a simulated router.
* Router uses two sockets, one for monitoring and
* one to receive OSPF packets.
* The former we allocate so that they are in well known
* places, the latter the router allocates.
* On Windows, the spawn calls work much faster than fork().
*/
int StartRouter(ClientData, Tcl_Interp *, int, char *argv[])
{
char server_port[8];
sprintf(server_port, "%d", (int) sim->assigned_port);
spawnl(_P_DETACH, "ospfd_sim", "ospfd_sim", argv[1], server_port, 0);
return(TCL_OK);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -