亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? unknownattributesattribute.java

?? stun的java實現
?? JAVA
字號:
/*
 * Stun4j, the OpenSource Java Solution for NAT and Firewall Traversal.
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package net.java.stun4j.attribute;

import java.util.ArrayList;
import java.util.*;
import net.java.stun4j.StunException;

/**
 * The UNKNOWN-ATTRIBUTES attribute is present only in a Binding Error
 * Response or Shared Secret Error Response when the response code in
 * the ERROR-CODE attribute is 420.
 *
 * The attribute contains a list of 16 bit values, each of which
 * represents an attribute type that was not understood by the server.
 * If the number of unknown attributes is an odd number, one of the
 * attributes MUST be repeated in the list, so that the total length of
 * the list is a multiple of 4 bytes.
 *
 * 0                   1                   2                   3
 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 * |      Attribute 1 Type           |     Attribute 2 Type        |
 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 * |      Attribute 3 Type           |     Attribute 4 Type    ...
 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Organisation: Louis Pasteur University, Strasbourg, France</p>
 * <p>Network Research Team (http://www-r2.u-strasbg.fr)</p></p>
 * @author Emil Ivov
 * @version 0.1
 */

public class UnknownAttributesAttribute extends Attribute
{
    /**
     * A list of attribute types that were not understood by the server.
     */
    private ArrayList unknownAttributes = new ArrayList();



    UnknownAttributesAttribute()
    {
        super(UNKNOWN_ATTRIBUTES);
    }

    /**
     * Returns the human readable name of this attribute. Attribute names do
     * not really matter from the protocol point of view. They are only used
     * for debugging and readability.
     * @return this attribute's name.
     */
    public String getName()
    {
        return NAME;
    }

    public static String NAME = "UNKNOWN-ATTRIBUTES";

   /**
    * Returns the length (in bytes) of this attribute's body.
    * If the number of unknown attributes is an odd number, one of the
    * attributes MUST be repeated in the list, so that the total length of
    * the list is a multiple of 4 bytes.
    * @return the length of this attribute's value (a multiple of 4).
    */
    public char getDataLength()
    {
        char len = (char)unknownAttributes.size();

        if( (len % 2 ) != 0 )
            len++;

        return (char)(len*2);
    }

    /**
     * Adds the specified attribute type to the list of unknown attributes.
     * @param attributeID the id of an attribute to be listed as unknown in this
     * attribute
     */
    public void addAttributeID(char attributeID)
    {
        //some attributes may be repeated for padding
        //(packet length should be divisable by 4)
        if(!contains(attributeID))
            unknownAttributes.add(new Character(attributeID));
    }

    /**
     * Verifies whether the specified attributeID is contained by this attribute.
     * @param attributeID the attribute id to look for.
     * @return true if this attribute contains the specified attribute id.
     */
    public boolean contains(char attributeID)
    {
        return unknownAttributes.contains(new Character(attributeID));
    }

    /**
     * Returns an iterator over the list of attribute IDs contained by this
     * attribute.
     * @return an iterator over the list of attribute IDs contained by this
     * attribute.
     */
    public Iterator getAttributes()
    {
        return unknownAttributes.iterator();

    }

    /**
     * Returns the number of attribute IDs contained by this class.
     * @return the number of attribute IDs contained by this class.
     */
    public int getAttributeCount()
    {
        return unknownAttributes.size();
    }

    /**
     * Returns the attribute id with index i.
     * @param index the index of the attribute id to return.
     * @return the attribute id with index i.
     */
    public char getAttribute(int index )
    {
        return ((Character)unknownAttributes.get(index)).charValue();
    }

    /**
     * Returns a binary representation of this attribute.
     * @return a binary representation of this attribute.
     */
    public byte[] encode()
    {
        byte binValue[] = new byte[getDataLength() + HEADER_LENGTH];
        int  offset     = 0;

        //Type
        binValue[offset++] = (byte) (getAttributeType() >> 8);
        binValue[offset++] = (byte) (getAttributeType() & 0x00FF);

        //Length
        binValue[offset++] = (byte) (getDataLength() >> 8);
        binValue[offset++] = (byte) (getDataLength() & 0x00FF);


        Iterator attributes = getAttributes();
        while (attributes.hasNext()) {
            char att = ((Character)attributes.next()).charValue();
            binValue[offset++] = (byte)(att>>8);
            binValue[offset++] = (byte)(att & 0x00FF);
        }

       // If the number of unknown attributes is an odd number, one of the
       // attributes MUST be repeated in the list, so that the total length of
       // the list is a multiple of 4 bytes.
       if(offset < binValue.length)
       {
           char att = getAttribute(0);
           binValue[offset++] = (byte) (att >> 8);
           binValue[offset++] = (byte) (att & 0x00FF);
       }


        return binValue;
    }

