本文整理汇总了C++中config_perror函数的典型用法代码示例。如果您正苦于以下问题:C++ config_perror函数的具体用法?C++ config_perror怎么用?C++ config_perror使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了config_perror函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: snmpd_parse_config_informsink
void
snmpd_parse_config_informsink(const char *word, char *cptr)
{
char tmpbuf[1024];
char *sp, *cp, *pp = NULL;
u_short sinkport;
if (!snmp_trapcommunity) snmp_trapcommunity = strdup("public");
sp = strtok(cptr, " \t\n");
cp = strtok(NULL, " \t\n");
if (cp) pp = strtok(NULL, " \t\n");
if (cp && pp) {
sinkport = atoi(pp);
if ((sinkport < 1) || (sinkport > 0xffff)) {
config_perror("trapsink port out of range");
sinkport = SNMP_TRAP_PORT;
}
} else {
sinkport = SNMP_TRAP_PORT;
}
if (create_v2_inform_session(sp, sinkport,
cp ? cp : snmp_trapcommunity) == 0) {
sprintf(tmpbuf,"cannot create informsink: %s", cptr);
config_perror(tmpbuf);
}
}
开发者ID:LucidOne,项目名称:Rovio,代码行数:26,代码来源:agent_trap.c
示例2: proxyOptProc
static void
proxyOptProc(int argc, char *const *argv, int opt)
{
switch (opt) {
case 'C':
while (*optarg) {
switch (*optarg++) {
case 'n':
optind++;
if (optind < argc) {
context_string = argv[optind - 1];
} else {
config_perror("No context name passed to -Cn");
}
break;
case 'c':
netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_LIB_IGNORE_NO_COMMUNITY, 1);
break;
default:
config_perror("unknown argument passed to -C");
break;
}
}
break;
default:
break;
/*
* shouldn't get here
*/
}
}
开发者ID:Nymphetaminer,项目名称:dsl-n55u,代码行数:32,代码来源:proxy.c
示例3: disk_parse_config_all
static void disk_parse_config_all (const char *token, char *cptr)
{
#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS
int minpercent = DISKMINPERCENT;
if (numdisks == maxdisks)
{
if (maxdisks == 0)
{
maxdisks = 50;
disks = (struct diskpart *) malloc (maxdisks * sizeof (struct diskpart));
if (!disks)
{
config_perror ("malloc failed for new disk allocation.");
netsnmp_config_error ("\tignoring: %s", cptr);
return;
}
memset (disks, 0, maxdisks * sizeof (struct diskpart));
}
else
{
maxdisks *= 2;
disks = (struct diskpart *) realloc (disks, maxdisks * sizeof (struct diskpart));
if (!disks)
{
config_perror ("malloc failed for new disk allocation.");
netsnmp_config_error ("\tignoring: %s", cptr);
return;
}
memset (disks + maxdisks / 2, 0, maxdisks / 2 * sizeof (struct diskpart));
}
}
/*
* read the minimum disk usage percent
*/
if (cptr != NULL)
{
if (strchr (cptr, '%') != NULL)
{
minpercent = atoi (cptr);
}
}
/*
* if we have already seen the "includeAllDisks" directive
* then search for the disk in the "disks" array and modify
* the values. if we havent seen the "includeAllDisks"
* directive then include this disk
*/
if (allDisksIncluded)
{
config_perror ("includeAllDisks already specified.");
netsnmp_config_error ("\tignoring: includeAllDisks %s", cptr);
}
else
{
allDisksIncluded = 1;
find_and_add_allDisks (minpercent);
}
#endif /* HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS */
}
开发者ID:274914765,项目名称:C,代码行数:60,代码来源:disk.c
示例4: proxyOptProc
static void
proxyOptProc(int argc, char *const *argv, int opt)
{
switch (opt) {
case 'C':
while (*optarg) {
switch (*optarg++) {
case 'n':
optind++;
if (optind < argc) {
context_string = argv[optind - 1];
} else {
config_perror("No context name passed to -Cn");
}
break;
default:
config_perror("unknown argument passed to -C");
break;
}
}
break;
default:
break;
/*
* shouldn't get here
*/
}
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:28,代码来源:proxy.c
示例5: snmpd_set_agent_group
void
snmpd_set_agent_group(const char *token, char *cptr)
{
#if defined(HAVE_GETGRNAM) && defined(HAVE_GRP_H)
struct group *info;
#endif
if (cptr[0] == '#') {
char *ecp;
int gid = strtoul(cptr + 1, &ecp, 10);
if (*ecp != 0) {
config_perror("Bad number");
} else {
netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_GROUPID, gid);
}
}
#if defined(HAVE_GETGRNAM) && defined(HAVE_GRP_H)
else if ((info = getgrnam(cptr)) != NULL) {
netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_GROUPID, info->gr_gid);
} else {
config_perror("Group not found in group database");
}
endpwent();
#endif
}
开发者ID:Nymphetaminer,项目名称:dsl-n55u,代码行数:27,代码来源:agent_read_config.c
示例6: vacm_parse_authtokens
int
vacm_parse_authtokens(const char *token, char **confline)
{
char authspec[SNMP_MAXBUF_MEDIUM];
char *strtok_state;
char *type;
int viewtype, viewtypes = 0;
*confline = copy_nword(*confline, authspec, sizeof(authspec));
DEBUGMSGTL(("vacm_parse_authtokens","parsing %s",authspec));
if (!*confline) {
config_perror("Illegal configuration line: missing fields");
return -1;
}
type = strtok_r(authspec, ",|:", &strtok_state);
while(type && *type != '\0') {
viewtype = se_find_value_in_slist(VACM_VIEW_ENUM_NAME, type);
if (viewtype < 0 || viewtype >= VACM_MAX_VIEWS) {
config_perror("Illegal view name");
} else {
viewtypes |= (1 << viewtype);
}
type = strtok_r(NULL, ",|:", &strtok_state);
}
DEBUGMSG(("vacm_parse_authtokens"," .. result = 0x%x\n",viewtypes));
return viewtypes;
}
开发者ID:prak5192,项目名称:C_Project,代码行数:29,代码来源:vacm_conf.c
示例7: parse_snmpNotifyTable
/*
* parse_snmpNotifyTable():
* parses .conf file entries needed to configure the mib.
*/
void
parse_snmpNotifyTable(const char *token, char *line)
{
size_t tmpint;
struct snmpNotifyTable_data *StorageTmp =
SNMP_MALLOC_STRUCT(snmpNotifyTable_data);
DEBUGMSGTL(("snmpNotifyTable", "parsing config... "));
if (StorageTmp == NULL) {
config_perror("malloc failure");
return;
}
line =
read_config_read_data(ASN_OCTET_STR, line,
&StorageTmp->snmpNotifyName,
&StorageTmp->snmpNotifyNameLen);
if (StorageTmp->snmpNotifyName == NULL) {
config_perror("invalid specification for snmpNotifyName");
return;
}
line =
read_config_read_data(ASN_OCTET_STR, line,
&StorageTmp->snmpNotifyTag,
&StorageTmp->snmpNotifyTagLen);
if (StorageTmp->snmpNotifyTag == NULL) {
config_perror("invalid specification for snmpNotifyTag");
return;
}
line =
read_config_read_data(ASN_INTEGER, line,
&StorageTmp->snmpNotifyType, &tmpint);
line =
read_config_read_data(ASN_INTEGER, line,
&StorageTmp->snmpNotifyStorageType, &tmpint);
if (!StorageTmp->snmpNotifyStorageType)
StorageTmp->snmpNotifyStorageType = ST_READONLY;
line =
read_config_read_data(ASN_INTEGER, line,
&StorageTmp->snmpNotifyRowStatus, &tmpint);
if (!StorageTmp->snmpNotifyRowStatus)
StorageTmp->snmpNotifyRowStatus = RS_ACTIVE;
if (snmpNotifyTable_add(StorageTmp) != SNMPERR_SUCCESS){
SNMP_FREE(StorageTmp->snmpNotifyName);
SNMP_FREE(StorageTmp->snmpNotifyTag);
SNMP_FREE(StorageTmp);
}
DEBUGMSGTL(("snmpNotifyTable", "done.\n"));
}
开发者ID:a5216652166,项目名称:rcp100,代码行数:64,代码来源:snmpNotifyTable.c
示例8: parse_config_agentuser
void
parse_config_agentuser(const char *token, char *cptr)
{
if (cptr[0] == '#') {
char *ecp;
int uid;
uid = strtoul(cptr + 1, &ecp, 10);
if (*ecp != 0) {
config_perror("Bad number");
} else {
netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_USERID, uid);
}
#if defined(HAVE_GETPWNAM) && defined(HAVE_PWD_H)
} else {
struct passwd *info;
info = getpwnam(cptr);
if (info)
netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_USERID, info->pw_uid);
else
config_perror("User not found in passwd database");
endpwent();
#endif
}
}
开发者ID:michalklempa,项目名称:net-snmp,代码行数:28,代码来源:snmptrapd.c
示例9: parse_config_agentgroup
void
parse_config_agentgroup(const char *token, char *cptr)
{
if (cptr[0] == '#') {
char *ecp;
int gid = strtoul(cptr + 1, &ecp, 10);
if (*ecp != 0) {
config_perror("Bad number");
} else {
netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_GROUPID, gid);
}
#if defined(HAVE_GETGRNAM) && defined(HAVE_GRP_H)
} else {
struct group *info;
info = getgrnam(cptr);
if (info)
netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_GROUPID, info->gr_gid);
else
config_perror("Group not found in group database");
endgrent();
#endif
}
}
开发者ID:michalklempa,项目名称:net-snmp,代码行数:27,代码来源:snmptrapd.c
示例10: parse_snmpNotifyFilterTable
/*
* parse_snmpNotifyFilterTable():
* parses .conf file entries needed to configure the mib.
*/
void
parse_snmpNotifyFilterTable(const char *token, char *line)
{
size_t tmpint;
struct snmpNotifyFilterTable_data *StorageTmp =
SNMP_MALLOC_STRUCT(snmpNotifyFilterTable_data);
DEBUGMSGTL(("snmpNotifyFilterTable", "parsing config... "));
if (StorageTmp == NULL) {
config_perror("malloc failure");
return;
}
line =
read_config_read_data(ASN_OCTET_STR, line,
&StorageTmp->snmpNotifyFilterProfileName,
&StorageTmp->snmpNotifyFilterProfileNameLen);
if (StorageTmp->snmpNotifyFilterProfileName == NULL) {
config_perror
("invalid specification for snmpNotifyFilterProfileName");
return;
}
line =
read_config_read_data(ASN_OBJECT_ID, line,
&StorageTmp->snmpNotifyFilterSubtree,
&StorageTmp->snmpNotifyFilterSubtreeLen);
if (StorageTmp->snmpNotifyFilterSubtree == NULL) {
config_perror("invalid specification for snmpNotifyFilterSubtree");
return;
}
line =
read_config_read_data(ASN_OCTET_STR, line,
&StorageTmp->snmpNotifyFilterMask,
&StorageTmp->snmpNotifyFilterMaskLen);
line =
read_config_read_data(ASN_INTEGER, line,
&StorageTmp->snmpNotifyFilterType, &tmpint);
line =
read_config_read_data(ASN_INTEGER, line,
&StorageTmp->snmpNotifyFilterStorageType,
&tmpint);
line =
read_config_read_data(ASN_INTEGER, line,
&StorageTmp->snmpNotifyFilterRowStatus,
&tmpint);
snmpNotifyFilterTable_add(StorageTmp);
DEBUGMSGTL(("snmpNotifyFilterTable", "done.\n"));
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:63,代码来源:snmpNotifyFilterTable.c
示例11: vacm_parse_setaccess
void
vacm_parse_setaccess(const char *token, char *param)
{
char *name, *context, *viewname, *viewval;
int imodel, ilevel, iprefix;
int viewnum;
char *st;
struct vacm_accessEntry *ap;
if (_vacm_parse_access_common(token, param, &st, &name,
&context, &imodel, &ilevel, &iprefix)
== PARSE_FAIL) {
return;
}
viewname = strtok_r(NULL, " \t\n", &st);
if (!viewname) {
config_perror("missing viewname parameter");
return;
}
viewval = strtok_r(NULL, " \t\n", &st);
if (!viewval) {
config_perror("missing viewval parameter");
return;
}
if (strlen(viewval) + 1 > sizeof(ap->views[VACM_VIEW_NOTIFY])) {
config_perror("View value too long");
return;
}
viewnum = se_find_value_in_slist(VACM_VIEW_ENUM_NAME, viewname);
if (viewnum < 0 || viewnum >= VACM_MAX_VIEWS) {
config_perror("Illegal view name");
return;
}
ap = vacm_getAccessEntry(name, context, imodel, ilevel);
if (!ap) {
ap = vacm_createAccessEntry(name, context, imodel, ilevel);
DEBUGMSGTL(("vacm:conf:setaccess",
"no existing access found; creating a new one\n"));
} else {
DEBUGMSGTL(("vacm:conf:setaccess",
"existing access found, using it\n"));
}
if (!ap) {
config_perror("failed to create access entry");
return;
}
strcpy(ap->views[viewnum], viewval);
ap->contextMatch = iprefix;
ap->storageType = SNMP_STORAGE_PERMANENT;
ap->status = SNMP_ROW_ACTIVE;
free(ap->reserved);
ap->reserved = NULL;
}
开发者ID:prak5192,项目名称:C_Project,代码行数:58,代码来源:vacm_conf.c
示例12: parse_lookupResultsTable
void
parse_lookupResultsTable(const char *token, char *line)
{
size_t tmpint;
struct lookupResultsTable_data *StorageTmp =
SNMP_MALLOC_STRUCT(lookupResultsTable_data);
DEBUGMSGTL(("lookupResultsTable", "parsing config... "));
if (StorageTmp == NULL) {
config_perror("malloc failure");
return;
}
line =
read_config_read_data(ASN_OCTET_STR, line,
&StorageTmp->lookupCtlOwnerIndex,
&StorageTmp->lookupCtlOwnerIndexLen);
if (StorageTmp->lookupCtlOwnerIndex == NULL) {
config_perror("invalid specification for lookupCtlOwnerIndex");
return;
}
line =
read_config_read_data(ASN_OCTET_STR, line,
&StorageTmp->lookupCtlOperationName,
&StorageTmp->lookupCtlOperationNameLen);
if (StorageTmp->lookupCtlOperationName == NULL) {
config_perror("invalid specification for lookupCtlOperationName");
return;
}
line =
read_config_read_data(ASN_UNSIGNED, line,
&StorageTmp->lookupResultsIndex, &tmpint);
line =
read_config_read_data(ASN_INTEGER, line,
&StorageTmp->lookupResultsAddressType,
&tmpint);
line =
read_config_read_data(ASN_OCTET_STR, line,
&StorageTmp->lookupResultsAddress,
&StorageTmp->lookupResultsAddressLen);
if (StorageTmp->lookupResultsAddress == NULL) {
config_perror("invalid specification for lookupResultsAddress");
return;
}
lookupResultsTable_inadd(StorageTmp);
/* lookupResultsTable_cleaner(lookupResultsTableStorage); */
DEBUGMSGTL(("lookupResultsTable", "done.\n"));
}
开发者ID:RasmusKoldsoe,项目名称:performand.k70.2,代码行数:56,代码来源:lookupResultsTable.c
示例13: parse_snmpNotifyFilterProfileTable
/*
* parse_snmpNotifyFilterProfileTable():
* parses .conf file entries needed to configure the mib.
*/
void
parse_snmpNotifyFilterProfileTable(const char *token, char *line)
{
size_t tmpint;
struct snmpNotifyFilterProfileTable_data *StorageTmp =
SNMP_MALLOC_STRUCT(snmpNotifyFilterProfileTable_data);
DEBUGMSGTL(("snmpNotifyFilterProfileTable", "parsing config... "));
if (StorageTmp == NULL) {
config_perror("malloc failure");
return;
}
line =
read_config_read_data(ASN_OCTET_STR, line,
&StorageTmp->snmpTargetParamsName,
&StorageTmp->snmpTargetParamsNameLen);
if (StorageTmp->snmpTargetParamsName == NULL) {
config_perror("invalid specification for snmpTargetParamsName");
return;
}
line =
read_config_read_data(ASN_OCTET_STR, line,
&StorageTmp->snmpNotifyFilterProfileName,
&StorageTmp->snmpNotifyFilterProfileNameLen);
if (StorageTmp->snmpNotifyFilterProfileName == NULL) {
config_perror("invalid specification for snmpNotifyFilterProfileName");
return;
}
line =
read_config_read_data(ASN_INTEGER, line,
&StorageTmp->snmpNotifyFilterProfileStorType,
&tmpint);
line =
read_config_read_data(ASN_INTEGER, line,
&StorageTmp->
snmpNotifyFilterProfileRowStatus, &tmpint);
if (snmpNotifyFilterProfileTable_add(StorageTmp) != SNMPERR_SUCCESS){
SNMP_FREE(StorageTmp->snmpTargetParamsName);
SNMP_FREE(StorageTmp->snmpNotifyFilterProfileName);
SNMP_FREE(StorageTmp);
}
DEBUGMSGTL(("snmpNotifyFilterProfileTable", "done.\n"));
}
开发者ID:a5216652166,项目名称:rcp100,代码行数:54,代码来源:snmpNotifyFilterProfileTable.c
示例14: snmpv3_secLevel_conf
/*******************************************************************-o-******
* snmpv3_secLevel_conf
*
* Parameters:
* *word
* *cptr
*
* Line syntax:
* defSecurityLevel "noAuthNoPriv" | "authNoPriv" | "authPriv"
*/
void
snmpv3_secLevel_conf(const char *word, char *cptr)
{
char buf[1024];
if (strcasecmp(cptr, "noAuthNoPriv") == 0 || strcmp(cptr, "1") == 0 ||
strcasecmp(cptr, "nanp") == 0) {
netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_LIB_SECLEVEL, SNMP_SEC_LEVEL_NOAUTH);
} else if (strcasecmp(cptr, "authNoPriv") == 0 || strcmp(cptr, "2") == 0 ||
strcasecmp(cptr, "anp") == 0) {
netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_LIB_SECLEVEL, SNMP_SEC_LEVEL_AUTHNOPRIV);
} else if (strcasecmp(cptr, "authPriv") == 0 || strcmp(cptr, "3") == 0 ||
strcasecmp(cptr, "ap") == 0) {
netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_LIB_SECLEVEL, SNMP_SEC_LEVEL_AUTHPRIV);
} else {
snprintf(buf, sizeof(buf), "Unknown security level: %s", cptr);
buf[ sizeof(buf)-1 ] = 0;
config_perror(buf);
}
DEBUGMSGTL(("snmpv3", "default secLevel set to: %s = %d\n", cptr,
netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_LIB_SECLEVEL)));
}
开发者ID:DYFeng,项目名称:infinidb,代码行数:36,代码来源:snmpv3.c
示例15: system_parse_config_sysObjectID
void system_parse_config_sysObjectID(const char *token, char *cptr)
{
char tmpbuf[1024];
sysObjectIDLength = MAX_OID_LEN;
if (!read_objid(cptr, sysObjectID, &sysObjectIDLength)) {
snprintf(tmpbuf,
sizeof(tmpbuf),
"sysobjectid token not a parsable OID:\n\t%s",
cptr);
config_perror(tmpbuf);
// Modified by Gavin Lin, 2008/10/30
//memcpy(sysObjectID, version_sysoid, version_sysoid_len * sizeof(oid));
//sysObjectIDLength = version_sysoid_len;
#ifdef CONFIG_MODEL_LRTXXX
/* purpose : 0012697 author : Gavin.Lin date : 2010-06-22 */
/* description : Customer requirements */
kd_doCommand("VERSION MODEL", CMD_PRINT, ASH_DO_NOTHING, tmpbuf);
if (!strcmp("LRT214", tmpbuf))
{
memcpy(sysObjectID, nk_sysobjectid_214, nk_sysobjectid_len * sizeof(oid));
}
if (!strcmp("LRT224", tmpbuf))
{
memcpy(sysObjectID, nk_sysobjectid_224, nk_sysobjectid_len * sizeof(oid));
}
#else
memcpy(sysObjectID, nk_sysobjectid, nk_sysobjectid_len * sizeof(oid));
#endif
sysObjectIDLength = nk_sysobjectid_len;
}
}
开发者ID:KrisChaplin,项目名称:LRT2x4_v1.0.2.06_GPL_source,代码行数:32,代码来源:system_mib.c
示例16: netsnmp_parse_iqueryVersion
void
netsnmp_parse_iqueryVersion(const char *token, char *line)
{
char buf[1024];
#ifndef NETSNMP_DISABLE_SNMPV1
if (!strcmp( line, "1" ))
netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_INTERNAL_VERSION, SNMP_VERSION_1);
else
#endif
#ifndef NETSNMP_DISABLE_SNMPV2C
if (!strcmp( line, "2" ) || !strcasecmp( line, "2c" ))
netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_INTERNAL_VERSION, SNMP_VERSION_2c);
else
#endif
if (!strcmp( line, "3" ))
netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_INTERNAL_VERSION, SNMP_VERSION_3);
else {
snprintf(buf, sizeof(buf), "Unknown version: %s", line);
buf[ sizeof(buf)-1 ] = 0;
config_perror(buf);
}
}
开发者ID:KrisChaplin,项目名称:LRT2x4_v1.0.2.06_GPL_source,代码行数:26,代码来源:iquery.c
示例17: snmpv3_privtype_conf
void
snmpv3_privtype_conf(const char *word, char *cptr)
{
int testcase = 0;
#ifndef NETSNMP_DISABLE_DES
if (strcasecmp(cptr, "DES") == 0) {
testcase = 1;
defaultPrivType = usmDESPrivProtocol;
}
#endif
#if HAVE_AES
/* XXX AES: assumes oid length == des oid length */
if (strcasecmp(cptr, "AES128") == 0 ||
strcasecmp(cptr, "AES") == 0) {
testcase = 1;
defaultPrivType = usmAES128PrivProtocol;
}
#endif
if (testcase == 0)
config_perror("Unknown privacy type");
defaultPrivTypeLen = SNMP_DEFAULT_PRIV_PROTOLEN;
DEBUGMSGTL(("snmpv3", "set default privacy type: %s\n", cptr));
}
开发者ID:KrisChaplin,项目名称:LRT2x4_v1.0.2.06_GPL_source,代码行数:25,代码来源:snmpv3.c
示例18: opencc_perror
void opencc_perror(const char* spec) {
if (!lib_initialized) {
lib_initialize();
}
perr(spec);
perr("\n");
switch (errnum) {
case OPENCC_ERROR_VOID:
break;
case OPENCC_ERROR_DICTLOAD:
dictionary_perror(_("Dictionary loading error"));
break;
case OPENCC_ERROR_CONFIG:
config_perror(_("Configuration error"));
break;
case OPENCC_ERROR_CONVERTER:
converter_perror(_("Converter error"));
break;
case OPENCC_ERROR_ENCODING:
perr(_("Encoding error"));
break;
default:
perr(_("Unknown"));
}
perr("\n");
}
开发者ID:johnnywjy,项目名称:OpenCC,代码行数:26,代码来源:opencc.c
示例19: engineIDType_conf
/*******************************************************************-o-******
* engineIDType_conf
*
* Parameters:
* *word
* *cptr
*
* Line syntax:
* engineIDType <1 or 3>
* 1 is default for IPv4 engine ID type. Will automatically
* chose between IPv4 & IPv6 if either 1 or 2 is specified.
* 2 is for IPv6.
* 3 is hardware (MAC) address, currently supported under Linux
*/
void
engineIDType_conf(const char *word, char *cptr)
{
engineIDType = atoi(cptr);
/*
* verify valid type selected
*/
switch (engineIDType) {
case ENGINEID_TYPE_IPV4: /* IPv4 */
case ENGINEID_TYPE_IPV6: /* IPv6 */
/*
* IPV? is always good
*/
break;
#if defined(IFHWADDRLEN) && defined(SIOCGIFHWADDR)
case ENGINEID_TYPE_MACADDR: /* MAC address */
break;
#endif
default:
/*
* unsupported one chosen
*/
config_perror("Unsupported enginedIDType, forcing IPv4");
engineIDType = ENGINEID_TYPE_IPV4;
}
DEBUGMSGTL(("snmpv3", "engineIDType: %d\n", engineIDType));
}
开发者ID:KrisChaplin,项目名称:LRT2x4_v1.0.2.06_GPL_source,代码行数:41,代码来源:snmpv3.c
示例20: version_conf
void
version_conf(const char *word, char *cptr)
{
int valid = 0;
#ifndef NETSNMP_DISABLE_SNMPV1
if ((strcmp(cptr, "1") == 0) ||
(strcmp(cptr, "v1") == 0)) {
netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SNMPVERSION,
NETSNMP_DS_SNMP_VERSION_1); /* bogus value */
valid = 1;
}
#endif
#ifndef NETSNMP_DISABLE_SNMPV2C
if ((strcasecmp(cptr, "2c") == 0) ||
(strcasecmp(cptr, "v2c") == 0)) {
netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SNMPVERSION,
NETSNMP_DS_SNMP_VERSION_2c);
valid = 1;
}
#endif
if ((strcasecmp(cptr, "3" ) == 0) ||
(strcasecmp(cptr, "v3" ) == 0)) {
netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SNMPVERSION,
NETSNMP_DS_SNMP_VERSION_3);
valid = 1;
}
if (!valid) {
config_perror("Unknown version specification");
return;
}
DEBUGMSGTL(("snmpv3", "set default version to %d\n",
netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_LIB_SNMPVERSION)));
}
开发者ID:KrisChaplin,项目名称:LRT2x4_v1.0.2.06_GPL_source,代码行数:34,代码来源:snmpv3.c
注:本文中的config_perror函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论