Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Ethereal-users: [Ethereal-users] snmp asn1 counter64

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

Date: Mon, 14 Apr 2003 09:33:06 +0200 (CEST)
Hi all

Does anyone know why the SNMP_COUNTER64 type
has to be 8 bytes in length? See code below
taken from "packet-snmp.c"

I cannot find this requirement in the SNMP RFCs.
I thought the ASN1 code only took up the space
it needed.

Best Regards

Markus



static guchar *
format_var(struct variable_list *variable, subid_t *variable_oid,
    guint variable_oid_length, gushort vb_type, guint val_len)
{
	guchar *buf;
	size_t buf_len;
	size_t out_len;

	switch (vb_type) {

	case SNMP_IPADDR:
		/* Length has to be 4 bytes. */
		buf = check_var_length(val_len, 4);
		if (buf != NULL)
			return buf;	/* it's not 4 bytes */
		break;

	case SNMP_COUNTER64:
		/* Length has to be 8 bytes. */
		buf = check_var_length(val_len, 8);
		if (buf != NULL)
			return buf;	/* it's not 8 bytes */
		break;

	default:
		break;
	}