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

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

?? message.java

?? stun的java實現
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/*
 * 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.message;

import net.java.stun4j.attribute.Attribute;
import java.util.*;
import net.java.stun4j.StunException;
import net.java.stun4j.attribute.ChangeRequestAttribute;
import net.java.stun4j.attribute.AttributeDecoder;

/**
 * This class represents a STUN message. STUN messages are TLV (type-length-value)
 * encoded using big endian (network ordered) binary.  All STUN messages start
 * with a STUN header, followed by a STUN payload.  The payload is a series of
 * STUN attributes, the set of which depends on the message type.  The STUN
 * header contains a STUN message type, transaction ID, and length.
 *
 * <p>Organisation: Louis Pasteur University, Strasbourg, France</p>
 * 					<p>Network Research Team (http://www-r2.u-strasbg.fr)</p>
 * @author Emil Ivov
 * @version 0.1
 */

public abstract class Message
{
    public static final char BINDING_REQUEST               = 0x0001;
    public static final char BINDING_RESPONSE              = 0x0101;
    public static final char BINDING_ERROR_RESPONSE        = 0x0111;
    public static final char SHARED_SECRET_REQUEST         = 0x0002;
    public static final char SHARED_SECRET_RESPONSE        = 0x0102;
    public static final char SHARED_SECRET_ERROR_RESPONSE  = 0x0112;

    //Message fields
    /**
     * The length of Stun Message Headers in byres
     * = len(Type) + len(DataLength) + len(Transaction ID).
     */
    public static final byte HEADER_LENGTH = 20;

    /**
     * Indicates the type of the message. The message type can be Binding Request,
     * Binding Response, Binding Error Response, Shared Secret Request, Shared
     * Secret Response, or Shared Secret Error Response.
     */
    protected char messageType = 0x0000;

    /**
     * The transaction ID is used to correlate requests and responses.
     */
    protected byte[] transactionID = null;

    /**
     * The length of the transaction id (in bytes).
     */
    public static final byte TRANSACTION_ID_LENGTH = 16;


    /**
     * The list of attributes contained by the message. We are using a hastable
     * rather than a uni-dimensional list, in order to facilitate attribute
     * search (even though it introduces some redundancies). Order is important
     * so we'll be using a LinkedHashMap
     */
    //not sure this is the best solution but I'm trying to keep entry order
    protected LinkedHashMap attributes = new LinkedHashMap();

    /**
     * Desribes which attributes are present in which messages.  An
     * M indicates that inclusion of the attribute in the message is
     * mandatory, O means its optional, C means it's conditional based on
     * some other aspect of the message, and N/A means that the attribute is
     * not applicable to that message type.
     *
     *
     *                                         Binding  Shared  Shared  Shared        <br/>
     *                       Binding  Binding  Error    Secret  Secret  Secret        <br/>
     *   Att.                Req.     Resp.    Resp.    Req.    Resp.   Error         <br/>
     *                                                                  Resp.         <br/>
     *   _____________________________________________________________________        <br/>
     *   MAPPED-ADDRESS      N/A      M        N/A      N/A     N/A     N/A           <br/>
     *   RESPONSE-ADDRESS    O        N/A      N/A      N/A     N/A     N/A           <br/>
     *   CHANGE-REQUEST      O        N/A      N/A      N/A     N/A     N/A           <br/>
     *   SOURCE-ADDRESS      N/A      M        N/A      N/A     N/A     N/A           <br/>
     *   CHANGED-ADDRESS     N/A      M        N/A      N/A     N/A     N/A           <br/>
     *   USERNAME            O        N/A      N/A      N/A     M       N/A           <br/>
     *   PASSWORD            N/A      N/A      N/A      N/A     M       N/A           <br/>
     *   MESSAGE-INTEGRITY   O        O        N/A      N/A     N/A     N/A           <br/>
     *   ERROR-CODE          N/A      N/A      M        N/A     N/A     M             <br/>
     *   UNKNOWN-ATTRIBUTES  N/A      N/A      C        N/A     N/A     C             <br/>
     *   REFLECTED-FROM      N/A      C        N/A      N/A     N/A     N/A           <br/>
     *   XOR-MAPPED-ADDRESS  N/A      M        N/A      N/A     N/A     N/A
     *   XOR-ONLY            O        N/A      N/A      N/A     N/A     N/A
     *   SERVER              N/A      O        O        N/A     O       O
     *
     */
    public static final byte N_A = 0;
    public static final byte C   = 1;
    public static final byte O   = 2;
    public static final byte M   = 3;

