aboutsummaryrefslogtreecommitdiff
path: root/src/libjin
diff options
context:
space:
mode:
Diffstat (limited to 'src/libjin')
-rw-r--r--src/libjin/Common/data.h32
-rw-r--r--src/libjin/Net/Socket.cpp2
-rw-r--r--src/libjin/Net/Socket.h2
-rw-r--r--src/libjin/Net/net.cpp24
-rw-r--r--src/libjin/Net/net.h30
5 files changed, 88 insertions, 2 deletions
diff --git a/src/libjin/Common/data.h b/src/libjin/Common/data.h
new file mode 100644
index 0000000..7fcc389
--- /dev/null
+++ b/src/libjin/Common/data.h
@@ -0,0 +1,32 @@
+#ifndef __JIN_COMMON_DATA_H
+#define __JIN_COMMON_DATA_H
+
+namespace jin
+{
+
+ class DataBuffer
+ {
+ public:
+ DataBuffer(int n)
+ : len(n)
+ {
+ buffer = new char[len];
+ memset(buffer, 0, len);
+ }
+ ~DataBuffer()
+ {
+ delete[] buffer;
+ }
+ char* operator&()
+ {
+ return buffer;
+ }
+
+ private:
+ char* buffer;
+ int len;
+ };
+
+} // jin
+
+#endif \ No newline at end of file
diff --git a/src/libjin/Net/Socket.cpp b/src/libjin/Net/Socket.cpp
index b7c621e..7e6fa7d 100644
--- a/src/libjin/Net/Socket.cpp
+++ b/src/libjin/Net/Socket.cpp
@@ -5,7 +5,7 @@ namespace jin
namespace net
{
- Socket::Socket(SocketInformation info)
+ Socket::Socket(const SocketInformation& info)
: tcpHandle(nullptr)
, udpHandle(nullptr)
{
diff --git a/src/libjin/Net/Socket.h b/src/libjin/Net/Socket.h
index fae6bd2..eb00605 100644
--- a/src/libjin/Net/Socket.h
+++ b/src/libjin/Net/Socket.h
@@ -26,7 +26,7 @@ namespace net
class Socket
{
public:
- Socket(SocketInformation socketInformation);
+ Socket(const SocketInformation& socketInformation);
Socket(SocketType type, unsigned short port);
Socket(SocketType type, unsigned int address, unsigned short port);
Socket(SocketType type, const char* address, unsigned short port);
diff --git a/src/libjin/Net/net.cpp b/src/libjin/Net/net.cpp
new file mode 100644
index 0000000..db39be7
--- /dev/null
+++ b/src/libjin/Net/net.cpp
@@ -0,0 +1,24 @@
+#include "Net.h"
+
+namespace jin
+{
+namespace net
+{
+
+ bool Net::initSystem(const SettingBase* setting)
+ {
+ #ifdef _WIN32
+ #if JIN_NET_TEKCOS
+ tk_init();
+ #endif
+ #endif
+ return true;
+ }
+
+ void Net::quitSystem()
+ {
+
+ }
+
+}
+}
diff --git a/src/libjin/Net/net.h b/src/libjin/Net/net.h
new file mode 100644
index 0000000..54ffede
--- /dev/null
+++ b/src/libjin/Net/net.h
@@ -0,0 +1,30 @@
+#ifndef __JIN_NET_H
+#define __JIN_NET_H
+#include "../modules.h"
+#if JIN_MODULES_NET
+
+#include "../Common/Subsystem.hpp"
+#include "Socket.h"
+
+namespace jin
+{
+namespace net
+{
+
+ class Net : public Subsystem<Net>
+ {
+ public:
+
+ protected:
+ Net() {};
+ ~Net() {};
+ SINGLETON(Net);
+ bool initSystem(const SettingBase* setting) override;
+ void quitSystem() override;
+ };
+
+}
+}
+
+#endif // JIN_MODULES_NET
+#endif // __JIN_NET_H \ No newline at end of file