Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4213305
  • 博文数量: 1148
  • 博客积分: 25453
  • 博客等级: 上将
  • 技术积分: 11949
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-06 21:14
文章分类

全部博文(1148)

文章存档

2012年(15)

2011年(1078)

2010年(58)

分类: Mysql/postgreSQL

2011-08-13 20:02:51

1.打开数据库
 
  1. ./bin/mysqld_safe --defaults-file=./my.cnf --user=root &
  2. ./bin/mysql --defaults-file=./my.cnf -u root -p
  3. Enter password:

2. 新建数据库及表

  1. crate database packets_db
  2. use packets_db
  3. create table 2011_8_13 (id int auto_increment not null primary key,
  4. CollectTime datetime,DestIP varchar(15) not null,DestMac varchar(15) not null,
  5. DestPort int not null,Length int not null,SrcIP varchar(15) not null,SrcMac varchar(15) not null,SrcPort int not null,
  6. PacketType int not null)

  7. create table manager_table (id int auto_increment not null primary key,createtime datetime,tablename varchar(100))
  8. create table type_table(packettype int not null primary key,typename varchar(100))

3. 代码附件
  
 xx.rar  

   从linux转换到windows格式 todos -b xx.cpp -b 表示备份
   从windows转换回linux格式 fromdos -b xx.cpp


4. 编译源码:
 
  1. root@ywx:/home/ywx/yu/libpcap# g++ -o xx -lpcap -lpthread
  2. -I/opt/mysql5151/include/mysql -L/opt/mysql5151/lib/mysql -lmysqlclient xx.cpp

5. 运行结果

  1. root@ywx:/home/ywx/yu/libpcap# ./xx
  2. 分布式数据包采集系统
  3. 系统运行时间为: 2011-8-13 19:54:27

  4. 请输入命令:>help
  5. ==================================================================
  6. version:V1.0
  7. author:my2005lb


  8. run capture 开启采集
  9. stop capture 关闭采集
  10. run write 开启存储
  11. stop write 关闭存储
  12. capture status 状态查询
  13. write status 存储状态查询
  14. db Status 数据库查看
  15. exit 退出
  16. ==================================================================
  17. 请输入命令:>run capture
  18. 采集已开启....
  19. 请输入命令:>



阅读(833) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~