From b1d5ff8898c1cca680842848586251c6f64b6932 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Tue, 28 Feb 2023 16:46:41 -0400 Subject: TTcpSocket: Start work on `TTcpSocket` I've done most of it, still have to do `test_connection()`, and `open()`. --- include/pso/TTcpSocket.h | 41 +++++++++++++++++++++++++++++++++++++++++ include/pso/forward.h | 2 ++ 2 files changed, 43 insertions(+) create mode 100644 include/pso/TTcpSocket.h (limited to 'include') diff --git a/include/pso/TTcpSocket.h b/include/pso/TTcpSocket.h new file mode 100644 index 0000000..9740a3a --- /dev/null +++ b/include/pso/TTcpSocket.h @@ -0,0 +1,41 @@ +#ifndef TTCPSOCKET_H +#define TTCPSOCKET_H + +#include +#include +#include +#include +#include +#include +#include +#include + +EXTERN_OBJECT_NAME(TTcpSocket); +extern TTcpSocket *tcp_socket_table[16]; + +class TTcpSocket : public TSocket { +private: + PSOV3EncryptionTCP m_send_crypt; + PSOV3EncryptionTCP m_recv_crypt; + int m_is_encrypted; +public: + WEAK_FUNC TTcpSocket(TObject *parent = nullptr); + virtual ~TTcpSocket(); + + virtual short open() override; + virtual short close() override; + virtual void recv() override; + virtual short send(u8 *data) override; + virtual int send(u8 *data, size_t size) override; + + int stat(); + int test_connection(); + + static void notify(short size, short sock_fd); + + PRIVATE_MEMBER_ACCESSORS(PSOV3EncryptionTCP, send_crypt); + PRIVATE_MEMBER_ACCESSORS(PSOV3EncryptionTCP, recv_crypt); + PRIVATE_MEMBER_ACCESSORS(int, is_encrypted); +}; + +#endif diff --git a/include/pso/forward.h b/include/pso/forward.h index 165b9ad..1bc71cf 100644 --- a/include/pso/forward.h +++ b/include/pso/forward.h @@ -1,6 +1,8 @@ #ifndef FORWARD_H #define FORWARD_H +class TTcpSocket; +class PSOV3EncryptionTCP; class TSocket; class THeap; class TObject; -- cgit v1.2.3-13-gbd6f