Source Code (Use browser search to find items of interest.)

Class Index

kioslave'ResourceRecord (./kdebase/kioslave/smb/libsmb++/src/NameServicePacket.h:61)

class ResourceRecord
{
/*RESOURCE RECORD

                        1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   /                            RR_NAME                            /
   /                                                               /
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |           RR_TYPE             |          RR_CLASS             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                              TTL                              |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |           RDLENGTH            |                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |
   /                                                               /
   /                             RDATA                             /
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected:
	char *rrName;	// NetBIOS format
	uint16 nameLength;
	uint16 rrType;
	uint16 rrClass;
	uint32 ttl;
	uint8 *data;
	uint16 dataLength;
public:
	ResourceRecord(const char *n, uint16 t, uint16 c, uint16 l, uint8* d, uint16 dl);
	uint8* build();
	uint16 getLength();
	~ResourceRecord();
};



kioslave'ResourceRecord::ResourceRecord() (./kdebase/kioslave/smb/libsmb++/src/NameServicePacket.cpp:27)

ResourceRecord::ResourceRecord(const char *n, uint16 t, uint16 c, uint16 l, uint8* d, uint16 dl)
{
	nameLength=strlen(n)+1;;
	rrName=new char[nameLength];
	memcpy(rrName,n,nameLength);
	rrType=t; rrClass=c; ttl=l;
	dataLength=dl;
	data=new uint8[dl];
	memcpy(data,d,dl);
}


kioslave'ResourceRecord::~ResourceRecord() (./kdebase/kioslave/smb/libsmb++/src/NameServicePacket.cpp:38)

ResourceRecord::~ResourceRecord()
{
	if (rrName) delete rrName;
	if (data) delete data;
}


kioslave'ResourceRecord::build() (./kdebase/kioslave/smb/libsmb++/src/NameServicePacket.cpp:44)

uint8* ResourceRecord::build()
{
	uint8* ret=new uint8[nameLength+10+dataLength];
	memcpy(ret,rrName,nameLength);
	// warning from gcc with (uint16*) on left side
	uint16 *p16 = (uint16 *)((uint8*)ret+nameLength);
	*(p16++)=BIGEND16(rrType);
	*p16=BIGEND16(rrClass);	
	uint32 *p32 = (uint32 *)((uint8*)ret+nameLength+4);
	*p32=BIGEND32(ttl);;
	*(p16+3) = BIGEND16(dataLength);
	memcpy(ret+nameLength+10,data,dataLength);
	return ret;
}


kioslave'ResourceRecord::getLength() (./kdebase/kioslave/smb/libsmb++/src/NameServicePacket.cpp:59)

uint16 ResourceRecord::getLength()
{
	return nameLength+dataLength+10;
}