Rudiments
Public Member Functions | Static Public Member Functions
protocolentry Class Reference

List of all members.

Public Member Functions

 protocolentry ()
 protocolentry (const protocolentry &p)
protocolentryoperator= (const protocolentry &p)
 ~protocolentry ()
bool initialize (const char *protocolname)
bool initialize (int32_t number)
const char * getName () const
const char *const getAliasList () const
int32_t getNumber () const
void print () const

Static Public Member Functions

static bool getAliasList (const char *protocolname, char ***aliaslist)
static bool getNumber (const char *protocolname, int32_t *number)
static bool getName (int32_t number, char **name)
static bool getAliasList (int32_t number, char ***aliaslist)
static bool needsMutex ()
static void setMutex (mutex *mtx)

Detailed Description

The protocolentry class provides methods for retrieving entries from the protocol file (/etc/protocols on unix).


Constructor & Destructor Documentation

protocolentry::protocolentry ( )

Creates an instance of the protocolentry class.

protocolentry::protocolentry ( const protocolentry p)

Creates an instance of the protocolentry class. that is identical to "p".

protocolentry::~protocolentry ( )

Deletes this instance of the protocolentry class.


Member Function Documentation

static bool protocolentry::getAliasList ( const char *  protocolname,
char ***  aliaslist 
) [static]

Sets "aliaslist" to a NULL-terminated list of aliases for "protocolname". Note that "aliaslist" is allocated internally and returned. The calling program must free each element and the array itself.

Returns true on success and false otherwise.

static bool protocolentry::getAliasList ( int32_t  number,
char ***  aliaslist 
) [static]

Sets "aliaslist" to a NULL-terminated list of aliases for the protocol associated with "number". Note that "aliaslist" is allocated internally and returned. The calling program must free each element and the array itself.

Returns true on success and false otherwise.

const char* const protocolentry::getAliasList ( ) const

Returns a NULL-terminated list of aliases for the protocol entry.

const char* protocolentry::getName ( ) const

Returns the name of the protocol entry.

static bool protocolentry::getName ( int32_t  number,
char **  name 
) [static]

Sets "name" to the name of the protocol associated with "number".

static bool protocolentry::getNumber ( const char *  protocolname,
int32_t *  number 
) [static]

Sets "number" to the number associated with "protocolname".

int32_t protocolentry::getNumber ( ) const

Returns the number associated with the protocol entry.

bool protocolentry::initialize ( int32_t  number)

Looks up a protocol entry by number. Returns true on success and false on failure.

bool protocolentry::initialize ( const char *  protocolname)

Looks up a protocol entry by name. Returns true on success and false on failure.

static bool protocolentry::needsMutex ( ) [static]

Returns true if this class needs a mutex to operate safely in a threaded environment and false otherwise.

protocolentry& protocolentry::operator= ( const protocolentry p)

Makes this instance of the protocolentry class identical to "p".

void protocolentry::print ( ) const

Prints out a representation of the protocol entry.

static void protocolentry::setMutex ( mutex mtx) [static]

Allows you to supply a mutex is the class needs it. (see needsMutex()). If your application is not multithreaded, then there is no need to supply a mutex.