summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-22 21:49:39 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-22 21:49:39 +0000
commitb43fc66c17c2bef6dca66a966676b8128d5774ee (patch)
tree1d7aa401ffbf682595e1152ae97d2e2d0fcd8d7a /include
parentf49a18e9abc210cb7ec4a691691cbbefe51a1854 (diff)
Make irc::sockets::* parameters consistent, add irc::sockets::mask
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11953 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r--include/socket.h13
-rw-r--r--include/users.h13
2 files changed, 14 insertions, 12 deletions
diff --git a/include/socket.h b/include/socket.h
index a9b0a472e..bfde750ea 100644
--- a/include/socket.h
+++ b/include/socket.h
@@ -107,20 +107,27 @@ namespace irc
* @param sa The structure to place the result in. Will be zeroed prior to conversion
* @return true if the conversion was successful, false if not.
*/
- CoreExport bool aptosa(const std::string& addr, int port, irc::sockets::sockaddrs* sa);
+ CoreExport bool aptosa(const std::string& addr, int port, irc::sockets::sockaddrs& sa);
+
/** Convert a binary sockaddr to an address-port pair
* @param sa The structure to convert
* @param addr the IP address
* @param port the port
* @return true if the conversion was successful, false if unknown address family
*/
- CoreExport bool satoap(const irc::sockets::sockaddrs* sa, std::string& addr, int &port);
+ CoreExport bool satoap(const irc::sockets::sockaddrs& sa, std::string& addr, int &port);
+
/** Convert a binary sockaddr to a user-readable string.
* This means IPv6 addresses are written as [::1]:6667, and *:6668 is used for 0.0.0.0:6668
* @param sa The structure to convert
* @return The string; "<unknown>" if not a valid address
*/
- CoreExport std::string satouser(const irc::sockets::sockaddrs* sa);
+ CoreExport std::string satouser(const irc::sockets::sockaddrs& sa);
+
+ /** Create a CIDR mask from the given address, of length <range>
+ * Result will be of the form 192.0.5.0/24 or 2001:af35::/48
+ */
+ CoreExport std::string mask(irc::sockets::sockaddrs sa, unsigned int range);
}
}
diff --git a/include/users.h b/include/users.h
index 49e43f0bf..fa56abc0e 100644
--- a/include/users.h
+++ b/include/users.h
@@ -388,20 +388,15 @@ class CoreExport User : public StreamSocket
*/
const char* GetIPString();
+ /** Get CIDR mask, using default range, for this user
+ */
+ irc::string GetCIDRMask();
+
/** Sets the client IP for this user
* @return true if the conversion was successful
*/
bool SetClientIP(const char* sip);
- /** Get a CIDR mask from the IP of this user, using a static internal buffer.
- * e.g., GetCIDRMask(16) for 223.254.214.52 returns 223.254.0.0/16
- * This may be used for CIDR clone detection, etc.
- *
- * (XXX, brief note: when we do the sockets rewrite, this should move down a
- * level so it may be used on more derived objects. -- w00t)
- */
- const char *GetCIDRMask(int range);
-
/** Default constructor
* @throw CoreException if the UID allocated to the user already exists
* @param Instance Creator instance