本文整理汇总了C++中DEBUGMSGT函数的典型用法代码示例。如果您正苦于以下问题:C++ DEBUGMSGT函数的具体用法?C++ DEBUGMSGT怎么用?C++ DEBUGMSGT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DEBUGMSGT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: netsnmp_os_prematch
/*
* This function was created to differentiate actions
* that are appropriate for Linux 2.4 kernels, but not later kernels.
*
* This function can be used to test kernels on any platform that supports uname().
*
* If not running a platform that supports uname(), return -1.
*
* If ospname matches, and the release matches up through the prefix,
* return 0.
* If the release is ordered higher, return 1.
* Be aware that "ordered higher" is not a guarantee of correctness.
*/
int
netsnmp_os_prematch(const char *ospmname,
const char *ospmrelprefix)
{
#if HAVE_SYS_UTSNAME_H
static int printOSonce = 1;
struct utsname utsbuf;
if ( 0 != uname(&utsbuf))
return -1;
if (printOSonce) {
printOSonce = 0;
/* show the four elements that the kernel can be sure of */
DEBUGMSGT(("daemonize","sysname '%s',\nrelease '%s',\nversion '%s',\nmachine '%s'\n",
utsbuf.sysname, utsbuf.release, utsbuf.version, utsbuf.machine));
}
if (0 != strcasecmp(utsbuf.sysname, ospmname)) return -1;
/* Required to match only the leading characters */
return strncasecmp(utsbuf.release, ospmrelprefix, strlen(ospmrelprefix));
#else
return -1;
#endif /* HAVE_SYS_UTSNAME_H */
}
示例2: ipAddressAddrType_check_index
/**
* check validity of ipAddressAddrType index portion
*
* @retval MFD_SUCCESS : the incoming value is legal
* @retval MFD_ERROR : the incoming value is NOT legal
*
* @note this is not the place to do any checks for the sanity
* of multiple indexes. Those types of checks should be done in the
* ipAddressTable_validate_index() function.
*
* @note Also keep in mind that if the index refers to a row in this or
* some other table, you can't check for that row here to make
* decisions, since that row might not be created yet, but may
* be created during the processing this request. If you have
* such checks, they should be done in the check_dependencies
* function, because any new/deleted/changed rows should be
* available then.
*
* The following checks have already been done for you:
* The value is one of unknown(0), ipv4(1), ipv6(2), ipv4z(3), ipv6z(4), dns(16)
*
* If there a no other checks you need to do, simply return MFD_SUCCESS.
*/
int
ipAddressAddrType_check_index(ipAddressTable_rowreq_ctx * rowreq_ctx)
{
DEBUGMSGTL(("verbose:ipAddressTable:ipAddressAddrType_check_index",
"called\n"));
netsnmp_assert(NULL != rowreq_ctx);
/*
* TODO:426:M: |-> Check ipAddressTable index ipAddressAddrType.
* check that index value in the table context is legal.
* (rowreq_ctx->tbl_index.ipAddressAddrType)
*/
switch (rowreq_ctx->tbl_idx.ipAddressAddrType) {
case INETADDRESSTYPE_IPV4:
case INETADDRESSTYPE_IPV6:
break;
default:
DEBUGMSGT(("ipAddressTable", "illegal addr type\n"));
return MFD_ERROR;
}
return MFD_SUCCESS; /* ipAddressAddrType index ok */
} /* ipAddressAddrType_check_index */
示例3: netsnmp_access_ipaddress_entry_create
netsnmp_ipaddress_entry *
netsnmp_access_ipaddress_entry_create(void)
{
netsnmp_ipaddress_entry *entry =
SNMP_MALLOC_TYPEDEF(netsnmp_ipaddress_entry);
int rc = 0;
entry->oid_index.len = 1;
entry->oid_index.oids = &entry->ns_ia_index;
/*
* set up defaults
*/
entry->ia_type = IPADDRESSTYPE_UNICAST;
entry->ia_status = IPADDRESSSTATUSTC_PREFERRED;
entry->ia_storagetype = STORAGETYPE_VOLATILE;
rc = netsnmp_arch_ipaddress_entry_init(entry);
if (SNMP_ERR_NOERROR != rc) {
DEBUGMSGT(("access:ipaddress:create","error %d in arch init\n"));
netsnmp_access_ipaddress_entry_free(entry);
}
return entry;
}
示例4: netsnmp_arch_ipaddress_delete
/*
* delete an entry
*/
int netsnmp_arch_ipaddress_delete (netsnmp_ipaddress_entry * entry)
{
if (NULL == entry)
return -1;
DEBUGMSGT (("access:ipaddress:create", "not applicable\n"));
return 0;
}
示例5: inetCidrRouteTable_container_load
/**
* load initial data
*
* TODO:350:M: Implement inetCidrRouteTable data load
* This function will also be called by the cache helper to load
* the container again (after the container free function has been
* called to free the previous contents).
*
* @param container container to which items should be inserted
*
* @retval MFD_SUCCESS : success.
* @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source
* @retval MFD_ERROR : other error.
*
* This function is called to load the index(es) (and data, optionally)
* for the every row in the data set.
*
* @remark
* While loading the data, the only important thing is the indexes.
* If access to your data is cheap/fast (e.g. you have a pointer to a
* structure in memory), it would make sense to update the data here.
* If, however, the accessing the data invovles more work (e.g. parsing
* some other existing data, or peforming calculations to derive the data),
* then you can limit yourself to setting the indexes and saving any
* information you will need later. Then use the saved information in
* inetCidrRouteTable_row_prep() for populating data.
*
* @note
* If you need consistency between rows (like you want statistics
* for each row to be from the same time frame), you should set all
* data here.
*
*/
int
inetCidrRouteTable_container_load(netsnmp_container *container)
{
netsnmp_container *route_container;
DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_container_load", "called\n"));
/*
* TODO:351:M: |-> Load/update data in the inetCidrRouteTable container.
* loop over your inetCidrRouteTable data, allocate a rowreq context,
* set the index(es) [and data, optionally] and insert into
* the container.
*
* we use the netsnmp data access api to get the data
*/
route_container =
netsnmp_access_route_container_load(NULL,
NETSNMP_ACCESS_ROUTE_LOAD_NOFLAGS);
DEBUGMSGT(("verbose:inetCidrRouteTable:inetCidrRouteTable_cache_load",
"%d records\n", (int)CONTAINER_SIZE(route_container)));
if (NULL == route_container)
return MFD_RESOURCE_UNAVAILABLE; /* msg already logged */
/*
* we just got a fresh copy of route data. snarf data
*/
CONTAINER_FOR_EACH(route_container,
(netsnmp_container_obj_func *) _snarf_route_entry,
container);
/*
* free the container. we've either claimed each ifentry, or released it,
* so the dal function doesn't need to clear the container.
*/
netsnmp_access_route_container_free(route_container,
NETSNMP_ACCESS_ROUTE_FREE_DONT_CLEAR);
DEBUGMSGT(("verbose:inetCidrRouteTable:inetCidrRouteTable_cache_load",
"%d records\n", (int)CONTAINER_SIZE(container)));
return MFD_SUCCESS;
} /* inetCidrRouteTable_container_load */
示例6: _iterator_find_next
static void *
_iterator_find_next(iterator_info *ii, const void *data)
{
DEBUGMSGT(("container_iterator",">%s\n", "_iterator_find_next"));
if(NULL == ii)
return NULL;
return _iterator_get_next(ii, data);
}
示例7: _timer_reload
/** callback function to call cache load function */
static void
_timer_reload(unsigned int regNo, void *clientargs)
{
netsnmp_cache *cache = (netsnmp_cache *)clientargs;
DEBUGMSGT(("cache_timer:start", "loading cache %p\n", cache));
cache->expired = 1;
_cache_load(cache);
}
示例8: netsnmp_file_new
/**
* open file and get stats
*/
netsnmp_file *
netsnmp_file_new(const char *name, int fs_flags, mode_t mode, u_int ns_flags)
{
netsnmp_file *filei = netsnmp_file_fill(NULL, name, fs_flags, mode, 0);
if (NULL == filei)
return NULL;
if (ns_flags & NETSNMP_FILE_STATS) {
filei->stats = (struct stat*)calloc(1, sizeof(*(filei->stats)));
if (NULL == filei->stats)
DEBUGMSGT(("nsfile:new", "no memory for stats\n"));
else if (stat(name, filei->stats) != 0)
DEBUGMSGT(("nsfile:new", "error getting stats\n"));
}
if (ns_flags & NETSNMP_FILE_AUTO_OPEN)
netsnmp_file_open(filei);
return filei;
}
示例9: _iterator_free
/**********************************************************************
*
* container
*
**********************************************************************/
static void
_iterator_free(iterator_info *ii)
{
DEBUGMSGT(("container_iterator",">%s\n", "_iterator_free"));
if(NULL == ii)
return;
if(ii->user_ctx)
ii->free_user_ctx(ii->user_ctx,ii->user_ctx);
free(ii);
}
示例10: _iterator_release
static int
_iterator_release(iterator_info *ii, const void *data)
{
DEBUGMSGT(("container_iterator",">%s\n", "_iterator_release"));
if(NULL == ii)
return -1;
if(NULL == ii->release_data)
return -1;
return ii->release_data(ii->user_ctx, data);
}
示例11: netsnmp_arch_route_delete
/*
* create a new entry
*/
int
netsnmp_arch_route_delete(netsnmp_route_entry *entry)
{
if (NULL == entry)
return -1;
if (4 != entry->rt_dest_len) {
DEBUGMSGT(("access:route:create", "only ipv4 supported\n"));
return -2;
}
return _netsnmp_ioctl_route_delete_v4(entry);
}
示例12: netsnmp_arch_ipaddress_create
/*
* create a new entry
*/
int
netsnmp_arch_ipaddress_create(netsnmp_ipaddress_entry *entry)
{
if (NULL == entry)
return -1;
if (4 != entry->ia_address_len) {
DEBUGMSGT(("access:ipaddress:create", "only ipv4 supported\n"));
return -2;
}
return _netsnmp_ioctl_ipaddress_set_v4(entry);
}
示例13: ifTable_container_load
/**
* load initial data
*
* TODO:350:M: Implement ifTable data load
* This function will also be called by the cache helper to load
* the container again (after the container free function has been
* called to free the previous contents).
*
* @param container container to which items should be inserted
*
* @retval MFD_SUCCESS : success.
* @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source
* @retval MFD_ERROR : other error.
*
* This function is called to load the index(es) (and data, optionally)
* for the every row in the data set.
*
* @remark
* While loading the data, the only important thing is the indexes.
* If access to your data is cheap/fast (e.g. you have a pointer to a
* structure in memory), it would make sense to update the data here.
* If, however, the accessing the data invovles more work (e.g. parsing
* some other existing data, or peforming calculations to derive the data),
* then you can limit yourself to setting the indexes and saving any
* information you will need later. Then use the saved information in
* ifTable_row_prep() for populating data.
*
* @note
* If you need consistency between rows (like you want statistics
* for each row to be from the same time frame), you should set all
* data here.
*
*/
int
ifTable_container_load(netsnmp_container *container)
{
netsnmp_container *ifcontainer;
DEBUGMSGTL(("verbose:ifTable:ifTable_container_load", "called\n"));
/*
* TODO:351:M: |-> Load/update data in the ifTable container.
* loop over your ifTable data, allocate a rowreq context,
* set the index(es) [and data, optionally] and insert into
* the container.
*/
/*
* ifTable gets its data from the netsnmp_interface API.
*/
ifcontainer =
netsnmp_access_interface_container_load(NULL,
NETSNMP_ACCESS_INTERFACE_INIT_NOFLAGS);
if (NULL == ifcontainer)
return MFD_RESOURCE_UNAVAILABLE; /* msg already logged */
/*
* we just got a fresh copy of interface data. compare it to
* what we've already got, and make any adjustements...
*/
CONTAINER_FOR_EACH(container, (netsnmp_container_obj_func *)
_check_interface_entry_for_updates, ifcontainer);
/*
* now add any new interfaces
*/
CONTAINER_FOR_EACH(ifcontainer,
(netsnmp_container_obj_func *) _add_new_interface,
container);
/*
* free the container. we've either claimed each ifentry, or released it,
* so the dal function doesn't need to clear the container.
*/
netsnmp_access_interface_container_free(ifcontainer,
NETSNMP_ACCESS_INTERFACE_FREE_DONT_CLEAR);
DEBUGMSGT(("verbose:ifTable:ifTable_cache_load",
"%d records\n", CONTAINER_SIZE(container)));
if (_first_load)
_first_load = 0;
return MFD_SUCCESS;
} /* ifTable_container_load */
示例14: _cache_load
static int
_cache_load( netsnmp_cache *cache )
{
int ret = -1;
/*
* If we've got a valid cache, then release it before reloading
*/
if (cache->valid &&
(! (cache->flags & NETSNMP_CACHE_DONT_FREE_BEFORE_LOAD)))
_cache_free(cache);
if ( cache->load_cache)
ret = cache->load_cache(cache, cache->magic);
if (ret < 0) {
DEBUGMSGT(("helper:cache_handler", " load failed (%d)\n", ret));
cache->valid = 0;
return ret;
}
cache->valid = 1;
cache->expired = 0;
/*
* If we didn't previously have any valid caches outstanding,
* then schedule a pass of the auto-release routine.
*/
if ((!cache_outstanding_valid) &&
(! (cache->flags & NETSNMP_CACHE_DONT_FREE_EXPIRED))) {
snmp_alarm_register(CACHE_RELEASE_FREQUENCY,
0, release_cached_resources, NULL);
cache_outstanding_valid = 1;
}
netsnmp_set_monotonic_marker(&cache->timestampM);
DEBUGMSGT(("helper:cache_handler", " loaded (%d)\n", cache->timeout));
return ret;
}
示例15: _sql_process_queue
/*
* process (save) queued items to sql database.
*
* dontcare & meeither are dummy params so this function can be used
* as a netsnmp_alarm callback function.
*/
static void
_sql_process_queue(u_int dontcare, void *meeither)
{
int rc;
/** bail if the queue is empty */
if( 0 == CONTAINER_SIZE(_sql.queue))
return;
DEBUGMSGT(("sql:process", "processing %d queued traps\n",
(int)CONTAINER_SIZE(_sql.queue)));
/*
* if we don't have a database connection, try to reconnect. We
* don't care if we fail - traps will be logged in that case.
*/
if (0 == _sql.connected) {
DEBUGMSGT(("sql:process", "no sql connection; reconnecting\n"));
(void) netsnmp_mysql_connect();
}
CONTAINER_FOR_EACH(_sql.queue, (netsnmp_container_obj_func*)_sql_save,
NULL);
if (_sql.connected) {
rc = mysql_commit(_sql.conn);
if (rc) { /* nuts... now what? */
netsnmp_sql_error("commit failed");
CONTAINER_FOR_EACH(_sql.queue,
(netsnmp_container_obj_func*)_sql_log,
NULL);
}
}
CONTAINER_CLEAR(_sql.queue, (netsnmp_container_obj_func*)_sql_buf_free,
NULL);
}