NetBurner 3.5.6
PDF Version |
Macros | |
#define | DB_TCPIP (1) |
Debug output control flags for NetBurner system components. | |
#define | DB_HTTP (2) |
HTTP debug messages. | |
#define | DB_ETHER (4) |
Ethernet debug messages. | |
#define | DB_RTOS (8) |
RTOS debug messages. | |
#define | DB_BUFFER (16) |
Buffer debug messages. | |
#define | DB_PPP (32) |
PPP debug messages. | |
#define | DB_AU (64) |
Authentication debug messages. | |
#define | DB_MAIL (128) |
Mail debug messages. | |
#define | DB_IP (256) |
IP debug messages. | |
#define | DB_TCPDATA (512) |
TCP data debug messages. | |
#define | DB_SSL (1024) |
SSL debug messages. | |
#define | DB_SNMP (2048) |
SNMP debug messages. | |
#define | DB_IPV6_ND (4096) |
IPv6 Neighbor Discovery debug messages. | |
#define | DB_IPV6_ICMP (8192) |
IPv6 ICMP debug messages. | |
#define | DB_IPV6_ROUTE (16384) |
IPv6 routing debug messages. | |
#define | DB_IPV6_FRAG (32768) |
IPv6 fragmentation debug messages. | |
#define | DB_IPV6_ERR (65536) |
IPv6 error debug messages. | |
Functions | |
IPADDR | AsciiToIp6 (const char *p) |
Convert an ASCII IPv6 string to an IP address. | |
void | ShowCounters () |
Dump all system counters to stdio. | |
void | sShowCounters (char *buffer, int slen) |
Dump all system counters to a memory buffer. | |
void | FdShowRingData (int fd, const uint8_t *ringBuf, uint32_t bufLen, uint32_t start, uint32_t end, const char *indent=NULL) |
Dump part of a ring buffer to file descriptor. | |
void | ShowRingData (const uint8_t *ringBuf, uint32_t bufLen, uint32_t start, uint32_t end, const char *indent=NULL) |
Dump part of a ring buffer to stdio. | |
void | FdShowData (int fd, const uint8_t *fromptr, uint16_t len) |
Dump a block of data to file descriptor and show in ASCII and hex. | |
void | ShowData (const uint8_t *fromptr, uint16_t len) |
Dump a block of data to stdio and show in ASCII and hex. | |
void | ShowMac (const MACADR *ma) |
Dump a MAC address to stdio. | |
void | fdShowMac (int fd, const MACADR *ma) |
Dump a MAC address to file descriptor. | |
void | ShowMac (const MACADR &ma) |
Dump a MAC address to stdio (reference version) | |
void | snShowMac (char *buf, size_t maxlen, const MACADR *ma) |
Dump a MAC address to character buffer. | |
void | snShowMac (char *buf, size_t maxlen, const MACADR &ma) |
Dump a MAC address to character buffer (reference version) | |
void | MacToID (MACADR *ma, char *IDBuf) |
Write 6 character ID string based on unique portion of MAC. | |
void | outbyte (char c) |
Write out a single, unbuffered byte to stdio. | |
void | print (const char *str) |
Write out a zero-terminated, unbuffered string. | |
void | putnum (int i) |
Write out a hexadecimal, unbuffered number to stdio. | |
void | putbytenum (unsigned char c) |
Write out a hexadecimal, unbuffered byte to stdio. | |
IPADDR4 | AsciiToIp4 (const char *p) |
Convert an ASCII IPv4 string to an IP address. | |
MACADR | AsciiToMac (const char *p) |
Convert an ASCII MAC address string to a MAC address. | |
BOOL | ValidIPv4 (const char *p) |
Validate if a string contains a valid IPv4 address. | |
void | ShowIP4 (const IPADDR4 ia) |
Dump an IPv4 address in ASCII IP string format to stdio. | |
int | snShowIP4 (char *buf, size_t maxlen, const IPADDR4 ia) |
Dump an IPv4 address in ASCII IP string format to character buffer. | |
void | ShowIP6 (const IPADDR &ia) |
Dump an IPv6 address in ASCII IP string format to stdio. | |
int | snShowIP6 (char *buf, size_t maxlen, const IPADDR &ia) |
Dump an IPv6 address in ASCII IP string format to character buffer. | |
uint32_t | GetPreciseTime (void) |
Gets the time tick since system start at a higher resolution. | |
unsigned long long | Get_msec () |
Returns the number of milliseconds as a 64-bit value. | |
int | kill (int pid, int sig) |
Send a signal to a process. | |
void | _exit (int i) |
Terminate the calling process. | |
int | _fini (void) |
Finalization function. | |
unsigned char * | convertBinaryToHexAscii (unsigned char *fromBufferPtr, unsigned int fromByteCount, unsigned char *toBufferPtr, unsigned int toByteCount) |
Convert binary data to hexadecimal ASCII representation. | |
unsigned char * | convertHexAsciiToBinary (unsigned char *fromBufferPtr, unsigned int fromByteCount, unsigned char *toBufferPtr, unsigned int toByteCount) |
Convert hexadecimal ASCII string to binary data. | |
const char * | bufnstr (const char *search, const char *target, size_t len) |
Search for a C string in an arbitrary memory blob that may contain NULL chars. | |
#include< utils.h>
#define DB_TCPIP (1) |
#include <utils.h>
Debug output control flags for NetBurner system components.
These flags control diagnostic output from various NetBurner subsystems. Set the global DB_FLAGS variable to enable debug messages from specific components. Flags can be combined using bitwise OR to enable multiple debug outputs simultaneously.
Use requires the declaration of unsigned int DB_FLAGS = NB_SSL
, usually in main.cpp. At least one flag or a value of 0 must be set in the DB_FLAGS declaration.
TCP/IP debug messages
void _exit | ( | int | i | ) |
#include <utils.h>
Terminate the calling process.
i | Exit status |
int _fini | ( | void | ) |
#include <utils.h>
Finalization function.
IPADDR4 AsciiToIp4 | ( | const char * | p | ) |
#include <utils.h>
Convert an ASCII IPv4 string to an IP address.
p | Pointer to null-terminated ASCII IPv4 string |
IPADDR AsciiToIp6 | ( | const char * | p | ) |
#include <utils.h>
Convert an ASCII IPv6 string to an IP address.
p | Pointer to null-terminated ASCII IPv6 string |
MACADR AsciiToMac | ( | const char * | p | ) |
#include <utils.h>
Convert an ASCII MAC address string to a MAC address.
p | Pointer to null-terminated ASCII MAC address string |
const char * bufnstr | ( | const char * | search, |
const char * | target, | ||
size_t | len ) |
#include <utils.h>
Search for a C string in an arbitrary memory blob that may contain NULL chars.
search | Pointer to the buffer to search |
target | The C string being searched for |
len | Length of the search buffer |
unsigned char * convertBinaryToHexAscii | ( | unsigned char * | fromBufferPtr, |
unsigned int | fromByteCount, | ||
unsigned char * | toBufferPtr, | ||
unsigned int | toByteCount ) |
#include <utils.h>
Convert binary data to hexadecimal ASCII representation.
Converts raw binary data into a hexadecimal ASCII string where each byte is represented by two hexadecimal characters (0-9, A-F). For example, the byte value 0xFF becomes the two-character string "FF".
This function is commonly used for:
fromBufferPtr | Pointer to the source buffer containing binary data to convert |
fromByteCount | Number of bytes to convert from the source buffer |
toBufferPtr | Pointer to the destination buffer for hexadecimal ASCII output |
toByteCount | Size of the destination buffer in bytes |
toByteCount >= (fromByteCount * 2)
Expand for Example Usage
unsigned char * convertHexAsciiToBinary | ( | unsigned char * | fromBufferPtr, |
unsigned int | fromByteCount, | ||
unsigned char * | toBufferPtr, | ||
unsigned int | toByteCount ) |
#include <utils.h>
Convert hexadecimal ASCII string to binary data.
Converts a hexadecimal ASCII string (where each pair of characters represents one byte) into raw binary data. This is the reverse operation of convertBinaryToHexAscii(). For example, the string "FF" becomes the byte value 0xFF, and "48656C6C6F" becomes the five bytes {0x48, 0x65, 0x6C, 0x6C, 0x6F} which represents "Hello".
This function is commonly used for:
fromBufferPtr | Pointer to the source buffer containing hexadecimal ASCII string |
fromByteCount | Number of ASCII characters to convert (must be even for complete bytes) |
toBufferPtr | Pointer to the destination buffer for binary output |
toByteCount | Size of the destination buffer in bytes |
toByteCount >= (fromByteCount / 2)
Expand for Example Usage
void FdShowData | ( | int | fd, |
const uint8_t * | fromptr, | ||
uint16_t | len ) |
#include <utils.h>
Dump a block of data to file descriptor and show in ASCII and hex.
fd | File descriptor to write to |
fromptr | Pointer to data to display |
len | Number of bytes to display |
void fdShowMac | ( | int | fd, |
const MACADR * | ma ) |
#include <utils.h>
Dump a MAC address to file descriptor.
fd | File descriptor to write to |
ma | Pointer to MACADR structure to display |
void FdShowRingData | ( | int | fd, |
const uint8_t * | ringBuf, | ||
uint32_t | bufLen, | ||
uint32_t | start, | ||
uint32_t | end, | ||
const char * | indent = NULL ) |
#include <utils.h>
Dump part of a ring buffer to file descriptor.
fd | File descriptor to write to |
ringBuf | Pointer to ring buffer data |
bufLen | Total length of ring buffer |
start | Start offset in ring buffer |
end | End offset in ring buffer |
indent | Optional indentation string for formatting (can be NULL) |
unsigned long long Get_msec | ( | ) |
#include <utils.h>
Returns the number of milliseconds as a 64-bit value.
Number | of milliseconds |
|
extern |
#include <utils.h>
Gets the time tick since system start at a higher resolution.
Resolution depends on the platform: 0.868-us for MOD5234/70, and 1.929-us for MOD5282
int kill | ( | int | pid, |
int | sig ) |
#include <utils.h>
Send a signal to a process.
pid | Process ID |
sig | Signal number |
void MacToID | ( | MACADR * | ma, |
char * | IDBuf ) |
#include <utils.h>
Write 6 character ID string based on unique portion of MAC.
ma | Pointer to MACADR structure |
IDBuf | Buffer to write 6-character ID string to (must be at least 7 bytes for null terminator) |
void outbyte | ( | char | c | ) |
#include <utils.h>
Write out a single, unbuffered byte to stdio.
c | Character to output |
void print | ( | const char * | str | ) |
#include <utils.h>
Write out a zero-terminated, unbuffered string.
str | Pointer to null-terminated string to output |
void putbytenum | ( | unsigned char | c | ) |
#include <utils.h>
Write out a hexadecimal, unbuffered byte to stdio.
c | Byte value to output in hexadecimal format |
void putnum | ( | int | i | ) |
#include <utils.h>
Write out a hexadecimal, unbuffered number to stdio.
i | Integer value to output in hexadecimal format |
void ShowData | ( | const uint8_t * | fromptr, |
uint16_t | len ) |
#include <utils.h>
Dump a block of data to stdio and show in ASCII and hex.
fromptr | Pointer to data to display |
len | Number of bytes to display |
void ShowIP4 | ( | const IPADDR4 | ia | ) |
#include <utils.h>
Dump an IPv4 address in ASCII IP string format to stdio.
ia | IPv4 address to display |
|
inline |
#include <utils.h>
Dump an IPv6 address in ASCII IP string format to stdio.
ia | IPv6 address to display |
|
inline |
#include <utils.h>
Dump a MAC address to stdio (reference version)
ma | Reference to MACADR structure to display |
void ShowMac | ( | const MACADR * | ma | ) |
void ShowRingData | ( | const uint8_t * | ringBuf, |
uint32_t | bufLen, | ||
uint32_t | start, | ||
uint32_t | end, | ||
const char * | indent = NULL ) |
#include <utils.h>
Dump part of a ring buffer to stdio.
ringBuf | Pointer to ring buffer data |
bufLen | Total length of ring buffer |
start | Start offset in ring buffer |
end | End offset in ring buffer |
indent | Optional indentation string for formatting (can be NULL) |
int snShowIP4 | ( | char * | buf, |
size_t | maxlen, | ||
const IPADDR4 | ia ) |
#include <utils.h>
Dump an IPv4 address in ASCII IP string format to character buffer.
buf | Buffer to write IP address string to |
maxlen | Maximum length of buffer |
ia | IPv4 address to convert |
|
inline |
#include <utils.h>
Dump an IPv6 address in ASCII IP string format to character buffer.
buf | Buffer to write IP address string to |
maxlen | Maximum length of buffer |
ia | IPv6 address to convert |
|
inline |
#include <utils.h>
Dump a MAC address to character buffer (reference version)
buf | Buffer to write MAC address string to |
maxlen | Maximum length of buffer |
ma | Reference to MACADR structure to convert |
void snShowMac | ( | char * | buf, |
size_t | maxlen, | ||
const MACADR * | ma ) |
#include <utils.h>
Dump a MAC address to character buffer.
buf | Buffer to write MAC address string to |
maxlen | Maximum length of buffer |
ma | Pointer to MACADR structure to convert |
void sShowCounters | ( | char * | buffer, |
int | slen ) |
#include <utils.h>
Dump all system counters to a memory buffer.
buffer | Pointer to buffer to store counter information |
slen | Size of the buffer in bytes |
BOOL ValidIPv4 | ( | const char * | p | ) |
#include <utils.h>
Validate if a string contains a valid IPv4 address.
p | Pointer to null-terminated string to validate |