    /**
     * Compares two STUN Attributes. Attributeas are considered equal when their
     * type, length, and all data are the same.
     *
     * @param obj the object to compare this attribute with.
     * @return true if the attributes are equal and false otherwise.
     */
    public boolean equals(Object obj)
    {
        if (! (obj instanceof UnknownAttributesAttribute)
            || obj == null)
            return false;

        if (obj == this)
            return true;

        UnknownAttributesAttribute att = (UnknownAttributesAttribute) obj;
        if (att.getAttributeType() != getAttributeType()
            || att.getDataLength() != getDataLength()
            || !unknownAttributes.equals(att.unknownAttributes)
        )
            return false;

        return true;

    }

    /**
     * Sets this attribute's fields according to attributeValue array.
     *
     * @param attributeValue a binary array containing this attribute's field
     *                       values and NOT containing the attribute header.
     * @param offset the position where attribute values begin (most often
     * 				 offset is equal to the index of the first byte after
     * 				 length)
     * @param length the length of the binary array.
     * @throws StunException if attrubteValue contains invalid data.
     */
    void decodeAttributeBody(byte[] attributeValue, char offset, char length) throws
        StunException
    {

        if( (length % 2 ) != 0)
            throw new StunException("Attribute IDs are 2 bytes long and the "
                                    +"passed binary array has an odd length value.");
        char originalOffset = (char)offset;
        for(int i = offset; i < originalOffset + length; i+=2)
        {
            char attributeID = (char)( (attributeValue[offset++]<<8) |
                               (attributeValue[offset++]) );
            addAttributeID(attributeID);
        }

    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美一区二区三区孕妇| 久久精品一区八戒影视| 国产成人在线色| 99精品视频在线免费观看| 国产寡妇亲子伦一区二区| 国产在线看一区| 精品一区二区av| 精品一区二区三区香蕉蜜桃| 韩国欧美国产1区| 国产呦精品一区二区三区网站| 久久91精品久久久久久秒播| 精品一区二区日韩| 国产一区二区在线观看视频| 国产一区二区导航在线播放| 国产丶欧美丶日本不卡视频| 不卡的电视剧免费网站有什么| 波多野结衣在线一区| 91美女蜜桃在线| 欧美日韩一级视频| 日韩一区二区免费在线电影| 国产亚洲精品久| 一区二区在线观看不卡| 午夜精品久久久久久久蜜桃app| 午夜精品久久久久久不卡8050| 蜜桃久久久久久久| 国产成人精品免费| 欧美在线视频全部完| 欧美v日韩v国产v| 国产精品美女久久久久高潮| 伊人开心综合网| 精品影视av免费| 色综合天天综合网天天狠天天 | 久久精品免费在线观看| 国产精品动漫网站| 亚洲一区精品在线| 韩国欧美国产一区| 在线欧美日韩精品| 欧美xingq一区二区| 亚洲精品少妇30p| 久久av中文字幕片| 色成人在线视频| 久久众筹精品私拍模特| 曰韩精品一区二区| 丰满亚洲少妇av| 欧美一区二区三区免费观看视频| 国产精品理论片| 狠狠色狠狠色综合| 欧美日韩高清一区| 中文字幕在线不卡一区| 久久国产精品99久久久久久老狼| 91成人在线免费观看| 欧美国产精品久久| 激情五月婷婷综合| 777xxx欧美| 一区二区三区四区激情| 成人性生交大片免费看中文| 日韩一区二区三区四区五区六区| 亚洲女同女同女同女同女同69| 国产露脸91国语对白| 欧美一级片免费看| 日韩精品一二三| 欧美视频一区二| 一区二区三区四区亚洲| 成人免费视频免费观看| 国产亚洲欧美日韩俺去了| 精品在线播放免费| 日韩欧美一级精品久久| 日韩二区三区四区| 欧美日韩不卡一区二区| 亚洲综合无码一区二区| 色就色 综合激情| 亚洲免费观看高清完整| av日韩在线网站| 国产精品美女久久久久av爽李琼| 成人一级视频在线观看| 久久精品欧美日韩精品| 国产一区二区成人久久免费影院| 欧美成人三级在线| 免费精品视频在线| 日韩一区二区三区在线观看| 秋霞av亚洲一区二区三| 91麻豆精品国产91久久久资源速度 | 日产欧产美韩系列久久99| 欧美四级电影在线观看| 一区二区三区四区高清精品免费观看| 成人午夜短视频| 国产精品人成在线观看免费| 成人app软件下载大全免费| 中文字幕在线一区二区三区| 91丨九色丨蝌蚪丨老版| 亚洲高清久久久| 欧美日韩一本到| 青椒成人免费视频| 久久欧美中文字幕| 成人精品视频一区| 一区二区成人在线| 91精品婷婷国产综合久久性色| 日韩电影在线免费看| 精品免费国产二区三区| 99久久综合99久久综合网站| 一区二区三区精品在线观看| 欧美人妖巨大在线| 精品福利在线导航| 成人午夜视频免费看| 亚洲国产精品久久人人爱| 日韩欧美国产高清| 成人av影视在线观看| 亚洲高清三级视频| 久久色在线观看| 在线观看精品一区| 国内精品国产成人| 一区二区三区在线不卡| 精品日韩在线一区| 91色视频在线| 韩国v欧美v日本v亚洲v| 一区二区三区免费看视频| 日韩欧美中文字幕精品| av中文字幕一区| 另类小说视频一区二区| 1000部国产精品成人观看| 91精品国产福利| av在线播放成人| 精品一区二区在线观看| 亚洲精品视频在线观看免费| 日韩精品一区二区三区视频在线观看 | 国产精品久久久久久久久动漫| 69精品人人人人| 色综合久久天天| 国产成人精品三级| 久久成人久久爱| 婷婷久久综合九色国产成人| 亚洲色图.com| 日本一区二区久久| 亚洲精品在线免费播放| 7777精品伊人久久久大香线蕉经典版下载| 国产成人鲁色资源国产91色综| 蜜桃视频一区二区三区| 亚洲韩国一区二区三区| 亚洲女爱视频在线| 国产精品久久久久久久久图文区 | 亚洲四区在线观看| 久久只精品国产| 欧美一区二区三区免费| 欧美日韩激情在线| 色噜噜狠狠成人网p站| 国产精品资源站在线| 麻豆极品一区二区三区| 丝袜a∨在线一区二区三区不卡| 亚洲乱码国产乱码精品精可以看| 国产精品少妇自拍| 26uuu色噜噜精品一区二区| 欧美一级精品大片| 欧美一区二区视频免费观看| 欧美欧美欧美欧美首页| 欧美日韩亚洲另类| 欧洲生活片亚洲生活在线观看| 色综合久久六月婷婷中文字幕| 91色视频在线| 色噜噜狠狠一区二区三区果冻| 色视频一区二区| 欧美综合天天夜夜久久| 欧美日韩久久久一区| 欧美日韩精品一区二区天天拍小说 | 精品视频资源站| 欧美群妇大交群的观看方式| 欧美日韩欧美一区二区| 欧美老女人在线| 日韩女优毛片在线| 国产视频视频一区| 亚洲欧美综合另类在线卡通| 亚洲欧美日韩国产手机在线| 亚洲国产欧美另类丝袜| 午夜精品123| 毛片av一区二区| 高清成人免费视频| 91片黄在线观看| 欧美久久久久免费| 欧美精品一区二区三区高清aⅴ| 久久精品欧美一区二区三区麻豆| 亚洲人成在线观看一区二区| 日韩成人午夜电影| 国产一区日韩二区欧美三区| 99国产精品久久久久| 欧美做爰猛烈大尺度电影无法无天| 精品视频1区2区| 久久久一区二区三区捆绑**| 中文字幕一区在线观看视频| 日韩成人一级片| 本田岬高潮一区二区三区| 欧美日韩在线观看一区二区| 精品日韩欧美在线| 中文字幕五月欧美| 日韩av电影天堂| 一本在线高清不卡dvd| 欧美一区二区播放| 自拍偷自拍亚洲精品播放| 三级在线观看一区二区| 成人精品鲁一区一区二区| 欧美一区二区视频在线观看2020| 国产精品久久久久久妇女6080|