IDA C++ SDK 9.2
Loading...
Searching...
No Matches
netnode Class Reference

Definition of the IDA database node. More...

#include <netnode.hpp>

Public Member Functions

Constructors, conversions and assignments
 netnode (nodeidx_t num=BADNODE)
 Constructor to create a netnode to access information about the specified linear address (possibly missing)
 operator nodeidx_t () const
 Conversion from netnode to a linear address.
 netnode (const char *_name, size_t namlen=0, bool do_create=false)
 Construct an instance of netnode class to access the specified netnode.
Create/Delete
Note
You can check if a netnode already exists with exist()
bool create (const char *_name, size_t namlen=0)
 Create a named netnode.
bool create (void)
 Create unnamed netnode.
void kill (void)
 Delete a netnode with all information attached to it.
Netnode names
ssize_t get_name (qstring *buf) const
 Get the netnode name.
bool rename (const char *newname, size_t namlen=0)
 Rename a netnode.
Value of netnode
ssize_t valobj (void *buf, size_t bufsize) const
 Get value of netnode.
ssize_t valstr (qstring *buf) const
 Get string value of netnode.
ssize_t valstr (char *buf, size_t bufsize) const
bool set (const void *value, size_t length=0)
 Set value of netnode.
bool delvalue (void)
 Delete value of netnode.
bool set_long (nodeidx_t x)
 Value of netnode as a long number:
bool value_exists (void) const
nodeidx_t long_value (void) const
Arrays of altvals.

altvals: a sparse array of 32-bit values.

indexes in this array may be 8-bit or 32-bit values

nodeidx_t altval (nodeidx_t alt, uchar tag=atag) const
 Get altval element of the specified array.
nodeidx_t altval_ea (ea_t ea, uchar tag=atag) const
bool altset (nodeidx_t alt, nodeidx_t value, uchar tag=atag)
 Set value of altval array.
bool altset_ea (ea_t ea, nodeidx_t value, uchar tag=atag)
bool altdel (nodeidx_t alt, uchar tag=atag)
 Delete element of altval array.
bool altdel_ea (ea_t ea, uchar tag=atag)
bool easet (ea_t ea, ea_t addr, uchar tag)
 Store/retrieve/delete an address value in the netnode that corresponds to an address.
ea_t eaget (ea_t ea, uchar tag) const
bool eadel (ea_t ea, uchar tag)
bool easet_idx (nodeidx_t idx, ea_t addr, uchar tag)
ea_t eaget_idx (nodeidx_t idx, uchar tag)
bool easet_idx8 (uchar idx, ea_t addr, uchar tag)
ea_t eaget_idx8 (uchar idx, uchar tag) const
bool eadel_idx8 (uchar idx, uchar tag)
nodeidx_t altfirst (uchar tag=atag) const
 Get first existing element of altval array.
nodeidx_t altnext (nodeidx_t cur, uchar tag=atag) const
 Get next existing element of altval array.
nodeidx_t altlast (uchar tag=atag) const
 Get last element of altval array.
nodeidx_t altprev (nodeidx_t cur, uchar tag=atag) const
 Get previous existing element of altval array.
size_t altshift (nodeidx_t from, nodeidx_t to, nodeidx_t size, uchar tag=atag)
 Shift the altval array elements.
void altadjust (nodeidx_t from, nodeidx_t to, nodeidx_t size, bool(idaapi *should_skip)(nodeidx_t ea)=nullptr)
 Adjust values of altval arrays elements.
void altadjust2 (nodeidx_t from, nodeidx_t to, nodeidx_t size, altadjust_visitor_t &av)
Arrays of altvals: 8-bit values

The following functions behave in the same manner as the functions described above.

The only difference is that the array value is 8-bits.

  • index: 32 bits
  • value: 8 bits
uchar charval (nodeidx_t alt, uchar tag) const
bool charset (nodeidx_t alt, uchar val, uchar tag)
bool chardel (nodeidx_t alt, uchar tag)
uchar charval_ea (ea_t ea, uchar tag) const
bool charset_ea (ea_t ea, uchar val, uchar tag)
bool chardel_ea (ea_t ea, uchar tag)
nodeidx_t charfirst (uchar tag) const
nodeidx_t charnext (nodeidx_t cur, uchar tag) const
nodeidx_t charlast (uchar tag) const
nodeidx_t charprev (nodeidx_t cur, uchar tag) const
size_t charshift (nodeidx_t from, nodeidx_t to, nodeidx_t size, uchar tag)
Arrays of altvals: 8-bit indexes

Another set of functions to work with altvals.

The only difference is that the array index is 8-bits, and therefore the array may contain up to 256 elements only.

  • index: 8 bits
  • value: 32 bits
nodeidx_t altval_idx8 (uchar alt, uchar tag) const
bool altset_idx8 (uchar alt, nodeidx_t val, uchar tag)
bool altdel_idx8 (uchar alt, uchar tag)
nodeidx_t altfirst_idx8 (uchar tag) const
nodeidx_t altnext_idx8 (uchar cur, uchar tag) const
nodeidx_t altlast_idx8 (uchar tag) const
nodeidx_t altprev_idx8 (uchar cur, uchar tag) const
More altvals

