InspIRCd  4.0
Public Member Functions | List of all members
ClientProtocol::Serializer Class Referenceabstract

#include <clientprotocol.h>

Inheritance diagram for ClientProtocol::Serializer:
DataProvider ServiceProvider Cullable insp::uncopiable

Public Member Functions

 Serializer (Module *mod, const char *Name)
bool HandleTag (LocalUser *user, const std::string &tagname, std::string &tagvalue, TagMap &tags) const
const SerializedMessage & SerializeForUser (LocalUser *user, Message &msg)
virtual std::string Serialize (const Message &msg, const TagSelection &tagwl) const =0
virtual bool Parse (LocalUser *user, const std::string &line, ParseOutput &parseoutput)=0
- Public Member Functions inherited from DataProvider
 DataProvider (Module *Creator, const std::string &Name)
- Public Member Functions inherited from ServiceProvider
 ServiceProvider (Module *Creator, const std::string &Name, ServiceType Type)
const char * GetTypeString () const
virtual void RegisterService ()
void DisableAutoRegister ()
- Public Member Functions inherited from Cullable
virtual ~Cullable ()
virtual Result Cull ()

Additional Inherited Members

- Public Attributes inherited from ServiceProvider
ModuleRef creator
const std::string name
const ServiceType service
- Protected Member Functions inherited from Cullable
 Cullable ()

Detailed Description

Base class for client protocol serializers. A serializer has to implement serialization and parsing of protocol messages to/from wire format.

Constructor & Destructor Documentation

◆ Serializer()

ClientProtocol::Serializer::Serializer ( Module mod,
const char *  Name 


modModule owning the serializer.
NameName of the serializer, e.g. "rfc".

Member Function Documentation

◆ HandleTag()

bool ClientProtocol::Serializer::HandleTag ( LocalUser user,
const std::string &  tagname,
std::string &  tagvalue,
TagMap tags 
) const

Handle a tag in a message being parsed. Call this method for each parsed tag.

userUser sending the tag.
tagnameName of the tag.
tagvalueTag value, may be empty.
tagsTagMap to place the tag into, if it gets accepted.
True if no error occurred, false if the tag name is invalid or if this tag already exists.

◆ Parse()

virtual bool ClientProtocol::Serializer::Parse ( LocalUser user,
const std::string &  line,
ParseOutput parseoutput 
pure virtual

Parse a protocol message from wire format.

userSource of the message.
lineRaw protocol message.
parseoutputOutput of the parser.
True if the message was parsed successfully into parseoutput and should be processed, false to drop the message.

◆ Serialize()

virtual std::string ClientProtocol::Serializer::Serialize ( const Message msg,
const TagSelection tagwl 
) const
pure virtual

Serialize a high level protocol message into wire format.

msgHigh level message to serialize. Contains all necessary information about the message, including all possible tags.
tagwlMessage tags to include in the serialized message. Tags attached to the message but not included in the whitelist must not appear in the output. This is because each user may get a different set of tags for the same message.
Protocol message in wire format. Must contain message delimiter as well, if any (e.g. CRLF for RFC1459).

◆ SerializeForUser()

const ClientProtocol::SerializedMessage & ClientProtocol::Serializer::SerializeForUser ( LocalUser user,
Message msg 

Serialize a message for a user.

userUser to serialize the message for.
msgMessage to serialize.
Raw serialized message, only containing the appropriate tags for the user. The reference is guaranteed to be valid as long as the Message object is alive and until the same Message is serialized for another user.

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