Initial repository load.
This commit is contained in:
commit
604e196fbb
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
Debug
|
||||
Release
|
||||
*.o
|
||||
*~
|
||||
*.mk
|
||||
libCoreUtils.a
|
152
CoreUtils.mk
Normal file
152
CoreUtils.mk
Normal file
@ -0,0 +1,152 @@
|
||||
##
|
||||
## Auto Generated makefile by CodeLite IDE
|
||||
## any manual changes will be erased
|
||||
##
|
||||
## Debug
|
||||
ProjectName :=CoreUtils
|
||||
ConfigurationName :=Debug
|
||||
WorkspacePath :=/home/bradarant/barant
|
||||
ProjectPath :=/home/bradarant/barant/CoreUtils
|
||||
IntermediateDirectory :=./Debug
|
||||
OutDir := $(IntermediateDirectory)
|
||||
CurrentFileName :=
|
||||
CurrentFilePath :=
|
||||
CurrentFileFullPath :=
|
||||
User :=Brad Arant
|
||||
Date :=10/07/19
|
||||
CodeLitePath :=/home/bradarant/.codelite
|
||||
LinkerName :=/usr/bin/x86_64-linux-gnu-g++
|
||||
SharedObjectLinkerName :=/usr/bin/x86_64-linux-gnu-g++ -shared -fPIC
|
||||
ObjectSuffix :=.o
|
||||
DependSuffix :=.o.d
|
||||
PreprocessSuffix :=.i
|
||||
DebugSwitch :=-g
|
||||
IncludeSwitch :=-I
|
||||
LibrarySwitch :=-l
|
||||
OutputSwitch :=-o
|
||||
LibraryPathSwitch :=-L
|
||||
PreprocessorSwitch :=-D
|
||||
SourceSwitch :=-c
|
||||
OutputFile :=$(IntermediateDirectory)/lib$(ProjectName).a
|
||||
Preprocessors :=
|
||||
ObjectSwitch :=-o
|
||||
ArchiveOutputSwitch :=
|
||||
PreprocessOnlySwitch :=-E
|
||||
ObjectsFileList :="CoreUtils.txt"
|
||||
PCHCompileFlags :=
|
||||
MakeDirCommand :=mkdir -p
|
||||
LinkOptions :=
|
||||
IncludePath := $(IncludeSwitch). $(IncludeSwitch). $(IncludeSwitch)../ServerCore
|
||||
IncludePCH :=
|
||||
RcIncludePath :=
|
||||
Libs :=
|
||||
ArLibs :=
|
||||
LibPath := $(LibraryPathSwitch).
|
||||
|
||||
##
|
||||
## Common variables
|
||||
## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables
|
||||
##
|
||||
AR := /usr/bin/x86_64-linux-gnu-ar rcu
|
||||
CXX := /usr/bin/x86_64-linux-gnu-g++
|
||||
CC := /usr/bin/x86_64-linux-gnu-gcc
|
||||
CXXFLAGS := -g $(Preprocessors)
|
||||
CFLAGS := -g $(Preprocessors)
|
||||
ASFLAGS :=
|
||||
AS := /usr/bin/x86_64-linux-gnu-as
|
||||
|
||||
|
||||
##
|
||||
## User defined environment variables
|
||||
##
|
||||
CodeLiteDir:=/usr/share/codelite
|
||||
Objects0=$(IntermediateDirectory)/IMFHeader.cpp$(ObjectSuffix) $(IntermediateDirectory)/PString.cpp$(ObjectSuffix) $(IntermediateDirectory)/IMFMultipart.cpp$(ObjectSuffix) $(IntermediateDirectory)/IMFMessage.cpp$(ObjectSuffix) $(IntermediateDirectory)/IMFRequest.cpp$(ObjectSuffix) $(IntermediateDirectory)/IMFResponse.cpp$(ObjectSuffix)
|
||||
|
||||
|
||||
|
||||
Objects=$(Objects0)
|
||||
|
||||
##
|
||||
## Main Build Targets
|
||||
##
|
||||
.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs
|
||||
all: $(IntermediateDirectory) $(OutputFile)
|
||||
|
||||
$(OutputFile): $(Objects)
|
||||
@$(MakeDirCommand) $(@D)
|
||||
@echo "" > $(IntermediateDirectory)/.d
|
||||
@echo $(Objects0) > $(ObjectsFileList)
|
||||
$(AR) $(ArchiveOutputSwitch)$(OutputFile) @$(ObjectsFileList) $(ArLibs)
|
||||
@$(MakeDirCommand) "/home/bradarant/barant/.build-debug"
|
||||
@echo rebuilt > "/home/bradarant/barant/.build-debug/CoreUtils"
|
||||
|
||||
MakeIntermediateDirs:
|
||||
@test -d ./Debug || $(MakeDirCommand) ./Debug
|
||||
|
||||
|
||||
./Debug:
|
||||
@test -d ./Debug || $(MakeDirCommand) ./Debug
|
||||
|
||||
PreBuild:
|
||||
|
||||
|
||||
##
|
||||
## Objects
|
||||
##
|
||||
$(IntermediateDirectory)/IMFHeader.cpp$(ObjectSuffix): IMFHeader.cpp $(IntermediateDirectory)/IMFHeader.cpp$(DependSuffix)
|
||||
$(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/CoreUtils/IMFHeader.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/IMFHeader.cpp$(ObjectSuffix) $(IncludePath)
|
||||
$(IntermediateDirectory)/IMFHeader.cpp$(DependSuffix): IMFHeader.cpp
|
||||
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/IMFHeader.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/IMFHeader.cpp$(DependSuffix) -MM IMFHeader.cpp
|
||||
|
||||
$(IntermediateDirectory)/IMFHeader.cpp$(PreprocessSuffix): IMFHeader.cpp
|
||||
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/IMFHeader.cpp$(PreprocessSuffix) IMFHeader.cpp
|
||||
|
||||
$(IntermediateDirectory)/PString.cpp$(ObjectSuffix): PString.cpp $(IntermediateDirectory)/PString.cpp$(DependSuffix)
|
||||
$(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/CoreUtils/PString.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PString.cpp$(ObjectSuffix) $(IncludePath)
|
||||
$(IntermediateDirectory)/PString.cpp$(DependSuffix): PString.cpp
|
||||
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PString.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PString.cpp$(DependSuffix) -MM PString.cpp
|
||||
|
||||
$(IntermediateDirectory)/PString.cpp$(PreprocessSuffix): PString.cpp
|
||||
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PString.cpp$(PreprocessSuffix) PString.cpp
|
||||
|
||||
$(IntermediateDirectory)/IMFMultipart.cpp$(ObjectSuffix): IMFMultipart.cpp $(IntermediateDirectory)/IMFMultipart.cpp$(DependSuffix)
|
||||
$(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/CoreUtils/IMFMultipart.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/IMFMultipart.cpp$(ObjectSuffix) $(IncludePath)
|
||||
$(IntermediateDirectory)/IMFMultipart.cpp$(DependSuffix): IMFMultipart.cpp
|
||||
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/IMFMultipart.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/IMFMultipart.cpp$(DependSuffix) -MM IMFMultipart.cpp
|
||||
|
||||
$(IntermediateDirectory)/IMFMultipart.cpp$(PreprocessSuffix): IMFMultipart.cpp
|
||||
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/IMFMultipart.cpp$(PreprocessSuffix) IMFMultipart.cpp
|
||||
|
||||
$(IntermediateDirectory)/IMFMessage.cpp$(ObjectSuffix): IMFMessage.cpp $(IntermediateDirectory)/IMFMessage.cpp$(DependSuffix)
|
||||
$(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/CoreUtils/IMFMessage.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/IMFMessage.cpp$(ObjectSuffix) $(IncludePath)
|
||||
$(IntermediateDirectory)/IMFMessage.cpp$(DependSuffix): IMFMessage.cpp
|
||||
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/IMFMessage.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/IMFMessage.cpp$(DependSuffix) -MM IMFMessage.cpp
|
||||
|
||||
$(IntermediateDirectory)/IMFMessage.cpp$(PreprocessSuffix): IMFMessage.cpp
|
||||
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/IMFMessage.cpp$(PreprocessSuffix) IMFMessage.cpp
|
||||
|
||||
$(IntermediateDirectory)/IMFRequest.cpp$(ObjectSuffix): IMFRequest.cpp $(IntermediateDirectory)/IMFRequest.cpp$(DependSuffix)
|
||||
$(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/CoreUtils/IMFRequest.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/IMFRequest.cpp$(ObjectSuffix) $(IncludePath)
|
||||
$(IntermediateDirectory)/IMFRequest.cpp$(DependSuffix): IMFRequest.cpp
|
||||
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/IMFRequest.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/IMFRequest.cpp$(DependSuffix) -MM IMFRequest.cpp
|
||||
|
||||
$(IntermediateDirectory)/IMFRequest.cpp$(PreprocessSuffix): IMFRequest.cpp
|
||||
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/IMFRequest.cpp$(PreprocessSuffix) IMFRequest.cpp
|
||||
|
||||
$(IntermediateDirectory)/IMFResponse.cpp$(ObjectSuffix): IMFResponse.cpp $(IntermediateDirectory)/IMFResponse.cpp$(DependSuffix)
|
||||
$(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/CoreUtils/IMFResponse.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/IMFResponse.cpp$(ObjectSuffix) $(IncludePath)
|
||||
$(IntermediateDirectory)/IMFResponse.cpp$(DependSuffix): IMFResponse.cpp
|
||||
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/IMFResponse.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/IMFResponse.cpp$(DependSuffix) -MM IMFResponse.cpp
|
||||
|
||||
$(IntermediateDirectory)/IMFResponse.cpp$(PreprocessSuffix): IMFResponse.cpp
|
||||
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/IMFResponse.cpp$(PreprocessSuffix) IMFResponse.cpp
|
||||
|
||||
|
||||
-include $(IntermediateDirectory)/*$(DependSuffix)
|
||||
##
|
||||
## Clean
|
||||
##
|
||||
clean:
|
||||
$(RM) -r ./Debug/
|
||||
|
||||
|
111
CoreUtils.project
Normal file
111
CoreUtils.project
Normal file
@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CodeLite_Project Name="CoreUtils" Version="10.0.0" InternalType="Library">
|
||||
<Description/>
|
||||
<Dependencies/>
|
||||
<VirtualDirectory Name="src">
|
||||
<File Name="IMFMessage.h"/>
|
||||
<File Name="IMFHeader.h"/>
|
||||
<File Name="IMFHeader.cpp"/>
|
||||
<File Name="includes"/>
|
||||
<File Name="PString.h"/>
|
||||
<File Name="PString.cpp"/>
|
||||
<File Name="IMFMultipart.h"/>
|
||||
<File Name="IMFMultipart.cpp"/>
|
||||
<File Name="IMFMessage.cpp"/>
|
||||
<File Name="IMFRequest.h"/>
|
||||
<File Name="IMFRequest.cpp"/>
|
||||
<File Name="IMFResponse.h"/>
|
||||
<File Name="IMFResponse.cpp"/>
|
||||
<File Name="IMFBody.h"/>
|
||||
</VirtualDirectory>
|
||||
<Settings Type="Static Library">
|
||||
<GlobalSettings>
|
||||
<Compiler Options="" C_Options="" Assembler="">
|
||||
<IncludePath Value="."/>
|
||||
</Compiler>
|
||||
<Linker Options="">
|
||||
<LibraryPath Value="."/>
|
||||
</Linker>
|
||||
<ResourceCompiler Options=""/>
|
||||
</GlobalSettings>
|
||||
<Configuration Name="Debug" CompilerType="Cross GCC ( x86_64-linux-gnu )" DebuggerType="GNU gdb debugger" Type="Static Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
|
||||
<Compiler Options="-g" C_Options="-g" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0">
|
||||
<IncludePath Value="."/>
|
||||
<IncludePath Value="../ServerCore"/>
|
||||
</Compiler>
|
||||
<Linker Options="" Required="yes"/>
|
||||
<ResourceCompiler Options="" Required="no"/>
|
||||
<General OutputFile="$(IntermediateDirectory)/lib$(ProjectName).a" IntermediateDirectory="./Debug" Command="" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
|
||||
<BuildSystem Name="Default"/>
|
||||
<Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>">
|
||||
<![CDATA[]]>
|
||||
</Environment>
|
||||
<Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="yes">
|
||||
<DebuggerSearchPaths/>
|
||||
<PostConnectCommands/>
|
||||
<StartupCommands/>
|
||||
</Debugger>
|
||||
<PreBuild/>
|
||||
<PostBuild/>
|
||||
<CustomBuild Enabled="no">
|
||||
<RebuildCommand/>
|
||||
<CleanCommand/>
|
||||
<BuildCommand/>
|
||||
<PreprocessFileCommand/>
|
||||
<SingleFileCommand/>
|
||||
<MakefileGenerationCommand/>
|
||||
<ThirdPartyToolName/>
|
||||
<WorkingDirectory/>
|
||||
</CustomBuild>
|
||||
<AdditionalRules>
|
||||
<CustomPostBuild/>
|
||||
<CustomPreBuild/>
|
||||
</AdditionalRules>
|
||||
<Completion EnableCpp11="no" EnableCpp14="no">
|
||||
<ClangCmpFlagsC/>
|
||||
<ClangCmpFlags/>
|
||||
<ClangPP/>
|
||||
<SearchPaths/>
|
||||
</Completion>
|
||||
</Configuration>
|
||||
<Configuration Name="Release" CompilerType="Cross GCC ( x86_64-linux-gnu )" DebuggerType="GNU gdb debugger" Type="Static Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
|
||||
<Compiler Options="" C_Options="" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0">
|
||||
<IncludePath Value="."/>
|
||||
</Compiler>
|
||||
<Linker Options="" Required="yes"/>
|
||||
<ResourceCompiler Options="" Required="no"/>
|
||||
<General OutputFile="$(IntermediateDirectory)/lib$(ProjectName).a" IntermediateDirectory="./Release" Command="" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
|
||||
<BuildSystem Name="Default"/>
|
||||
<Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>">
|
||||
<![CDATA[]]>
|
||||
</Environment>
|
||||
<Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="yes">
|
||||
<DebuggerSearchPaths/>
|
||||
<PostConnectCommands/>
|
||||
<StartupCommands/>
|
||||
</Debugger>
|
||||
<PreBuild/>
|
||||
<PostBuild/>
|
||||
<CustomBuild Enabled="no">
|
||||
<RebuildCommand/>
|
||||
<CleanCommand/>
|
||||
<BuildCommand/>
|
||||
<PreprocessFileCommand/>
|
||||
<SingleFileCommand/>
|
||||
<MakefileGenerationCommand/>
|
||||
<ThirdPartyToolName/>
|
||||
<WorkingDirectory/>
|
||||
</CustomBuild>
|
||||
<AdditionalRules>
|
||||
<CustomPostBuild/>
|
||||
<CustomPreBuild/>
|
||||
</AdditionalRules>
|
||||
<Completion EnableCpp11="no" EnableCpp14="no">
|
||||
<ClangCmpFlagsC/>
|
||||
<ClangCmpFlags/>
|
||||
<ClangPP/>
|
||||
<SearchPaths/>
|
||||
</Completion>
|
||||
</Configuration>
|
||||
</Settings>
|
||||
</CodeLite_Project>
|
1
CoreUtils.txt
Normal file
1
CoreUtils.txt
Normal file
@ -0,0 +1 @@
|
||||
./Debug/IMFHeader.cpp.o ./Debug/PString.cpp.o ./Debug/IMFMultipart.cpp.o ./Debug/IMFMessage.cpp.o ./Debug/IMFRequest.cpp.o ./Debug/IMFResponse.cpp.o
|
BIN
Debug/IMFHeader.cpp.o
Normal file
BIN
Debug/IMFHeader.cpp.o
Normal file
Binary file not shown.
12
Debug/IMFHeader.cpp.o.d
Normal file
12
Debug/IMFHeader.cpp.o.d
Normal file
@ -0,0 +1,12 @@
|
||||
Debug/IMFHeader.cpp.o: IMFHeader.cpp IMFHeader.h PString.h includes \
|
||||
../ServerCore/Exception.h ../ServerCore/includes
|
||||
|
||||
IMFHeader.h:
|
||||
|
||||
PString.h:
|
||||
|
||||
includes:
|
||||
|
||||
../ServerCore/Exception.h:
|
||||
|
||||
../ServerCore/includes:
|
BIN
Debug/IMFMessage.cpp.o
Normal file
BIN
Debug/IMFMessage.cpp.o
Normal file
Binary file not shown.
16
Debug/IMFMessage.cpp.o.d
Normal file
16
Debug/IMFMessage.cpp.o.d
Normal file
@ -0,0 +1,16 @@
|
||||
Debug/IMFMessage.cpp.o: IMFMessage.cpp IMFMessage.h PString.h includes \
|
||||
IMFHeader.h IMFRequest.h IMFBody.h IMFMultipart.h
|
||||
|
||||
IMFMessage.h:
|
||||
|
||||
PString.h:
|
||||
|
||||
includes:
|
||||
|
||||
IMFHeader.h:
|
||||
|
||||
IMFRequest.h:
|
||||
|
||||
IMFBody.h:
|
||||
|
||||
IMFMultipart.h:
|
BIN
Debug/IMFMultipart.cpp.o
Normal file
BIN
Debug/IMFMultipart.cpp.o
Normal file
Binary file not shown.
10
Debug/IMFMultipart.cpp.o.d
Normal file
10
Debug/IMFMultipart.cpp.o.d
Normal file
@ -0,0 +1,10 @@
|
||||
Debug/IMFMultipart.cpp.o: IMFMultipart.cpp IMFMultipart.h PString.h \
|
||||
includes IMFBody.h
|
||||
|
||||
IMFMultipart.h:
|
||||
|
||||
PString.h:
|
||||
|
||||
includes:
|
||||
|
||||
IMFBody.h:
|
BIN
Debug/IMFRequest.cpp.o
Normal file
BIN
Debug/IMFRequest.cpp.o
Normal file
Binary file not shown.
12
Debug/IMFRequest.cpp.o.d
Normal file
12
Debug/IMFRequest.cpp.o.d
Normal file
@ -0,0 +1,12 @@
|
||||
Debug/IMFRequest.cpp.o: IMFRequest.cpp IMFRequest.h PString.h includes \
|
||||
../ServerCore/Exception.h ../ServerCore/includes
|
||||
|
||||
IMFRequest.h:
|
||||
|
||||
PString.h:
|
||||
|
||||
includes:
|
||||
|
||||
../ServerCore/Exception.h:
|
||||
|
||||
../ServerCore/includes:
|
BIN
Debug/IMFResponse.cpp.o
Normal file
BIN
Debug/IMFResponse.cpp.o
Normal file
Binary file not shown.
26
Debug/IMFResponse.cpp.o.d
Normal file
26
Debug/IMFResponse.cpp.o.d
Normal file
@ -0,0 +1,26 @@
|
||||
Debug/IMFResponse.cpp.o: IMFResponse.cpp IMFResponse.h includes \
|
||||
IMFMessage.h PString.h IMFHeader.h IMFRequest.h IMFBody.h \
|
||||
../ServerCore/Log.h ../ServerCore/includes ../ServerCore/File.h \
|
||||
../ServerCore/Object.h
|
||||
|
||||
IMFResponse.h:
|
||||
|
||||
includes:
|
||||
|
||||
IMFMessage.h:
|
||||
|
||||
PString.h:
|
||||
|
||||
IMFHeader.h:
|
||||
|
||||
IMFRequest.h:
|
||||
|
||||
IMFBody.h:
|
||||
|
||||
../ServerCore/Log.h:
|
||||
|
||||
../ServerCore/includes:
|
||||
|
||||
../ServerCore/File.h:
|
||||
|
||||
../ServerCore/Object.h:
|
BIN
Debug/PString.cpp.o
Normal file
BIN
Debug/PString.cpp.o
Normal file
Binary file not shown.
14
Debug/PString.cpp.o.d
Normal file
14
Debug/PString.cpp.o.d
Normal file
@ -0,0 +1,14 @@
|
||||
Debug/PString.cpp.o: PString.cpp PString.h includes ../ServerCore/Log.h \
|
||||
../ServerCore/includes ../ServerCore/File.h ../ServerCore/Object.h
|
||||
|
||||
PString.h:
|
||||
|
||||
includes:
|
||||
|
||||
../ServerCore/Log.h:
|
||||
|
||||
../ServerCore/includes:
|
||||
|
||||
../ServerCore/File.h:
|
||||
|
||||
../ServerCore/Object.h:
|
BIN
Debug/libCoreUtils.a
Normal file
BIN
Debug/libCoreUtils.a
Normal file
Binary file not shown.
10
IMFBody.h
Normal file
10
IMFBody.h
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef __IMFBody_h__
|
||||
#define __IMFBody_h__
|
||||
|
||||
namespace coreutils {
|
||||
|
||||
class IMFBody {};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
45
IMFHeader.cpp
Normal file
45
IMFHeader.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
#include "IMFHeader.h"
|
||||
#include "Exception.h"
|
||||
|
||||
namespace coreutils {
|
||||
|
||||
IMFHeader::IMFHeader() {
|
||||
|
||||
}
|
||||
|
||||
IMFHeader::IMFHeader(PString &in) {
|
||||
key = in.getTokenInclude("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-");
|
||||
if(!in.ifNext(":"))
|
||||
throw core::Exception("Invalid character in expected header token.");
|
||||
in.skipWhitespace();
|
||||
value = in.getTokenExclude("\r\n");
|
||||
if(!in.ifNext("\r\n"))
|
||||
throw core::Exception("Expected CRLF.");
|
||||
}
|
||||
|
||||
IMFHeader::IMFHeader(std::string key, std::string value) {
|
||||
this->key = key;
|
||||
this->value = value;
|
||||
}
|
||||
|
||||
std::string IMFHeader::getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
void IMFHeader::setKey(std::string key) {
|
||||
this->key = key;
|
||||
}
|
||||
|
||||
std::string IMFHeader::getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
void IMFHeader::setValue(std::string value) {
|
||||
this->value = value;
|
||||
}
|
||||
|
||||
void IMFHeader::output(std::stringstream &out) {
|
||||
out << key << ": " << value << "\r\n";
|
||||
}
|
||||
|
||||
}
|
30
IMFHeader.h
Normal file
30
IMFHeader.h
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef __IMFHeader_h__
|
||||
#define __IMFHeader_h__
|
||||
|
||||
#include "PString.h"
|
||||
|
||||
namespace coreutils {
|
||||
|
||||
class IMFHeader {
|
||||
|
||||
public:
|
||||
IMFHeader();
|
||||
IMFHeader(PString &in);
|
||||
IMFHeader(std::string key, std::string value);
|
||||
|
||||
std::string getKey();
|
||||
void setKey(std::string name);
|
||||
std::string getValue();
|
||||
void setValue(std::string value);
|
||||
|
||||
void output(std::stringstream &out);
|
||||
|
||||
private:
|
||||
std::string key;
|
||||
std::string value;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
75
IMFMessage.cpp
Normal file
75
IMFMessage.cpp
Normal file
@ -0,0 +1,75 @@
|
||||
#include "IMFMessage.h"
|
||||
#include "IMFHeader.h"
|
||||
#include "IMFMultipart.h"
|
||||
|
||||
namespace coreutils {
|
||||
|
||||
IMFMessage::IMFMessage() {}
|
||||
|
||||
IMFMessage::IMFMessage(PString &in) {
|
||||
parse(in);
|
||||
}
|
||||
|
||||
void IMFMessage::parse(PString &in) {
|
||||
while(!in.ifNext("\r\n"))
|
||||
headers.emplace_back(in);
|
||||
|
||||
std::string type = getHeader("Content-Type");
|
||||
|
||||
if(type == "multipart/form-data")
|
||||
body = new IMFMultipart(in, getHeaderKeyPairValue("Content-Type", "boundary"));
|
||||
else
|
||||
body = new IMFBody();
|
||||
}
|
||||
|
||||
void IMFMessage::output(std::stringstream &out) {
|
||||
for(IMFHeader header: headers) {
|
||||
out << header.getKey() << ": " << header.getValue() << "\r\n";
|
||||
}
|
||||
out << "\r\n";
|
||||
}
|
||||
|
||||
void IMFMessage::addHeader(std::string key, std::string value) {
|
||||
headers.emplace_back(key, value);
|
||||
|
||||
}
|
||||
|
||||
std::string IMFMessage::getHeader(std::string key, bool valueOnly) {
|
||||
for(IMFHeader header: headers) {
|
||||
if(header.getKey() == key) {
|
||||
std::string value = header.getValue();
|
||||
if(valueOnly) {
|
||||
std::vector<std::string> split = PString(value).split(";");
|
||||
value = split[0];
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return std::string("");
|
||||
}
|
||||
|
||||
std::string IMFMessage::getHeaderKeyPairValue(std::string headerKey, std::string key) {
|
||||
coreutils::PString psource(getHeader(headerKey, false));
|
||||
std::vector<std::string> sourcep = psource.split(";");
|
||||
for(std::string keyx: sourcep) {
|
||||
PString work(keyx);
|
||||
work.skipWhitespace();
|
||||
std::string token = work.getTokenExclude("=");
|
||||
if(work.ifNext("=")) {
|
||||
if(token == key)
|
||||
return work.str();
|
||||
else
|
||||
continue;
|
||||
|
||||
} else if (work.ifNext(";") || work.ifNext(" ")) {
|
||||
if(token == key)
|
||||
return std::string("true");
|
||||
else
|
||||
continue;
|
||||
|
||||
}
|
||||
}
|
||||
return std::string("false");
|
||||
}
|
||||
|
||||
}
|
36
IMFMessage.h
Normal file
36
IMFMessage.h
Normal file
@ -0,0 +1,36 @@
|
||||
#ifndef __IMFMessage_h__
|
||||
#define __IMFMessage_h__
|
||||
|
||||
#include "PString.h"
|
||||
#include "IMFHeader.h"
|
||||
#include "IMFRequest.h"
|
||||
#include "IMFBody.h"
|
||||
|
||||
namespace coreutils {
|
||||
|
||||
class IMFMessage {
|
||||
|
||||
public:
|
||||
IMFMessage();
|
||||
IMFMessage(PString &in);
|
||||
|
||||
void parse(PString &in);
|
||||
|
||||
void output(std::stringstream &out);
|
||||
IMFRequest *request;
|
||||
|
||||
void addHeader(std::string key, std::string value);
|
||||
|
||||
std::string getHeader(std::string key, bool valueOnly = true);
|
||||
std::string getHeaderKeyPairValue(std::string headerKey, std::string key);
|
||||
|
||||
IMFBody *body;
|
||||
|
||||
protected:
|
||||
std::vector<IMFHeader> headers;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
15
IMFMultipart.cpp
Normal file
15
IMFMultipart.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include "IMFMultipart.h"
|
||||
|
||||
namespace coreutils {
|
||||
|
||||
IMFMultipart::IMFMultipart() {
|
||||
|
||||
}
|
||||
|
||||
IMFMultipart::IMFMultipart(PString &in, std::string boundary) {
|
||||
in.cursor -= 2;
|
||||
section = in.split("\r\n--" + boundary);
|
||||
|
||||
}
|
||||
|
||||
}
|
23
IMFMultipart.h
Normal file
23
IMFMultipart.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef __IMFMultipart_h__
|
||||
#define __IMFMultipart_h__
|
||||
|
||||
#include "PString.h"
|
||||
#include "IMFBody.h"
|
||||
|
||||
namespace coreutils {
|
||||
|
||||
class IMFMultipart: public IMFBody {
|
||||
|
||||
public:
|
||||
IMFMultipart();
|
||||
IMFMultipart(PString &in, std::string boundary);
|
||||
|
||||
private:
|
||||
std::string boundary;
|
||||
std::vector<std::string> section;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
48
IMFRequest.cpp
Normal file
48
IMFRequest.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
#include "IMFRequest.h"
|
||||
#include "Exception.h"
|
||||
|
||||
namespace coreutils {
|
||||
|
||||
IMFRequest::IMFRequest() {}
|
||||
|
||||
IMFRequest::IMFRequest(PString &in) {
|
||||
method = in.getTokenExclude(" ");
|
||||
if(!in.ifNext(" "))
|
||||
throw core::Exception("Expecting space after method.");
|
||||
uri = in.getTokenExclude(" ");
|
||||
if(!in.ifNext(" "))
|
||||
throw core::Exception("Expecting space after URI.");
|
||||
protocol = in.getTokenExclude("\r\n");
|
||||
if(!in.ifNext("\r\n"))
|
||||
throw core::Exception("Expecting CRLF after protocol.");
|
||||
}
|
||||
|
||||
std::string IMFRequest::getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
void IMFRequest::setMethod(std::string method) {
|
||||
this->method = method;
|
||||
}
|
||||
|
||||
std::string IMFRequest::getURI() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
void IMFRequest::setURI(std::string uri) {
|
||||
this->uri = uri;
|
||||
}
|
||||
|
||||
std::string IMFRequest::getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
|
||||
void IMFRequest::setProtocol(std::string protocol) {
|
||||
this->protocol = protocol;
|
||||
}
|
||||
|
||||
void IMFRequest::output(std::stringstream &out) {
|
||||
out << method << " " << uri << " " << protocol << "\r\n";
|
||||
}
|
||||
|
||||
}
|
32
IMFRequest.h
Normal file
32
IMFRequest.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef __IMFRequest_h__
|
||||
#define __IMFRequest_h__
|
||||
|
||||
#include "PString.h"
|
||||
|
||||
namespace coreutils {
|
||||
|
||||
class IMFRequest {
|
||||
|
||||
public:
|
||||
IMFRequest();
|
||||
IMFRequest(PString &in);
|
||||
|
||||
std::string getMethod();
|
||||
void setMethod(std::string method);
|
||||
std::string getURI();
|
||||
void setURI(std::string uri);
|
||||
std::string getProtocol();
|
||||
void setProtocol(std::string protocol);
|
||||
|
||||
void output(std::stringstream &out);
|
||||
|
||||
private:
|
||||
std::string method;
|
||||
std::string uri;
|
||||
std::string protocol;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
44
IMFResponse.cpp
Normal file
44
IMFResponse.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
#include "IMFResponse.h"
|
||||
#include "Log.h"
|
||||
|
||||
namespace coreutils {
|
||||
|
||||
IMFResponse::IMFResponse() {}
|
||||
IMFResponse::~IMFResponse() {}
|
||||
|
||||
std::string IMFResponse::getResponse(Mode mode) {
|
||||
return getResponse("", mode);
|
||||
}
|
||||
|
||||
std::string IMFResponse::getResponse(std::string content, Mode mode) {
|
||||
std::stringstream response;
|
||||
response << protocol << " " << code << " " << text << CRLF;
|
||||
|
||||
if(mode == LENGTH)
|
||||
addHeader("Content-Length", std::to_string(content.size()));
|
||||
else
|
||||
addHeader("Transfer-Encoding", "chunked");
|
||||
|
||||
output(response);
|
||||
response << content;
|
||||
// core::Log(core::LOG_DEBUG_4) << response.str();
|
||||
return response.str();
|
||||
}
|
||||
|
||||
void IMFResponse::setProtocol(std::string protocol) {
|
||||
this->protocol = protocol;
|
||||
}
|
||||
|
||||
void IMFResponse::setCode(std::string code) {
|
||||
this->code = code;
|
||||
}
|
||||
|
||||
void IMFResponse::setText(std::string text) {
|
||||
this->text = text;
|
||||
}
|
||||
|
||||
void IMFResponse::setCookie(std::string name, std::string value) {
|
||||
addHeader("Set-Cookie", name + "=" + value + ";");
|
||||
}
|
||||
|
||||
}
|
97
IMFResponse.h
Normal file
97
IMFResponse.h
Normal file
@ -0,0 +1,97 @@
|
||||
#ifndef __IMFResponse_h__
|
||||
#define __IMFResponse_h__
|
||||
|
||||
#include "includes"
|
||||
#include "IMFMessage.h"
|
||||
|
||||
namespace coreutils {
|
||||
|
||||
///
|
||||
/// IMFResponse
|
||||
///
|
||||
/// Use this object to build a response output for a protocol that uses headers
|
||||
/// and responses as the main communications protocol.
|
||||
///
|
||||
|
||||
class IMFResponse : public IMFMessage {
|
||||
|
||||
public:
|
||||
|
||||
enum Mode { LENGTH, STREAMING };
|
||||
|
||||
///
|
||||
/// The constructor for the object.
|
||||
///
|
||||
|
||||
IMFResponse();
|
||||
|
||||
///
|
||||
/// The destructor for the object.
|
||||
///
|
||||
|
||||
~IMFResponse();
|
||||
|
||||
///
|
||||
/// Returns the response generated from the contained values that
|
||||
/// do not return a content length. Using this constructor ensures
|
||||
/// a zero length Content-Length value.
|
||||
///
|
||||
/// @return the complete response string to send to client.
|
||||
///
|
||||
|
||||
std::string getResponse(Mode mode = LENGTH);
|
||||
|
||||
///
|
||||
/// Returns the response plus the content passed as a parameter.
|
||||
///
|
||||
/// This method will automatically generate the proper Content-Length
|
||||
/// value for the response.
|
||||
///
|
||||
/// @param content the content that will be provided on the response
|
||||
/// message to the client.
|
||||
///
|
||||
/// @return the complete response string to send to client.
|
||||
///
|
||||
|
||||
std::string getResponse(std::string content, Mode mode = LENGTH);
|
||||
|
||||
///
|
||||
/// Sets the protocol value for the response message. The protocol
|
||||
/// should match the header received.
|
||||
///
|
||||
/// @param protocol the protocol value to return in response.
|
||||
///
|
||||
|
||||
void setProtocol(std::string protocol);
|
||||
|
||||
///
|
||||
/// Sets the return code value for the response.
|
||||
///
|
||||
/// @param code the response code value to return in the response.
|
||||
///
|
||||
|
||||
void setCode(std::string code);
|
||||
|
||||
///
|
||||
/// Sets the return code string value for the response.
|
||||
///
|
||||
/// @param text the text value for the response code to return on
|
||||
/// the response.
|
||||
///
|
||||
|
||||
void setText(std::string text);
|
||||
|
||||
void setCookie(std::string name, std::string value);
|
||||
|
||||
private:
|
||||
std::string protocol;
|
||||
std::string code;
|
||||
std::string text;
|
||||
|
||||
std::string CRLF = "\r\n";
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
64
PString.cpp
Normal file
64
PString.cpp
Normal file
@ -0,0 +1,64 @@
|
||||
#include "PString.h"
|
||||
#include "Log.h"
|
||||
|
||||
namespace coreutils {
|
||||
|
||||
PString::PString() {
|
||||
}
|
||||
|
||||
PString::PString(std::string pstring) {
|
||||
this->pstring = pstring;
|
||||
}
|
||||
|
||||
std::string PString::str() {
|
||||
return pstring.substr(cursor);
|
||||
}
|
||||
|
||||
std::vector<std::string> PString::split(std::string delimiter, int maxSize) {
|
||||
std::vector<std::string> list;
|
||||
size_t end,
|
||||
pos = cursor;
|
||||
while(pos < pstring.length()) {
|
||||
end = pstring.find(delimiter, pos);
|
||||
if(end == std::string::npos)
|
||||
end = pstring.length();
|
||||
list.push_back(pstring.substr(pos, end - pos));
|
||||
pos = end + delimiter.size();
|
||||
if(pos > pstring.size())
|
||||
break;
|
||||
if(maxSize != 0) {
|
||||
if(list.size() >= maxSize) {
|
||||
list.push_back(pstring.substr(pos));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
std::string PString::getTokenInclude(std::string include) {
|
||||
int start = cursor;
|
||||
cursor = pstring.find_first_not_of(include, cursor);
|
||||
return pstring.substr(start, cursor - start);
|
||||
}
|
||||
|
||||
std::string PString::getTokenExclude(std::string exclude) {
|
||||
int start = cursor;
|
||||
cursor = pstring.find_first_of(exclude, cursor);
|
||||
if(cursor == -1)
|
||||
cursor = pstring.size();
|
||||
return pstring.substr(start, cursor - start);
|
||||
}
|
||||
|
||||
bool PString::ifNext(std::string value) {
|
||||
bool test = (value == pstring.substr(cursor, value.length()));
|
||||
if(test)
|
||||
cursor += value.size();
|
||||
return test;
|
||||
}
|
||||
|
||||
void PString::skipWhitespace() {
|
||||
cursor = pstring.find_first_not_of(" \t", cursor);
|
||||
}
|
||||
|
||||
}
|
29
PString.h
Normal file
29
PString.h
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef __SString_h__
|
||||
#define __SString_h__
|
||||
|
||||
#include "includes"
|
||||
|
||||
namespace coreutils {
|
||||
|
||||
class PString {
|
||||
|
||||
public:
|
||||
PString();
|
||||
PString(std::string pstring);
|
||||
|
||||
std::string str();
|
||||
std::vector<std::string> split(std::string delimiter, int maxSize = 0);
|
||||
std::string getTokenInclude(std::string include);
|
||||
std::string getTokenExclude(std::string exclude);
|
||||
bool ifNext(std::string value);
|
||||
void skipWhitespace();
|
||||
int cursor = 0;
|
||||
|
||||
private:
|
||||
std::string pstring;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
36
includes
Normal file
36
includes
Normal file
@ -0,0 +1,36 @@
|
||||
#define _GLIBCXX_USE_CXX11_ABI 0
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <thread>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/epoll.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <chrono>
|
||||
#include <ctime>
|
||||
#include <queue>
|
||||
#include <mutex>
|
||||
#include <string.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/timerfd.h>
|
||||
#include <math.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <openssl/err.h>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user