Another set of functions to work with altvals.

  • index: 8 bits
  • value: 8 bits
uchar charval_idx8 (uchar alt, uchar tag) const
bool charset_idx8 (uchar alt, uchar val, uchar tag)
bool chardel_idx8 (uchar alt, uchar tag)
nodeidx_t charfirst_idx8 (uchar tag) const
nodeidx_t charnext_idx8 (uchar cur, uchar tag) const
nodeidx_t charlast_idx8 (uchar tag) const
nodeidx_t charprev_idx8 (uchar cur, uchar tag) const
Delete altvals
Note
To delete range of elements in an altval array, see supdel_range()
bool altdel (void)
 Delete all elements of altval array.
bool altdel_all (uchar tag=atag)
 Delete all elements of the specified altval array.
Arrays of supvals

supvals: an array of arbitrary sized objects.

(size of each object is limited by MAXSPECSIZE). indexes in this array may be 8-bit or 32-bit values.

ssize_t supval (nodeidx_t alt, void *buf, size_t bufsize, uchar tag=stag) const
 Get value of the specified supval array element.
ssize_t supval_ea (ea_t ea, void *buf, size_t bufsize, uchar tag=stag) const
ssize_t supstr (qstring *buf, nodeidx_t alt, uchar tag=stag) const
 Get string value of the specified supval array element.
ssize_t supstr_ea (qstring *buf, ea_t ea, uchar tag=stag) const
ssize_t supstr (nodeidx_t alt, char *buf, size_t bufsize, uchar tag=stag) const
ssize_t supstr_ea (ea_t ea, char *buf, size_t bufsize, uchar tag=stag) const
bool supset (nodeidx_t alt, const void *value, size_t length=0, uchar tag=stag)
 Set value of supval array element.
bool supset_ea (ea_t ea, const void *value, size_t length=0, uchar tag=stag)
bool supdel (nodeidx_t alt, uchar tag=stag)
 Delete supval element.
bool supdel_ea (ea_t ea, uchar tag=stag)
nodeidx_t lower_bound (nodeidx_t cur, uchar tag=stag) const
 Get lower bound of existing elements of supval array.
nodeidx_t lower_bound_ea (ea_t ea, uchar tag=stag) const
nodeidx_t supfirst (uchar tag=stag) const
 Get first existing element of supval array.
nodeidx_t supnext (nodeidx_t cur, uchar tag=stag) const
 Get next existing element of supval array.
nodeidx_t suplast (uchar tag=stag) const
 Get last existing element of supval array.
nodeidx_t supprev (nodeidx_t cur, uchar tag=stag) const
 Get previous existing element of supval array.
size_t supshift (nodeidx_t from, nodeidx_t to, nodeidx_t size, uchar tag=stag)
 Shift the supval array elements.
Arrays of supvals: 8-bit indexes

The following functions behave in the same manner as the functions described above.

The only difference is that the array index is 8-bits and therefore the array may contains up to 256 elements only.

ssize_t supval_idx8 (uchar alt, void *buf, size_t bufsize, uchar tag) const
ssize_t supstr_idx8 (uchar alt, char *buf, size_t bufsize, uchar tag) const
ssize_t supstr_idx8 (qstring *buf, uchar alt, uchar tag) const
bool supset_idx8 (uchar alt, const void *value, size_t length, uchar tag)
bool supdel_idx8 (uchar alt, uchar tag)
nodeidx_t lower_bound_idx8 (uchar alt, uchar tag) const
nodeidx_t supfirst_idx8 (uchar tag) const
nodeidx_t supnext_idx8 (uchar alt, uchar tag) const
nodeidx_t suplast_idx8 (uchar tag) const
nodeidx_t supprev_idx8 (uchar alt, uchar tag) const
Delete supvals
bool supdel (void)
 Delete all elements of supval array.
bool supdel_all (uchar tag)
 Delete all elements of the specified supval array.
int supdel_range (nodeidx_t idx1, nodeidx_t idx2, uchar tag)
 Delete range of elements in the specified supval array.
int supdel_range_idx8 (uchar idx1, uchar idx2, uchar tag)
 Same as above, but accepts 8-bit indexes.
Hashes

Associative arrays indexed by strings.

hashvals: Indexes in this array are strings. Values are arbitrary sized (max size is MAXSPECSIZE)

ssize_t hashval (const char *idx, void *buf, size_t bufsize, uchar tag=htag) const
 Get value of the specified hash element.
ssize_t hashstr (qstring *buf, const char *idx, uchar tag=htag) const
 Similar to supstr(), but accepts a hash index.
ssize_t hashstr (const char *idx, char *buf, size_t bufsize, uchar tag=htag) const
nodeidx_t hashval_long (const char *idx, uchar tag=htag) const
 Get value of the specified hash element.
bool hashset (const char *idx, const void *value, size_t length=0, uchar tag=htag)
 Set value of hash element.
bool hashset (const char *idx, nodeidx_t value, uchar tag=htag)
 Set value of hash element to long value.
bool hashdel (const char *idx, uchar tag=htag)
 Delete hash element.
ssize_t hashfirst (qstring *buf, uchar tag=htag) const
 Get first existing element of hash.
