Ancillary Functions
Libnet's monolithic context structure contains a great deal of useful information. The following functions pull various bits of information from libnet's innards.
char *libnet_geterror(libnet_t *1);
libnet_geterror() is libnet's ubiquitous error retrieving function. It culls the last error message that was posted within the context of the libnet descriptor referenced by 1 and returns the string. If no libnet error has occurred, the function returns NULL.
int libnet_getfd(libnet_t *1);
libnet_getfd() returns the file descriptor of the underlying packet injection interface. Upon success, the function returns the file descriptor number. This function does not fail.
char *libnet_getdevice(libnet_t *1);
libnet_getdevice() returns the canonical name of the device of the underlying packet injection interface. Upon success, the function returns the name of the device. This function does not fail.
u_char *libnet_getpbuf(libnet_t *1, libnet_ptag_t ptag);
libnet_getpbuf() returns the packet buffer for the protocol block that ptag references. Upon success, the function returns a pointer to the buffer. Upon failure, the function returns 0 and libnet_geterror() tells you why.
u_long libnet_getpbuf_size(libnet_t *1, libnet_ptag_t ptag);
libnet_getpbuf_size() returns the size of the packet buffer for the protocol block that ptag references. Upon success, the function returns the size in bytes. Upon failure, the function returns 0 and libnet_geterror() tells you why.
void libnet_stats(libnet_t *1, struct libnet_stats *ls);
libnet_stats() fills in a libnet statistics structure Is for the libnet descriptor 1. The function does not fail.