diff options
author | Attila Molnar <attilamolnar@hush.com> | 2016-08-08 16:30:04 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2016-08-08 16:30:04 +0200 |
commit | 40e42a47a7b1f12bb0a9e20c3fa1d9bdccd85c04 (patch) | |
tree | 49fd282fd5bd93662ad93225af9d1ea7c9103705 /include/iohook.h | |
parent | 0053cf0d24ab60a474bd1b84060f96d7108d56d8 (diff) |
Update comments for classes IOHookProvider and IOHook
Diffstat (limited to 'include/iohook.h')
-rw-r--r-- | include/iohook.h | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/include/iohook.h b/include/iohook.h index f23648658..e99316b99 100644 --- a/include/iohook.h +++ b/include/iohook.h @@ -34,6 +34,12 @@ class IOHookProvider : public ServiceProvider const Type type; + /** Constructor + * @param mod Module that owns the IOHookProvider + * @param Name Name of the provider + * @param hooktype One of IOHookProvider::Type + * @param middle True if the IOHook instances created by this hook are subclasses of IOHookMiddle, false otherwise + */ IOHookProvider(Module* mod, const std::string& Name, Type hooktype = IOH_UNKNOWN, bool middle = false) : ServiceProvider(mod, Name, SERVICE_IOHOOK), middlehook(middle), type(hooktype) { } @@ -43,18 +49,16 @@ class IOHookProvider : public ServiceProvider */ bool IsMiddle() const { return middlehook; } - /** Called immediately after a connection is accepted. This is intended for raw socket - * processing (e.g. modules which wrap the tcp connection within another library) and provides - * no information relating to a user record as the connection has not been assigned yet. - * @param sock The socket in question - * @param client The client IP address and port - * @param server The server IP address and port + /** Called when the provider should hook an incoming connection and act as being on the server side of the connection. + * This occurs when a bind block has a hook configured and the listener accepts a connection. + * @param sock Socket to hook + * @param client Client IP address and port + * @param server Server IP address and port */ virtual void OnAccept(StreamSocket* sock, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server) = 0; - /** Called immediately upon connection of an outbound BufferedSocket which has been hooked - * by a module. - * @param sock The socket in question + /** Called when the provider should hook an outgoing connection and act as being on the client side of the connection. + * @param sock Socket to hook */ virtual void OnConnect(StreamSocket* sock) = 0; }; @@ -67,28 +71,30 @@ class IOHook : public classbase */ IOHookProvider* const prov; + /** Constructor + * @param provider IOHookProvider that creates this object + */ IOHook(IOHookProvider* provider) : prov(provider) { } /** - * Called when a hooked stream has data to write, or when the socket - * engine returns it as writable - * @param sock The socket in question + * Called when the hooked socket has data to write, or when the socket engine returns it as writable + * @param sock Hooked socket * @param sendq Send queue to send data from * @return 1 if the sendq has been completely emptied, 0 if there is * still data to send, and -1 if there was an error */ virtual int OnStreamSocketWrite(StreamSocket* sock, StreamSocket::SendQueue& sendq) = 0; - /** Called immediately before any socket is closed. When this event is called, shutdown() + /** Called immediately before the hooked socket is closed. When this event is called, shutdown() * has not yet been called on the socket. - * @param sock The socket in question + * @param sock Hooked socket */ virtual void OnStreamSocketClose(StreamSocket* sock) = 0; /** - * Called when the stream socket has data to read - * @param sock The socket that is ready + * Called when the hooked socket has data to read + * @param sock Hooked socket * @param recvq The receive queue that new data should be appended to * @return 1 if new data has been read, 0 if no new data is ready (but the * socket is still connected), -1 if there was an error or close |