ssize_t hashfirst (char *buf, size_t bufsize, uchar tag=htag) const
ssize_t hashnext (qstring *buf, const char *idx, uchar tag=htag) const
 Get next existing element of hash.
ssize_t hashnext (const char *idx, char *buf, size_t bufsize, uchar tag=htag) const
ssize_t hashlast (qstring *buf, uchar tag=htag) const
 Get last existing element of hash.
ssize_t hashlast (char *buf, size_t bufsize, uchar tag=htag) const
ssize_t hashprev (qstring *buf, const char *idx, uchar tag=htag) const
 Get previous existing element of supval array.
ssize_t hashprev (const char *idx, char *buf, size_t bufsize, uchar tag=htag) const
bool hashdel_all (uchar tag=htag)
 Delete all elements of hash.
Blobs

Virtually unlimited size binary objects.

Blobs are stored in several supval array elements.

size_t blobsize (nodeidx_t _start, uchar tag)
 Get size of blob.
size_t blobsize_ea (ea_t ea, uchar tag)
voidgetblob (void *buf, size_t *bufsize, nodeidx_t _start, uchar tag)
 Get blob from a netnode.
voidgetblob_ea (void *buf, size_t *bufsize, ea_t ea, uchar tag)
template<class T>
ssize_t getblob (qvector< T > *blob, nodeidx_t _start, uchar tag)
 Get blob from a netnode.
template<class T>
ssize_t getblob_ea (qvector< T > *blob, ea_t ea, uchar tag)
ssize_t getblob (qstring *buf, nodeidx_t _start, uchar tag)
 Get blob from a netnode into a qstring* and make sure the string is null-terminated.
bool setblob (const void *buf, size_t size, nodeidx_t _start, uchar tag)
 Store a blob in a netnode.
bool setblob_ea (const void *buf, size_t size, ea_t ea, uchar tag)
int delblob (nodeidx_t _start, uchar tag)
 Delete a blob.
int delblob_ea (ea_t ea, uchar tag)
size_t blobshift (nodeidx_t from, nodeidx_t to, nodeidx_t size, uchar tag)
 Shift the blob array elements.
Enumerate all netnodes
bool start (void)
 Get first netnode in the graph.
bool end (void)
 Get last netnode in the graph.
bool next (void)
 Get next netnode in the graph.
bool prev (void)
 Get prev netnode in the graph.
Move and copy netnodes
Parameters
destnodethe destination netnode
counthow many netnodes to copy
Returns
number of copied/moved keys, #BADNODE if failure or not enough memory
size_t copyto (netnode destnode, nodeidx_t count=1)
size_t moveto (netnode destnode, nodeidx_t count=1)
Netnode comparisons
bool operator== (netnode &n) const
bool operator!= (netnode &n) const
bool operator== (nodeidx_t x) const
bool operator!= (nodeidx_t x) const

Static Public Member Functions

static bool exist (const char *_name)
 Does the netnode with the specified name exist?
static bool inited (void)
static bool is_available (void)

Friends

bool exist (const netnode &n)
 Does the specified netnode exist?

Detailed Description

Definition of the IDA database node.

Note that the size of the 'netnode' class is 4 bytes and it can be freely casted to 'uint32' and back. This makes it easy to store information about the program location in the netnodes. Please pass netnodes to functions by value.

Constructor & Destructor Documentation

◆ netnode() [1/2]

netnode::netnode ( nodeidx_t num = BADNODE)
inline

Constructor to create a netnode to access information about the specified linear address (possibly missing)

◆ netnode() [2/2]

netnode::netnode ( const char * _name,
size_t namlen = 0,
bool do_create = false )
inline

Construct an instance of netnode class to access the specified netnode.

Parameters
_namename of netnode
namlenlength of the name. may be omitted, in this case the length will be calculated with strlen()
do_createtrue: create the netnode if it doesn't exist yet. false: don't create the netnode, set netnumber to #BADNODE if it doesn't exist

Member Function Documentation

◆ operator nodeidx_t()

netnode::operator nodeidx_t ( ) const
inline

Conversion from netnode to a linear address.

◆ exist()

bool netnode::exist ( const char * _name)
inlinestatic

Does the netnode with the specified name exist?

◆ create() [1/2]

bool netnode::create ( const char * _name,
size_t namlen = 0 )
inline

Create a named netnode.

Parameters
_namename of netnode to create. names of user-defined netnodes must have the "$ " prefix in order to avoid clashes with program byte names.
namlenlength of the name. if not specified, it will be calculated using strlen()
Return values
1ok, the node is created
0the node already exists. you may use the netnode class to access it.

◆ create() [2/2]

bool netnode::create ( void )
inline

Create unnamed netnode.

Return values
1ok
0should not happen, indicates internal error

◆ kill()

void netnode::kill ( void )
inline

Delete a netnode with all information attached to it.

◆ get_name()

ssize_t netnode::get_name ( qstring * buf) const
inline

Get the netnode name.

Returns
-1 if netnode is unnamed (buf is untouched in this case), otherwise the name length

◆ rename()

bool netnode::rename ( const char * newname,
size_t namlen = 0 )
inline

