Details
nd_misc_ones_complement_checksum ()
int nd_misc_ones_complement_checksum
(const void *data,
int data_len,
u_int32_t sum); |
The function computes the ones-complement checksum of the data
pointed to by data. If you want to extend the checksum over data
areas not included in data, you can pre-add the sum of that data
in units of short ints (16bit) and pass it as sum.
nd_misc_in_cksum ()
u_short nd_misc_in_cksum (); |
The function computes the Internet checksum of addr. Other data
can be included in the checksum by pre-added the sum if that data
in units of short ints (16bit) and passing it as preadd.
nd_misc_exists ()
gboolean nd_misc_exists (const char *filename); |
The function checks whether filename exists and returns
the result.
nd_misc_can_read ()
gboolean nd_misc_can_read (const char *filename); |
The function checks whether filename can be read and
returns the result.
nd_misc_is_tcpdump_file ()
gboolean nd_misc_is_tcpdump_file (const char *filename); |
The function checks whether filename is a tcpdump savefile
by looking for tcpdump's magic 0xa1b2c3d4 and its variations.
nd_misc_can_exec ()
gboolean nd_misc_can_exec (const char *filename); |
The function checks whether filename can be executed and
returns the result.
nd_misc_is_dir ()
gboolean nd_misc_is_dir (const char *filename); |
The function checks whether filename is a directory and
returns the result.
nd_misc_int_cmp ()
gint nd_misc_int_cmp (gconstpointer int1,
gconstpointer int2); |
This is a simple compare function for pointers that can be casted
(not dereferenced!) to ints, returning -1/0/1 of row1 is smaller/
equal/larger than row2. The signature allows usage with various
glib functions.
nd_misc_add_slash ()
char* nd_misc_add_slash (char *filename); |
The function checks if filename ends with a slash and if not,
reallocs the memory filename uses and appends a slash.
nd_misc_get_if_names ()
GList* nd_misc_get_if_names (int flags); |
The function returns an alphabetically ordered glib list of strings containing
the names of those network interfaces that satisfy the given flag combination.
nd_misc_get_if_mtu ()
int nd_misc_get_if_mtu (const char *ifname); |
The function returns the MTU for a given interface.
I have no idea whether this compiles on anything non-Linux ...
nd_misc_get_hardware_string ()
void nd_misc_get_hardware_string (char *str,
guint str_len,
guchar *address,
guint addr_len); |
The function places into the space pointed to by str
a string representing the hardware address as "xx : xx : ... : xx".
nd_misc_get_unnamed_string ()
char* nd_misc_get_unnamed_string (void); |
The function returns a pointer to statically allocated data
that gets filled with a numbered dummy file name. You need
to strdup() the pointer if you want to keep it around.