[AGENT++] build_vb and too many variables

Jacek Poplawski jacekp at s3group.com.pl
Wed Feb 8 10:13:36 CET 2006


 > May be you can consider to upgrade to the latest SNMP++/AGENT++
We are using 3.2.20.

 > which does no longer have a fixed upper limit for the VBs in a PDU. 
Otherwise you may test the constant MAX_VBS defined in config_snmp_pp.h

The question is not how to increase number of variables, but how to 
check if given number of variables will fit there.
According to RFC (if I understand it correctly) one should put part of 
variables into PDU, not return error.
Such test is in commercial SNMP testsuite, I want to pass it.

we are currently calling:

scopedPDUPtr = build_vb(pdu, scopedPDUPtr, &maxLen);

interesting part of build_vb from asn1.cpp:

  int vb_length;
  int length = MAX_SNMP_PACKET;

  // build varbinds into packet buffer
  for(vp = pdu->variables; vp; vp = vp->next_variable)
  {
    cp = snmp_build_var_op( cp, vp->name, &vp->name_length,
                vp->type, vp->val_len,
                (unsigned char *)vp->val.string,
                &length);
    if (cp == NULL) return 0;
  }
  vb_length = cp - tmp_buf.get_ptr();
  *buf_len -= vb_length;
  if (*buf_len <= 0) return 0;

This code doesn't check how many variables will fit, if buf_len is 
smaller than vb_length it just return error :-(
Can I somehow calculate vb_length easier way than by calling build_vb? 
Or is there any build_vb alternative available?

The information contained in this e-mail and in any attachments is confidential and is designated solely for the attention of the intended recipient(s). If you are not an intended recipient, you must not use, disclose, copy, distribute or retain this e-mail or any part thereof. If you have received this e-mail in error, please notify the sender by return e-mail and delete all copies of this e-mail from your computer system(s).
Please direct any additional queries to: communications at s3group.com.
Thank You.



More information about the AGENTPP mailing list