33#ifndef PPTConnection_h
34#define PPTConnection_h 1
36#include "Connection.h"
37#include "PPTProtocolNames.h"
41#define PPT_CHUNK_HEADER_SPACE 15
43class PPTConnection:
public Connection {
46 char * _inBuff =
nullptr;
49 PPTConnection() =
default;
51 virtual int readChunkHeader(
char *inBuff,
int buff_size);
52 void sendChunk(
const std::string &buffer, std::map<std::string, std::string> &extensions)
override;
53 virtual void receive(std::ostream &strm,
const int len);
56 explicit PPTConnection(
int timeout) : _timeout(timeout) { }
58 virtual int readBuffer(
char *inBuff,
const unsigned int buff_size);
61 void send(
const std::string &buffer)
override;
62 virtual void read_extensions(std::map<std::string, std::string> &extensions,
const std::string &xstr);
65 ~PPTConnection()
override;
67 void initConnection()
override = 0;
68 void closeConnection()
override = 0;
70 std::string exit()
override
75 void send(
const std::string &buffer, std::map<std::string, std::string> &extensions)
override;
76 void sendExtensions(std::map<std::string, std::string> &extensions)
override;
78 bool receive(std::map<std::string, std::string> &extensions, std::ostream *strm =
nullptr)
override;
80 unsigned int getRecvChunkSize()
override;
81 unsigned int getSendChunkSize()
override;
83 void dump(std::ostream &strm)
const override;
void send(const std::string &buffer) override
sends the buffer to the socket
virtual int readBuffer(char *inBuff, const unsigned int buff_size)
read a buffer of data from the socket
void sendExtensions(std::map< std::string, std::string > &extensions) override
send the specified extensions
void sendExit() override
Send the exit token as an extension.
virtual void read_extensions(std::map< std::string, std::string > &extensions, const std::string &xstr)
the string passed are extensions, read them and store the name/value pairs into the passed map
virtual int readBufferNonBlocking(char *inBuff, const int buff_size)
read a buffer of data from the socket without blocking
void dump(std::ostream &strm) const override
dumps information about this object