    //Message indices
    protected static final byte BINDING_REQUEST_PRESENTITY_INDEX              = 0;
    protected static final byte BINDING_RESPONSE_PRESENTITY_INDEX             = 1;
    protected static final byte BINDING_ERROR_RESPONSE_PRESENTITY_INDEX       = 2;
    protected static final byte SHARED_SECRET_REQUEST_PRESENTITY_INDEX        = 3;
    protected static final byte SHARED_SECRET_RESPONSE_PRESENTITY_INDEX       = 4;
    protected static final byte SHARED_SECRET_ERROR_RESPONSE_PRESENTITY_INDEX = 5;

    //Attribute indices
    protected static final byte MAPPED_ADDRESS_PRESENTITY_INDEX               =  0;
    protected static final byte RESPONSE_ADDRESS_PRESENTITY_INDEX             =  1;
    protected static final byte CHANGE_REQUEST_PRESENTITY_INDEX               =  2;
    protected static final byte SOURCE_ADDRESS_PRESENTITY_INDEX               =  3;
    protected static final byte CHANGED_ADDRESS_PRESENTITY_INDEX              =  4;
    protected static final byte USERNAME_PRESENTITY_INDEX                     =  5;
    protected static final byte PASSWORD_PRESENTITY_INDEX                     =  6;
    protected static final byte MESSAGE_INTEGRITY_PRESENTITY_INDEX            =  7;
    protected static final byte ERROR_CODE_PRESENTITY_INDEX                   =  8;
    protected static final byte UNKNOWN_ATTRIBUTES_PRESENTITY_INDEX           =  9;
    protected static final byte REFLECTED_FROM_PRESENTITY_INDEX               = 10;
    protected static final byte XOR_MAPPED_ADDRESS_PRESENTITY_INDEX           = 11;
    protected static final byte XOR_ONLY_PRESENTITY_INDEX                     = 12;
    protected static final byte SERVER_PRESENTITY_INDEX                       = 13;
    protected static final byte UNKNOWN_OPTIONAL_ATTRIBUTES_PRESENTITY_INDEX  = 14;


    protected final static byte attributePresentities[][] = new byte[][]{
    //                                            Binding   Shared   Shared   Shared
    //                        Binding   Binding   Error     Secret   Secret   Secret
    //  Att.                  Req.      Resp.     Resp.     Req.     Resp.    Error
    //                                                                        Resp.
    //  _______________________________________________________________________
      /*MAPPED-ADDRESS*/    { N_A,      M,        N_A,      N_A,     N_A,     N_A},
      /*RESPONSE-ADDRESS*/  { O,        N_A,      N_A,      N_A,     N_A,     N_A},
      /*CHANGE-REQUEST*/    { O,        N_A,      N_A,      N_A,     N_A,     N_A},
      /*SOURCE-ADDRESS*/    { N_A,      M,        N_A,      N_A,     N_A,     N_A},
      /*CHANGED-ADDRESS*/   { N_A,      M,        N_A,      N_A,     N_A,     N_A},
      /*USERNAME*/          { O,        N_A,      N_A,      N_A,     M,       N_A},
      /*PASSWORD*/          { N_A,      N_A,      N_A,      N_A,     M,       N_A},
      /*MESSAGE-INTEGRITY*/ { O,        O,        N_A,      N_A,     N_A,     N_A},
      /*ERROR-CODE*/        { N_A,      N_A,      M,        N_A,     N_A,     M},
      /*UNKNOWN-ATTRIBUTES*/{ N_A,      N_A,      C,        N_A,     N_A,     C},
      /*REFLECTED-FROM*/    { N_A,      C,        N_A,      N_A,     N_A,     N_A},
      /*XOR-MAPPED-ADDRESS*/{ N_A,      M,        N_A,      N_A,     N_A,     N_A},
      /*XOR-ONLY*/          { O,        N_A,      N_A,      N_A,     N_A,     N_A},
      /*SERVER*/            { N_A,      O,        O,        N_A,     O,       O},
      /*UNKNOWN_OPTIONAL*/  { O,        O,        O,        O,       O,       O}};




    /**
     * Creates an empty STUN Mesage.
     */
    protected Message()
    {
    }

    /**
     * Returns the length of this message's body.
     * @return the length of the data in this message.
     */
    public char getDataLength()
    {
        char length = 0;
        Attribute att = null;

        Iterator iter = attributes.entrySet().iterator();
        while (iter.hasNext()) {
            att = (Attribute)((Map.Entry)iter.next()).getValue();
            length += att.getDataLength() + Attribute.HEADER_LENGTH;
        }

        return length;
    }

