Rudiments
|
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 |
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) |
The protocolentry class provides methods for retrieving entries from the protocol file (/etc/protocols on unix).
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.
|
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 |
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.
|
static |
Sets "name" to the name of the protocol associated with "number".
const char* protocolentry::getName | ( | ) | const |
Returns the name of the protocol entry.
|
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 | ( | 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 |
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 |
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.