houxiao
2016-12-09 b39645c1a9514c6e89dcc179ed93f9f64d22e6e5
test for pc server

git-svn-id: http://192.168.1.226/svn/proxy@8 454eff88-639b-444f-9e54-f578c98de674
2个文件已添加
1个文件已修改
143 ■■■■■ 已修改文件
ProxyConsole/make.sh 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ProxyConsole/opentutorials.sql 111 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ProxyConsole/proxyconsole.c 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ProxyConsole/make.sh
New file
@@ -0,0 +1,4 @@
#!/bin/sh
gcc -pthread -lmysqlclient proxyconsole.c -o proxyconsole
ProxyConsole/opentutorials.sql
New file
@@ -0,0 +1,111 @@
-- phpMyAdmin SQL Dump
-- version 4.5.4.1deb2ubuntu2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Nov 03, 2016 at 09:58 AM
-- Server version: 5.7.16-0ubuntu0.16.04.1
-- PHP Version: 7.0.8-0ubuntu0.16.04.3
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `opentutorials`
--
CREATE DATABASE IF NOT EXISTS `opentutorials` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `opentutorials`;
-- --------------------------------------------------------
--
-- Table structure for table `tbl_deviceinfo`
--
CREATE TABLE `tbl_deviceinfo` (
  `id` int(11) NOT NULL,
  `equipmentip` varchar(20) DEFAULT NULL,
  `equipmentport` varchar(10) DEFAULT NULL,
  `serverip` varchar(20) DEFAULT NULL,
  `serverport` varchar(10) DEFAULT NULL,
  `password` varchar(50) DEFAULT NULL,
  `username` varchar(50) DEFAULT NULL,
  `analysis` varchar(10) DEFAULT NULL,
  `comtype` varchar(10) DEFAULT NULL,
  `redate` datetime  DEFAULT NULL,
  `comment` varchar(256) DEFAULT NULL,
  `reboot` int(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='This table contains device related infomation';
--
-- Dumping data for table `tbl_deviceinfo`
--
INSERT INTO `tbl_deviceinfo` (`id`, `equipmentip`, `equipmentport`, `serverip`, `serverport`, `password`, `username`, `analysis`, `comtype`, `redate`, `comment`, `reboot`) VALUES
(4, '124.205.246.90', '80', '192.168.1.3', '5015', 'supervisor', 'supervisor', '222', 'TCP', '2016-11-02 11:37:48', '1256', 0),
(6, '124.205.246.91', '80', '192.168.1.3', '5015', 'supervisor', 'supervisor', '10000', 'TCP', '2016-11-01 21:23:55', 'Bioolfy', 0);
-- --------------------------------------------------------
--
-- Table structure for table `tbl_userinfo`
--
CREATE TABLE `tbl_userinfo` (
  `id` int(10) UNSIGNED NOT NULL,
  `account` varchar(50) DEFAULT NULL,
  `password` varchar(50) DEFAULT NULL,
  `redate` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbl_userinfo`
--
INSERT INTO `tbl_userinfo` (`id`, `account`, `password`, `redate`) VALUES
(1, 'admin', 'admin', '2016-10-22 00:00:00');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `tbl_deviceinfo`
--
ALTER TABLE `tbl_deviceinfo`
  ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbl_userinfo`
--
ALTER TABLE `tbl_userinfo`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `id` (`id`),
  ADD UNIQUE KEY `id_2` (`id`),
  ADD UNIQUE KEY `id_3` (`id`),
  ADD UNIQUE KEY `id_4` (`id`),
  ADD UNIQUE KEY `id_5` (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `tbl_deviceinfo`
--
ALTER TABLE `tbl_deviceinfo`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `tbl_userinfo`
--
ALTER TABLE `tbl_userinfo`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
ProxyConsole/proxyconsole.c
@@ -12,7 +12,7 @@
#include <pthread.h>
#include <sys/time.h>
#include <fcntl.h>
#include "/usr/include/mysql/mysql.h"
//#include "/usr/include/mysql/mysql.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -437,6 +437,29 @@
  pthread_exit((void*)thread_Real[eidx]);
}
int Read_MysqlData()
{
    static sockinfo equipments_config[] = {
        //{
        //    .m_id = 1,
        //    .ip = "192.168.1.5",         // equipmentip (analizer)
        //    .port = "80",                 // equipmentport
        //    .user = "supervisor",         // equipment username
        //    .pass = "supervisor",         // equipment password
        //    .serverIP = "192.168.1.2",     // serverip
        //    .serverport = "5015",         // serverport
        //    .reboot = 0
        //},
        { .m_id = 1, .ip = "192.168.1.5", .port = "80", .user = "supervisor", .pass = "supervisor", .serverIP = "192.168.1.2", .serverport = "5015", .reboot = 0 },
    };
    memcpy(equipments, equipments_config, sizeof(equipments_config));
    NUM = sizeof(equipments_config) / sizeof(sockinfo);
    return 1;
}
/*
int Read_MysqlData(){
    int ret=0;
    MYSQL *conn;
@@ -529,7 +552,8 @@
    mysql_close(conn);
    return ret;
    
}
}*/
int net_test(char* serverIP,char* port){
        struct sockaddr_in servaddr;
       int strlen=sizeof(servaddr);