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

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

?? cwsppdu.java

?? jwap 協議 udp 可以用于手機通訊
?? JAVA
字號:
/** * JWAP - A Java Implementation of the WAP Protocols * Copyright (C) 2001-2004 Niko Bender * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */package net.sourceforge.jwap.wsp.pdu;import java.util.BitSet;import java.util.Vector;import net.sourceforge.jwap.util.BitArrayInputStream;import net.sourceforge.jwap.util.Logger;import net.sourceforge.jwap.wsp.WSPDecoder;import net.sourceforge.jwap.wsp.header.WAPCodePage;public abstract class CWSPPDU {    /**     * Table 34     */    public static final short PDU_TYPE_CONNECT = 0x01;    public static final short PDU_TYPE_CONNECTREPLY = 0x02;    public static final short PDU_TYPE_REDIRECT = 0x03;    public static final short PDU_TYPE_REPLY = 0x04;    public static final short PDU_TYPE_DISCONNECT = 0x05;    public static final short PDU_TYPE_PUSH = 0x06;    public static final short PDU_TYPE_CONFIRMEDPUSH = 0x07;    public static final short PDU_TYPE_SUSPEND = 0x08;    public static final short PDU_TYPE_RESUME = 0x09;    public static final short PDU_TYPE_GET = 0x40;    public static final short PDU_TYPE_GET_OPTIONS = 0x41;    public static final short PDU_TYPE_GET_HEAD = 0x42;    public static final short PDU_TYPE_GET_DELETE = 0x43;    public static final short PDU_TYPE_GET_TRACE = 0x44;    public static final short PDU_TYPE_POST = 0x60;    public static final short PDU_TYPE_POST_PUT = 0x61;    public static final short PDU_TYPE_DATA_FRAGMENT = 0x80;    static Logger logger = Logger.getLogger(CWSPPDU.class);    protected CWSPCapabilities capabilities = new CWSPCapabilities();    protected CWSPHeaders headers = new CWSPHeaders();    private static WAPCodePage wapCodePage = WAPCodePage.getInstance(1,2);    /**     * TID     * unint8     * in case of connectionless WSP PDUs (NOT IMPLEMENTED IN THIS RELEASE!)     * get it from S-Unit-MethodInvoke.req::TID     *          or S-Unit-MethodResult.req::TID     *          or S-Unit-Push.req::push ID     */    protected short TID;    /**     * PDU Type     * unint8     */    protected short pduType;    protected byte[] payload;    /////////////////////////////////////////////////////////////////////////////    //////////////////////////////// CONSTRUCTORS ///////////////////////////////    public CWSPPDU() {    }    public CWSPPDU(byte[] payload) {        this.payload = payload;    }    /////////////////////////////////////////////////////////////////////////////    //////////////////////////////// ABSTRACT METHOD ////////////////////////////    /**     * Encodes the PDU according to WAP-230-WSP-20010705-A.     * See <a href="http://www.wapforum.org">www.wapforum.org</a> for more information.     */    public abstract byte[] toByteArray();    /////////////////////////////////////////////////////////////////////////////    //////////////////////////////// CAPABILITIES/HEADERS ///////////////////////    public CWSPCapabilities getCapabilities() {        return capabilities;    }    public void setCapabilities(CWSPCapabilities c) {        capabilities = c;    }    public CWSPHeaders getHeaders() {        return headers;    }    public void setHeaders(CWSPHeaders h) {        headers = h;    }    public short getType() {        return pduType;    }    public byte[] getPayload() {        return payload;    }    public void setPayload(byte[] payload) {        this.payload = payload;    }    public String toString() {        return BitArrayInputStream.getBitString(this.toByteArray());    }    public boolean equals(CWSPPDU pdu) {        byte[] a1 = this.toByteArray();        byte[] a2 = pdu.toByteArray();        if (a1.length != a2.length) {            return false;        } else {            for (int i = 0; i < a1.length; i++) {                if (a1[i] != a2[i]) {                    logger.error("Can not decode received PDU - Byte " + i);                    return false;                }            }            return true;        }    }    /////////////////////////////////////////////////////////////////////////////////////////    public static synchronized CWSPPDU getPDU(byte[] bytes)        throws EWSPCorruptPDUException {        // This is a class, that helps us with decoding bits        WSPDecoder bin = new WSPDecoder(bytes);        //the PDU to be returned        CWSPPDU end = null;        //decode PDU type        /** for connectionless mode: 1st byte is tid:        short tid = bin.getUInt8(bytes[0]);        short pduType = bin.getUInt8(bytes[1]);        byte[] payload = null;        int aktbyte = 2;        */        short pduType = bin.getUint8();        switch (pduType) {        /** @todo ConfirmedPush PDU */        case CWSPPDU.PDU_TYPE_CONNECT:            CWSPConnect pdu1 = new CWSPConnect();            // decode Version            pdu1.setVersion(bin.getUint8());            // decode length of capabilities            long caplength = bin.getUintVar();            // decode length of headers            long headlength = bin.getUintVar();            // decode capabilities            pdu1.setCapabilities(getCapabilities(bytes, bin.seek(0), caplength));            bin.seek((int) caplength);            // decode headers            pdu1.setHeaders(new CWSPHeaders(bin, (int) headlength, wapCodePage));            end = pdu1;            break;        case CWSPPDU.PDU_TYPE_CONNECTREPLY:            // decode SessionID            CWSPConnectReply pdu2 = new CWSPConnectReply(bin.getUintVar());            // decode length of capabilities            caplength = bin.getUintVar();            // decode length of headers            headlength = bin.getUintVar();            // decode capabilities            pdu2.setCapabilities(getCapabilities(bytes, bin.seek(0), caplength));            bin.seek((int) caplength);            // decode headers            pdu2.setHeaders(new CWSPHeaders(bin, (int) headlength, wapCodePage));            end = pdu2;            break;        case CWSPPDU.PDU_TYPE_DATA_FRAGMENT:            // decode length of headers            headlength = bin.getUintVar();            // decode headers            CWSPHeaders headers = new CWSPHeaders(bin, (int) headlength, wapCodePage);            // the balance is payload            byte[] payload = bin.getBytes(bin.getRemainingOctets());            CWSPDataFragment pdu3 = new CWSPDataFragment(payload);            pdu3.setHeaders(headers);            end = pdu3;            break;        case CWSPPDU.PDU_TYPE_DISCONNECT:            CWSPDisconnect pdu4 = new CWSPDisconnect(bin.getUintVar());            end = pdu4;            break;        case CWSPPDU.PDU_TYPE_GET: //5            int urilength = (int) bin.getUintVar();            String uri = bin.getString(urilength);            CWSPGet pdu5 = new CWSPGet(uri);            pdu5.setHeaders(new CWSPHeaders(bin,bin.getRemainingOctets(),                wapCodePage));            end = pdu5;            break;        case CWSPPDU.PDU_TYPE_POST:            // decode length of URI            urilength = (int) bin.getUintVar();            // decode length of headers + contenttype            headlength = bin.getUintVar();            // decode URI            uri = bin.getString(urilength);            // decode contenttype            int cpos = bin.seek(0);            String contenttype = getContentType(bin);            headlength -= (bin.seek(0) - cpos);            // decode headers            headers = new CWSPHeaders(bin, (int) headlength, wapCodePage);            // the balance is payload            payload = bin.getBytes(bin.getRemainingOctets());            CWSPPost pdu6 = new CWSPPost(payload, contenttype, uri);            pdu6.setHeaders(headers);            end = pdu6;            break;        case CWSPPDU.PDU_TYPE_REDIRECT:            CWSPRedirect pdu8 = new CWSPRedirect();            // decode flags            pdu8.setFlags(bin.getUint8());            // decode addresses            pdu8.setAddresses(getAddresses(bytes, bin.seek(0),                    bin.getRemainingOctets()));            end = pdu8;            break;        case CWSPPDU.PDU_TYPE_REPLY:            // status            long status = bin.getUint8();            // length of header + contenttype            headlength = bin.getUintVar();            // decode contenttype            cpos = bin.seek(0);            contenttype = getContentType(bin);            headlength -= (bin.seek(0) - cpos);            // decode headers            headers = new CWSPHeaders(bin, (int) headlength, wapCodePage);            // the balance is payload            payload = bin.getBytes(bin.getRemainingOctets());            CWSPReply pdu9 = new CWSPReply(status, payload, contenttype);            pdu9.setHeaders(headers);            end = pdu9;            break;        case CWSPPDU.PDU_TYPE_RESUME:            // decode sessionID            long sessionID = bin.getUintVar();            // decode length of capabilities            caplength = bin.getUintVar();            // decode capabilities            CWSPCapabilities capabilities = getCapabilities(bytes, bin.seek(0),                    caplength);            bin.seek((int) caplength);            // decode headers            headers = new CWSPHeaders(bin, bin.getRemainingOctets(),                wapCodePage);            CWSPResume pdu10 = new CWSPResume(sessionID);            pdu10.setCapabilities(capabilities);            pdu10.setHeaders(headers);            end = pdu10;            break;        case CWSPPDU.PDU_TYPE_SUSPEND:            sessionID = bin.getUintVar();            CWSPSuspend pdu11 = new CWSPSuspend(sessionID);            end = pdu11;            break;        case CWSPPDU.PDU_TYPE_PUSH:            CWSPPush pdu12 = new CWSPPush();            headlength = bin.getUintVar();            cpos = bin.seek(0);            contenttype = getContentType(bin);            headlength -= (bin.seek(0) - cpos);            logger.debug("Push headers found. Len: " + headlength +                "  content type:" + contenttype);            // decode headers            pdu12.setHeaders(new CWSPHeaders(bin,(int) headlength,                wapCodePage));            // decode payload            pdu12.payload = bin.getBytes(bin.getRemainingOctets());            end = pdu12;            break;        default:            // unnown PDU types            throw new EWSPCorruptPDUException(                "Unknown PDU-Type! By the way: *is* it WSP? pduType=" +                pduType);        }        // finally, set TID (for all types):        //    end.TID=tid;        //logger.debug(">>> decoded and re-encoded:");        //logger.debug(end.toString());        return end;    }    private static synchronized CWSPCapabilities getCapabilities(byte[] bytes,        int offset, long count) {        CWSPCapabilities result = new CWSPCapabilities();        if (count <= 0) {            return result;        }        try {            /** @todo decode capabilities */        } catch (IndexOutOfBoundsException e) {            // ignore and return null            return result;        }        return result;    }    private static synchronized Vector getAddresses(byte[] bytes, int offset,        long count) {        // This is a class, that helps us with decoding bits        BitArrayInputStream bin = new BitArrayInputStream();        Vector result = new Vector();        if (count <= 0) {            return result;        }        int aktbyte = offset;        while (aktbyte < (count + offset)) {            BitSet b = BitArrayInputStream.getBitSet(bytes[aktbyte]);            boolean bearerTypeIncluded = b.get(0);            boolean portNumberIncluded = b.get(1);            short addresslen = bin.getByte(bytes[aktbyte], 2, 6);            short bearerType = bin.getUInt8(bytes[++aktbyte]);            int portNumber = bin.getUInt16(bytes[++aktbyte], bytes[++aktbyte]);            String address = "";            if (addresslen != 4) {                logger.warn("Unknown bearer type when decoding addresses!");            } else {                // the ipv4 address is encoded in 4 bytes                // get each byte and concat the ipv4 address as a string                for (int i = 0; i < addresslen; i++) {                    short ip = bin.getUInt8(bytes[++aktbyte]);                    address = address + ip;                    if (i < (addresslen - 1)) {                        address = address + ".";                    }                }            }            //String address = new String(bytes, ++aktbyte, addresslen);            CWSPAddress a = new CWSPAddress(bearerTypeIncluded,                    portNumberIncluded, bearerType, portNumber, address);            aktbyte += addresslen;            result.addElement(a);        }        return result;    }    public static synchronized String getContentType(WSPDecoder dc) {        int hs = CWSPHeaders.getHeaderValueSize(dc);        byte[] header = dc.getBytes(hs);        return wapCodePage.decodeContentType(header);    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲va在线va天堂| 国产精品入口麻豆原神| 香蕉乱码成人久久天堂爱免费| 91啪亚洲精品| 一区二区激情小说| 日韩一区二区精品葵司在线| 国产自产视频一区二区三区| 久久精品男人天堂av| 国产白丝精品91爽爽久久| 国产精品久久久久久久久动漫| 一本大道av一区二区在线播放| 亚洲国产一区视频| 日韩欧美在线网站| 粉嫩一区二区三区在线看| 亚洲人成亚洲人成在线观看图片| 欧美在线视频全部完| 日韩国产精品久久久| 久久九九国产精品| 色狠狠桃花综合| 久久国产精品99久久久久久老狼| 欧美精品久久天天躁| 国产一区二区伦理片| 亚洲丝袜制服诱惑| 91精品啪在线观看国产60岁| 国产成人在线视频播放| 一区二区三区蜜桃| 日韩欧美的一区| 99视频精品免费视频| 日本欧美一区二区三区乱码 | 国产欧美精品国产国产专区| 99精品视频在线观看| 一区二区激情视频| 欧美国产丝袜视频| 在线综合视频播放| 91网页版在线| 国产一区视频导航| 亚洲一区二区三区免费视频| 26uuu另类欧美| 欧美日韩国产免费一区二区| 成人免费电影视频| 久久精品国产99国产精品| 一区二区三区欧美久久| 精品电影一区二区三区| 欧美吻胸吃奶大尺度电影| 国产凹凸在线观看一区二区| 日韩电影免费一区| 亚洲狼人国产精品| 亚洲国产成人午夜在线一区| 欧美一区二区大片| 色哦色哦哦色天天综合| 成人国产精品免费观看| 国产一区二区三区| 日韩精品亚洲一区| 亚洲久草在线视频| 国产精品网站在线| 久久伊人蜜桃av一区二区| 欧美日本一道本| 色视频一区二区| 成人激情图片网| 国产成人啪免费观看软件| 久久精品国产网站| 日本强好片久久久久久aaa| 亚洲午夜视频在线观看| 亚洲欧美日韩国产中文在线| 国产调教视频一区| 久久久久一区二区三区四区| 4438x成人网最大色成网站| 在线亚洲一区二区| 91老师片黄在线观看| 不卡视频一二三| 成人国产电影网| 波多野结衣亚洲一区| 成人中文字幕合集| 国产不卡高清在线观看视频| 高清成人免费视频| 成人免费观看av| 国产精品88888| 国产精品影音先锋| 国产91在线看| 成人午夜精品在线| 北岛玲一区二区三区四区| 成人综合日日夜夜| av在线不卡免费看| 色婷婷av一区二区三区大白胸| 日本高清不卡一区| 69堂精品视频| 精品日产卡一卡二卡麻豆| 精品粉嫩aⅴ一区二区三区四区| 国产三级欧美三级日产三级99| 2024国产精品| 中文字幕精品在线不卡| 国产精品久久99| 亚洲自拍偷拍麻豆| 亚洲成av人片www| 看片的网站亚洲| 韩国成人福利片在线播放| 国产精品一区二区你懂的| av在线这里只有精品| 欧洲国产伦久久久久久久| 日韩欧美你懂的| 日本一区二区三区四区| 亚洲免费在线看| 视频一区中文字幕| 国内精品第一页| 99久久777色| 欧美三级日韩在线| 久久影院视频免费| 亚洲黄色免费电影| 看电视剧不卡顿的网站| 成人综合婷婷国产精品久久蜜臀 | 肉丝袜脚交视频一区二区| 捆绑变态av一区二区三区| 不卡影院免费观看| 欧美精品高清视频| 国产欧美日韩精品在线| 一区二区三区蜜桃网| 国产中文字幕一区| 色又黄又爽网站www久久| 精品捆绑美女sm三区| 综合久久久久久久| 日韩高清在线一区| 99久久99精品久久久久久 | 欧美日韩欧美一区二区| 久久综合给合久久狠狠狠97色69| 亚洲欧美日韩国产中文在线| 捆绑调教美女网站视频一区| 一本大道综合伊人精品热热| 精品久久久久av影院| 亚洲欧美日韩中文播放 | 99久久国产免费看| 日韩一区二区三区三四区视频在线观看| 国产精品精品国产色婷婷| 蜜桃久久久久久| 欧洲一区二区三区免费视频| 国产亚洲1区2区3区| 日本三级亚洲精品| 色av成人天堂桃色av| 国产精品免费视频观看| 毛片不卡一区二区| 欧美三级视频在线观看| 亚洲欧美国产毛片在线| 福利视频网站一区二区三区| 日韩一区二区三区四区五区六区| 国产精品二三区| 国产一区二区免费视频| 欧美一区二区免费| 亚洲成a人片在线不卡一二三区 | 91行情网站电视在线观看高清版| 精品久久久久久久久久久久久久久 | 欧美日韩在线亚洲一区蜜芽| 中文av一区二区| 国产一区在线观看视频| 欧美精品乱码久久久久久| 亚洲国产精品久久人人爱| 91在线观看免费视频| 久久久噜噜噜久久中文字幕色伊伊| 三级影片在线观看欧美日韩一区二区| 色综合网色综合| 国产精品狼人久久影院观看方式| 国产一区视频导航| 久久久久久久电影| 韩国精品主播一区二区在线观看| 欧美xingq一区二区| 欧美a级理论片| 91精品国产乱码久久蜜臀| 日本中文字幕一区二区视频| 欧美日本视频在线| 日韩成人一级片| 精品日韩一区二区三区| 精品一区二区三区久久久| 久久综合资源网| 国产真实乱对白精彩久久| 久久久精品国产免费观看同学| 国产麻豆一精品一av一免费| 精品成人一区二区| 久久97超碰国产精品超碰| 久久综合九色综合欧美就去吻| 久久国产精品99精品国产| 久久久久青草大香线综合精品| 国产精品 日产精品 欧美精品| 国产女人18毛片水真多成人如厕| 国产成人精品影院| 国产精品入口麻豆原神| 色欧美88888久久久久久影院| 人禽交欧美网站| 亚洲精品一区二区三区影院 | 国产精品不卡一区| 99国产精品久久| 亚洲电影中文字幕在线观看| 在线观看91精品国产麻豆| 久久精品免费观看| 久久蜜桃av一区精品变态类天堂| 成人国产精品视频| 五月激情六月综合| 精品国产乱码久久| 99riav一区二区三区| 亚洲18色成人| 久久久无码精品亚洲日韩按摩| 色综合久久综合中文综合网| 日韩高清不卡一区二区三区|