Counter64: Endianness
Krishna Chaitanya <[email protected]>
| Newsgroups | gmane.network.net-snmp.devel |
|---|---|
| Message-ID | <CABPxzY+spkJts+1E3nnVtXpBX7j9CVn+45iRQBdw+ZF9xE+qwg@mail.gmail.com> |
Hi,
I am running an SNMP subagent using agentX protocol and all MIB values
of type Counter64 as shown in big_endian order even though my desktop
is Intel (little endian).
The basic problem arises because Counter64 is not a direct data type
rather its a struct {high, low} and the value is stored using memmove
which copies the LSB into high.
Sample code is below:
int64_t a = 99;
snmp_set_var_typed_value (..ASN_COUNTER64, & a);
If I explicitly set is as below, it works. But doing this for many
variables and explicitly copying to high/low is cumbersome.
struct counter64 a = {0, 99};
snmp_set_var_typed_value (..ASN_COUNTER64, & a);
Is there a way we can use int64_t and get little endian?
P.S. During my search, I did come across code handling Endianess based
on session.flags (AGENTX_MSG_FLAG_NETWORK_BYTE_ORDER) but
snmp_pdu_create doesn't set those flags.
--
Thanks,
Regards,
Chaitanya T K.