Source Code (Use browser search to find items of interest.)
Class Index
kioslave'Descriptor (./kdebase/kioslave/smb/libsmb++/src/SambaLink.cpp:166)
class Descriptor {
private:
int myNumber;
Descriptor *beforeMe;
Descriptor *afterMe;
char *myFile;
cli_state *myCli;
public:
Descriptor(const char* file, cli_state* cli, int sambafd);
~Descriptor();
cli_state *cli();
int fid;
char *file();
// directory descriptor
bool dirdesc;
// used for readdir, since Samba gets all the results at one time
SMBdirentList *dirList; // the whole list, if any
SMBdirentList *pdirList; // pointer to the current element of that list
uint32 pos;
operator const int() const;
Descriptor *next();
// number of the last created descriptor
static Descriptor *find(int num);
static int descCount;
static Descriptor *descriptorList;
};
// Init static values to something
Descriptor *Descriptor::descriptorList=0;
int Descriptor::descCount=10000;
Descriptor::Descriptor(const char* file, cli_state* cli, int sambafd)
{
// Link ourself to the other descriptors
beforeMe = 0;
afterMe = descriptorList;
descriptorList = this;
if (afterMe) afterMe->beforeMe = this;
// get a number
myNumber = descCount++;
// record our info
myFile=0; newstrcpy(myFile,file);
myCli = cli;
fid = sambafd;
pos = 0;
dirList = 0;
pdirList = 0;
dirdesc = false;
}
Descriptor::~Descriptor()
{
// unlink from previous element, or update list
if (!beforeMe) descriptorList = afterMe;
else beforeMe->afterMe = afterMe;
// unlink from next element
if (afterMe) afterMe->beforeMe = beforeMe;
// cleanup
if (myCli) {
cli_close(myCli,fid);
cli_shutdown(myCli);
delete myCli;
}
if (myFile) delete myFile;
if (dirList) delete dirList; // recursive deletion
}
Descriptor::operator const int() const
{
return myNumber;
}
Descriptor *Descriptor::next()
{
return afterMe;
}
cli_state *Descriptor::cli()
{
return myCli;
}
char* Descriptor::file()
{
return myFile;
}
Descriptor *Descriptor::find(int num)
{
for (Descriptor* it=descriptorList; (it); it = it->next()) {
if ( *it == num ) return it;
}
return 0;
}
kioslave'Descriptor::find() (./kdebase/kioslave/smb/libsmb++/src/SambaLink.cpp:253)
Descriptor *Descriptor::find(int num)
{
for (Descriptor* it=descriptorList; (it); it = it->next()) {
if ( *it == num ) return it;
}
return 0;
}