Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields  

clawsoft::User Class Reference

#include <User.h>

Inheritance diagram for clawsoft::User:

Inheritance graph
[legend]
Collaboration diagram for clawsoft::User:

Collaboration graph
[legend]

Detailed Description

This class deals with user management and numeric id setup on on running processes.

STATUS: READY TO TEST


Public Methods

 User ()
 This is the default constructor, it will initialize the internal userid and username to the same one as the current executing process.

 User (int uid)
 This will create a new User object with userid uid.

 User (const String &uname)
 This will create a new User object with username uname.

int getUserID ()
 This will return the object's numeric user id.


Static Public Methods

int getCurrentUserID ()
 This will return the current process's user id.

int getUserID (const String &uname)
 This will return the numeric user id corresponding to the string uname.

int getEffectiveUserID ()
 This will give the numeric effective user id.

void setUserID (int uid)
 This will set the current process user id to uid.

void setUserID (const String &uname)
 This will set the current process user id to uname.

void setUserID (const User &usrobj)
 This will set the current process user id to usrobj.

void setEffectiveUserID (int uid)
 This will set the current process effective user id to uid.

void setEffectiveUserID (const String &uname)
 This will set the current process effective user id to uname.

void setEffectiveUserID (const User &usrobj)
 This will set the current process effective user id to usrobj.


Protected Methods

void getKernelInfo ()
 This method will update the name and information about the current running kernel.

const char * getUnixName ()
 Use this method to retreives the name of the UNIX version you are currently using.

const char * getNodeName ()
 This method will give you the nodename of your current host machine.

const char * getKernelRelease ()
 This will return your current kernel release string.

const char * getKernelReleaseVersion ()
 This will return your current kernel release version string.

const char * getHostMachine ()
 This will return your current architecture description.

void setClassName (const char *n)
 Call this method when you need to set the name of the class you're creating, typically in it's constructor, remember that you must set the classname for every class you create, that way you can have more information while debugging.

const char * getClassName ()
 Returns the name of the current class.


Static Protected Methods

char * _getUsername (int uid)
 This will translate a numeric user id into a null terminated character array.

int getuid ()
 Obtains the current (running) user id.

int getuid (const String &username)
 Obtain uid from username.

int getgid ()
 Obtains the current (running) user id.

int getgid (const String &groupname)
 Obtain uid from username.

int chown (const String &fname, int userid, int groupid=-1)
 Changes the owner of the file by its numeric userid.

int chown (const String &fname, const String &owner)
 Changes the owner of the file by its username.

int chgrp (const String &fname, int userid)
 Changes the group owner of the file by its numeric userid.

int chgrp (const String &fname, const String &groupname)
 Changes the group owner of the file by its groupname.

int installedCPUs ()
 This will return how many CPUs are installed in the system.

double cpuSpeed ()
 This will return the CPU speed in megahertz.

int totalMemory ()
 Will return the total amount of system memory.

int freeMemory ()
 Will return the total amount of free system memory.

void usleep (Uint32 usec)
 Will freeze the software for usec microseconds.


Protected Attributes

int _userid
 This member stores the numeric user id.

String _username
 This member stores the username as a string.

char * sysname
 Pointer to system name.


Constructor & Destructor Documentation

clawsoft::User::User  
 

This is the default constructor, it will initialize the internal userid and username to the same one as the current executing process.

clawsoft::User::User int    uid
 

This will create a new User object with userid uid.

clawsoft::User::User const String   uname
 

This will create a new User object with username uname.


Member Function Documentation

char * clawsoft::User::_getUsername int    uid [static, protected]
 

This will translate a numeric user id into a null terminated character array.

int clawsoft::Unix::chgrp const String   fname,
const String   groupname
[static, inherited]
 

Changes the group owner of the file by its groupname.

int clawsoft::Unix::chgrp const String   fname,
int    userid
[static, inherited]
 

Changes the group owner of the file by its numeric userid.

int clawsoft::Unix::chown const String   fname,
const String   owner
[static, inherited]
 

Changes the owner of the file by its username.

int clawsoft::Unix::chown const String   fname,
int    userid,
int    groupid = -1
[static, inherited]
 

Changes the owner of the file by its numeric userid.

double clawsoft::System::cpuSpeed   [static, inherited]
 

This will return the CPU speed in megahertz.

int clawsoft::System::freeMemory   [static, inherited]
 

Will return the total amount of free system memory.

const char * clawsoft::Object::getClassName   [inherited]
 

Returns the name of the current class.

int clawsoft::User::getCurrentUserID   [static]
 

This will return the current process's user id.

int clawsoft::User::getEffectiveUserID   [static]
 

This will give the numeric effective user id.

int clawsoft::Unix::getgid const String   groupname [static, inherited]
 

Obtain uid from username.

int clawsoft::Unix::getgid   [static, inherited]
 

Obtains the current (running) user id.

const char * clawsoft::Unix::getHostMachine   [inherited]
 

This will return your current architecture description.

void clawsoft::Unix::getKernelInfo   [inherited]
 

This method will update the name and information about the current running kernel.

const char * clawsoft::Unix::getKernelRelease   [inherited]
 

This will return your current kernel release string.

const char * clawsoft::Unix::getKernelReleaseVersion   [inherited]
 

This will return your current kernel release version string.

const char * clawsoft::Unix::getNodeName   [inherited]
 

This method will give you the nodename of your current host machine.

int clawsoft::Unix::getuid const String   username [static, inherited]
 

Obtain uid from username.

int clawsoft::Unix::getuid   [static, inherited]
 

Obtains the current (running) user id.

const char * clawsoft::Unix::getUnixName   [inherited]
 

Use this method to retreives the name of the UNIX version you are currently using.

int clawsoft::User::getUserID const String   uname [static]
 

This will return the numeric user id corresponding to the string uname.

int clawsoft::User::getUserID  
 

This will return the object's numeric user id.

int clawsoft::System::installedCPUs   [static, inherited]
 

This will return how many CPUs are installed in the system.

void clawsoft::Object::setClassName const char *    n [protected, inherited]
 

Call this method when you need to set the name of the class you're creating, typically in it's constructor, remember that you must set the classname for every class you create, that way you can have more information while debugging.

void clawsoft::User::setEffectiveUserID const User &    usrobj [static]
 

This will set the current process effective user id to usrobj.

void clawsoft::User::setEffectiveUserID const String   uname [static]
 

This will set the current process effective user id to uname.

void clawsoft::User::setEffectiveUserID int    uid [static]
 

This will set the current process effective user id to uid.

void clawsoft::User::setUserID const User &    usrobj [static]
 

This will set the current process user id to usrobj.

void clawsoft::User::setUserID const String   uname [static]
 

This will set the current process user id to uname.

void clawsoft::User::setUserID int    uid [static]
 

This will set the current process user id to uid.

int clawsoft::System::totalMemory   [static, inherited]
 

Will return the total amount of system memory.

void clawsoft::System::usleep Uint32    usec [static, inherited]
 

Will freeze the software for usec microseconds.


Field Documentation

int clawsoft::User::_userid [protected]
 

This member stores the numeric user id.

String clawsoft::User::_username [protected]
 

This member stores the username as a string.

char* clawsoft::Unix::sysname [protected, inherited]
 

Pointer to system name.


The documentation for this class was generated from the following files:

Authors:

Juan V. Guerrero
Jannette C. Mejia
Juan C. Guevara

Powered by:

SourceForgeLogo