Rename a netnode.

Parameters
newnamenew name of netnode. nullptr or "" means to delete name. names of user-defined netnodes must have the "$ " prefix in order to avoid clashes with program byte names.
namlenlength of new name. if not specified, it will be calculated using strlen()
Return values
1ok
0failed, newname is already used

◆ valobj()

ssize_t netnode::valobj ( void * buf,
size_t bufsize ) const
inline

Get value of netnode.

Netnode values are arbitrary sized objects with max size is MAXSPECSIZE. NB: do not use this function for strings - see valstr().

Returns
length of value, -1 if no value present

◆ valstr() [1/2]

ssize_t netnode::valstr ( qstring * buf) const
inline

Get string value of netnode.

See explanations for supstr() function about the differences between valobj() and valstr()

Returns
length of value, -1 if no value present

◆ valstr() [2/2]

ssize_t netnode::valstr ( char * buf,
size_t bufsize ) const
inline

◆ set()

bool netnode::set ( const void * value,
size_t length = 0 )
inline

Set value of netnode.

Parameters
valuepointer to value
lengthlength of value. if not specified, it will be calculated using strlen()
Returns
1 - ok

◆ delvalue()

bool netnode::delvalue ( void )
inline

Delete value of netnode.

Return values
1ok
0failed, netnode is bad or other error

◆ set_long()

bool netnode::set_long ( nodeidx_t x)
inline

Value of netnode as a long number:

◆ value_exists()

bool netnode::value_exists ( void ) const
inline

◆ long_value()

nodeidx_t netnode::long_value ( void ) const
inline

◆ altval()

nodeidx_t netnode::altval ( nodeidx_t alt,
uchar tag = atag ) const
inline

Get altval element of the specified array.

Parameters
altindex into array of altvals
tagtag of array. may be omitted
Returns
value of altval element. nonexistent altval members are returned as zeroes

◆ altval_ea()

nodeidx_t netnode::altval_ea ( ea_t ea,
uchar tag = atag ) const
inline

◆ altset()

bool netnode::altset ( nodeidx_t alt,
nodeidx_t value,
uchar tag = atag )
inline

Set value of altval array.

Parameters
altindex into array of altvals
valuenew value of altval element
tagtag of array
Return values
1ok
0failed, normally should not occur

◆ altset_ea()

bool netnode::altset_ea ( ea_t ea,
nodeidx_t value,
uchar tag = atag )
inline

◆ altdel() [1/2]

bool netnode::altdel ( nodeidx_t alt,
uchar tag = atag )
inline

Delete element of altval array.

Parameters
altindex into array of altvals
tagtag of array
Return values
1ok
0failed, element doesn't exist

◆ altdel_ea()

bool netnode::altdel_ea ( ea_t ea,
uchar tag = atag )
inline

◆ easet()

bool netnode::easet ( ea_t ea,
ea_t addr,
uchar tag )
inline

Store/retrieve/delete an address value in the netnode that corresponds to an address.

◆ eaget()

ea_t netnode::eaget ( ea_t ea,
uchar tag ) const
inline

◆ eadel()

bool netnode::eadel ( ea_t ea,
uchar tag )
inline

◆ easet_idx()

bool netnode::easet_idx ( nodeidx_t idx,
ea_t addr,
uchar tag )
inline

◆ eaget_idx()

ea_t netnode::eaget_idx ( nodeidx_t idx,
uchar tag )
inline

◆ easet_idx8()

bool netnode::easet_idx8 ( uchar idx,
ea_t addr,
uchar tag )
inline

◆ eaget_idx8()

ea_t netnode::eaget_idx8 ( uchar idx,
uchar tag ) const
inline

◆ eadel_idx8()

bool netnode::eadel_idx8 ( uchar idx,
uchar tag )
inline

◆ altfirst()

nodeidx_t netnode::altfirst ( uchar tag = atag) const
inline

Get first existing element of altval array.

Parameters
tagtag of array
Returns
index of first existing element of altval array, #BADNODE if altval array is empty

◆ altnext()

nodeidx_t netnode::altnext ( nodeidx_t cur,
uchar tag = atag ) const
inline

Get next existing element of altval array.

Parameters
curcurrent index
tagtag of array
Returns
index of the next existing element of altval array, #BADNODE if no more altval array elements exist

◆ altlast()

nodeidx_t netnode::altlast ( uchar tag = atag) const
inline

Get last element of altval array.

Parameters
tagtag of array
Returns
index of last existing element of altval array, #BADNODE if altval array is empty

◆ altprev()

nodeidx_t netnode::altprev ( nodeidx_t cur,
uchar tag = atag ) const
inline

Get previous existing element of altval array.

Parameters
curcurrent index
tagtag of array
Returns
index of the previous existing element of altval array, #BADNODE if no more altval array elements exist

◆ altshift()

size_t netnode::altshift ( nodeidx_t from,
nodeidx_t to,
nodeidx_t size,
uchar tag = atag )
inline

Shift the altval array elements.

Moves the array elements at (from..from+size) to (to..to+size)

Returns
number of shifted elements

◆ altadjust()

