diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-10-15 21:04:32 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-10-15 21:04:32 +0000 |
commit | 2b68243097f98ace4a53b21520718874b0ed7db5 (patch) | |
tree | 5fbdbb4270efebbfb0956733d25b1245c8586d25 /src | |
parent | 03e0fb206d3f5709868f03bc7a401cb666c38ffb (diff) |
InspSocket -> BufferedSocket. Paves the way for a SimpleSocket class which ident etc will use.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8206 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
23 files changed, 118 insertions, 118 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp index 0bb4587b3..776793405 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -58,9 +58,9 @@ Module* ServerConfig::GetIOHook(int port) return (x != IOHookModule.end() ? x->second : NULL); } -Module* ServerConfig::GetIOHook(InspSocket* is) +Module* ServerConfig::GetIOHook(BufferedSocket* is) { - std::map<InspSocket*,Module*>::iterator x = SocketIOHookModule.find(is); + std::map<BufferedSocket*,Module*>::iterator x = SocketIOHookModule.find(is); return (x != SocketIOHookModule.end() ? x->second : NULL); } @@ -78,7 +78,7 @@ bool ServerConfig::AddIOHook(int port, Module* iomod) } } -bool ServerConfig::AddIOHook(Module* iomod, InspSocket* is) +bool ServerConfig::AddIOHook(Module* iomod, BufferedSocket* is) { if (!GetIOHook(is)) { @@ -88,7 +88,7 @@ bool ServerConfig::AddIOHook(Module* iomod, InspSocket* is) } else { - throw ModuleException("InspSocket derived class already hooked by another module"); + throw ModuleException("BufferedSocket derived class already hooked by another module"); return false; } } @@ -104,9 +104,9 @@ bool ServerConfig::DelIOHook(int port) return false; } -bool ServerConfig::DelIOHook(InspSocket* is) +bool ServerConfig::DelIOHook(BufferedSocket* is) { - std::map<InspSocket*,Module*>::iterator x = SocketIOHookModule.find(is); + std::map<BufferedSocket*,Module*>::iterator x = SocketIOHookModule.find(is); if (x != SocketIOHookModule.end()) { SocketIOHookModule.erase(x); diff --git a/src/inspircd.cpp b/src/inspircd.cpp index d16938818..54243e807 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -664,7 +664,7 @@ int InspIRCd::Run() this->GlobalCulls.Apply(); /* If any inspsockets closed, remove them */ - this->InspSocketCull(); + this->BufferedSocketCull(); if (this->s_signal) { @@ -676,9 +676,9 @@ int InspIRCd::Run() return 0; } -void InspIRCd::InspSocketCull() +void InspIRCd::BufferedSocketCull() { - for (std::map<InspSocket*,InspSocket*>::iterator x = SocketCull.begin(); x != SocketCull.end(); ++x) + for (std::map<BufferedSocket*,BufferedSocket*>::iterator x = SocketCull.begin(); x != SocketCull.end(); ++x) { SE->DelFd(x->second); x->second->Close(); diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index dc0c5beba..83754741f 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -18,12 +18,12 @@ using irc::sockets::OpenTCPSocket; -bool InspSocket::Readable() +bool BufferedSocket::Readable() { return ((this->state != I_CONNECTING) && (this->WaitingForWriteEvent == false)); } -InspSocket::InspSocket(InspIRCd* SI) +BufferedSocket::BufferedSocket(InspIRCd* SI) { this->Timeout = NULL; this->state = I_DISCONNECTED; @@ -33,7 +33,7 @@ InspSocket::InspSocket(InspIRCd* SI) this->IsIOHooked = false; } -InspSocket::InspSocket(InspIRCd* SI, int newfd, const char* ip) +BufferedSocket::BufferedSocket(InspIRCd* SI, int newfd, const char* ip) { this->Timeout = NULL; this->fd = newfd; @@ -46,7 +46,7 @@ InspSocket::InspSocket(InspIRCd* SI, int newfd, const char* ip) this->Instance->SE->AddFd(this); } -InspSocket::InspSocket(InspIRCd* SI, const std::string &ipaddr, int aport, bool listening, unsigned long maxtime, const std::string &connectbindip) +BufferedSocket::BufferedSocket(InspIRCd* SI, const std::string &ipaddr, int aport, bool listening, unsigned long maxtime, const std::string &connectbindip) { this->cbindip = connectbindip; this->fd = -1; @@ -114,7 +114,7 @@ InspSocket::InspSocket(InspIRCd* SI, const std::string &ipaddr, int aport, bool } if (!ipvalid) { - this->Instance->Log(DEBUG,"BUG: Hostname passed to InspSocket, rather than an IP address!"); + this->Instance->Log(DEBUG,"BUG: Hostname passed to BufferedSocket, rather than an IP address!"); this->OnError(I_ERR_CONNECT); this->Close(); this->fd = -1; @@ -137,13 +137,13 @@ InspSocket::InspSocket(InspIRCd* SI, const std::string &ipaddr, int aport, bool } } -void InspSocket::WantWrite() +void BufferedSocket::WantWrite() { this->Instance->SE->WantWrite(this); this->WaitingForWriteEvent = true; } -void InspSocket::SetQueues(int nfd) +void BufferedSocket::SetQueues(int nfd) { // attempt to increase socket sendq and recvq as high as its possible int sendbuf = 32768; @@ -160,7 +160,7 @@ void InspSocket::SetQueues(int nfd) * This is easier to configure when you have a lot of links and a lot * of servers to configure. */ -bool InspSocket::BindAddr(const std::string &ip) +bool BufferedSocket::BindAddr(const std::string &ip) { ConfigReader Conf(this->Instance); socklen_t size = sizeof(sockaddr_in); @@ -234,7 +234,7 @@ bool InspSocket::BindAddr(const std::string &ip) return true; } -bool InspSocket::DoConnect() +bool BufferedSocket::DoConnect() { /* The [2] is required because we may write a sockaddr_in6 here, and sockaddr_in6 is larger than sockaddr, where sockaddr_in4 is not. */ sockaddr* addr = new sockaddr[2]; @@ -342,7 +342,7 @@ bool InspSocket::DoConnect() } -void InspSocket::Close() +void BufferedSocket::Close() { /* Save this, so we dont lose it, * otherise on failure, error messages @@ -372,12 +372,12 @@ void InspSocket::Close() errno = save; } -std::string InspSocket::GetIP() +std::string BufferedSocket::GetIP() { return this->IP; } -char* InspSocket::Read() +char* BufferedSocket::Read() { if (!Instance->SE->BoundsCheckFd(this)) return NULL; @@ -426,7 +426,7 @@ char* InspSocket::Read() } } -void InspSocket::MarkAsClosed() +void BufferedSocket::MarkAsClosed() { } @@ -434,7 +434,7 @@ void InspSocket::MarkAsClosed() // It will either write all of the data, or an undefined amount. // If an undefined amount is written the connection has failed // and should be aborted. -int InspSocket::Write(const std::string &data) +int BufferedSocket::Write(const std::string &data) { /* Try and append the data to the back of the queue, and send it on its way */ @@ -443,7 +443,7 @@ int InspSocket::Write(const std::string &data) return (!this->FlushWriteBuffer()); } -bool InspSocket::FlushWriteBuffer() +bool BufferedSocket::FlushWriteBuffer() { errno = 0; if ((this->fd > -1) && (this->state == I_CONNECTED)) @@ -554,7 +554,7 @@ void SocketTimeout::Tick(time_t now) this->sock->Timeout = NULL; } -bool InspSocket::Poll() +bool BufferedSocket::Poll() { int incoming = -1; @@ -648,31 +648,31 @@ bool InspSocket::Poll() return true; } -void InspSocket::SetState(InspSocketState s) +void BufferedSocket::SetState(BufferedSocketState s) { this->state = s; } -InspSocketState InspSocket::GetState() +BufferedSocketState BufferedSocket::GetState() { return this->state; } -int InspSocket::GetFd() +int BufferedSocket::GetFd() { return this->fd; } -bool InspSocket::OnConnected() { return true; } -void InspSocket::OnError(InspSocketError e) { return; } -int InspSocket::OnDisconnect() { return 0; } -int InspSocket::OnIncomingConnection(int newfd, char* ip) { return 0; } -bool InspSocket::OnDataReady() { return true; } -bool InspSocket::OnWriteReady() { return true; } -void InspSocket::OnTimeout() { return; } -void InspSocket::OnClose() { return; } +bool BufferedSocket::OnConnected() { return true; } +void BufferedSocket::OnError(BufferedSocketError e) { return; } +int BufferedSocket::OnDisconnect() { return 0; } +int BufferedSocket::OnIncomingConnection(int newfd, char* ip) { return 0; } +bool BufferedSocket::OnDataReady() { return true; } +bool BufferedSocket::OnWriteReady() { return true; } +void BufferedSocket::OnTimeout() { return; } +void BufferedSocket::OnClose() { return; } -InspSocket::~InspSocket() +BufferedSocket::~BufferedSocket() { this->Close(); if (Timeout) @@ -682,7 +682,7 @@ InspSocket::~InspSocket() } } -void InspSocket::HandleEvent(EventType et, int errornum) +void BufferedSocket::HandleEvent(EventType et, int errornum) { switch (et) { @@ -732,7 +732,7 @@ void InspSocket::HandleEvent(EventType et, int errornum) /* This might look wrong as if we should be actually calling * with EVENT_WRITE, but trust me it is correct. There are some * writeability-state things in the read code, because of how - * InspSocket used to work regarding write buffering in previous + * BufferedSocket used to work regarding write buffering in previous * versions of InspIRCd. - Brain */ this->HandleEvent(EVENT_READ); diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 53d852f72..21906196b 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -624,7 +624,7 @@ void* DispatcherThread(void* arg); /** Used by m_mysql to notify one thread when the other has a result */ -class Notifier : public InspSocket +class Notifier : public BufferedSocket { insp_sockaddr sock_us; socklen_t uslen; @@ -634,9 +634,9 @@ class Notifier : public InspSocket /* Create a socket on a random port. Let the tcp stack allocate us an available port */ #ifdef IPV6 - Notifier(InspIRCd* SI) : InspSocket(SI, "::1", 0, true, 3000) + Notifier(InspIRCd* SI) : BufferedSocket(SI, "::1", 0, true, 3000) #else - Notifier(InspIRCd* SI) : InspSocket(SI, "127.0.0.1", 0, true, 3000) + Notifier(InspIRCd* SI) : BufferedSocket(SI, "127.0.0.1", 0, true, 3000) #endif { uslen = sizeof(sock_us); @@ -646,7 +646,7 @@ class Notifier : public InspSocket } } - Notifier(InspIRCd* SI, int newfd, char* ip) : InspSocket(SI, newfd, ip) + Notifier(InspIRCd* SI, int newfd, char* ip) : BufferedSocket(SI, newfd, ip) { } diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index 97ecd0a8a..3120836c9 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -29,7 +29,7 @@ /* SQLConn rewritten by peavey to * use EventHandler instead of - * InspSocket. This is much neater + * BufferedSocket. This is much neater * and gives total control of destroy * and delete of resources. */ diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp index 9795e9f8b..0f0da20a1 100644 --- a/src/modules/extra/m_sqlite3.cpp +++ b/src/modules/extra/m_sqlite3.cpp @@ -36,7 +36,7 @@ typedef std::deque<SQLite3Result*> ResultQueue; ResultNotifier* resultnotify = NULL; -class ResultNotifier : public InspSocket +class ResultNotifier : public BufferedSocket { Module* mod; insp_sockaddr sock_us; @@ -45,9 +45,9 @@ class ResultNotifier : public InspSocket public: /* Create a socket on a random port. Let the tcp stack allocate us an available port */ #ifdef IPV6 - ResultNotifier(InspIRCd* SI, Module* m) : InspSocket(SI, "::1", 0, true, 3000), mod(m) + ResultNotifier(InspIRCd* SI, Module* m) : BufferedSocket(SI, "::1", 0, true, 3000), mod(m) #else - ResultNotifier(InspIRCd* SI, Module* m) : InspSocket(SI, "127.0.0.1", 0, true, 3000), mod(m) + ResultNotifier(InspIRCd* SI, Module* m) : BufferedSocket(SI, "127.0.0.1", 0, true, 3000), mod(m) #endif { uslen = sizeof(sock_us); @@ -57,7 +57,7 @@ class ResultNotifier : public InspSocket } } - ResultNotifier(InspIRCd* SI, Module* m, int newfd, char* ip) : InspSocket(SI, newfd, ip), mod(m) + ResultNotifier(InspIRCd* SI, Module* m, int newfd, char* ip) : BufferedSocket(SI, newfd, ip), mod(m) { } diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index a7a52d910..323fe912f 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -90,7 +90,7 @@ class ModuleSSLGnuTLS : public Module ModuleSSLGnuTLS(InspIRCd* Me) : Module(Me) { - ServerInstance->Modules->PublishInterface("InspSocketHook", this); + ServerInstance->Modules->PublishInterface("BufferedSocketHook", this); // Not rehashable...because I cba to reduce all the sizes of existing buffers. inbufsize = ServerInstance->Config->NetBufferSize; @@ -307,7 +307,7 @@ class ModuleSSLGnuTLS : public Module char* ret = "OK"; try { - ret = ServerInstance->Config->AddIOHook((Module*)this, (InspSocket*)ISR->Sock) ? (char*)"OK" : NULL; + ret = ServerInstance->Config->AddIOHook((Module*)this, (BufferedSocket*)ISR->Sock) ? (char*)"OK" : NULL; } catch (ModuleException &e) { @@ -317,7 +317,7 @@ class ModuleSSLGnuTLS : public Module } else if (strcmp("IS_UNHOOK", request->GetId()) == 0) { - return ServerInstance->Config->DelIOHook((InspSocket*)ISR->Sock) ? (char*)"OK" : NULL; + return ServerInstance->Config->DelIOHook((BufferedSocket*)ISR->Sock) ? (char*)"OK" : NULL; } else if (strcmp("IS_HSDONE", request->GetId()) == 0) { @@ -336,7 +336,7 @@ class ModuleSSLGnuTLS : public Module { if ((Extensible*)ServerInstance->FindDescriptor(ISR->Sock->GetFd()) == (Extensible*)(ISR->Sock)) { - VerifyCertificate(session, (InspSocket*)ISR->Sock); + VerifyCertificate(session, (BufferedSocket*)ISR->Sock); return "OK"; } } @@ -572,7 +572,7 @@ class ModuleSSLGnuTLS : public Module MakePollWrite(session); /* Who's smart idea was it to return 1 when we havent written anything? - * This fucks the buffer up in InspSocket :p + * This fucks the buffer up in BufferedSocket :p */ return ret < 1 ? 0 : ret; } diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 4ce21c805..df47762af 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -130,7 +130,7 @@ class ModuleSSLOpenSSL : public Module ModuleSSLOpenSSL(InspIRCd* Me) : Module(Me), PublicInstance(Me) { - ServerInstance->Modules->PublishInterface("InspSocketHook", this); + ServerInstance->Modules->PublishInterface("BufferedSocketHook", this); // Not rehashable...because I cba to reduce all the sizes of existing buffers. inbufsize = ServerInstance->Config->NetBufferSize; @@ -356,7 +356,7 @@ class ModuleSSLOpenSSL : public Module char* ret = "OK"; try { - ret = ServerInstance->Config->AddIOHook((Module*)this, (InspSocket*)ISR->Sock) ? (char*)"OK" : NULL; + ret = ServerInstance->Config->AddIOHook((Module*)this, (BufferedSocket*)ISR->Sock) ? (char*)"OK" : NULL; } catch (ModuleException &e) { @@ -367,7 +367,7 @@ class ModuleSSLOpenSSL : public Module } else if (strcmp("IS_UNHOOK", request->GetId()) == 0) { - return ServerInstance->Config->DelIOHook((InspSocket*)ISR->Sock) ? (char*)"OK" : NULL; + return ServerInstance->Config->DelIOHook((BufferedSocket*)ISR->Sock) ? (char*)"OK" : NULL; } else if (strcmp("IS_HSDONE", request->GetId()) == 0) { @@ -382,7 +382,7 @@ class ModuleSSLOpenSSL : public Module issl_session* session = &sessions[ISR->Sock->GetFd()]; if (session->sess) { - VerifyCertificate(session, (InspSocket*)ISR->Sock); + VerifyCertificate(session, (BufferedSocket*)ISR->Sock); return "OK"; } } diff --git a/src/modules/extra/m_ziplink.cpp b/src/modules/extra/m_ziplink.cpp index 90da97856..c7ba1b6af 100644 --- a/src/modules/extra/m_ziplink.cpp +++ b/src/modules/extra/m_ziplink.cpp @@ -150,7 +150,7 @@ class ModuleZLib : public Module ModuleZLib(InspIRCd* Me) : Module::Module(Me) { - ServerInstance->Modules->PublishInterface("InspSocketHook", this); + ServerInstance->Modules->PublishInterface("BufferedSocketHook", this); total_out_compressed = total_in_compressed = 0; total_out_uncompressed = total_out_uncompressed = 0; @@ -158,7 +158,7 @@ class ModuleZLib : public Module virtual ~ModuleZLib() { - ServerInstance->Modules->UnpublishInterface("InspSocketHook", this); + ServerInstance->Modules->UnpublishInterface("BufferedSocketHook", this); } virtual Version GetVersion() @@ -172,7 +172,7 @@ class ModuleZLib : public Module List[I_OnStats] = List[I_OnRequest] = 1; } - /* Handle InspSocketHook API requests */ + /* Handle BufferedSocketHook API requests */ virtual char* OnRequest(Request* request) { ISHRequest* ISR = (ISHRequest*)request; @@ -187,7 +187,7 @@ class ModuleZLib : public Module char* ret = "OK"; try { - ret = ServerInstance->Config->AddIOHook((Module*)this, (InspSocket*)ISR->Sock) ? (char*)"OK" : NULL; + ret = ServerInstance->Config->AddIOHook((Module*)this, (BufferedSocket*)ISR->Sock) ? (char*)"OK" : NULL; } catch (ModuleException& e) { @@ -198,7 +198,7 @@ class ModuleZLib : public Module else if (strcmp("IS_UNHOOK", request->GetId()) == 0) { /* Detatch from an inspsocket */ - return ServerInstance->Config->DelIOHook((InspSocket*)ISR->Sock) ? (char*)"OK" : NULL; + return ServerInstance->Config->DelIOHook((BufferedSocket*)ISR->Sock) ? (char*)"OK" : NULL; } else if (strcmp("IS_HSDONE", request->GetId()) == 0) { diff --git a/src/modules/m_http_client.cpp b/src/modules/m_http_client.cpp index a2f80687f..3f424b595 100644 --- a/src/modules/m_http_client.cpp +++ b/src/modules/m_http_client.cpp @@ -24,7 +24,7 @@ class URL int port; }; -class HTTPSocket : public InspSocket +class HTTPSocket : public BufferedSocket { private: InspIRCd *Server; @@ -111,7 +111,7 @@ class ModuleHTTPClient : public Module }; HTTPSocket::HTTPSocket(InspIRCd *Instance, ModuleHTTPClient *Mod) - : InspSocket(Instance), Server(Instance), Mod(Mod), status(HTTP_CLOSED) + : BufferedSocket(Instance), Server(Instance), Mod(Mod), status(HTTP_CLOSED) { this->ClosePending = false; this->port = 80; diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index b89260831..bb6c6d786 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -56,7 +56,7 @@ class HttpServerTimeout : public Timer /** A socket used for HTTP transport */ -class HttpServerSocket : public InspSocket +class HttpServerSocket : public BufferedSocket { FileReader* index; HttpState InternalState; @@ -76,13 +76,13 @@ class HttpServerSocket : public InspSocket public: - HttpServerSocket(InspIRCd* SI, std::string host, int port, bool listening, unsigned long maxtime, FileReader* index_page) : InspSocket(SI, host, port, listening, maxtime), index(index_page), postsize(0) + HttpServerSocket(InspIRCd* SI, std::string host, int port, bool listening, unsigned long maxtime, FileReader* index_page) : BufferedSocket(SI, host, port, listening, maxtime), index(index_page), postsize(0) { InternalState = HTTP_LISTEN; Timeout = NULL; } - HttpServerSocket(InspIRCd* SI, int newfd, char* ip, FileReader* ind) : InspSocket(SI, newfd, ip), index(ind), postsize(0), keepalive(false), DataSinceLastTick(false) + HttpServerSocket(InspIRCd* SI, int newfd, char* ip, FileReader* ind) : BufferedSocket(SI, newfd, ip), index(ind), postsize(0), keepalive(false), DataSinceLastTick(false) { InternalState = HTTP_SERVE_WAIT_REQUEST; Timeout = new HttpServerTimeout(this, Instance->SE); @@ -498,7 +498,7 @@ class ModuleHttpServer : public Module httpsocks[i]->Close(); delete httpsocks[i]->GetIndex(); } - ServerInstance->InspSocketCull(); + ServerInstance->BufferedSocketCull(); } virtual Version GetVersion() diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 5e7e6ccd0..6b1d77945 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -18,14 +18,14 @@ /* $ModDesc: Provides support for RFC1413 ident lookups */ -class IdentRequestSocket : public InspSocket +class IdentRequestSocket : public BufferedSocket { private: User *user; int original_fd; public: IdentRequestSocket(InspIRCd *Server, User *user, int timeout, const std::string &bindip) - : InspSocket(Server, user->GetIPString(), 113, false, timeout, bindip), user(user) + : BufferedSocket(Server, user->GetIPString(), 113, false, timeout, bindip), user(user) { original_fd = user->GetFd(); Instance->Log(DEBUG, "Ident request against user with fd %d", original_fd); @@ -95,7 +95,7 @@ class IdentRequestSocket : public InspSocket Instance->next_call = Instance->Time(); } - virtual void OnError(InspSocketError e) + virtual void OnError(BufferedSocketError e) { if (Instance->SE->GetRef(original_fd) == user) { diff --git a/src/modules/m_spanningtree/handshaketimer.cpp b/src/modules/m_spanningtree/handshaketimer.cpp index ffe81ad80..1108c5dcc 100644 --- a/src/modules/m_spanningtree/handshaketimer.cpp +++ b/src/modules/m_spanningtree/handshaketimer.cpp @@ -43,9 +43,9 @@ void HandshakeTimer::Tick(time_t TIME) } else { - if (sock->GetHook() && InspSocketHSCompleteRequest(sock, (Module*)Utils->Creator, sock->GetHook()).Send()) + if (sock->GetHook() && BufferedSocketHSCompleteRequest(sock, (Module*)Utils->Creator, sock->GetHook()).Send()) { - InspSocketAttachCertRequest(sock, (Module*)Utils->Creator, sock->GetHook()).Send(); + BufferedSocketAttachCertRequest(sock, (Module*)Utils->Creator, sock->GetHook()).Send(); sock->SendCapabilities(); } else diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 62f288fb3..2ccf510c7 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -36,7 +36,7 @@ ModuleSpanningTree::ModuleSpanningTree(InspIRCd* Me) : Module(Me), max_local(0), max_global(0) { - ServerInstance->Modules->UseInterface("InspSocketHook"); + ServerInstance->Modules->UseInterface("BufferedSocketHook"); Utils = new SpanningTreeUtilities(Me, this); command_rconnect = new cmd_rconnect(ServerInstance, this, Utils); ServerInstance->AddCommand(command_rconnect); @@ -1016,7 +1016,7 @@ ModuleSpanningTree::~ModuleSpanningTree() ServerInstance->Timers->DelTimer(RefreshTimer); - ServerInstance->Modules->DoneWithInterface("InspSocketHook"); + ServerInstance->Modules->DoneWithInterface("BufferedSocketHook"); } Version ModuleSpanningTree::GetVersion() diff --git a/src/modules/m_spanningtree/override_stats.cpp b/src/modules/m_spanningtree/override_stats.cpp index d9dca2827..5768ead80 100644 --- a/src/modules/m_spanningtree/override_stats.cpp +++ b/src/modules/m_spanningtree/override_stats.cpp @@ -88,7 +88,7 @@ int ModuleSpanningTree::OnStats(char statschar, User* user, string_list &results std::string transport("plaintext"); if (Utils->Bindings[i]->GetHook()) - transport = InspSocketNameRequest(this, Utils->Bindings[i]->GetHook()).Send(); + transport = BufferedSocketNameRequest(this, Utils->Bindings[i]->GetHook()).Send(); results.push_back(ConvToStr(ServerInstance->Config->ServerName) + " 249 "+user->nick+" :" + ip + ":" + ConvToStr(Utils->Bindings[i]->port)+ " (server, " + transport + ")"); diff --git a/src/modules/m_spanningtree/resolvers.cpp b/src/modules/m_spanningtree/resolvers.cpp index 7c4282c42..b033b5265 100644 --- a/src/modules/m_spanningtree/resolvers.cpp +++ b/src/modules/m_spanningtree/resolvers.cpp @@ -29,7 +29,7 @@ /* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */ /** This class is used to resolve server hostnames during /connect and autoconnect. - * As of 1.1, the resolver system is seperated out from InspSocket, so we must do this + * As of 1.1, the resolver system is seperated out from BufferedSocket, so we must do this * resolver step first ourselves if we need it. This is totally nonblocking, and will * callback to OnLookupComplete or OnError when completed. Once it has completed we * will have an IP address which we can then use to continue our connection. @@ -45,7 +45,7 @@ void ServernameResolver::OnLookupComplete(const std::string &result, unsigned in return; /* Initiate the connection, now that we have an IP to use. - * Passing a hostname directly to InspSocket causes it to + * Passing a hostname directly to BufferedSocket causes it to * just bail and set its FD to -1. */ TreeServer* CheckDupe = Utils->FindServer(MyLink.Name.c_str()); diff --git a/src/modules/m_spanningtree/resolvers.h b/src/modules/m_spanningtree/resolvers.h index 4549c8551..d1e5d1a5b 100644 --- a/src/modules/m_spanningtree/resolvers.h +++ b/src/modules/m_spanningtree/resolvers.h @@ -60,7 +60,7 @@ class SecurityIPResolver : public Resolver }; /** This class is used to resolve server hostnames during /connect and autoconnect. - * As of 1.1, the resolver system is seperated out from InspSocket, so we must do this + * As of 1.1, the resolver system is seperated out from BufferedSocket, so we must do this * resolver step first ourselves if we need it. This is totally nonblocking, and will * callback to OnLookupComplete or OnError when completed. Once it has completed we * will have an IP address which we can then use to continue our connection. diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h index 08e308dfb..ba0a04c3a 100644 --- a/src/modules/m_spanningtree/treesocket.h +++ b/src/modules/m_spanningtree/treesocket.h @@ -62,7 +62,7 @@ enum ServerState { LISTENER, CONNECTING, WAIT_AUTH_1, WAIT_AUTH_2, CONNECTED }; /** Every SERVER connection inbound or outbound is represented by * an object of type TreeSocket. - * TreeSockets, being inherited from InspSocket, can be tied into + * TreeSockets, being inherited from BufferedSocket, can be tied into * the core socket engine, and we cn therefore receive activity events * for them, just like activex objects on speed. (yes really, that * is a technical term!) Each of these which relates to a locally @@ -71,7 +71,7 @@ enum ServerState { LISTENER, CONNECTING, WAIT_AUTH_1, WAIT_AUTH_2, CONNECTED }; * maintain a list of servers, some of which are directly connected, * some of which are not. */ -class TreeSocket : public InspSocket +class TreeSocket : public BufferedSocket { SpanningTreeUtilities* Utils; /* Utility class */ std::string myhost; /* Canonical hostname */ @@ -96,14 +96,14 @@ class TreeSocket : public InspSocket public: /** Because most of the I/O gubbins are encapsulated within - * InspSocket, we just call the superclass constructor for + * BufferedSocket, we just call the superclass constructor for * most of the action, and append a few of our own values * to it. */ TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string host, int port, bool listening, unsigned long maxtime, Module* HookMod = NULL); /** Because most of the I/O gubbins are encapsulated within - * InspSocket, we just call the superclass constructor for + * BufferedSocket, we just call the superclass constructor for * most of the action, and append a few of our own values * to it. */ @@ -166,7 +166,7 @@ class TreeSocket : public InspSocket /** Handle socket error event */ - virtual void OnError(InspSocketError e); + virtual void OnError(BufferedSocketError e); /** Sends an error to the remote server, and displays it locally to show * that it was sent. @@ -257,7 +257,7 @@ class TreeSocket : public InspSocket /** This function is called when we receive data from a remote * server. We buffer the data in a std::string (it doesnt stay - * there for long), reading using InspSocket::Read() which can + * there for long), reading using BufferedSocket::Read() which can * read up to 16 kilobytes in one operation. * * IF THIS FUNCTION RETURNS FALSE, THE CORE CLOSES AND DELETES diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index 4f6dae56a..d9d44733d 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -33,30 +33,30 @@ /** Because most of the I/O gubbins are encapsulated within - * InspSocket, we just call the superclass constructor for + * BufferedSocket, we just call the superclass constructor for * most of the action, and append a few of our own values * to it. */ TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string host, int port, bool listening, unsigned long maxtime, Module* HookMod) - : InspSocket(SI, host, port, listening, maxtime), Utils(Util), Hook(HookMod) + : BufferedSocket(SI, host, port, listening, maxtime), Utils(Util), Hook(HookMod) { myhost = host; this->LinkState = LISTENER; theirchallenge.clear(); ourchallenge.clear(); if (listening && Hook) - InspSocketHookRequest(this, (Module*)Utils->Creator, Hook).Send(); + BufferedSocketHookRequest(this, (Module*)Utils->Creator, Hook).Send(); } TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string host, int port, bool listening, unsigned long maxtime, const std::string &ServerName, const std::string &bindto, Module* HookMod) - : InspSocket(SI, host, port, listening, maxtime, bindto), Utils(Util), Hook(HookMod) + : BufferedSocket(SI, host, port, listening, maxtime, bindto), Utils(Util), Hook(HookMod) { myhost = ServerName; theirchallenge.clear(); ourchallenge.clear(); this->LinkState = CONNECTING; if (Hook) - InspSocketHookRequest(this, (Module*)Utils->Creator, Hook).Send(); + BufferedSocketHookRequest(this, (Module*)Utils->Creator, Hook).Send(); } /** When a listening socket gives us a new file descriptor, @@ -64,7 +64,7 @@ TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string ho * connection. This constructor is used for this purpose. */ TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, int newfd, char* ip, Module* HookMod) - : InspSocket(SI, newfd, ip), Utils(Util), Hook(HookMod) + : BufferedSocket(SI, newfd, ip), Utils(Util), Hook(HookMod) { this->LinkState = WAIT_AUTH_1; theirchallenge.clear(); @@ -74,7 +74,7 @@ TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, int newfd, cha * socket, and set a timer waiting for handshake before we send CAPAB etc. */ if (Hook) - InspSocketHookRequest(this, (Module*)Utils->Creator, Hook).Send(); + BufferedSocketHookRequest(this, (Module*)Utils->Creator, Hook).Send(); Instance->Timers->AddTimer(new HandshakeTimer(Instance, this, &(Utils->LinkBlocks[0]), this->Utils, 1)); } @@ -92,7 +92,7 @@ Module* TreeSocket::GetHook() TreeSocket::~TreeSocket() { if (Hook) - InspSocketUnhookRequest(this, (Module*)Utils->Creator, Hook).Send(); + BufferedSocketUnhookRequest(this, (Module*)Utils->Creator, Hook).Send(); Utils->DelBurstingServer(this); } @@ -179,7 +179,7 @@ bool TreeSocket::OnConnected() Utils->Creator->RemoteMessage(NULL,"Connection to \2%s\2[%s] started.", myhost.c_str(), (x->HiddenFromStats ? "<hidden>" : this->GetIP().c_str())); if (Hook) { - InspSocketHookRequest(this, (Module*)Utils->Creator, Hook).Send(); + BufferedSocketHookRequest(this, (Module*)Utils->Creator, Hook).Send(); Utils->Creator->RemoteMessage(NULL,"Connection to \2%s\2[%s] using transport \2%s\2", myhost.c_str(), (x->HiddenFromStats ? "<hidden>" : this->GetIP().c_str()), x->Hook.c_str()); } @@ -205,7 +205,7 @@ bool TreeSocket::OnConnected() return true; } -void TreeSocket::OnError(InspSocketError e) +void TreeSocket::OnError(BufferedSocketError e) { Link* MyLink; @@ -1358,7 +1358,7 @@ void TreeSocket::DoBurst(TreeServer* s) /** This function is called when we receive data from a remote * server. We buffer the data in a std::string (it doesnt stay - * there for long), reading using InspSocket::Read() which can + * there for long), reading using BufferedSocket::Read() which can * read up to 16 kilobytes in one operation. * * IF THIS FUNCTION RETURNS FALSE, THE CORE CLOSES AND DELETES diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 0c2e99041..01e1316f5 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -1015,7 +1015,7 @@ bool TreeSocket::Inbound_Server(std::deque<std::string> ¶ms) this->Instance->SNO->WriteToSnoMask('l',"Verified incoming server connection from \002"+sname+"\002["+(x->HiddenFromStats ? "<hidden>" : this->GetIP())+"] ("+description+")"); if (this->Hook) { - std::string name = InspSocketNameRequest((Module*)Utils->Creator, this->Hook).Send(); + std::string name = BufferedSocketNameRequest((Module*)Utils->Creator, this->Hook).Send(); this->Instance->SNO->WriteToSnoMask('l',"Connection from \2"+sname+"\2["+(x->HiddenFromStats ? "<hidden>" : this->GetIP())+"] using transport \2"+name+"\2"); } diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 4814013e6..0376ea0c2 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -181,7 +181,7 @@ SpanningTreeUtilities::SpanningTreeUtilities(InspIRCd* Instance, ModuleSpanningT this->TreeRoot = new TreeServer(this, ServerInstance, ServerInstance->Config->ServerName, ServerInstance->Config->ServerDesc, ServerInstance->Config->GetSID()); - modulelist* ml = ServerInstance->Modules->FindInterface("InspSocketHook"); + modulelist* ml = ServerInstance->Modules->FindInterface("BufferedSocketHook"); /* Did we find any modules? */ if (ml) @@ -190,9 +190,9 @@ SpanningTreeUtilities::SpanningTreeUtilities(InspIRCd* Instance, ModuleSpanningT for (modulelist::iterator m = ml->begin(); m != ml->end(); m++) { /* Make a request to it for its name, its implementing - * InspSocketHook so we know its safe to do this + * BufferedSocketHook so we know its safe to do this */ - std::string name = InspSocketNameRequest((Module*)Creator, *m).Send(); + std::string name = BufferedSocketNameRequest((Module*)Creator, *m).Send(); /* Build a map of them */ hooks[name.c_str()] = *m; hooknames.push_back(name); @@ -220,7 +220,7 @@ SpanningTreeUtilities::~SpanningTreeUtilities() } } delete TreeRoot; - ServerInstance->InspSocketCull(); + ServerInstance->BufferedSocketCull(); } void SpanningTreeUtilities::AddThisServer(TreeServer* server, TreeServerList &list) diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h index aeb89c6be..38ddba0ed 100644 --- a/src/modules/m_spanningtree/utils.h +++ b/src/modules/m_spanningtree/utils.h @@ -33,7 +33,7 @@ typedef nspace::hash_map<std::string, TreeServer*, nspace::hash<string>, irc::St typedef std::map<TreeServer*,TreeServer*> TreeServerList; -/** A group of modules that implement InspSocketHook +/** A group of modules that implement BufferedSocketHook * that we can use to hook our server to server connections. */ typedef std::map<irc::string, Module*> hookmodules; diff --git a/src/modules/transport.h b/src/modules/transport.h index ba8e3973b..15a4a47ae 100644 --- a/src/modules/transport.h +++ b/src/modules/transport.h @@ -167,62 +167,62 @@ class ssl_cert class ISHRequest : public Request { public: - InspSocket* Sock; + BufferedSocket* Sock; - ISHRequest(Module* Me, Module* Target, const char* rtype, InspSocket* sock) : Request(Me, Target, rtype), Sock(sock) + ISHRequest(Module* Me, Module* Target, const char* rtype, BufferedSocket* sock) : Request(Me, Target, rtype), Sock(sock) { } }; -/** Used to represent a request to attach a cert to an InspSocket +/** Used to represent a request to attach a cert to an BufferedSocket */ -class InspSocketAttachCertRequest : public ISHRequest +class BufferedSocketAttachCertRequest : public ISHRequest { public: /** Initialize the request as an attach cert message */ - InspSocketAttachCertRequest(InspSocket* is, Module* Me, Module* Target) : ISHRequest(Me, Target, "IS_ATTACH", is) + BufferedSocketAttachCertRequest(BufferedSocket* is, Module* Me, Module* Target) : ISHRequest(Me, Target, "IS_ATTACH", is) { } }; -/** Used to check if a handshake is complete on an InspSocket yet +/** Used to check if a handshake is complete on an BufferedSocket yet */ -class InspSocketHSCompleteRequest : public ISHRequest +class BufferedSocketHSCompleteRequest : public ISHRequest { public: /** Initialize the request as a 'handshake complete?' message */ - InspSocketHSCompleteRequest(InspSocket* is, Module* Me, Module* Target) : ISHRequest(Me, Target, "IS_HSDONE", is) + BufferedSocketHSCompleteRequest(BufferedSocket* is, Module* Me, Module* Target) : ISHRequest(Me, Target, "IS_HSDONE", is) { } }; -/** Used to hook a transport provider to an InspSocket +/** Used to hook a transport provider to an BufferedSocket */ -class InspSocketHookRequest : public ISHRequest +class BufferedSocketHookRequest : public ISHRequest { public: /** Initialize request as a hook message */ - InspSocketHookRequest(InspSocket* is, Module* Me, Module* Target) : ISHRequest(Me, Target, "IS_HOOK", is) + BufferedSocketHookRequest(BufferedSocket* is, Module* Me, Module* Target) : ISHRequest(Me, Target, "IS_HOOK", is) { } }; -/** Used to unhook a transport provider from an InspSocket +/** Used to unhook a transport provider from an BufferedSocket */ -class InspSocketUnhookRequest : public ISHRequest +class BufferedSocketUnhookRequest : public ISHRequest { public: /** Initialize request as an unhook message */ - InspSocketUnhookRequest(InspSocket* is, Module* Me, Module* Target) : ISHRequest(Me, Target, "IS_UNHOOK", is) + BufferedSocketUnhookRequest(BufferedSocket* is, Module* Me, Module* Target) : ISHRequest(Me, Target, "IS_UNHOOK", is) { } }; -class InspSocketNameRequest : public ISHRequest +class BufferedSocketNameRequest : public ISHRequest { public: /** Initialize request as a get name message */ - InspSocketNameRequest(Module* Me, Module* Target) : ISHRequest(Me, Target, "IS_NAME", NULL) + BufferedSocketNameRequest(Module* Me, Module* Target) : ISHRequest(Me, Target, "IS_NAME", NULL) { } }; |