Defines |
|
| #define | SNMP_MAXPATH 1024 |
| #define | SNMP_MAXBUF (1024 * 4) |
| #define | SNMP_MAXBUF_MEDIUM 1024 |
| #define | SNMP_MAXBUF_SMALL 512 |
| #define | SNMP_MAXBUF_MESSAGE 1500 |
| #define | SNMP_MAXOID 64 |
| #define | SNMP_MAX_CMDLINE_OIDS 128 |
| #define | SNMP_FILEMODE_CLOSED 0600 |
| #define | SNMP_FILEMODE_OPEN 0644 |
| #define | BYTESIZE(bitsize) ((bitsize + 7) >> 3) |
| #define | ROUNDUP8(x) ( ( (x+7) >> 3 ) * 8 ) |
| #define | SNMP_FREE(s) do { if (s) { free((void *)s); s=NULL; } } while(0) |
| Frees a pointer only if it is !NULL and sets its value to NULL. |
|
| #define | SNMP_SWIPE_MEM(n, s) do { if (n) free((void *)n); n = s; s=NULL; } while(0) |
| Frees pointer n only if it is !NULL, sets n to s and sets s to NULL. |
|
| #define | SNMP_MALLOC_STRUCT(s) (struct s *) calloc(1, sizeof(struct s)) |
| Mallocs memory of sizeof(struct s), zeros it and returns a pointer to it. |
|
| #define | SNMP_MALLOC_TYPEDEF(td) (td *) calloc(1, sizeof(td)) |
| Mallocs memory of sizeof(t), zeros it and returns a pointer to it. |
|
| #define | SNMP_ZERO(s, l) do { if (s) memset(s, 0, l); } while(0) |
| Zeros l bytes of memory starting at s. |
|
| #define | TOUPPER(c) (c >= 'a' && c <= 'z' ? c - ('a' - 'A') : c) |
| #define | TOLOWER(c) (c >= 'A' && c <= 'Z' ? c + ('a' - 'A') : c) |
| #define | HEX2VAL(s) ((isalpha(s) ? (TOLOWER(s)-'a'+10) : (TOLOWER(s)-'0')) & 0xf) |
| #define | VAL2HEX(s) ( (s) + (((s) >= 10) ? ('a'-10) : '0') ) |
| #define | SNMP_MAX(a, b) ((a) > (b) ? (a) : (b)) |
| Computers the maximum of a and b. |
|
| #define | SNMP_MIN(a, b) ((a) > (b) ? (b) : (a)) |
| Computers the minimum of a and b. |
|
| #define | FALSE 0 |
| #define | TRUE 1 |
| #define | QUITFUN(e, l) |
| #define | DIFFTIMEVAL(now, then, diff) |
| #define | USM_LENGTH_OID_TRANSFORM 10 |
| #define | ISTRANSFORM(ttype, toid) |
| #define | ENGINETIME_MAX 2147483647 |
| #define | ENGINEBOOT_MAX 2147483647 |
Typedefs |
|
| typedef void * | marker_t |
Functions |
|
| int | snmp_realloc (u_char **buf, size_t *buf_len) |
| This function increase the size of the buffer pointed at by *buf, which is initially of size
*buf_len. |
|
| void | free_zero (void *buf, size_t size) |
| zeros memory before freeing it. |
|
| u_char * | malloc_random (size_t *size) |
| Returns pointer to allocaed & set buffer on success, size contains number of random bytes
filled. |
|
| u_char * | malloc_zero (size_t size) |
| int | memdup (u_char **to, const u_char *from, size_t size) |
| Duplicates a memory block. |
|
| u_int | binary_to_hex (const u_char *input, size_t len, char **output) |
| converts binary to hexidecimal |
|
| int | netsnmp_hex_to_binary (u_char **buf, size_t *buf_len, size_t *offset, int allow_realloc, const char *hex, const char *delim) |
| convert an ASCII hex string (with specified delimiters) to binary |
|
| int | snmp_hex_to_binary (u_char **buf, size_t *buf_len, size_t *offset, int allow_realloc, const char *hex) |
| convert an ASCII hex string to binary |
|
| int | hex_to_binary2 (const u_char *input, size_t len, char **output) |
| hex_to_binary2 |
|
| int | snmp_decimal_to_binary (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const char *decimal) |
| int | snmp_strcat (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const u_char *s) |
| char * | netsnmp_strdup_and_null (const u_char *from, size_t from_len) |
| copies a (possible) unterminated string of a given length into a new buffer and null terminates it
as well (new buffer MAY be one byte longer to account for this |
|
| void | dump_chunk (const char *debugtoken, const char *title, const u_char *buf, int size) |
| char * | dump_snmpEngineID (const u_char *buf, size_t *buflen) |
| marker_t | atime_newMarker (void) |
| create a new time marker. |
|
| void | atime_setMarker (marker_t pm) |
| set a time marker. |
|
| long | atime_diff (marker_t first, marker_t second) |
| Returns the difference (in msec) between the two markers. |
|
| u_long | uatime_diff (marker_t first, marker_t second) |
| Returns the difference (in u_long msec) between the two markers. |
|
| u_long | uatime_hdiff (marker_t first, marker_t second) |
| Returns the difference (in u_long 1/100th secs) between the two markers (functionally this is what
sysUpTime needs). |
|
| int | atime_ready (marker_t pm, int deltaT) |
| Test: Has (marked time plus delta) exceeded current time (in msec) ? Returns 0 if test fails or
cannot be tested (no marker). |
|
| int | uatime_ready (marker_t pm, unsigned int deltaT) |
| Test: Has (marked time plus delta) exceeded current time (in msec) ? Returns 0 if test fails or
cannot be tested (no marker). |
|
| int | marker_tticks (marker_t pm) |
| Return the number of timeTicks since the given marker. |
|
| int | timeval_tticks (struct timeval *tv) |
| char * | netsnmp_getenv (const char *name) |
| Non Windows: Returns a pointer to the desired environment variable or NULL if the environment
variable does not exist. |
|
|
|
Value:
{ \
now.tv_sec--; \
now.tv_usec += 1000000L; \
diff.tv_sec = now.tv_sec - then.tv_sec; \
diff.tv_usec = now.tv_usec - then.tv_usec; \
if (diff.tv_usec > 1000000L){ \
diff.tv_usec -= 1000000L; \
diff.tv_sec++; \
} \
}
|
|
|
Value: !snmp_oid_compare(ttype, USM_LENGTH_OID_TRANSFORM, \ usm ## toid ## Protocol, USM_LENGTH_OID_TRANSFORM) |
|
|
Value: if ( (e) != SNMPERR_SUCCESS) { \ rval = SNMPERR_GENERR; \ goto l ; \ } |
|
|
|
Mallocs memory of sizeof(struct s), zeros it and returns a pointer to it. Definition at line 64 of file tools.h. Referenced by snmp_alarm_register(), and snmp_alarm_register_hr(). |
|
|
|
Computers the maximum of a and b. Definition at line 85 of file tools.h. Referenced by netsnmp_register_table_data_set(). |
|
|
Computers the minimum of a and b. Definition at line 89 of file tools.h. Referenced by netsnmp_oid_find_prefix(), and netsnmp_register_table_data_set(). |
|
|
Frees pointer n only if it is !NULL, sets n to s and sets s to NULL. |
|
|
Zeros l bytes of memory starting at s. |
|
||||||||||||
|
Returns the difference (in msec) between the two markers. Definition at line 794 of file tools.c. Referenced by atime_ready(), and marker_tticks(). |
|
|
create a new time marker. NOTE: Caller must free time marker when no longer needed. Definition at line 770 of file tools.c. Referenced by atime_ready(), marker_tticks(), and uatime_ready(). |
|
||||||||||||
|
Test: Has (marked time plus delta) exceeded current time (in msec) ? Returns 0 if test fails or cannot be tested (no marker). Definition at line 849 of file tools.c. References atime_diff(), and atime_newMarker(). Referenced by netsnmp_cache_check_expired(). |
|
|
set a time marker. |
|
||||||||||||||||
|
converts binary to hexidecimal
|
|
||||||||||||
|
zeros memory before freeing it.
Definition at line 185 of file tools.c. Referenced by hex_to_binary2(), and malloc_random(). |
|
||||||||||||||||
|
hex_to_binary2
FIX Another version of "hex-to-binary" which takes odd length input strings. It also allocates the memory to hold the binary data. Should be integrated with the official hex_to_binary() function. Definition at line 324 of file tools.c. References free_zero(). |
|
|
Returns pointer to allocaed & set buffer on success, size contains number of random bytes filled. buf is NULL and *size set to KMT error value upon failure.
Definition at line 205 of file tools.c. References free_zero(). |
|
|
Return the number of timeTicks since the given marker. Definition at line 897 of file tools.c. References atime_diff(), and atime_newMarker(). |
|
||||||||||||||||
|
Duplicates a memory block. Copies a existing memory location from a pointer to another, newly malloced, pointer.
Definition at line 236 of file tools.c. Referenced by netsnmp_handler_registration_create(), netsnmp_handler_registration_dup(), netsnmp_instance_num_file_handler(), netsnmp_register_old_api(), netsnmp_set_row_column(), netsnmp_table_data_clone_row(), netsnmp_table_data_set_clone_row(), netsnmp_table_set_add_default_row(), netsnmp_tdata_clone_row(), and netsnmp_tdata_copy_row(). |
|
|
Non Windows: Returns a pointer to the desired environment variable or NULL if the environment variable does not exist. Windows: Returns a pointer to the desired environment variable if it exists. If it does not, the variable is looked up in the registry in HKCU-SNMP or HKLM-SNMP (whichever it finds first) and stores the result in the environment variable. It then returns a pointer to environment variable. Definition at line 925 of file tools.c. References SNMP_FREE. Referenced by init_mib(), netsnmp_fixup_mib_directory(), netsnmp_get_mib_directory(), and read_config_store(). |
|
||||||||||||||||||||||||||||
|
convert an ASCII hex string (with specified delimiters) to binary
Definition at line 425 of file tools.c. References snmp_realloc(). Referenced by snmp_hex_to_binary(). |
|
||||||||||||
|
copies a (possible) unterminated string of a given length into a new buffer and null terminates it as well (new buffer MAY be one byte longer to account for this |
|
||||||||||||||||||||||||
|
convert an ASCII hex string to binary
Definition at line 484 of file tools.c. References netsnmp_hex_to_binary(). |
|
||||||||||||
|
This function increase the size of the buffer pointed at by *buf, which is initially of size *buf_len. Contents are preserved **AT THE BOTTOM END OF THE BUFFER**. If memory can be (re-)allocated then it returns 1, else it returns 0.
Definition at line 121 of file tools.c. Referenced by _sprint_hexstring_line(), netsnmp_hex_to_binary(), sprint_realloc_asciistring(), sprint_realloc_ipaddress(), sprint_realloc_networkaddress(), and sprint_realloc_octet_string(). |
|
||||||||||||
|
Returns the difference (in u_long msec) between the two markers. Definition at line 811 of file tools.c. Referenced by uatime_ready(). |
|
||||||||||||
|
Returns the difference (in u_long 1/100th secs) between the two markers (functionally this is what sysUpTime needs). |
|
||||||||||||
|
Test: Has (marked time plus delta) exceeded current time (in msec) ? Returns 0 if test fails or cannot be tested (no marker). Definition at line 871 of file tools.c. References atime_newMarker(), and uatime_diff(). |
1.3.9.1
Last modified: Thursday, 01-Mar-2007 16:20:00 PST
For questions regarding web content and site functionality, please write to the net-snmp-users mail list.