Changeset 410

Show
Ignore:
Timestamp:
04/11/06 09:37:52 (3 years ago)
Author:
alban
Message:

[Bug 77] removed 1.5 code

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/track/jstun/patches/0.5.9.2/src/de/javawi/jstun/attribute/MessageAttribute.java

    r337 r410  
    4747         
    4848        public static int typeToInteger(MessageAttributeType type) { 
    49                 if (type == MessageAttributeType.MappedAddress) return MAPPEDADDRESS; 
    50                 if (type == MessageAttributeType.ResponseAddress) return RESPONSEADDRESS; 
    51                 if (type == MessageAttributeType.ChangeRequest) return CHANGEREQUEST; 
    52                 if (type == MessageAttributeType.SourceAddress) return SOURCEADDRESS; 
    53                 if (type == MessageAttributeType.ChangedAddress) return CHANGEDADDRESS; 
    54                 if (type == MessageAttributeType.Username) return USERNAME; 
    55                 if (type == MessageAttributeType.Password) return PASSWORD; 
    56                 if (type == MessageAttributeType.MessageIntegrity) return MESSAGEINTEGRITY; 
    57                 if (type == MessageAttributeType.ErrorCode) return ERRORCODE; 
    58                 if (type == MessageAttributeType.UnknownAttribute) return UNKNOWNATTRIBUTE; 
    59                 if (type == MessageAttributeType.ReflectedFrom) return REFLECTEDFROM; 
    60                 if (type == MessageAttributeType.Dummy) return DUMMY; 
    61                 return -1; 
     49                return type.getValue(); 
    6250        } 
    6351         
  • trunk/track/jstun/patches/0.5.9.2/src/de/javawi/jstun/attribute/MessageAttributeInterface.java

    r337 r410  
    2121package de.javawi.jstun.attribute; 
    2222 
     23import org.apache.commons.lang.enums.ValuedEnum; 
     24 
    2325public interface MessageAttributeInterface { 
    24         public enum MessageAttributeType { Dummy, MappedAddress, ResponseAddress, ChangeRequest, SourceAddress, ChangedAddress, Username, Password, MessageIntegrity, ErrorCode, UnknownAttribute, ReflectedFrom }; 
     26        public class MessageAttributeType extends ValuedEnum {  
     27            public static final MessageAttributeType Dummy =  
     28                           new MessageAttributeType("Dummy", DUMMY); 
     29                public static final MessageAttributeType MappedAddress =  
     30                           new MessageAttributeType("MappedAddress", MAPPEDADDRESS); 
     31                public static final MessageAttributeType ResponseAddress =  
     32                           new MessageAttributeType("ResponseAddress", RESPONSEADDRESS); 
     33                public static final MessageAttributeType ChangeRequest =  
     34                           new MessageAttributeType("ChangeRequest", CHANGEREQUEST); 
     35                public static final MessageAttributeType SourceAddress =  
     36                           new MessageAttributeType("SourceAddress", SOURCEADDRESS); 
     37                public static final MessageAttributeType ChangedAddress =  
     38                           new MessageAttributeType("ChangedAddress", CHANGEDADDRESS); 
     39                public static final MessageAttributeType Username =  
     40                           new MessageAttributeType("Username", USERNAME); 
     41                public static final MessageAttributeType Password =  
     42                           new MessageAttributeType("Password", PASSWORD); 
     43                public static final MessageAttributeType MessageIntegrity =  
     44                           new MessageAttributeType("MessageIntegrity", MESSAGEINTEGRITY); 
     45                public static final MessageAttributeType ErrorCode =  
     46                           new MessageAttributeType("ErrorCode", ERRORCODE); 
     47                public static final MessageAttributeType UnknownAttribute =  
     48                           new MessageAttributeType("UnknownAttribute", UNKNOWNATTRIBUTE); 
     49                public static final MessageAttributeType ReflectedFrom =  
     50                           new MessageAttributeType("ReflectedFrom", REFLECTEDFROM); 
     51 
     52                private MessageAttributeType(String name, int value) { 
     53                                super(name, value); 
     54                } 
     55        }; 
    2556        final static int DUMMY = 0x0000; 
    2657        final static int MAPPEDADDRESS = 0x0001; 
  • trunk/track/jstun/patches/0.5.9.2/src/de/javawi/jstun/attribute/UnknownAttribute.java

    r337 r410  
    3737         */ 
    3838         
    39         Vector<MessageAttributeType> unkown = new Vector<MessageAttributeType>(); 
     39        private final List unkown = new ArrayList(); 
    4040         
    4141        public UnknownAttribute() { 
     
    6262                 
    6363                // unkown attribute header 
    64                 Iterator<MessageAttributeType> it = unkown.iterator(); 
     64                Iterator it = unkown.iterator(); 
    6565                while(it.hasNext()) { 
    66                         MessageAttributeType attri = it.next(); 
     66                        MessageAttributeType attri = (MessageAttributeType) it.next(); 
    6767                        System.arraycopy(Utility.IntegerToTwoBytes(typeToInteger(attri)), 0, result, 4, 2); 
    6868                } 
    6969                // padding 
    7070                if (unkown.size()%2 == 1) { 
    71                         System.arraycopy(Utility.IntegerToTwoBytes(typeToInteger(unkown.elementAt(1))), 0, result, 4, 2); 
     71                        System.arraycopy(Utility.IntegerToTwoBytes(typeToInteger((MessageAttributeType) unkown.get(1))), 0, result, 4, 2); 
    7272                } 
    7373                return result; 
  • trunk/track/jstun/patches/0.5.9.2/src/de/javawi/jstun/header/MessageHeader.java

    r337 r410  
    4747        byte[] id = new byte[16]; 
    4848         
    49         TreeMap<MessageAttribute.MessageAttributeType, MessageAttribute> ma = new TreeMap<MessageAttribute.MessageAttributeType, MessageAttribute>(); 
     49        private final Map ma = new TreeMap(); 
    5050         
    5151        public MessageHeader() { 
     
    109109         
    110110        public MessageAttribute getMessageAttribute(MessageAttribute.MessageAttributeType type) { 
    111                 return ma.get(type); 
     111                return (MessageAttribute) ma.get(type); 
    112112        } 
    113113         
    114114        public byte[] getBytes() throws UtilityException { 
    115115                int length = 20; 
    116                 Iterator<MessageAttribute.MessageAttributeType> it = ma.keySet().iterator(); 
     116                Iterator it = ma.keySet().iterator(); 
    117117                while (it.hasNext()) { 
    118                         MessageAttribute attri = ma.get(it.next()); 
     118                        MessageAttribute attri = (MessageAttribute) ma.get(it.next()); 
    119119                        length += attri.getLength(); 
    120120                } 
     
    129129                it = ma.keySet().iterator(); 
    130130                while (it.hasNext()) { 
    131                         MessageAttribute attri = ma.get(it.next()); 
     131                        MessageAttribute attri = (MessageAttribute) ma.get(it.next()); 
    132132                        System.arraycopy(attri.getBytes(), 0, result, offset, attri.getLength()); 
    133133                        offset += attri.getLength(); 
  • trunk/track/jstun/patches/0.5.9.2/src/de/javawi/jstun/header/MessageHeaderInterface.java

    r337 r410  
    2121package de.javawi.jstun.header; 
    2222 
     23import org.apache.commons.lang.enums.ValuedEnum; 
     24 
    2325public interface MessageHeaderInterface { 
    24         public enum MessageHeaderType { BindingRequest, BindingResponse, BindingErrorResponse, SharedSecretRequest, SharedSecretResponse, SharedSecretErrorResponse }; 
     26        public class MessageHeaderType extends ValuedEnum {  
     27        public final static MessageHeaderType BindingRequest =  
     28                           new MessageHeaderType("BindingRequest", BINDINGREQUEST); 
     29                public final static MessageHeaderType BindingResponse =  
     30                           new MessageHeaderType("BindingResponse", BINDINGRESPONSE); 
     31                public final static MessageHeaderType BindingErrorResponse =  
     32                           new MessageHeaderType("BindingErrorResponse", BINDINGERRORRESPONSE); 
     33                public final static MessageHeaderType SharedSecretRequest =  
     34                           new MessageHeaderType("SharedSecretRequest", SHAREDSECRETREQUEST); 
     35                public final static MessageHeaderType SharedSecretResponse =  
     36                           new MessageHeaderType("SharedSecretResponse", SHAREDSECRETRESPONSE); 
     37                public final static MessageHeaderType SharedSecretErrorResponse =  
     38                           new MessageHeaderType("SharedSecretErrorResponse", SHAREDSECRETERRORRESPONSE); 
     39 
     40                private MessageHeaderType(String name, int value) { 
     41                    super(name, value); 
     42                } 
     43        }; 
    2544        final static int BINDINGREQUEST = 0x0001; 
    2645        final static int BINDINGRESPONSE = 0x0101;