    /**
     * Adds the specified attribute to this message. If an attribute with that
     * name was already added, it would be replaced.
     * @param attribute the attribute to add to this message.
     * @throws StunException if the message cannot contain
     * such an attribute.
     */
    public void addAttribute(Attribute attribute)
        throws StunException
    {
        Character attributeType = new Character(attribute.getAttributeType());

        if (getAttributePresentity(attributeType.charValue()) == N_A)
            throw new StunException(StunException.ILLEGAL_ARGUMENT,
                                    "The attribute "
                                    + attribute.getName()
                                    + " is not allowed in a "
                                    + getName());

        attributes.put(attributeType, attribute);
    }

    /**
     * Returns the attribute with the specified type or null if no such
     * attribute exists.
     *
     * @param attributeType the type of the attribute
     * @return the attribute with the specified type or null if no such attribute
     * exists
     */
    public Attribute getAttribute(char attributeType)
    {
        return (Attribute)attributes.get(new Character(attributeType));
    }

    /*
     * Returns an enumeration containing all message attributes.
     * @return an enumeration containing all message attributes..
     */
    /*
    public Iterator getAttributes()
    {
        return attributes.entrySet().iterator();
    }
    */

    /**
     * Removes the specified attribute.
     * @param attributeType the attribute to remove.
     */
    public void removeAttribute(char attributeType)
    {
        attributes.remove(new Character(attributeType));
    }

    /**
     * Returns the number of attributes, currently contained by the message.
     * @return the number of attributes, currently contained by the message.
     */
    public int getAttributeCount()
    {
        return  attributes.size();
    }



    /**
     * Sets this message's type to be messageType. Method is package access
     * as it should not permit changing the type of message once it has been
     * initialized (could provoke attribute discrepancies). Called by
     * messageFactory.
     * @param messageType the message type.
     * @throws StunException ILLEGAL_ARGUMENT if message type is not valid in
     * the current context (e.g. when trying to set a Response type to a Request
     * and vice versa)
     */
    protected void setMessageType(char messageType)
        throws StunException
    {
        this.messageType = messageType;
    }

    /**
     * The message type of this message.
     * @return the message type of the message.
     */
    public char getMessageType()
    {
        return messageType;
    }