void netnode::altadjust ( nodeidx_t from,
nodeidx_t to,
nodeidx_t size,
bool(idaapi *should_skip)(nodeidx_t ea) = nullptr )
inline

Adjust values of altval arrays elements.

All altvals in the range from+1..from+size+1 and adjusted to have values in the range to+1..to+size+1. The parameter should_skip() can be used to skip the adjustment of some altvals

◆ altadjust2()

void netnode::altadjust2 ( nodeidx_t from,
nodeidx_t to,
nodeidx_t size,
altadjust_visitor_t & av )
inline

◆ charval()

uchar netnode::charval ( nodeidx_t alt,
uchar tag ) const
inline

◆ charset()

bool netnode::charset ( nodeidx_t alt,
uchar val,
uchar tag )
inline

◆ chardel()

bool netnode::chardel ( nodeidx_t alt,
uchar tag )
inline

◆ charval_ea()

uchar netnode::charval_ea ( ea_t ea,
uchar tag ) const
inline

◆ charset_ea()

bool netnode::charset_ea ( ea_t ea,
uchar val,
uchar tag )
inline

◆ chardel_ea()

bool netnode::chardel_ea ( ea_t ea,
uchar tag )
inline

◆ charfirst()

nodeidx_t netnode::charfirst ( uchar tag) const
inline

◆ charnext()

nodeidx_t netnode::charnext ( nodeidx_t cur,
uchar tag ) const
inline

◆ charlast()

nodeidx_t netnode::charlast ( uchar tag) const
inline

◆ charprev()

nodeidx_t netnode::charprev ( nodeidx_t cur,
uchar tag ) const
inline

◆ charshift()

size_t netnode::charshift ( nodeidx_t from,
nodeidx_t to,
nodeidx_t size,
uchar tag )
inline

◆ altval_idx8()

nodeidx_t netnode::altval_idx8 ( uchar alt,
uchar tag ) const
inline

◆ altset_idx8()

bool netnode::altset_idx8 ( uchar alt,
nodeidx_t val,
uchar tag )
inline

◆ altdel_idx8()

bool netnode::altdel_idx8 ( uchar alt,
uchar tag )
inline

◆ altfirst_idx8()

nodeidx_t netnode::altfirst_idx8 ( uchar tag) const
inline

◆ altnext_idx8()

nodeidx_t netnode::altnext_idx8 ( uchar cur,
uchar tag ) const
inline

◆ altlast_idx8()

nodeidx_t netnode::altlast_idx8 ( uchar tag) const
inline

◆ altprev_idx8()

nodeidx_t netnode::altprev_idx8 ( uchar cur,
uchar tag ) const
inline

◆ charval_idx8()

uchar netnode::charval_idx8 ( uchar alt,
uchar tag ) const
inline

◆ charset_idx8()

bool netnode::charset_idx8 ( uchar alt,
uchar val,
uchar tag )
inline

◆ chardel_idx8()

bool netnode::chardel_idx8 ( uchar alt,
uchar tag )
inline

◆ charfirst_idx8()

nodeidx_t netnode::charfirst_idx8 ( uchar tag) const
inline

◆ charnext_idx8()

nodeidx_t netnode::charnext_idx8 ( uchar cur,
uchar tag ) const
inline

◆ charlast_idx8()

nodeidx_t netnode::charlast_idx8 ( uchar tag) const
inline

◆ charprev_idx8()

nodeidx_t netnode::charprev_idx8 ( uchar cur,
uchar tag ) const
inline

◆ altdel() [2/2]

bool netnode::altdel ( void )
inline

Delete all elements of altval array.

This function may be applied to 32-bit and 8-bit altval arrays. This function deletes the whole altval array.

Returns
success

◆ altdel_all()

bool netnode::altdel_all ( uchar tag = atag)
inline

Delete all elements of the specified altval array.

This function may be applied to 32-bit and 8-bit altval arrays. This function deletes the whole altval array.

Parameters
tagtag of array
Returns
success

◆ supval()

ssize_t netnode::supval ( nodeidx_t alt,
void * buf,
size_t bufsize,
uchar tag = stag ) const
inline

Get value of the specified supval array element.

NB: do not use this function to retrieve strings, see supstr()!

Parameters
altindex into array of supvals
bufoutput buffer, may be nullptr
bufsizesize of output buffer
tagtag of array. Default: stag
Returns
size of value, -1 if element doesn't exist

◆ supval_ea()

ssize_t netnode::supval_ea ( ea_t ea,
void * buf,
size_t bufsize,
uchar tag = stag ) const
inline

◆ supstr() [1/2]

ssize_t netnode::supstr ( qstring * buf,
nodeidx_t alt,
uchar tag = stag ) const
inline

Get string value of the specified supval array element.

The differences between supval() and supstr() are the following:

  1. Strings are stored with the terminating zero in the old databases. supval() returns the exact size of the stored object (with the terminating zero) but supstr returns the string length without the terminating zero. supstr() can handle strings stored with or without the terminating zero.
  2. supstr() makes sure that the string is terminated with 0 even if the string was stored in the database without it or the output buffer is too small to hold the entire string. In the latter case the string will be truncated but still will have the terminating zero.

