#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <map>
#include <string>
#include <Base64.h>
#include <SocketHandler.h>
#include <StdoutLog.h>
#include "RobotXMLFile.h"
#include "InjectSocket.h"
#include "RowoHandler.h"
#include "CodeTool.h"
Include dependency graph for inject.cpp:
Go to the source code of this file.
Functions | |
int | main (int argc, char *argv[]) |
int main | ( | int | argc, | |
char * | argv[] | |||
) |
Definition at line 15 of file inject.cpp.
00016 { 00017 if (argc < 2) 00018 { 00019 printf("Usage: %s <.xml file>\n",*argv); 00020 exit(-1); 00021 } 00022 RowoHandler h; 00023 StdoutLog log; 00024 h.RegStdLog(&log); 00025 for (int i = 1; i < argc; i++) 00026 { 00027 RobotXMLFile x(argv[i]); 00028 if (x.IsOk()) 00029 { 00030 std::string robot_name = x.GetString("name"); 00031 std::string owner_uid = x.GetString("owner"); 00032 // std::string codestr64 = x.GetString("code"); 00033 00034 printf("Robot: %s\n",robot_name.c_str()); 00035 printf("Created by: %s\n",owner_uid.c_str()); 00036 // printf("Codestr64: %s\n",codestr64.c_str()); 00037 // code sanity check 00038 CodeTool ct(x); 00039 if (ct.Sane()) 00040 { 00041 // send file 00042 InjectSocket *p = new InjectSocket(h); 00043 p -> SetDeleteByHandler(); 00044 p -> SetFilename(argv[i]); 00045 p -> Open("localhost",32766); 00046 h.Add(p); 00047 h.Select(1,0); 00048 } 00049 else 00050 { 00051 printf("Insane code\n"); 00052 } 00053 } 00054 } 00055 while (h.GetCount()) 00056 { 00057 h.Select(1,0); 00058 } 00059 }