Rudiments
Public Member Functions | Static Public Member Functions | List of all members
protocolentry Class Reference

#include <protocolentry.h>

Inherits object.

Public Member Functions

 protocolentry ()
 
 ~protocolentry ()
 
bool open (const char *protocolname)
 
bool open (int32_t number)
 
const chargetName ()
 
const char *constgetAliasList ()
 
int32_t getNumber ()
 
- Public Member Functions inherited from object
virtual ~object ()
 

Static Public Member Functions

static int32_t getNumber (const char *protocolname)
 
static chargetName (int32_t number)
 
static bool getNeedsMutex ()
 
static void setMutex (threadmutex *mtx)
 

Detailed Description

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

Constructor & Destructor Documentation

◆ protocolentry()

protocolentry::protocolentry ( )

Creates an instance of the protocolentry class.

◆ ~protocolentry()

protocolentry::~protocolentry ( )

Deletes this instance of the protocolentry class.

Member Function Documentation

◆ getAliasList()

const char *const * protocolentry::getAliasList ( )

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

◆ getName() [1/2]

const char * protocolentry::getName ( )

Returns the name of the protocol entry.

◆ getName() [2/2]

static char * protocolentry::getName ( int32_t number)
static

Convenience method. Returns the name of the protocol associated with "number".

Note that the return value is allocated internally and returned. The calling program must free the buffer.

Returns NULL if an error occurred or if "number" is invalid.

◆ getNeedsMutex()

static bool protocolentry::getNeedsMutex ( )
static

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

◆ getNumber() [1/2]

int32_t protocolentry::getNumber ( )

Returns the number associated with the protocol entry.

◆ getNumber() [2/2]

static int32_t protocolentry::getNumber ( const char * protocolname)
static

Convenience method. Returns the number associated with "protocolname".

Returns -1 if an error occurred or if "protocolname" is invalid.

◆ open() [1/2]

bool protocolentry::open ( const char * protocolname)

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

◆ open() [2/2]

bool protocolentry::open ( int32_t number)

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

◆ setMutex()

static void protocolentry::setMutex ( threadmutex * mtx)
static

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