X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fsocketengine.h;h=d97c0ea9f9b9bd6c139abd09575e459e6a9d5ebc;hb=2eed59bea6f6e42c77ffd7e6061570c13f172e21;hp=2fc3cdbfd4d2849c05f5a02c8b97a5802c324afa;hpb=2bb64c5dcfb66e9bf7f6114de6501fd5dcd97138;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/socketengine.h b/include/socketengine.h index 2fc3cdbfd..d97c0ea9f 100644 --- a/include/socketengine.h +++ b/include/socketengine.h @@ -20,13 +20,12 @@ */ -#ifndef SOCKETENGINE_H -#define SOCKETENGINE_H +#pragma once #include #include #include -#include "inspircd_config.h" +#include "config.h" #include "socket.h" #include "base.h" @@ -128,7 +127,7 @@ enum EventMask /** Add a trial write. During the next DispatchEvents invocation, this * will call HandleEvent with EVENT_WRITE unless writes are known to be * blocking. - * + * * This could be used to group several writes together into a single * send() syscall, or to ensure that writes are blocking when attempting * to use FD_WANT_FAST_WRITE. @@ -137,7 +136,7 @@ enum EventMask /** Assert that writes are known to block. This cancels FD_ADD_TRIAL_WRITE. * Reset by SE before running EVENT_WRITE */ - FD_WRITE_WILL_BLOCK = 0x8000, + FD_WRITE_WILL_BLOCK = 0x8000, /** Mask for trial read/trial write */ FD_TRIAL_NOTE_MASK = 0x5000 @@ -418,7 +417,7 @@ public: * @param buf The buffer in which the data that is sent is stored. * @param len The size of the buffer. * @param flags A flag value that controls the sending of the data. - * @param to The remote IP address and port. + * @param to The remote IP address and port. * @param tolen The size of the to parameter. * @return This method should return exactly the same values as the system call it emulates. */ @@ -494,6 +493,14 @@ public: * Checks EAGAIN and WSAEWOULDBLOCK */ static bool IgnoreError(); + + /** Return the last socket related error. strrerror(errno) on *nix + */ + static std::string LastError(); + + /** Returns the error for the given error num, strerror(errnum) on *nix + */ + static std::string GetError(int errnum); }; inline bool SocketEngine::IgnoreError() @@ -510,6 +517,3 @@ inline bool SocketEngine::IgnoreError() } SocketEngine* CreateSocketEngine(); - -#endif -