If you do not use the string length returned by supval/supstr() functions and you are sure that the output buffer is big enough to hold the entire string and the string has been stored in the database with the terminating zero, then you can continue to use supval() instead of supstr().

Parameters
bufoutput buffer, may be nullptr
altindex into array of supvals
tagtag of array. Default: stag
Returns
length of the output string, -1 if element doesn't exist

◆ supstr_ea() [1/2]

ssize_t netnode::supstr_ea ( qstring * buf,
ea_t ea,
uchar tag = stag ) const
inline

◆ supstr() [2/2]

ssize_t netnode::supstr ( nodeidx_t alt,
char * buf,
size_t bufsize,
uchar tag = stag ) const
inline
See also
supstr(qstring *buf, nodeidx_t alt, uchar tag=stag) const

◆ supstr_ea() [2/2]

ssize_t netnode::supstr_ea ( ea_t ea,
char * buf,
size_t bufsize,
uchar tag = stag ) const
inline

◆ supset()

bool netnode::supset ( nodeidx_t alt,
const void * value,
size_t length = 0,
uchar tag = stag )
inline

Set value of supval array element.

Parameters
altindex into array of supvals
valuepointer to supval value
lengthlength of 'value'. If not specified, the length is calculated using strlen()+1.
tagtag of array
Return values
1ok
0should not occur - indicates internal error

◆ supset_ea()

bool netnode::supset_ea ( ea_t ea,
const void * value,
size_t length = 0,
uchar tag = stag )
inline

◆ supdel() [1/2]

bool netnode::supdel ( nodeidx_t alt,
uchar tag = stag )
inline

Delete supval element.

Parameters
altindex into array of supvals
tagtag of array
Return values
truedeleted
falseelement does not exist

◆ supdel_ea()

bool netnode::supdel_ea ( ea_t ea,
uchar tag = stag )
inline

◆ lower_bound()

nodeidx_t netnode::lower_bound ( nodeidx_t cur,
uchar tag = stag ) const
inline

Get lower bound of existing elements of supval array.

Parameters
curcurrent index
tagtag of array
Returns
index of first existing element of supval array >= cur #BADNODE if supval array is empty

◆ lower_bound_ea()

nodeidx_t netnode::lower_bound_ea ( ea_t ea,
uchar tag = stag ) const
inline

◆ supfirst()

nodeidx_t netnode::supfirst ( uchar tag = stag) const
inline

Get first existing element of supval array.

Parameters
tagtag of array
Returns
index of first existing element of supval array, #BADNODE if supval array is empty

◆ supnext()

nodeidx_t netnode::supnext ( nodeidx_t cur,
uchar tag = stag ) const
inline

Get next existing element of supval array.

Parameters
curcurrent index
tagtag of array
Returns
index of the next existing element of supval array, #BADNODE if no more supval array elements exist

◆ suplast()

nodeidx_t netnode::suplast ( uchar tag = stag) const
inline

Get last existing element of supval array.

Parameters
tagtag of array
Returns
index of last existing element of supval array, #BADNODE if supval array is empty

◆ supprev()

nodeidx_t netnode::supprev ( nodeidx_t cur,
uchar tag = stag ) const
inline

Get previous existing element of supval array.

Parameters
curcurrent index
tagtag of array
Returns
index of the previous existing element of supval array #BADNODE if no more supval array elements exist

◆ supshift()

size_t netnode::supshift ( nodeidx_t from,
nodeidx_t to,
nodeidx_t size,
uchar tag = stag )
inline

Shift the supval array elements.

Moves the array elements at (from..from+size) to (to..to+size)

Returns
number of shifted elements

◆ supval_idx8()

ssize_t netnode::supval_idx8 ( uchar alt,
void * buf,
size_t bufsize,
uchar tag ) const
inline

◆ supstr_idx8() [1/2]

ssize_t netnode::supstr_idx8 ( uchar alt,
char * buf,
size_t bufsize,
uchar tag ) const
inline

◆ supstr_idx8() [2/2]

ssize_t netnode::supstr_idx8 ( qstring * buf,
uchar alt,
uchar tag ) const
inline

◆ supset_idx8()

bool netnode::supset_idx8 ( uchar alt,
const void * value,
size_t length,
uchar tag )
inline

◆ supdel_idx8()

bool netnode::supdel_idx8 ( uchar alt,
uchar tag )
inline

◆ lower_bound_idx8()

nodeidx_t netnode::lower_bound_idx8 ( uchar alt,
uchar tag ) const
inline

◆ supfirst_idx8()

nodeidx_t netnode::supfirst_idx8 ( uchar tag) const
inline

◆ supnext_idx8()

nodeidx_t netnode::supnext_idx8 ( uchar alt,
uchar tag ) const
inline

◆ suplast_idx8()

nodeidx_t netnode::suplast_idx8 ( uchar tag) const
inline

◆ supprev_idx8()

nodeidx_t netnode::supprev_idx8 ( uchar alt,
uchar tag ) const
inline

◆ supdel() [2/2]

bool netnode::supdel ( void )
inline

Delete all elements of supval array.

This function may be applied to 32-bit and 8-bit supval arrays. This function deletes the whole supval array.

Returns
success

