diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/config.h | 6 | ||||
| -rw-r--r-- | include/sockets.h | 26 |
2 files changed, 20 insertions, 12 deletions
diff --git a/include/config.h b/include/config.h index 8b8cb65ca..48f334cff 100644 --- a/include/config.h +++ b/include/config.h @@ -150,10 +150,10 @@ namespace Configuration Anope::string host; unsigned port; Anope::string password; - bool ipv6; + int protocol; - Uplink(const Anope::string &_host, int _port, const Anope::string &_password, bool _ipv6) : host(_host), port(_port), password(_password), ipv6(_ipv6) { } - inline bool operator==(const Uplink &other) const { return host == other.host && port == other.port && password == other.password && ipv6 == other.ipv6; } + Uplink(const Anope::string &_host, int _port, const Anope::string &_password, int _protocol) : host(_host), port(_port), password(_password), protocol(_protocol) { } + inline bool operator==(const Uplink &other) const { return host == other.host && port == other.port && password == other.password && protocol == other.protocol; } inline bool operator!=(const Uplink &other) const { return !(*this == other); } }; } diff --git a/include/sockets.h b/include/sockets.h index 24e580902..641800b6d 100644 --- a/include/sockets.h +++ b/include/sockets.h @@ -15,10 +15,16 @@ #include <netinet/in.h> #include <sys/types.h> #include <sys/socket.h> +#include <sys/un.h> #endif #include "anope.h" +// This has to be after anope.h +#ifdef _WIN32 +# include <afunix.h> +#endif + #define NET_BUFSIZE 65535 /** A sockaddr union used to combine IPv4 and IPv6 sockaddrs @@ -28,6 +34,7 @@ union CoreExport sockaddrs sockaddr sa; sockaddr_in sa4; sockaddr_in6 sa6; + sockaddr_un saun; /** Construct the object, sets everything to 0 */ @@ -203,8 +210,9 @@ class CoreExport Socket protected: /* Socket FD */ int sock; - /* Is this an IPv6 socket? */ - bool ipv6; + + /* The family of this socket FD */ + int family; public: std::bitset<SF_SIZE> flags; @@ -221,25 +229,25 @@ class CoreExport Socket /** Constructor, possibly creates the socket and adds it to the engine * @param sock The socket to use, -1 if we need to create our own - * @param ipv6 true if using ipv6 + * @param family The family of the socket * @param type The socket type, defaults to SOCK_STREAM */ - Socket(int sock, bool ipv6 = false, int type = SOCK_STREAM); + Socket(int sock, bool family = AF_INET, int type = SOCK_STREAM); /** Destructor, closes the socket and removes it from the engine */ virtual ~Socket(); + /** Get the socket family for this socket + * @return the family + */ + int GetFamily() const; + /** Get the socket FD for this socket * @return the fd */ int GetFD() const; - /** Check if this socket is IPv6 - * @return true or false - */ - bool IsIPv6() const; - /** Mark a socket as (non)blocking * @param state true to enable blocking, false to disable blocking * @return true if the socket is now blocking |
