Fixed documentation, removed a few useless files, changed MD5 implementation to use openssl.
This commit is contained in:
parent
46ed4bdd60
commit
bf75cc278c
26 changed files with 97 additions and 608 deletions
|
@ -1,10 +1,10 @@
|
|||
SUBDIRS=converters analysers
|
||||
bin_PROGRAMS=MistBuffer MistController MistConnRAW MistConnRTMP MistConnHTTP
|
||||
AM_LDFLAGS=-L../lib
|
||||
MistBuffer_SOURCES=buffer.cpp buffer_stats.h buffer_stats.cpp buffer_user.h buffer_user.cpp buffer_stream.h buffer_stream.cpp
|
||||
MistBuffer_SOURCES=buffer.cpp buffer_user.h buffer_user.cpp buffer_stream.h buffer_stream.cpp
|
||||
MistBuffer_LDADD=-ljson -lsocket -ldtsc -ltinythread -lpthread
|
||||
MistController_SOURCES=controller.cpp
|
||||
MistController_LDADD=-ljson -lsocket -lprocs -lmd5 -lconfig -lhttp_parser -lauth -lbase64 -lssl -lcrypto
|
||||
MistController_LDADD=-ljson -lsocket -lprocs -lconfig -lhttp_parser -lauth -lbase64 -lssl -lcrypto
|
||||
MistConnRAW_SOURCES=conn_raw.cpp
|
||||
MistConnRAW_LDADD=-lsocket
|
||||
MistConnRTMP_SOURCES=conn_rtmp.cpp server_setup.h
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/// \file AMF_Tester/main.cpp
|
||||
/// \file amf_analyser.cpp
|
||||
/// Debugging tool for AMF data.
|
||||
/// Expects AMF data through stdin, outputs human-readable information to stderr.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/// \file DTSC_Analyser/main.cpp
|
||||
/// \file dtsc_analyser.cpp
|
||||
/// Contains the code for the DTSC Analysing tool.
|
||||
|
||||
#include <fcntl.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/// \file DTSC_Analyser/main.cpp
|
||||
/// Contains the code for the DTSC Analysing tool.
|
||||
/// \file flv_analyser.cpp
|
||||
/// Contains the code for the FLV Analysing tool.
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <iostream>
|
||||
|
@ -12,40 +12,12 @@
|
|||
#include <signal.h>
|
||||
#include "../../lib/flv_tag.h" //FLV support
|
||||
|
||||
/// Reads DTSC from stdin and outputs human-readable information to stderr.
|
||||
/// Reads FLV from stdin and outputs human-readable information to stderr.
|
||||
int main() {
|
||||
|
||||
FLV::Tag FLV_in; // Temporary storage for incoming FLV data.
|
||||
|
||||
|
||||
while (!feof(stdin)){
|
||||
if (FLV_in.FileLoader(stdin)){
|
||||
std::cout << "Tag: " << FLV_in.tagType() << std::endl;
|
||||
printf("%hhX %hhX %hhX %hhX %hhX %hhX %hhX %hhX %hhX %hhX\n", FLV_in.data[11], FLV_in.data[12], FLV_in.data[13], FLV_in.data[14], FLV_in.data[15], FLV_in.data[16], FLV_in.data[17], FLV_in.data[18], FLV_in.data[19], FLV_in.data[20]);
|
||||
printf("%hhX %hhX %hhX %hhX %hhX %hhX %hhX %hhX %hhX %hhX\n", FLV_in.data[FLV_in.len-10], FLV_in.data[FLV_in.len-9], FLV_in.data[FLV_in.len-8], FLV_in.data[FLV_in.len-7], FLV_in.data[FLV_in.len-6], FLV_in.data[FLV_in.len-5], FLV_in.data[FLV_in.len-4], FLV_in.data[FLV_in.len-3], FLV_in.data[FLV_in.len-2], FLV_in.data[FLV_in.len-1]);
|
||||
std::cout << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DTSC::Stream Strm;
|
||||
|
||||
std::string inBuffer;
|
||||
char charBuffer[1024*10];
|
||||
unsigned int charCount;
|
||||
bool doneheader = false;
|
||||
|
||||
while(std::cin.good()){
|
||||
//invalidate the current buffer
|
||||
std::cin.read(charBuffer, 1024*10);
|
||||
charCount = std::cin.gcount();
|
||||
inBuffer.append(charBuffer, charCount);
|
||||
if (Strm.parsePacket(inBuffer)){
|
||||
if (!doneheader){
|
||||
doneheader = true;
|
||||
Strm.metadata.Print();
|
||||
}
|
||||
Strm.getPacket().Print();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/// \file RTMP_Parser/main.cpp
|
||||
/// \file rtmp_analyser.cpp
|
||||
/// Debugging tool for RTMP data.
|
||||
/// Expects RTMP data of one side of the conversion through stdin, outputs human-readable information to stderr.
|
||||
/// Automatically skips 3073 bytes of handshake data.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/// \file Buffer/main.cpp
|
||||
/// \file buffer.cpp
|
||||
/// Contains the main code for the Buffer.
|
||||
|
||||
#include <fcntl.h>
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
#include "buffer_stats.h"
|
||||
#include <stdlib.h> //for atoi()
|
||||
|
||||
Buffer::Stats::Stats(){
|
||||
up = 0;
|
||||
down = 0;
|
||||
conntime = 0;
|
||||
}
|
||||
|
||||
Buffer::Stats::Stats(std::string s){
|
||||
size_t f = s.find(' ');
|
||||
if (f != std::string::npos){
|
||||
host = s.substr(0, f);
|
||||
s.erase(0, f+1);
|
||||
}
|
||||
f = s.find(' ');
|
||||
if (f != std::string::npos){
|
||||
connector = s.substr(0, f);
|
||||
s.erase(0, f+1);
|
||||
}
|
||||
f = s.find(' ');
|
||||
if (f != std::string::npos){
|
||||
conntime = atoi(s.substr(0, f).c_str());
|
||||
s.erase(0, f+1);
|
||||
}
|
||||
f = s.find(' ');
|
||||
if (f != std::string::npos){
|
||||
up = atoi(s.substr(0, f).c_str());
|
||||
s.erase(0, f+1);
|
||||
down = atoi(s.c_str());
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
|
||||
namespace Buffer{
|
||||
/// Converts a stats line to up, down, host, connector and conntime values.
|
||||
class Stats{
|
||||
public:
|
||||
unsigned int up;
|
||||
unsigned int down;
|
||||
std::string host;
|
||||
std::string connector;
|
||||
unsigned int conntime;
|
||||
Stats();
|
||||
Stats(std::string s);
|
||||
};
|
||||
}
|
|
@ -1,3 +1,6 @@
|
|||
/// \file buffer_stream.cpp
|
||||
/// Contains definitions for buffer streams.
|
||||
|
||||
#include "buffer_stream.h"
|
||||
|
||||
/// Stores the globally equal reference.
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/// \file buffer_stream.h
|
||||
/// Contains definitions for buffer streams.
|
||||
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include "../lib/tinythread.h"
|
||||
|
@ -5,6 +8,7 @@
|
|||
#include "buffer_user.h"
|
||||
|
||||
namespace Buffer{
|
||||
/// Keeps track of a single streams inputs and outputs, taking care of thread safety and all other related issues.
|
||||
class Stream{
|
||||
public:
|
||||
/// Get a reference to this Stream object.
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
/// \file buffer_user.cpp
|
||||
/// Contains code for buffer users.
|
||||
|
||||
#include "buffer_user.h"
|
||||
#include "buffer_stream.h"
|
||||
#include <sstream>
|
||||
#include <stdlib.h> //for atoi and friends
|
||||
|
||||
int Buffer::user::UserCount = 0;
|
||||
|
||||
|
@ -74,3 +78,35 @@ void Buffer::user::Send(){
|
|||
}//completed a send
|
||||
Stream::get()->dropReadLock();
|
||||
}//send
|
||||
|
||||
/// Default constructor - should not be in use.
|
||||
Buffer::Stats::Stats(){
|
||||
up = 0;
|
||||
down = 0;
|
||||
conntime = 0;
|
||||
}
|
||||
|
||||
/// Reads a stats string and parses it to the internal representation.
|
||||
Buffer::Stats::Stats(std::string s){
|
||||
size_t f = s.find(' ');
|
||||
if (f != std::string::npos){
|
||||
host = s.substr(0, f);
|
||||
s.erase(0, f+1);
|
||||
}
|
||||
f = s.find(' ');
|
||||
if (f != std::string::npos){
|
||||
connector = s.substr(0, f);
|
||||
s.erase(0, f+1);
|
||||
}
|
||||
f = s.find(' ');
|
||||
if (f != std::string::npos){
|
||||
conntime = atoi(s.substr(0, f).c_str());
|
||||
s.erase(0, f+1);
|
||||
}
|
||||
f = s.find(' ');
|
||||
if (f != std::string::npos){
|
||||
up = atoi(s.substr(0, f).c_str());
|
||||
s.erase(0, f+1);
|
||||
down = atoi(s.c_str());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,25 @@
|
|||
/// \file buffer_user.h
|
||||
/// Contains definitions for buffer users.
|
||||
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include "buffer_stats.h"
|
||||
#include "../lib/dtsc.h"
|
||||
#include "../lib/socket.h"
|
||||
#include "../lib/tinythread.h"
|
||||
|
||||
namespace Buffer{
|
||||
/// Converts a stats line to up, down, host, connector and conntime values.
|
||||
class Stats{
|
||||
public:
|
||||
unsigned int up;
|
||||
unsigned int down;
|
||||
std::string host;
|
||||
std::string connector;
|
||||
unsigned int conntime;
|
||||
Stats();
|
||||
Stats(std::string s);
|
||||
};
|
||||
|
||||
/// Holds connected users.
|
||||
/// Keeps track of what buffer users are using and the connection status.
|
||||
class user{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/// \file Connector_HTTP/main.cpp
|
||||
/// \file conn_http.cpp
|
||||
/// Contains the main code for the HTTP Connector
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/// \file Connector_RAW/main.cpp
|
||||
/// \file conn_raw.cpp
|
||||
/// Contains the main code for the RAW connector.
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/// \file Connector_RTMP/main.cpp
|
||||
/// \file conn_rtmp.cpp
|
||||
/// Contains the main code for the RTMP Connector
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/// \file controller.cpp
|
||||
/// Contains all code for the controller executable.
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
@ -21,9 +24,9 @@
|
|||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
#include <sstream>
|
||||
#include <openssl/md5.h>
|
||||
#include "../lib/socket.h"
|
||||
#include "../lib/http_parser.h"
|
||||
#include "../lib/md5.h"
|
||||
#include "../lib/json.h"
|
||||
#include "../lib/procs.h"
|
||||
#include "../lib/config.h"
|
||||
|
@ -61,6 +64,17 @@ void signal_handler (int signum){
|
|||
API_Socket.close();
|
||||
}//signal_handler
|
||||
|
||||
/// Wrapper function for openssl MD5 implementation
|
||||
std::string md5(std::string input){
|
||||
char tmp[3];
|
||||
std::string ret;
|
||||
const unsigned char * res = MD5((const unsigned char*)input.c_str(), input.length(), 0);
|
||||
for (int i = 0; i < 16; ++i){
|
||||
snprintf(tmp, 3, "%02x", res[i]);
|
||||
ret += tmp;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
JSON::Value Storage; ///< Global storage of data.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/// \file DTSC2FLV/main.cpp
|
||||
/// \file dtsc2flv.cpp
|
||||
/// Contains the code that will transform any valid DTSC input into valid FLVs.
|
||||
|
||||
#include <iostream>
|
||||
|
@ -14,7 +14,7 @@
|
|||
#include "../../lib/dtsc.h" //DTSC support
|
||||
#include "../../lib/amf.h" //AMF support
|
||||
|
||||
/// Holds all code that converts filetypes to DTSC.
|
||||
/// Holds all code that converts filetypes to/from DTSC.
|
||||
namespace Converters{
|
||||
|
||||
/// Reads DTSC from STDIN, outputs FLV to STDOUT.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/// \file FLV2DTSC/main.cpp
|
||||
/// \file flv2dtsc.cpp
|
||||
/// Contains the code that will transform any valid FLV input into valid DTSC.
|
||||
|
||||
#include <iostream>
|
||||
|
@ -14,7 +14,7 @@
|
|||
#include "../../lib/dtsc.h" //DTSC support
|
||||
#include "../../lib/amf.h" //AMF support
|
||||
|
||||
/// Holds all code that converts filetypes to DTSC.
|
||||
/// Holds all code that converts filetypes to/from to DTSC.
|
||||
namespace Converters{
|
||||
|
||||
/// Reads FLV from STDIN, outputs DTSC to STDOUT.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/// \file server_setup.cpp
|
||||
/// \file server_setup.h
|
||||
/// Contains generic functions for setting up a DDVTECH Connector.
|
||||
|
||||
#ifndef MAINHANDLER
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue