Rudiments: protocolentry Class Reference

Rudiments

- Main Page
- Classes

- Class List
- Class Hierarchy
- Class Members

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

## Public Member Functions
| protocolentry ()
| protocolentry (const protocolentry &p)
protocolentry & | operator= (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

## Static Public Member Functions
static int32_t | getNumber (const char *protocolname)
static char * | getName (int32_t number)
static bool | needsMutex ()
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 | ( |  | ) |

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

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 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.

int32_t protocolentry::getNumber | ( |  | ) | const

Returns the number associated with the protocol entry.

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.

bool protocolentry::initialize | ( | const char * | protocolname | ) |

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

bool protocolentry::initialize | ( | int32_t | number | ) |

Looks up a protocol entry by number. 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".

static void protocolentry::setMutex | ( | threadmutex * | 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.