◆ supdel_all()

bool netnode::supdel_all ( uchar tag)
inline

Delete all elements of the specified supval array.

This function may be applied to 32-bit and 8-bit supval arrays. This function deletes the whole supval array.

Returns
success

◆ supdel_range()

int netnode::supdel_range ( nodeidx_t idx1,
nodeidx_t idx2,
uchar tag )
inline

Delete range of elements in the specified supval array.

Elements in range [idx1, idx2) will be deleted.

Note
This function can also be used to delete a range of altval elements
Parameters
idx1first element to delete
idx2last element to delete + 1
tagtag of array
Returns
number of deleted elements

◆ supdel_range_idx8()

int netnode::supdel_range_idx8 ( uchar idx1,
uchar idx2,
uchar tag )
inline

Same as above, but accepts 8-bit indexes.

◆ hashval()

ssize_t netnode::hashval ( const char * idx,
void * buf,
size_t bufsize,
uchar tag = htag ) const
inline

Get value of the specified hash element.

Parameters
idxindex into hash
bufoutput buffer, may be nullptr
bufsizeoutput buffer size
tagtag of hash. Default: htag
Returns
-1 if element doesn't exist or idx is nullptr. otherwise returns the value size in bytes

◆ hashstr() [1/2]

ssize_t netnode::hashstr ( qstring * buf,
const char * idx,
uchar tag = htag ) const
inline

Similar to supstr(), but accepts a hash index.

◆ hashstr() [2/2]

ssize_t netnode::hashstr ( const char * idx,
char * buf,
size_t bufsize,
uchar tag = htag ) const
inline
See also
hashstr(qstring *buf, const char *idx, uchar tag=htag) const

◆ hashval_long()

nodeidx_t netnode::hashval_long ( const char * idx,
uchar tag = htag ) const
inline

Get value of the specified hash element.

Parameters
idxindex into hash
tagtag of hash. Default: htag
Returns
value of hash element (it should be set using hashset(nodeidx_t)), 0 if the element does not exist

◆ hashset() [1/2]

bool netnode::hashset ( const char * idx,
const void * value,
size_t length = 0,
uchar tag = htag )
inline

Set value of hash element.

Parameters
idxindex into hash
valuepointer to value
lengthlength of 'value'. If not specified, the length is calculated using strlen()+1.
tagtag of hash. Default: htag
Return values
1ok
0should not occur - indicates internal error

◆ hashset() [2/2]

bool netnode::hashset ( const char * idx,
nodeidx_t value,
uchar tag = htag )
inline

Set value of hash element to long value.

Parameters
idxindex into hash
valuenew value of hash element
tagtag of hash. Default: htag
Return values
1ok
0should not occur - indicates internal error

◆ hashdel()

bool netnode::hashdel ( const char * idx,
uchar tag = htag )
inline

Delete hash element.

Parameters
idxindex into hash
tagtag of hash. Default: htag
Return values
truedeleted
falseelement does not exist

◆ hashfirst() [1/2]

ssize_t netnode::hashfirst ( qstring * buf,
uchar tag = htag ) const
inline

Get first existing element of hash.

Note
elements of hash are kept sorted in lexical order
Parameters
bufoutput buffer, may be nullptr
tagtag of hash. Default: htag
Returns
size of index of first existing element of hash, -1 if hash is empty

◆ hashfirst() [2/2]

ssize_t netnode::hashfirst ( char * buf,
size_t bufsize,
uchar tag = htag ) const
inline
See also
hashfirst(qstring *buf, uchar tag=htag) const

◆ hashnext() [1/2]

ssize_t netnode::hashnext ( qstring * buf,
const char * idx,
uchar tag = htag ) const
inline

Get next existing element of hash.

Note
elements of hash are kept sorted in lexical order
Parameters
bufoutput buffer, may be nullptr
idxcurrent index into hash
tagtag of hash. Default: htag
Returns
size of index of the next existing element of hash, -1 if no more hash elements exist

◆ hashnext() [2/2]

ssize_t netnode::hashnext ( const char * idx,
char * buf,
size_t bufsize,
uchar tag = htag ) const
inline
See also
hashnext(qstring *buf, const char *idx, uchar tag=htag) const

◆ hashlast() [1/2]

ssize_t netnode::hashlast ( qstring * buf,
uchar tag = htag ) const
inline

Get last existing element of hash.

Note
elements of hash are kept sorted in lexical order
Parameters
bufoutput buffer, may be nullptr
tagtag of hash. Default: htag
Returns
size of index of last existing element of hash, -1 if hash is empty

◆ hashlast() [2/2]

ssize_t netnode::hashlast ( char * buf,
size_t bufsize,
uchar tag = htag ) const
inline
See also
hashlast(qstring *buf, uchar tag=htag) const

◆ hashprev() [1/2]

ssize_t netnode::hashprev ( qstring * buf,
const char * idx,
uchar tag = htag ) const
inline

Get previous existing element of supval array.

Note
elements of hash are kept sorted in lexical order
Parameters
bufoutput buffer, may be nullptr
idxcurrent index into hash
tagtag of hash. Default: htag
Returns
size of index of the previous existing element of hash, -1 if no more hash elements exist

