Initial repository load.
This commit is contained in:
commit
1751d431c9
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
Debug
|
||||||
|
Release
|
||||||
|
*.o
|
||||||
|
*~
|
||||||
|
*.mk
|
||||||
|
libBMAMail.a
|
25
BMAIMAPServer.h
Normal file
25
BMAIMAPServer.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#ifndef BMAIMAPServer_h__
|
||||||
|
#define BMAIMAPServer_h__
|
||||||
|
|
||||||
|
#include "includes"
|
||||||
|
#include "BMATCPServerSocket.h"
|
||||||
|
#include "BMACommand.h"
|
||||||
|
class BMATCPSocket;
|
||||||
|
|
||||||
|
class BMAIMAPServer : public BMATCPServerSocket {
|
||||||
|
|
||||||
|
public:
|
||||||
|
BMAIMAPServer(BMAEPoll &ePoll, std::string url, short int port);
|
||||||
|
~BMAIMAPServer();
|
||||||
|
|
||||||
|
BMASession * getSocketAccept();
|
||||||
|
|
||||||
|
void registerCommand(BMACommand &command);
|
||||||
|
|
||||||
|
int processCommand(BMASession *session) override; ///<Output the consoles array to the console.
|
||||||
|
|
||||||
|
std::vector<BMACommand *> commands;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
34
BMAIMAPSession.h
Normal file
34
BMAIMAPSession.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#ifndef __BMAIMAPSession_h__
|
||||||
|
#define __BMAIMAPSession_h__
|
||||||
|
|
||||||
|
#include "BMASession.h"
|
||||||
|
#include "BMAIMAPServer.h"
|
||||||
|
|
||||||
|
///
|
||||||
|
/// BMAIMAPSession
|
||||||
|
///
|
||||||
|
/// Extends the session parameters for this BMATCPSocket derived object.
|
||||||
|
/// Extend the protocol() method in order to define the behavior and
|
||||||
|
/// protocol interaction for this socket which is an IMAP session.
|
||||||
|
///
|
||||||
|
|
||||||
|
class BMAIMAPSession : public BMASession {
|
||||||
|
|
||||||
|
public:
|
||||||
|
BMAIMAPSession(BMAEPoll &ePoll, BMAConsoleServer &server);
|
||||||
|
~BMAIMAPSession();
|
||||||
|
|
||||||
|
virtual void output(std::stringstream &out);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void protocol(char *data, int length) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
BMAConsoleServer &server;
|
||||||
|
enum Status {WELCOME, PROMPT, INPUT, PROCESS, DONE};
|
||||||
|
Status status = WELCOME;
|
||||||
|
void doCommand(std::string request);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
106
BMAMail.project
Normal file
106
BMAMail.project
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<CodeLite_Project Name="BMAMail" Version="10.0.0" InternalType="Console">
|
||||||
|
<Description/>
|
||||||
|
<Dependencies/>
|
||||||
|
<Settings Type="Executable">
|
||||||
|
<GlobalSettings>
|
||||||
|
<Compiler Options="" C_Options="" Assembler="">
|
||||||
|
<IncludePath Value="."/>
|
||||||
|
</Compiler>
|
||||||
|
<Linker Options="">
|
||||||
|
<LibraryPath Value="."/>
|
||||||
|
</Linker>
|
||||||
|
<ResourceCompiler Options=""/>
|
||||||
|
</GlobalSettings>
|
||||||
|
<Configuration Name="Debug" CompilerType="GCC" DebuggerType="GNU gdb debugger" Type="Executable" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
|
||||||
|
<Compiler Options="-g;-O0;-Wall" C_Options="-g;-O0;-Wall" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0">
|
||||||
|
<IncludePath Value="."/>
|
||||||
|
</Compiler>
|
||||||
|
<Linker Options="" Required="yes"/>
|
||||||
|
<ResourceCompiler Options="" Required="no"/>
|
||||||
|
<General OutputFile="$(IntermediateDirectory)/$(ProjectName)" IntermediateDirectory="./Debug" Command="./$(ProjectName)" 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="no">
|
||||||
|
<DebuggerSearchPaths/>
|
||||||
|
<PostConnectCommands/>
|
||||||
|
<StartupCommands/>
|
||||||
|
</Debugger>
|
||||||
|
<PreBuild/>
|
||||||
|
<PostBuild/>
|
||||||
|
<CustomBuild Enabled="no">
|
||||||
|
<RebuildCommand/>
|
||||||
|
<CleanCommand/>
|
||||||
|
<BuildCommand/>
|
||||||
|
<PreprocessFileCommand/>
|
||||||
|
<SingleFileCommand/>
|
||||||
|
<MakefileGenerationCommand/>
|
||||||
|
<ThirdPartyToolName>None</ThirdPartyToolName>
|
||||||
|
<WorkingDirectory/>
|
||||||
|
</CustomBuild>
|
||||||
|
<AdditionalRules>
|
||||||
|
<CustomPostBuild/>
|
||||||
|
<CustomPreBuild/>
|
||||||
|
</AdditionalRules>
|
||||||
|
<Completion EnableCpp11="no" EnableCpp14="no">
|
||||||
|
<ClangCmpFlagsC/>
|
||||||
|
<ClangCmpFlags/>
|
||||||
|
<ClangPP/>
|
||||||
|
<SearchPaths/>
|
||||||
|
</Completion>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration Name="Release" CompilerType="GCC" DebuggerType="GNU gdb debugger" Type="Executable" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
|
||||||
|
<Compiler Options="-O2;-Wall" C_Options="-O2;-Wall" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0">
|
||||||
|
<IncludePath Value="."/>
|
||||||
|
<Preprocessor Value="NDEBUG"/>
|
||||||
|
</Compiler>
|
||||||
|
<Linker Options="" Required="yes"/>
|
||||||
|
<ResourceCompiler Options="" Required="no"/>
|
||||||
|
<General OutputFile="$(IntermediateDirectory)/$(ProjectName)" IntermediateDirectory="./Release" Command="./$(ProjectName)" 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="no">
|
||||||
|
<DebuggerSearchPaths/>
|
||||||
|
<PostConnectCommands/>
|
||||||
|
<StartupCommands/>
|
||||||
|
</Debugger>
|
||||||
|
<PreBuild/>
|
||||||
|
<PostBuild/>
|
||||||
|
<CustomBuild Enabled="no">
|
||||||
|
<RebuildCommand/>
|
||||||
|
<CleanCommand/>
|
||||||
|
<BuildCommand/>
|
||||||
|
<PreprocessFileCommand/>
|
||||||
|
<SingleFileCommand/>
|
||||||
|
<MakefileGenerationCommand/>
|
||||||
|
<ThirdPartyToolName>None</ThirdPartyToolName>
|
||||||
|
<WorkingDirectory/>
|
||||||
|
</CustomBuild>
|
||||||
|
<AdditionalRules>
|
||||||
|
<CustomPostBuild/>
|
||||||
|
<CustomPreBuild/>
|
||||||
|
</AdditionalRules>
|
||||||
|
<Completion EnableCpp11="no" EnableCpp14="no">
|
||||||
|
<ClangCmpFlagsC/>
|
||||||
|
<ClangCmpFlags/>
|
||||||
|
<ClangPP/>
|
||||||
|
<SearchPaths/>
|
||||||
|
</Completion>
|
||||||
|
</Configuration>
|
||||||
|
</Settings>
|
||||||
|
<VirtualDirectory Name="src">
|
||||||
|
<File Name="main.cpp"/>
|
||||||
|
<File Name="./BMAIMAPServer.h"/>
|
||||||
|
<File Name="./BMAIMAPSession.h"/>
|
||||||
|
<File Name="./BMAPOP3Server.h"/>
|
||||||
|
<File Name="./BMAPOP3Session.h"/>
|
||||||
|
<File Name="./BMASMTPServer.h"/>
|
||||||
|
<File Name="./BMASMTPSession.h"/>
|
||||||
|
</VirtualDirectory>
|
||||||
|
<Dependencies Name="Debug"/>
|
||||||
|
<Dependencies Name="Release"/>
|
||||||
|
</CodeLite_Project>
|
1
BMAMail.txt
Normal file
1
BMAMail.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
./Debug/main.cpp.o
|
25
BMAPOP3Server.h
Normal file
25
BMAPOP3Server.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#ifndef BMAPOP3Server_h__
|
||||||
|
#define BMAPOP3Server_h__
|
||||||
|
|
||||||
|
#include "includes"
|
||||||
|
#include "BMATCPServerSocket.h"
|
||||||
|
#include "BMACommand.h"
|
||||||
|
class BMATCPSocket;
|
||||||
|
|
||||||
|
class BMAPOP3Server : public BMATCPServerSocket {
|
||||||
|
|
||||||
|
public:
|
||||||
|
BMAPOP3Server(BMAEPoll &ePoll, std::string url, short int port);
|
||||||
|
~BMAPOP3Server();
|
||||||
|
|
||||||
|
BMASession * getSocketAccept();
|
||||||
|
|
||||||
|
void registerCommand(BMACommand &command);
|
||||||
|
|
||||||
|
int processCommand(BMASession *session) override; ///<Output the consoles array to the console.
|
||||||
|
|
||||||
|
std::vector<BMACommand *> commands;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
34
BMAPOP3Session.h
Normal file
34
BMAPOP3Session.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#ifndef __BMAPOP3Session_h__
|
||||||
|
#define __BMAPOP3Session_h__
|
||||||
|
|
||||||
|
#include "BMASession.h"
|
||||||
|
#include "BMAPOP3Server.h"
|
||||||
|
|
||||||
|
///
|
||||||
|
/// BMAPOP3Session
|
||||||
|
///
|
||||||
|
/// Extends the session parameters for this BMATCPSocket derived object.
|
||||||
|
/// Extend the protocol() method in order to define the behavior and
|
||||||
|
/// protocol interaction for this socket which is a console session.
|
||||||
|
///
|
||||||
|
|
||||||
|
class BMAPOP3Session : public BMASession {
|
||||||
|
|
||||||
|
public:
|
||||||
|
BMAPOP3Session(BMAEPoll &ePoll, BMAPOP3Server &server);
|
||||||
|
~BMAPop3Session();
|
||||||
|
|
||||||
|
virtual void output(std::stringstream &out);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void protocol(char *data, int length) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
BMAConsoleServer &server;
|
||||||
|
enum Status {WELCOME, PROMPT, INPUT, PROCESS, DONE};
|
||||||
|
Status status = WELCOME;
|
||||||
|
void doCommand(std::string request);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
31
BMASMTPServer.h
Normal file
31
BMASMTPServer.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#ifndef BMAConsoleServer_h__
|
||||||
|
#define BMAConsoleServer_h__
|
||||||
|
|
||||||
|
#include "includes"
|
||||||
|
#include "BMATCPServerSocket.h"
|
||||||
|
#include "BMACommand.h"
|
||||||
|
class BMATCPSocket;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// BMASMTPServer
|
||||||
|
///
|
||||||
|
/// Use this object to create a fully supported SMTP server.
|
||||||
|
///
|
||||||
|
|
||||||
|
class BMASMTPServer : public BMATCPServerSocket {
|
||||||
|
|
||||||
|
public:
|
||||||
|
BMASMTPServer(BMAEPoll &ePoll, std::string url, short int port);
|
||||||
|
~BMASMTPServer();
|
||||||
|
|
||||||
|
BMASession * getSocketAccept() override;
|
||||||
|
|
||||||
|
void registerCommand(BMACommand &command);
|
||||||
|
|
||||||
|
int processCommand(BMASession *session) override; ///<Output the consoles array to the console.
|
||||||
|
|
||||||
|
std::vector<BMACommand *> commands;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
33
BMASMTPSession.h
Normal file
33
BMASMTPSession.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#ifndef __BMASMTPSession_h__
|
||||||
|
#define __BMASMTPSession_h__
|
||||||
|
|
||||||
|
#include "BMASession.h"
|
||||||
|
|
||||||
|
///
|
||||||
|
/// BMAConsoleSession
|
||||||
|
///
|
||||||
|
/// Extends the session parameters for this BMATCPSocket derived object.
|
||||||
|
/// Extend the protocol() method in order to define the behavior and
|
||||||
|
/// protocol interaction for this socket which is a console session.
|
||||||
|
///
|
||||||
|
|
||||||
|
class BMASMTPSession : public BMASession {
|
||||||
|
|
||||||
|
public:
|
||||||
|
BMAConsoleSession(BMAEPoll &ePoll, BMAConsoleServer &server);
|
||||||
|
~BMAConsoleSession();
|
||||||
|
|
||||||
|
virtual void output(std::stringstream &out);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void protocol(char *data, int length) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
BMAConsoleServer &server;
|
||||||
|
enum Status {WELCOME, PROMPT, INPUT, PROCESS, DONE};
|
||||||
|
Status status = WELCOME;
|
||||||
|
void doCommand(std::string request);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user