[prev in list] [next in list] [prev in thread] [next in thread] 

List:       net-snmp-coders
Subject:    Re: timestamp issue
From:       "David T. Perkins" <dperkins () dsperkins ! com>
Date:       2005-11-30 16:06:38
Message-ID: Pine.LNX.4.10.10511300758440.14713-100000 () shell4 ! bayarea ! net
[Download RAW message or body]

HI,

OK, Try the following...

unsigned char val[] = { 0x07, 0xC8, 0x05, 0x1a, 0x0d,
                        0x1e, 0x0e, 0x00, 0x2d, 0x04, 0x00 };
int valLen = sizeof(val)/sizeof(unsigned char);

snmp_set_var_typed_value (requests,ASN_OCTET_STR, val, valLen);

What you did encodes a string that is 24 octets long.
Your value is a binary value whose length SHOULD BE
11 octets long!

On Wed, 30 Nov 2005 kanda.samy@wipro.com wrote:
> Hi David,
> 
> 	Thank you for quick the response
> 
> 	I had tried the value, what you had send, still i am getting some big number.
> I had filled the snmp_set_var_typed_value as
> snmp_set_var_typed_value (requests,ASN_OCTET_STR,"0x07C8051a0d1e0e002d0400",strlen \
> ("0x07C8051a0d1e0e002d0400")) the reply i got is,
> ------------------------------------------------------------------------------------------
>  [kanda@kanda kanda]$ snmpget -v2c -c motro localhost myScalar.0
> MY-MIB::myScalar.0 = STRING: \
>                 12408-48-55,67:56:48.53,197:48100491014810148485010048524848
> ------------------------------------------------------------------------------------------
>  
> if i change myScalar MIB definition from "SYNTAX  DateAndTime " to "SYNTAX  \
> DisplayString" and if i send "1992-5-26,13:30:15.0,-4:0" to \
> snmp_set_var_typed_value(), i am getting the same string what i had passed.
> 
> For dateAndTime scalars, Do i have to send the (hexa values), in some other format?
> 
> In mib2c code, i am getting variable->type as "ASN_OCTET_STR", wheather myScalar \
> SYNTAX is DisplayString or DateAndTime. How i can differenciate this displayString \
> and dateAndTime in mib2c code, Since you are telling for dateAndTime, i have to \
> give hexa format string for dateAndTime type scalars.
> 
> 
> Regards
> Kanda,
> 
> -----Original Message-----
> From: David T. Perkins [mailto:dperkins@dsperkins.com]
> Sent: Sunday, November 27, 2005 4:01 AM
> To: Siddesh P R (WT01 - Broadband Networks)
> Cc: net-snmp-coders@lists.sourceforge.net
> Subject: Re: timestamp issue
> 
> HI,
> 
> It appears that you have misunderstood the definition of the DataAndTime
> textual convention. Here is the definition from RFC 2579:
> DateAndTime ::= TEXTUAL-CONVENTION
> DISPLAY-HINT "2d-1d-1d,1d:1d:1d.1d,1a1d:1d"
> STATUS       current
> DESCRIPTION
> "A date-time specification.
> 
> field  octets  contents                  range
> -----  ------  --------                  -----
> 1      1-2   year*                     0..65536
> 2       3    month                     1..12
> 3       4    day                       1..31
> 4       5    hour                      0..23
> 5       6    minutes                   0..59
> 6       7    seconds                   0..60
> (use 60 for leap-second)
> 7       8    deci-seconds              0..9
> 8       9    direction from UTC        '+' / '-'
> 9      10    hours from UTC*           0..13
> 10      11    minutes from UTC          0..59
> 
> * Notes:
> - the value of year is in network-byte order
> - daylight saving time in New Zealand is +13
> 
> For example, Tuesday May 26, 1992 at 1:30:15 PM EDT would be
> displayed as:
> 
> 1992-5-26,13:30:15.0,-4:0
> 
> Note that if only local time is known, then timezone
> information (fields 8-10) is not present."
> SYNTAX       OCTET STRING (SIZE (8 | 11))
> 
> 
> The value of an item with data type DateAndTime is a binary
> string and NOT a displayable string. The value of the
> DISPLAY-HINT clause tells you how to decode the binary
> string to construct a displayable value. It appears that
> the DESCRIPTION clause is incomplete in that it should have
> said that the value of
> 0x07C8 05 1a 0d 1e 0e 00 2d 04 00 (i put in spaces to show the fields)
> or without spaces:
> 0x07C8051a0d1e0e002d0400 (length of 11)
> 
> Regards,
> /david t. perkins
> 
> On Sun, 27 Nov 2005 siddesh.rajappa@wipro.com wrote:
> > Hi
> > 
> > One of our Property MIB is defined as
> > "SYNTAX  DateAndTime
> > MAX-ACCESS      read-only".
> > 
> > For this mib i had generated c code , using mib2c script (
> > mib2c.scalar.conf). In the code, for that particular scalar i am sending
> > string
> > "1992-5-26,13:30:15.0,-4:0" by filling set_var_type value as
> > 
> > 
> > snmp_set_var_typed_value
> > (requests,ASN_OCTET_STR,"1992-5-26,13:30:15.0,-4:0",
> > strlen ("1992-5-26,13:30:15.0,-4:0").
> > 
> > When i am giving get on this scalar it is showing big strig...
> > Does net-snmp coverts for DateAndTime to       some other format ( the
> > formate what i had given is already in dateAndtime format).
> > 
> > 
> > ------------------------------------------------------------------------
> > ------------------------------------
> > [kanda@kanda weTst]$ snmpget -v2c -c motro 10.201.114.139 mySclalar.0
> > MY-MIB::myScalar.0 = STRING:
> > 12601-57-50,45:53:45.50,644:495158514858495346484445525848
> > 
> > ------------------------------------------------------------------------
> > ------------------------------------
> > 
> > 
> > Can some body help me , how i can display the same string what i am
> > sending in the code , as snmpget output.
> > 
> > regards
> > Kanda
> 
> 
> 
> 
> 
> Confidentiality Notice
> 
> The information contained in this electronic message and any attachments to this \
> message are intended for the exclusive use of the addressee(s) and may contain \
> confidential or privileged information. If you are not the intended recipient, \
> please notify the sender at Wipro or Mailadmin@wipro.com immediately and destroy \
> all copies of this message and any attachments.



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic