summaryrefslogtreecommitdiffstats
path: root/src/OSSupport/Network.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-01-22 13:00:32 +0100
committerMattes D <github@xoft.cz>2015-01-22 20:13:06 +0100
commitdbf7f13bd414daea5e787da2543df186dc465c34 (patch)
treec6ca36fcd22b422b89222a8c29beb046e70b4de6 /src/OSSupport/Network.h
parentcNetwork: Changed listening API. (diff)
downloadcuberite-dbf7f13bd414daea5e787da2543df186dc465c34.tar
cuberite-dbf7f13bd414daea5e787da2543df186dc465c34.tar.gz
cuberite-dbf7f13bd414daea5e787da2543df186dc465c34.tar.bz2
cuberite-dbf7f13bd414daea5e787da2543df186dc465c34.tar.lz
cuberite-dbf7f13bd414daea5e787da2543df186dc465c34.tar.xz
cuberite-dbf7f13bd414daea5e787da2543df186dc465c34.tar.zst
cuberite-dbf7f13bd414daea5e787da2543df186dc465c34.zip
Diffstat (limited to '')
-rw-r--r--src/OSSupport/Network.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/OSSupport/Network.h b/src/OSSupport/Network.h
index b9ca377cb..85c7c5dcb 100644
--- a/src/OSSupport/Network.h
+++ b/src/OSSupport/Network.h
@@ -13,6 +13,14 @@
+// fwd:
+class cTCPLink;
+typedef SharedPtr<cTCPLink> cTCPLinkPtr;
+
+
+
+
+
/** Interface that provides the methods available on a single TCP connection. */
class cTCPLink
{
@@ -25,16 +33,20 @@ public:
// Force a virtual destructor for all descendants:
virtual ~cCallbacks() {}
+ /** Called when the cTCPLink for the connection is created.
+ The callback may store the cTCPLink instance for later use, but it should remove it in OnError(), OnRemoteClosed() or right after Close(). */
+ virtual void OnLinkCreated(cTCPLinkPtr a_Link) = 0;
+
/** Called when there's data incoming from the remote peer. */
- virtual void OnReceivedData(cTCPLink & a_Link, const char * a_Data, size_t a_Length) = 0;
+ virtual void OnReceivedData(const char * a_Data, size_t a_Length) = 0;
/** Called when the remote end closes the connection.
The link is still available for connection information query (IP / port).
Sending data on the link is not an error, but the data won't be delivered. */
- virtual void OnRemoteClosed(cTCPLink & a_Link) = 0;
+ virtual void OnRemoteClosed(void) = 0;
/** Called when an error is detected on the connection. */
- virtual void OnError(cTCPLink & a_Link, int a_ErrorCode, const AString & a_ErrorMsg) = 0;
+ virtual void OnError(int a_ErrorCode, const AString & a_ErrorMsg) = 0;
};
typedef SharedPtr<cCallbacks> cCallbacksPtr;