360模拟点击参考资料
29 10 月, 2009MAC参考资料
27 10 月, 2009360免杀参考资料
22 10 月, 2009批处理过360云查杀
http://hookit.blogbus.com/logs/40415399.html
过360云查杀vc++代码
http://hookit.blogbus.com/logs/40415359.html
过360服务提示
OMNeT++实现随机拓扑
20 10 月, 2009核心代码如下:
MyOMNet.ned
network MyOMNeT
{
parameters:
int width; //布局宽
int height; //布局高
int numHosts; // number of hosts
@display(“bgi=maps/usa”);
submodules:
server: Server;
host[numHosts]: Host;
connections:
for i=0..numHosts-1 {
host[i].out –> { delay = 100ms; } –> server.in++;
}
}
Server.cc
void Server::initialize()
{
//设置网络布局大小
net = simulation.getModuleByPath(“MyOMNeT”);
if(!net) error(“net not found”);
//注释掉的方法需使用头文件中的全局变量
//net->getDisplayString().setTagArg(“bgb”, 0, width);
//net->getDisplayString().setTagArg(“bgb”, 1, height);
int width = net->par(“width”);
int height = net->par(“height”);
net->getDisplayString().setTagArg(“bgb”, 0, width);
net->getDisplayString().setTagArg(“bgb”, 1, height);
if (ev.isGUI())
getDisplayString().setTagArg(“i2″,0,”x_off”);
}
Host.h
//随机数种子
static long ltime = 0;
//块结构体
typedef struct _BLOCK {
int x;//x轴起始坐标,最初设计为const,但考虑到用户输入超过布局,故随机分配前判断并修改。
int y;//y轴起始坐标,同上。
int width;//宽,同上。
int height;//高,同上。
int num;//块内主机数
}BLOCK, *LPBLOCK;
//按块结构体设置各块参数,并修改.cc文件for循环中的i < 4为i < 当前块数。
BLOCK b[4] = {{0, 0, 100, 100, 1}, {0, 400, 100, 100, 1}, {400, 0, 100, 100, 1}, {400, 400, 100, 100, 1}};
Host.cc
void Host::initialize()
{
server = simulation.getModuleByPath(“server”);
if (!server) error(“server not found”);
if (ev.isGUI())
{
//块内随机
for(int i = 0; i < 4; i++)
{
//前面块内主机未完成随机分配,则不进行后面块内主机的随机分配。
if(0 != b[i].num)
{
//第一个主机进行随机分配时以当前时间为随机数种子,之后的随机数种子随机产生。
if(0 == ltime)
time(<ime);
srand(ltime);
//判断并修改超过布局大小的错误值
cModule* net = simulation.getModuleByPath(“MyOMNeT”);
if(!net) error(“net not found”);
int width = net->par(“width”);
int height = net->par(“height”);
if(b[i].x >= width) {
b[i].x = width – 1;
b[i].width = 1;
}
if(b[i].y >= height) {
b[i].y = height – 1;
b[i].height = 1;
}
if(b[i].x + b[i].width > width)
b[i].width = width – b[i].x;
if(b[i].y + b[i].height > height)
b[i].height = height – b[i].y;
//随机产生坐标和下一个随机数种子
long x = b[i].x + rand()%b[i].width;
long y = b[i].y + rand()%b[i].height;
ltime += rand();
this->getDisplayString().setTagArg(“p”,0,x);
this->getDisplayString().setTagArg(“p”,1,y);
b[i].num–;
break;
}
}
this->getDisplayString().setTagArg(“t”,2,”#808000″);
}
//cMessage *msg = new cMessage(“send”);
//sendDirect(msg, 10, 0, server->gate(“in”));
//send(msg, “out”);
//Sleep(500);如果使用当前时间为随机数种子,则需睡眠线程。
}
演示文档:OMNeT++实现随机拓扑