AOn Wed, 14 Sep 2005 14:45:25 +0100 Dave wrote:
DS> On Tue, 2005-09-13 at 12:22 -0400, Robert Story wrote:
DS> > On Tue, 13 Sep 2005 13:32:39 +0100 Dave wrote:
DS> > DS> Robert and I have been suggesting different forms of how to represent
DS> > DS> the requested service - either a string-based token ("snmpd:receive")
DS> > DS> or an integer ID
DS> > 
DS> > I like the strings because it's easier to extend,
DS> > and users can define their own.
DS> 
DS> AFAICS, the necessary code is almost identical, regardless
DS> of the syntax of the identifying token.

DS> This code is essentially identical, regardless of whether
DS> the service identifier was defined using:
DS> 
DS>     #define MY_SERVICE    "my:service"
DS> or
DS>     #define MY_SERVICE    6789

A string offers a reduction in the chances for collisions. I think it's pretty
likely that a user would choose a unique string for their service, and
slightly less likely that randomly chosen integers (probably with no meaning)
will be unique, requiring a search for which ones are currently defined.

And in my continuing effort to avoid prolonged battles over the 'right' way to
do things, I'll note that either way should check for uniqueness during
registration, so it should be a big issue.


DS> There's not really much to choose between the two approaches.
DS> IMO, the numeric style has two (relatively minor) advantages:
DS> 
DS>   a)  Numeric comparisons are more efficient than
DS>       string-based ones (so there'd be slightly less
DS>       overhead involved in looking up which port to use)

I agree that this is and advantage, and a relatively minor one.
 
DS>   b)  If the numeric MY_SERVICE identifier were defined as
DS> 
DS>     #define MY_SERVICE    12345
DS> 
DS>       (i.e. using the same numeric value as the default UDP
DS>       port) then the first ("udp:") registration call would
DS>       not be necessary.  But that's a useful optimisation,
DS>       rather than a core part of using a numeric identifier.

Not quite sure I get that one, but that's ok.

DS> Can you give me an example of some scenario where using a
DS> string-based tag provides functionality which a numeric
DS> identifier could not?

Referencing the service in the conf files. Which looks better:

        service 6789 udp:1234
   or
        my:service udp:1234

I think this is the best argument in favor of strings. Again, no more battles
over it, especially since I'm not offering to write the code. ;-)

-- 
NOTE: messages sent directly to me, instead of the lists, will be deleted
      unless they are requests for paid consulting services.

Robert Story; NET-SNMP Junkie
Support: <http://www.net-snmp.org/> <irc://irc.freenode.net/#net-snmp>
Archive: <http://sourceforge.net/mailarchive/forum.php?forum=net-snmp-coders>

You are lost in a twisty maze of little standards, all different. 


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. 
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to