From: Dave S. <D.T...@cs...> - 2004-08-09 08:33:32
|
> I am able to assign the value to a COUNTER64 type. Although I still > don't understand the 'high' and 'low' fields in the counter64 structure. Think of it as follows: Take a 64-bit value and write it as a binary string. You should have 64 binary digits (including several leading 0s), since that's what a 64-bit value means. Count the first 32 digits and draw a line after that point. There should now be 32 digits to the left of the line and 32 digits to the right of the line. Now treat these as two separate 32-bit values. The value to the left of the line is "high" and the value to the right is "low" OK? > I assigned the high (=100) and low (=0). But the returned value of the > query is something like "429496729600". Don't know how it comes out the > number, and if it's a correct returned value. Well, (high=100, low=0) means 100*2^32 + 0 2^10 is 1024, which is close to 1000, so 2^32 is roughly 4,000,000,000, so 100*2^32 is about 400,000,000,000 Compare that to: 429,496,729,600 and your answer is certainly plausible. > I searched for the files which has manipulation of ASN_COUNTER64. > The apps/snmpdelta.c has few lines. It uses u64Subtract() & memcpy(). > I don't know if this is the special case or it is the typical way to > handle a COUNTER64 type variable. This is typical. Remember that a 64-bit value may well be too large for many systems to handle "normally" - depending on the precise architecture and O/S that you're using. You'd have to consult your local documentation for details about how large various types can be (e.g. "int", "long", "long long", etc) > For instance I have value 100 to be assigned to a COUNTER64 type > variable. What is the correct way to fill in the counter64 structure? high = 0, low = 100 Dave |