Merge pull request #422 from dima1308/master
Add support decimal64 for SNMP
This commit is contained in:
commit
d6c523d27a
1 changed files with 17 additions and 0 deletions
|
|
@ -108,6 +108,7 @@ static const map_str2int snmp_type_map[] = {
|
||||||
{"uint64", ASN_COUNTER64}, // 0x46 / 70
|
{"uint64", ASN_COUNTER64}, // 0x46 / 70
|
||||||
{"boolean", ASN_INTEGER}, // 2 special case -> enumeration
|
{"boolean", ASN_INTEGER}, // 2 special case -> enumeration
|
||||||
{"string", ASN_IPADDRESS}, // 64
|
{"string", ASN_IPADDRESS}, // 64
|
||||||
|
{"decimal64", ASN_OCTET_STR},
|
||||||
{NULL, -1}
|
{NULL, -1}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -127,6 +128,7 @@ static const map_str2int snmp_orig_map[] = {
|
||||||
{"ipv4-address", ASN_IPADDRESS}, // 0x40 / 64 (This is used instead)
|
{"ipv4-address", ASN_IPADDRESS}, // 0x40 / 64 (This is used instead)
|
||||||
{"RowStatus", CLIXON_ASN_ROWSTATUS}, // 0x40 / 64 (This is used instead)
|
{"RowStatus", CLIXON_ASN_ROWSTATUS}, // 0x40 / 64 (This is used instead)
|
||||||
{"phys-address", CLIXON_ASN_PHYS_ADDR}, /* Clixon extended string type */
|
{"phys-address", CLIXON_ASN_PHYS_ADDR}, /* Clixon extended string type */
|
||||||
|
{"decimal64", ASN_OCTET_STR},
|
||||||
{NULL, -1}
|
{NULL, -1}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -750,6 +752,21 @@ type_xml2snmp_pre(char *xmlstr0,
|
||||||
else
|
else
|
||||||
str = "1";
|
str = "1";
|
||||||
}
|
}
|
||||||
|
else if( strcmp(restype, "decimal64") == 0 ) {
|
||||||
|
char **reason;
|
||||||
|
cbuf *cb = cbuf_new();
|
||||||
|
cg_var* cv = yang_cv_get(ys);
|
||||||
|
int64_t num;
|
||||||
|
if( (ret = parse_dec64(xmlstr0, cv_dec64_n_get(cv), &num, reason)) < 0)
|
||||||
|
goto done;
|
||||||
|
if (ret == 0){
|
||||||
|
clicon_debug(1, "Invalid decimal64 valstr %s", xmlstr0);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
cv_dec64_i_set(cv, num);
|
||||||
|
cv2cbuf(cv, cb);
|
||||||
|
str = cbuf_get(cb);
|
||||||
|
}
|
||||||
else{
|
else{
|
||||||
str = xmlstr0;
|
str = xmlstr0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue