Subject: [AAA-WG]: Java API, draft-kempf-diameter-api-04.txt

From: Cain Brian-BCAIN1 <[email-masked]>
Date: Mon, 2 Apr 2001 15:47:43 -0500

James, et al.

Here are some additional notes on the Java API...
 
>5.3.1.5   Instance Methods
>...
>   public int getStatusCode()
>
>   Return the message's status code
>

Do we really need this method now that we have the Result-Code AVP?

...
>      public java.util.Map getAVPMap()
>
>   Returns a Map of AVP objects for the message. Keys are the AVP names.

This is one of several places where strings are used as keys for lookups.
Since the AVP names probably aren't standardized, wouldn't it be a better
idea
to use the (Vendor-Id, AVP-code) pair as a key to prevent collisions?

...
>     public AAAMessage[]
>       synchronized send(int sessionId,InetAddress[] recipients)
>       throws AAAException
>
>  Send this message to the session identified by the session id, wait
>  for return messages, and return them as an array. The outgoing
...
>  Exceptions thrown:
>
>     AAAException - Thrown with one of the following error codes:
>                    FAILURE, SECURITY, UNKNOWN_CMD, MISSING_AVP,
>                    TIMED_OUT, CANNOT_SEND_MSG, NETWORK_ERROR,
>                    SESSION_INVALID.

Please excuse me if this is clearly stated somewhere in Base protocol... 
"wait for return messages": is this plural only because there could be
multiple
recipients? Or is it also possible to receive multiple responses for one
message?  

Also, in the case of n recipients, x fail, y succeed. If we throw an
exception,
none of the y valid responses will ever get to the API client, right? Is
this an
acceptable risk?

~~~~~
(from 5.2.6.4)
>     public static
>       AAAExtensionDescriptor registerExtension(int code,
>                                                java.lang.String name,
>                                                java.lang.String
vendorName)
...
>     public AAACommandDescriptor
>       registerCommand(int code,
>                       java.lang.String name,
>                       java.util.Collection mandatoryAVPNames)
>

 It would probably be desirable for those who use the API to not have to
write new
code in order to make the library aware of new commands. My point is that
extensions
and commands would be static enough to put in configuration files like the
AVPs. Though
the .INI format probably does not lend well to a command definition file; I
guess that's more encouragement to jump to something like XML/SMIng?

~~~~~
(from 5.2.1.3)
>  The following constants are used for AVPDescriptor flags:
>
>     public static final int EMPTY_FLAG              = 0x00000
>     public static final int MANDATORY_FLAG          = 0x00001
-     public static final int RESERVED_FLAG           = 0x00002
+     public static final int RESERVED_MASK           = 0x0FFEA
>     public static final int VENDOR_SPECIFIC_FLAG    = 0x00004
>     public static final int END_TO_END_ENCRYPT_FLAG = 0x00010

Instead of "public int flags" (and the static ints above), I would suggest
"isMandatory(), isVendorSpecific(), and isEncryptable()" methods for the
AVPDescriptor.  I think there is some value in separating the actual flags
sent over the wire from the characteristics of a dictionary entry.  AVP
could have the method "setEncryptedFlag(boolean)", and if it were necessary
to allow access to all of the flags, "setFlags(int)" could be added.

-Brian