◆ hashprev() [2/2]

ssize_t netnode::hashprev ( const char * idx,
char * buf,
size_t bufsize,
uchar tag = htag ) const
inline
See also
hashprev(qstring *buf, const char *idx, uchar tag=htag) const

◆ hashdel_all()

bool netnode::hashdel_all ( uchar tag = htag)
inline

Delete all elements of hash.

This function deletes the whole hash.

Parameters
tagtag of hash. Default: htag
Returns
success

◆ blobsize()

size_t netnode::blobsize ( nodeidx_t _start,
uchar tag )
inline

Get size of blob.

Parameters
_startindex of the first supval element used to store blob
tagtag of supval array
Returns
number of bytes required to store a blob

◆ blobsize_ea()

size_t netnode::blobsize_ea ( ea_t ea,
uchar tag )
inline

◆ getblob() [1/3]

void * netnode::getblob ( void * buf,
size_t * bufsize,
nodeidx_t _start,
uchar tag )
inline

Get blob from a netnode.

Parameters
bufbuffer to read into. if nullptr, the buffer will be allocated using qalloc()
[in,out]bufsizein: size of 'buf' in bytes (if buf == nullptr then meaningless). out: size of the blob if it exists. bufsize may be nullptr
_startindex of the first supval element used to store blob
tagtag of supval array
Returns
nullptr if blob doesn't exist, otherwise returns pointer to blob

◆ getblob_ea() [1/2]

void * netnode::getblob_ea ( void * buf,
size_t * bufsize,
ea_t ea,
uchar tag )
inline

◆ getblob() [2/3]

template<class T>
ssize_t netnode::getblob ( qvector< T > * blob,
nodeidx_t _start,
uchar tag )
inline

Get blob from a netnode.

Parameters
bloboutput qvector buffer
_startindex of the first supval element used to store blob
tagtag of supval array
Returns
-1 if blob doesn't exist, size of blob otherwise

◆ getblob_ea() [2/2]

template<class T>
ssize_t netnode::getblob_ea ( qvector< T > * blob,
ea_t ea,
uchar tag )
inline

◆ getblob() [3/3]

ssize_t netnode::getblob ( qstring * buf,
nodeidx_t _start,
uchar tag )
inline

Get blob from a netnode into a qstring* and make sure the string is null-terminated.

Parameters
bufoutput qstring buffer
_startindex of the first supval element used to store blob
tagtag of supval array
Returns
-1 if blob doesn't exist size of string (including terminating null) otherwise

◆ setblob()

bool netnode::setblob ( const void * buf,
size_t size,
nodeidx_t _start,
uchar tag )
inline

Store a blob in a netnode.

Parameters
bufpointer to blob to save
sizesize of blob in bytes
_startindex of the first supval element used to store blob
tagtag of supval array
Returns
success

◆ setblob_ea()

bool netnode::setblob_ea ( const void * buf,
size_t size,
ea_t ea,
uchar tag )
inline

◆ delblob()

int netnode::delblob ( nodeidx_t _start,
uchar tag )
inline

Delete a blob.

Parameters
_startindex of the first supval element used to store blob
tagtag of supval array
Returns
number of deleted supvals

◆ delblob_ea()

int netnode::delblob_ea ( ea_t ea,
uchar tag )
inline

◆ blobshift()

size_t netnode::blobshift ( nodeidx_t from,
nodeidx_t to,
nodeidx_t size,
uchar tag )
inline

Shift the blob array elements.

Moves the array elements at (from..from+size) to (to..to+size)

Returns
number of shifted elements

◆ start()

bool netnode::start ( void )
inline

Get first netnode in the graph.

Sets netnodenumber to the lowest existing number.

Return values
trueok
falsegraph is empty

◆ end()

bool netnode::end ( void )
inline

Get last netnode in the graph.

Sets netnodenumber to the highest existing number.

Return values
trueok
falsegraph is empty

◆ next()

bool netnode::next ( void )
inline

Get next netnode in the graph.

Sets netnodenumber to the next existing number

Return values
trueok
falseno more netnodes

◆ prev()

bool netnode::prev ( void )
inline

Get prev netnode in the graph.

Sets netnodenumber to the previous existing number

Return values
trueok
falseno more netnodes

◆ copyto()

size_t netnode::copyto ( netnode destnode,
nodeidx_t count = 1 )
inline

◆ moveto()

size_t netnode::moveto ( netnode destnode,
nodeidx_t count = 1 )
inline

◆ operator==() [1/2]

bool netnode::operator== ( netnode & n) const
inline

◆ operator!=() [1/2]

bool netnode::operator!= ( netnode & n) const
inline

◆ operator==() [2/2]

bool netnode::operator== ( nodeidx_t x) const
inline

◆ operator!=() [2/2]

bool netnode::operator!= ( nodeidx_t x) const
inline

◆ inited()

bool netnode::inited ( void )
inlinestatic

◆ is_available()

bool netnode::is_available ( void )
inlinestatic

◆ exist

bool exist ( const netnode & n)
friend

Does the specified netnode exist?

Return values
truethere is some information attached to the netnode.
falseunnamed netnode without any information

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