summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-01 15:07:36 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-01 15:07:36 +0000
commit7a672d42e4173e274ac0ee31331d41e45801facc (patch)
tree72ad0edb4d7a8b8cf0be854b784c328b6757327a /include
parent6278262baaed06e2acf134c53ed0485136d61f50 (diff)
Remove more text<->binary IP conversions, making code more IPv4/IPv6 independent
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11578 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r--include/modules.h7
-rw-r--r--include/usermanager.h6
-rw-r--r--include/users.h27
3 files changed, 25 insertions, 15 deletions
diff --git a/include/modules.h b/include/modules.h
index a539f3185..932ef3d19 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -1301,7 +1301,7 @@ class CoreExport Module : public Extensible
*/
virtual int OnDelBan(User* source, Channel* channel,const std::string &banmask);
- virtual void OnHookUserIO(User* user, const std::string &targetip);
+ virtual void OnHookUserIO(User* user);
/** Called immediately after any connection is accepted. This is intended for raw socket
* processing (e.g. modules which wrap the tcp connection within another library) and provides
@@ -1309,10 +1309,11 @@ class CoreExport Module : public Extensible
* There are no return values from this call as all modules get an opportunity if required to
* process the connection.
* @param fd The file descriptor returned from accept()
- * @param ip The IP address of the connecting user
+ * @param client The client IP address and port
+ * @param server The server IP address and port
* @param localport The local port number the user connected to
*/
- virtual void OnRawSocketAccept(int fd, const std::string &ip, int localport);
+ virtual void OnRawSocketAccept(int fd, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server);
/** Called immediately before any write() operation on a user's socket in the core. Because
* this event is a low level event no user information is associated with it. It is intended
diff --git a/include/usermanager.h b/include/usermanager.h
index c2f89729a..a6b5f74e4 100644
--- a/include/usermanager.h
+++ b/include/usermanager.h
@@ -73,12 +73,12 @@ class CoreExport UserManager : public Extensible
* initialize it as not yet registered, and add it to the socket engine.
* @param Instance a pointer to the server instance
* @param socket The socket id (file descriptor) this user is on
- * @param port The port number this user connected on
* @param iscached This variable is reserved for future use
- * @param ip The IP address of the user
+ * @param client The IP address and client port of the user
+ * @param server The server IP address and port used by the user
* @return This function has no return value, but a call to AddClient may remove the user.
*/
- void AddUser(InspIRCd* Instance, int socket, int port, bool iscached, irc::sockets::sockaddrs* ip, const std::string &targetip);
+ void AddUser(InspIRCd* Instance, int socket, bool iscached, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server);
/** Disconnect a user gracefully
* @param user The user to remove
diff --git a/include/users.h b/include/users.h
index e681ef326..39b0ebdca 100644
--- a/include/users.h
+++ b/include/users.h
@@ -472,23 +472,32 @@ class CoreExport User : public EventHandler
*/
bool quitting;
- /** IPV4 or IPV6 ip address, binary format. Use SetSockAddr to set this and
- * GetIPString/GetPort to obtain its value in a readable manner
+ /** Server address and port that this user is connected to.
+ * If unknown, address family is AF_UNKNOWN
*/
- irc::sockets::sockaddrs ip;
+ irc::sockets::sockaddrs server_sa;
+ /** Client address that the user is connected from.
+ * Port number is only valid if local.
+ *
+ * Do not modify this value directly, use SetClientIP() to change it
+ */
+ irc::sockets::sockaddrs client_sa;
- /** Initialize the clients sockaddr
- * @param ip A human-readable IP address for this user
- * @param port The port number of this user (zero if unknown)
+ /** Sets the client IP for this user
+ * @return true if the conversion was successful
*/
- void SetSockAddr(const char* ip, int port);
+ bool SetClientIP(const char* sip);
- /** Get port number from sockaddr
+ /**
* @return The port number of this user.
*/
int GetServerPort();
+ /**
+ * @return The server IP address
+ */
+ std::string GetServerIP();
- /** Get IP string from sockaddr, using static internal buffer
+ /** Get client IP string from sockaddr, using static internal buffer
* @return The IP string
*/
const char* GetIPString();