[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: snmpconf Snapshot draft




Much has been done in the last draft. I've included a list of notable
changes at the end of this message. 

The change most worthy of some attention is the addition of 
loosely-typed variables to the language. Loosely-typed variables 
are an attribute of every interpreted language I've been examining 
(Perl, TCL, Javascript, Python). With this we get automatic 
conversion as appropriate from integers to strings and back, no 
need to make size decisions and cast between different sizes of the 
same type, simpler accessor function APIs (also fewer functions 
needed), no need to declare type, etc. All of these culminate in the 
real goal: shorter, easier to write scripts.

For example, a popular idiom for us is to construct OIDs. So what once
was:

    char oid[STRINGLEN];
    sprintf(oid, "ifAdminStatus.%d", index);
    writeVar(pdu, 0, oid, INTEGER, 2, 4);

becomes

    writeVar(pdu, 0, "ifAdminStatus." + index, INTEGER, 2);


What this all looks like is:

declaration:
  var x, n = 5, str = "IETF";
      (declaration doesn't include type)

These are OK:
  x = "Hello World";
  x = 20;

Note the following:
"String" is of type string
55 is of type integer
"55" is of type string
Integer("55") is of type integer (the resulting value is 55)

If you perform A + B and either A or B is a string, it converts both
to strings and appends them. Hence:
   var index = 5;

   puts("ifAdminStatus." + index); ==> ifAdminStatus.5
   /* puts is just for demonstration. It's not in our library */

If both are integers, it adds them:
   var index = 5, num = 10;

   puts(index + num); ==> 15

All other arithmetic operators convert operands to integers, so:
    var str = "10", num = 5;

    puts(str * num); ==> 50

There's a detailed description of the conversion rules in the
description of "the var class".

The other changes include the following from Jon's todo list:
3, 5, 7, 9, 10, 15, 16, 17, 18, 19, 23, 24, 25, 28, 29, 35, 36,
37, 38, 39, 40, 48.

Here's a description of the changes:
- Added policyParameters and getParameters()
- Error to use a varbind that wasn't set
- Can we get a reference for the biblio for EBNF?
- Mention:
    implmentation specific limits on scratchpad variables per policy
    implmentation specific limits on global scratchpad may be lower
- Consider (in examples), having descriptor-style OIDs not in quotes so
  they aren't confused
- Be very explicit that examples are using descripters despite the fact
  that this is not the "over the wire" representation.
- More text about "this element" being index, context + address.
- policyGroup changes
    New "all at once" semantics
    When b trumps a, b runs for a while, b now terminates, we must
      re-execute a IMMEDIATELY
    Make things happen immediately when precedence changes
- incorporate (by value) schedule mib with changes
- Need to define element "0.0" for "this system" (think of it as
  policies for scalar elements
- Make changes for pass by reference
- Change to C++ reference
- Add automatic initialization
- Add newPDU()
- Explicit element addresses as varargs for roleMatch and capMatch
  for example, when processing DLCI, what is role of containing port?
- Add signalError() accessor function
    and enumeration per execution context (also for abnormalTermination)
    and pmSignalErrors gauge
- Define terms like execution context and "this element"
- Added loosely-typed variables
- Sscanf
- replace string "access functions" -> "accessor functions"
- Policy state object for showing inactive due to precedence.
- Security issue with deferring the loading of a policy based on
  lack of a role. Policy may not be able to be loaded in time to
  prevent havoc. Added in mib and in security considerations.
- PolicyAdminStatus
- iv() and ic()
- Integer() and String()
- chr() and ord()
- Delete strncpy(), strncat() and atoi().
- string substr(string s, int start, int len);
- string replace(string s1, int start, int len, string s2);
- reordered and renamed arguments to oidsplice
- reordered arguments in readVar/writeVar
- Fixed a few bugs in grammar for lexical elements and added octal
  encodings and escape sequences.
- Deleted getint() and setint() as unnecessary (getvar() is now just
  as simple)
- Updated declarations of many accessor functions
- Other typos, editorial changes, formatting, etc.


Steve