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

irc Namespace Reference

The irc namespace contains a number of helper classes. More...


Classes

struct  StrHashComp
 This class returns true if two strings match. More...
struct  irc_char_traits
 The irc_char_traits class is used for RFC-style comparison of strings. More...
class  stringjoiner
 irc::stringjoiner joins string lists into a string, using the given seperator string. More...
class  modestacker
 irc::modestacker stacks mode sequences into a list. More...
class  tokenstream
 irc::tokenstream reads a string formatted as per RFC1459 and RFC2812. More...
class  sepstream
 irc::sepstream allows for splitting token seperated lists. More...
class  commasepstream
 A derived form of sepstream, which seperates on commas. More...
class  spacesepstream
 A derived form of sepstream, which seperates on spaces. More...
class  portparser
 The portparser class seperates out a port range into integers. More...
class  dynamicbitmask
 The irc::dynamicbitmask class is used to maintain a bitmap of boolean values, which can grow to any reasonable size no matter how many bitfields are in it. More...

Namespaces

namespace  sockets
 This namespace contains various protocol-independent helper classes.

Typedefs

typedef basic_string< char,
irc_char_traits, allocator<
char > > 
string
 This typedef declares irc::string based upon irc_char_traits.
typedef std::pair< size_t,
unsigned char > 
bitfield
 Used to hold a bitfield definition in dynamicbitmask.

Functions

std::string hex (const unsigned char *raw, size_t rawsz)
 Compose a hex string from raw data.
CoreExport const char * Spacify (const char *n)
 Turn _ characters in a string into spaces.


Detailed Description

The irc namespace contains a number of helper classes.

Typedef Documentation

typedef std::pair<size_t, unsigned char> irc::bitfield
 

Used to hold a bitfield definition in dynamicbitmask.

You must be allocated one of these by dynamicbitmask::Allocate(), you should not fill the values yourself!

Definition at line 419 of file hashcomp.h.

typedef basic_string<char, irc_char_traits, allocator<char> > irc::string
 

This typedef declares irc::string based upon irc_char_traits.

Definition at line 136 of file hashcomp.h.


Function Documentation

CoreExport std::string irc::hex const unsigned char *  raw,
size_t  rawsz
 

Compose a hex string from raw data.

Parameters:
raw The raw data to compose hex from rawsz The size of the raw data buffer
Returns:
The hex string.

Definition at line 289 of file hashcomp.cpp.

References MAXBUF.

Referenced by DNS::MakeIP6Int(), ModuleSSLOpenSSL::VerifyCertificate(), and ModuleSSLGnuTLS::VerifyCertificate().

00290 {
00291         if (!rawsz)
00292                 return "";
00293 
00294         /* EWW! This used to be using sprintf, which is WAY inefficient. -Special */
00295         
00296         const char *hex = "0123456789abcdef";
00297         static char hexbuf[MAXBUF];
00298 
00299         size_t i, j;
00300         for (i = 0, j = 0; j < rawsz; ++j)
00301         {
00302                 hexbuf[i++] = hex[raw[j] / 16];
00303                 hexbuf[i++] = hex[raw[j] % 16];
00304         }
00305         hexbuf[i] = 0;
00306 
00307         return hexbuf;
00308 }

CoreExport const char * irc::Spacify const char *  n  ) 
 

Turn _ characters in a string into spaces.

Parameters:
n String to translate
Returns:
The new value with _ translated to space.

Definition at line 310 of file hashcomp.cpp.

References MAXBUF, and strlcpy().

Referenced by do_whois(), cmd_check::Handle(), cmd_oper::Handle(), and TreeSocket::OperType().

00311 {
00312         static char x[MAXBUF];
00313         strlcpy(x,n,MAXBUF);
00314         for (char* y = x; *y; y++)
00315                 if (*y == '_')
00316                         *y = ' ';
00317         return x;
00318 }