Some final tidying to the ACL code. The IP address checking has been moved out of the add method to a more suitable location. The code now seems to be more readable. This should be the last 'feature' that needs doing.
Minor tweak to the short[] comparing code. By ensuring the wildcarded array is the first one, we can perform less checks :-) As this is just in a local context, the tighter coupling to the rest of the code is probably ok. One more change to be made in the String to short[] method -- it needs to do some more rigourous tests, and possibly return an error if the String cannot be parsed into an IP address. At the moment it assumes the add method has already done this. This could also make the add method neater as it would not need to do as many checks, and would therefore look neater.
Opps. Lost a bracket. Right, it's time to go out for New Year :-) In fact, this commit log will be mailed at about 1 minute into 2002 ;-)
Some tidying up. Removed debugging code. Added required comments.
Added an ACLDatagramSocket. Operation is much the same as the ACLServerSocket. Also tweaked the toString() to keep the i-scream bits as well as the more useful stuff.
Some significant internal changes. It should be noted that this code is still in the debugging stage, and thus contains lots of println's :-) The most obvious change is that when adding a rule we try to determine if it's and IP address given as the expression. If it is, we store this in a short[] in the ACLRule inner class. Then when performing a check we look to see if it's an IP address rule, and then do a special check for IP addresses - which is much more efficient than comparing two strings. We have also halved the checks done by only comparing a rule to either the name or IP, rather than both.
Creating a toString() for ACLRule, and modified the ACL toString() to make use of this. It's a bit neater I think.
The getACLString() method has been changed to a toString() method, and the i-scream style toString() has been dropped. The functionality of toString() now more closely resembles the Java Map's in layout.
Added serialization support to the ACL class. Also added testing of this feature to the ACLTest class, which confirms it works nicely :-)
Changed the LinkedList/Iterator to an ArrayList.get(n) solution. According to Paul's research this should run at least 4 times as fast as the LinkedList in the iterating stage. (and twice as quick as an ArrayList/Iterator solution!). Using a plain array could make this go twice as fast again, but it's a lot more work :-)
Fully commented, and further testing in the Socket environment. Probably ready to integrate into the main source tree under the server util package.
Initial checkin of ACL code for i-scream server. At present it should allow for ServerSocket's to be wrapped up with an access control list. Very simple to use, will javadoc sometime soon. Essentially construct a ACLServerSocket instead of a ServerSocket, then set an ACL (defaults to open ACL). Then it can be used as a ServerSocket due to inheritance, and will only return from the allow() method if the connecting Socket is permitted by the ACL.
This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, select a symbolic revision name using the selection box, or choose 'Use Text Field' and enter a numeric revision.