diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2023-02-28 16:46:41 -0400 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2023-02-28 16:46:41 -0400 |
commit | b1d5ff8898c1cca680842848586251c6f64b6932 (patch) | |
tree | 6277c47ec9238c4ba73bbfa3a3bb44375dc8bd2c /include | |
parent | 707b3cefe5df770944ce6956c2ceaa194b96f111 (diff) |
TTcpSocket: Start work on `TTcpSocket`
I've done most of it, still have to do `test_connection()`, and
`open()`.
Diffstat (limited to 'include')
-rw-r--r-- | include/pso/TTcpSocket.h | 41 | ||||
-rw-r--r-- | include/pso/forward.h | 2 |
2 files changed, 43 insertions, 0 deletions
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 <global_types.h> +#include <string.h> +#include <pso/macros.h> +#include <pso/forward.h> +#include <pso/PSOV3EncryptionTCP.h> +#include <pso/TArray.h> +#include <pso/TSocket.h> +#include <pso/TObject.h> + +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; |