    /**
     * Copies the specified tranID and sets it as this message's transactionID.
     * @param tranID the transaction id to set in this message.
     * @throws StunException ILLEGAL_ARGUMENT if the transaction id is not valid.
     */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久婷婷国产综合国色天香| 日韩视频一区二区三区在线播放| 中文字幕不卡在线观看| 国产成人夜色高潮福利影视| 久久久精品国产免大香伊| 国产成人福利片| 国产精品精品国产色婷婷| 91片在线免费观看| 亚洲一区二区三区免费视频| 欧美精品777| 狠狠久久亚洲欧美| 亚洲欧洲无码一区二区三区| 91黄色免费版| 蜜桃一区二区三区四区| 欧美精彩视频一区二区三区| 日本精品视频一区二区三区| 日韩av不卡在线观看| 久久久久久久久伊人| 日本国产一区二区| 久久国产精品第一页| 自拍偷拍亚洲激情| 欧美一级免费大片| 国产不卡免费视频| 亚洲午夜视频在线| 久久久久久久久免费| 在线免费观看不卡av| 激情五月婷婷综合网| 亚洲免费在线看| 日韩一区二区三| 91麻豆视频网站| 久久99精品国产麻豆婷婷洗澡| 亚洲欧洲精品天堂一级 | 黄页网站大全一区二区| 国产精品久久久久影院| 欧美喷水一区二区| 成人动漫av在线| 男男gaygay亚洲| 亚洲天堂网中文字| 久久久青草青青国产亚洲免观| 在线视频观看一区| 懂色av中文一区二区三区| 免费观看日韩电影| 一区二区三区国产精品| 久久精品无码一区二区三区| 欧美日韩一区三区| 99精品一区二区三区| 国产乱码精品一区二区三区忘忧草 | 亚洲激情网站免费观看| 欧美va亚洲va香蕉在线| 欧美日韩国产一区| 一本大道久久精品懂色aⅴ| 国产最新精品精品你懂的| 亚洲国产精品人人做人人爽| 中文字幕日本乱码精品影院| 久久这里都是精品| 日韩一级片在线观看| 欧美三级韩国三级日本一级| av资源站一区| 懂色av噜噜一区二区三区av| 狠狠色狠狠色合久久伊人| 免费在线观看成人| 日韩高清在线不卡| 亚洲一区二区偷拍精品| 亚洲男人的天堂av| 亚洲色图视频网| 国产精品美女久久久久高潮| 久久精品亚洲乱码伦伦中文 | 亚洲精品乱码久久久久久久久| 久久久三级国产网站| 久久一区二区视频| 精品日产卡一卡二卡麻豆| 精品日产卡一卡二卡麻豆| 日韩精品中文字幕在线不卡尤物| 91精品久久久久久蜜臀| 欧美日韩大陆一区二区| 欧美影院一区二区| 欧美日韩一级片网站| 制服视频三区第一页精品| 欧美日韩国产一级| 91精品国产福利| 日韩一区二区三区在线视频| 欧美一区二区三区人| 欧美r级电影在线观看| 久久综合久久99| 欧美激情一区二区| 日韩毛片在线免费观看| 亚洲国产wwwccc36天堂| 午夜精品爽啪视频| 久久激情综合网| 成人午夜av在线| 91蜜桃传媒精品久久久一区二区| 欧洲av一区二区嗯嗯嗯啊| 欧美高清视频不卡网| 日韩欧美一区二区在线视频| 2021中文字幕一区亚洲| 国产精品久久久久永久免费观看| 一区二区三区小说| 日韩av一区二| 国产乱人伦偷精品视频免下载 | 色哟哟精品一区| 欧美主播一区二区三区| 日韩丝袜美女视频| 中文字幕国产一区| 亚洲激情一二三区| 精品一区二区久久久| 波多野结衣在线一区| 欧美怡红院视频| 亚洲精品一区二区三区精华液| 久久久91精品国产一区二区精品 | 国产精品456| 日本福利一区二区| 精品欧美黑人一区二区三区| 中文字幕综合网| 奇米四色…亚洲| 成人禁用看黄a在线| 欧美日本韩国一区二区三区视频| 久久久蜜桃精品| 亚洲大片在线观看| 国产成人日日夜夜| 欧美日本韩国一区二区三区视频 | 中文字幕亚洲精品在线观看| 亚洲国产日韩精品| 成人免费黄色在线| 欧美一区二区三区男人的天堂| 国产精品女上位| 蜜臀精品久久久久久蜜臀 | 一区二区国产视频| 国产麻豆精品theporn| 欧美三级欧美一级| 国产精品网站在线播放| 日韩高清一区二区| 91视频免费看| 久久精品一区蜜桃臀影院| 亚洲成人免费在线| 91丝袜高跟美女视频| 久久毛片高清国产| 日韩电影在线观看网站| 在线一区二区三区| 国产精品色在线观看| 免费不卡在线观看| 欧美日本在线一区| 夜夜嗨av一区二区三区中文字幕| 国产精品一区二区三区乱码| 日韩一区二区三区在线视频| 亚洲成a人片综合在线| 波多野结衣精品在线| 国产亚洲一区二区在线观看| 蜜桃一区二区三区在线| 欧美日韩精品二区第二页| 依依成人精品视频| 99精品热视频| 国产精品国产三级国产| 国产精品一区二区在线观看不卡 | 欧美一二三区在线| 亚洲香蕉伊在人在线观| 欧日韩精品视频| 亚洲精品中文在线影院| 91农村精品一区二区在线| 欧美激情艳妇裸体舞| 国产精品一区二区在线播放 | 97精品视频在线观看自产线路二| 久久视频一区二区| 激情综合网最新| 精品粉嫩aⅴ一区二区三区四区| 日韩成人av影视| 91精品国产免费久久综合| 日韩高清不卡一区二区三区| 91精品国产aⅴ一区二区| 日韩成人av影视| 精品捆绑美女sm三区| 国产麻豆精品久久一二三| 国产午夜亚洲精品理论片色戒 | 亚洲欧美激情小说另类| 97精品视频在线观看自产线路二| 日韩一区在线免费观看| 91麻豆国产自产在线观看| 一区二区三区中文字幕电影| 色呦呦日韩精品| 亚洲国产综合91精品麻豆| 欧美精品九九99久久| 琪琪一区二区三区| 久久婷婷一区二区三区| av亚洲精华国产精华| 亚洲精品国产第一综合99久久 | 26uuuu精品一区二区| 国产精品一色哟哟哟| 亚洲人成人一区二区在线观看| 一本大道久久精品懂色aⅴ| 午夜精品免费在线观看| 2024国产精品视频| 91蜜桃视频在线| 日韩国产在线一| 国产日韩亚洲欧美综合| 99re成人在线| 日韩影院免费视频| 久久综合久色欧美综合狠狠| 91麻豆福利精品推荐| 性久久久久久久久久久久| 久久久久97国产精华液好用吗| 成人av中文字幕|