The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

ModuleXMLSocket Class Reference

Inheritance diagram for ModuleXMLSocket:

Inheritance graph
[legend]
Collaboration diagram for ModuleXMLSocket:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ModuleXMLSocket (InspIRCd *Me)
bool isin (const std::string &host, int port, const std::vector< std::string > &portlist)
virtual void OnRehash (User *user, const std::string &param)
 Called on rehash.
virtual ~ModuleXMLSocket ()
virtual void OnUnloadModule (Module *mod, const std::string &name)
 Called whenever a module is unloaded.
virtual void OnCleanup (int target_type, void *item)
 Called before your module is unloaded to clean up Extensibles.
virtual Version GetVersion ()
 Returns the version number of a Module.
virtual void OnHookUserIO (User *user, const std::string &targetip)
virtual int OnRawSocketRead (int fd, char *buffer, unsigned int count, int &readresult)
 Called immediately before any read() operation on a client socket in the core.
virtual int OnRawSocketWrite (int fd, const char *buffer, int count)
 Called immediately before any write() operation on a user's socket in the core.

Private Attributes

ConfigReaderConf
std::vector< std::stringlistenports

Detailed Description

Definition at line 18 of file m_xmlsocket.cpp.


Constructor & Destructor Documentation

ModuleXMLSocket::ModuleXMLSocket InspIRCd Me  )  [inline]
 

Definition at line 25 of file m_xmlsocket.cpp.

References ModuleManager::Attach(), I_OnCleanup, I_OnHookUserIO, I_OnRawSocketRead, I_OnRawSocketWrite, I_OnRehash, I_OnUnloadModule, InspIRCd::Modules, OnRehash(), and Module::ServerInstance.

virtual ModuleXMLSocket::~ModuleXMLSocket  )  [inline, virtual]
 

Definition at line 83 of file m_xmlsocket.cpp.


Member Function Documentation

virtual Version ModuleXMLSocket::GetVersion  )  [inline, virtual]
 

Returns the version number of a Module.

The method should return a Version object with its version information assigned via Version::Version

Reimplemented from Module.

Definition at line 110 of file m_xmlsocket.cpp.

References API_VERSION, and VF_VENDOR.

bool ModuleXMLSocket::isin const std::string host,
int  port,
const std::vector< std::string > &  portlist
[inline]
 

Definition at line 33 of file m_xmlsocket.cpp.

References ConvToStr().

Referenced by OnHookUserIO().

virtual void ModuleXMLSocket::OnCleanup int  target_type,
void *  item
[inline, virtual]
 

Called before your module is unloaded to clean up Extensibles.

This method is called once for every user and channel on the network, so that when your module unloads it may clear up any remaining data in the form of Extensibles added using Extensible::Extend(). If the target_type variable is TYPE_USER, then void* item refers to a User*, otherwise it refers to a Channel*.

Parameters:
target_type The type of item being cleaned
item A pointer to the item's class

Reimplemented from Module.

Definition at line 100 of file m_xmlsocket.cpp.

References EventHandler::DelIOHook(), EventHandler::GetIOHook(), and TYPE_USER.

virtual void ModuleXMLSocket::OnHookUserIO User user,
const std::string targetip
[inline, virtual]
 

Reimplemented from Module.

Definition at line 115 of file m_xmlsocket.cpp.

References EventHandler::AddIOHook(), EventHandler::GetIOHook(), User::GetPort(), isin(), and listenports.

virtual int ModuleXMLSocket::OnRawSocketRead int  fd,
char *  buffer,
unsigned int  count,
int &  readresult
[inline, virtual]
 

Called immediately before any read() operation on a client socket in the core.

This occurs AFTER the select() or poll() so there is always data waiting to be read when this event occurs. Your event should return 1 if it has handled the reading itself, which prevents the core just using read(). You should place any data read into buffer, up to but NOT GREATER THAN the value of count. The value of readresult must be identical to an actual result that might be returned from the read() system call, for example, number of bytes read upon success, 0 upon EOF or closed socket, and -1 for error. If your function returns a nonzero value, you MUST set readresult.

Parameters:
fd The file descriptor of the socket
buffer A char* buffer being read to
count The size of the buffer
readresult The amount of characters read, or 0
Returns:
nonzero if the event was handled, in which case readresult must be valid on exit

Reimplemented from Module.

Definition at line 124 of file m_xmlsocket.cpp.

References InspIRCd::FindDescriptor, User::ReadData(), and Module::ServerInstance.

virtual int ModuleXMLSocket::OnRawSocketWrite int  fd,
const char *  buffer,
int  count
[inline, virtual]
 

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 for use by modules which may wrap connections within another API such as SSL for example. return a non-zero result if you have handled the write operation, in which case the core will not call write().

Parameters:
fd The file descriptor of the socket
buffer A char* buffer being written
Number of characters to write
Returns:
Number of characters actually written or 0 if you didn't handle the operation

Reimplemented from Module.

Definition at line 152 of file m_xmlsocket.cpp.

References User::AddWriteBuf(), InspIRCd::FindDescriptor, and Module::ServerInstance.

virtual void ModuleXMLSocket::OnRehash User user,
const std::string param
[inline, virtual]
 

Called on rehash.

This method is called prior to a /REHASH or when a SIGHUP is received from the operating system. You should use it to reload any files so that your module keeps in step with the rest of the application. If a parameter is given, the core has done nothing. The module receiving the event can decide if this parameter has any relevence to it.

Parameters:
user The user performing the rehash, if any -- if this is server initiated, the value of this variable will be NULL.
parameter The (optional) parameter given to REHASH from the user.

Reimplemented from Module.

Definition at line 44 of file m_xmlsocket.cpp.

References Conf, InspIRCd::Config, ConvToStr(), DEFAULT, CoreException::GetReason(), irc::portparser::GetToken(), listenports, LogManager::Log(), InspIRCd::Logs, ServerConfig::ports, ConfigReader::ReadFlag(), ConfigReader::ReadValue(), and Module::ServerInstance.

Referenced by ModuleXMLSocket().

virtual void ModuleXMLSocket::OnUnloadModule Module mod,
const std::string name
[inline, virtual]
 

Called whenever a module is unloaded.

mod will contain a pointer to the module, and string will contain its name, for example m_widgets.so. This function is primary for dependency checking, your module may decide to enable some extra features if it sees that you have for example loaded "m_killwidgets.so" with "m_makewidgets.so". It is highly recommended that modules do *NOT* bail if they cannot satisfy dependencies, but instead operate under reduced functionality, unless the dependency is absolutely neccessary (e.g. a module that extends the features of another module).

Parameters:
mod Pointer to the module being unloaded (still valid)
name The filename of the module being unloaded

Reimplemented from Module.

Definition at line 87 of file m_xmlsocket.cpp.

References InspIRCd::Config, ConvToStr(), listenports, ServerConfig::ports, and Module::ServerInstance.


Member Data Documentation

ConfigReader* ModuleXMLSocket::Conf [private]
 

Definition at line 20 of file m_xmlsocket.cpp.

Referenced by OnRehash().

std::vector<std::string> ModuleXMLSocket::listenports [private]
 

Definition at line 21 of file m_xmlsocket.cpp.

Referenced by OnHookUserIO(), OnRehash(), and OnUnloadModule().


The documentation for this class was generated from the following file: