Change project from listener to sstp
This commit is contained in:
36
sstp/socketconnectionreceiver.hpp
Normal file
36
sstp/socketconnectionreceiver.hpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#ifndef _LISTENER_SOCKETCONNECTIONRECEIVER_HPP_
|
||||
#define _LISTENER_SOCKETCONNECTIONRECEIVER_HPP_
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <unistd.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <thread>
|
||||
#include <common/string.hpp>
|
||||
#include <common/profiler.hpp>
|
||||
#include <common/block.hpp>
|
||||
#include <common/fileio.hpp>
|
||||
|
||||
class SocketConnectionReceiver
|
||||
{
|
||||
public:
|
||||
SocketConnectionReceiver(int socket, sockaddr_in inernalSocketAddress);
|
||||
virtual ~SocketConnectionReceiver();
|
||||
void close(void);
|
||||
private:
|
||||
static constexpr size_t BUFFER_LENGTH=65536; // this is the buffer length for the socket
|
||||
void threadFunction(int data);
|
||||
bool handlePut(Block<String> &commands);
|
||||
size_t readLine(String &line);
|
||||
size_t expectPacket(void);
|
||||
size_t read(Array<char> &buffer);
|
||||
String restoreFileName(Block<String> block,DWORD startIndex,DWORD endIndex);
|
||||
|
||||
friend class SocketServer;
|
||||
char mBuffer[BUFFER_LENGTH] = {0};
|
||||
int mSocket;
|
||||
sockaddr_in mInternalSocketAddress;
|
||||
};
|
||||
#endif
|
||||
Reference in New Issue
Block a user