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

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

?? session.java

?? Short Message Peer to Peer
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:
/*
 * Copyright (c) 1996-2001
 * Logica Mobile Networks Limited
 * All rights reserved.
 *
 * This software is distributed under Logica Open Source License Version 1.0
 * ("Licence Agreement"). You shall use it and distribute only in accordance
 * with the terms of the License Agreement.
 *
 */
package org.smpp;

import java.io.IOException;
import java.util.Hashtable;

import org.smpp.util.*;
import org.smpp.pdu.*;

/**
 * Class <code>Session</code> provides all methods necessary for communication
 * with SMSC using SMPP protocol, i.e. methods for sending PDUs as defined
 * in SMPP specification as well as receiving responses for sent PDUs
 * and waiting for PDUs whose sending was initiated by SMSC.<br>
 * Instance of <code>Session</code> represents one connection of ESME
 * to a SMSC. Multiple connections can be established using
 * multiple <code>Sessions</code>.
 * <p>
 * <code>Session</code> uses <code>Connection</code> object which is
 * instantiated outside of the <code>Session</code>. This way is
 * the <code>Session</code> made independent on the communication protocol
 * and <code>Session</code>'s code isn't populated by protocol dependent
 * initialisation.
 * <p>
 * Code example of binding, sending one message and unbinding:
 * <br><blockquote><pre>
 *   Connection conn = new TCPIPConnection("123.123.123.123", 6543);
 *   Session session = new Session(conn);
 *   BindRequest breq = new BindTransmitter();
 *   breq.setSystemId("MYNAME");
 *   breq.setPassword("my_pswdx");
 *   Response resp = session.bind(breq);
 *   if (resp.getCommandStatus() == Data.ESME_ROK) {
 *      SubmitSM msg = new SubmitSM();
 *      msg.setSourceAddr("3538998765432");
 *      msg.setDestAddr("3538619283746");
 *      msg.setShortMessage("Hello, world!");
 *      resp = session.submit(msg);
 *      if (resp.getCommandStatus() == Data.ESME_ROK) {
 *         System.out.println("Message submitted. Status=" + resp.getCommandStatus());
 *      } else {
 *         System.out.println("Message submission failed. Status=" + resp.getCommandStatus());
 *      }
 *      session.unbind();
 *   } else {
 *      System.out.println("Couldn't bind. Status=" + resp.getCommandStatus());
 *   }
 * </pre></blockquote>
 * Note that the cycle bind - send PDU's - unbind can be called
 * several times for once created session.
 * <p>
 * Particular methods for sending PDUs to SMSC return responses to the sent
 * PDUs. They return null if no response is received in time specified
 * by the receive timeout in receiver. This means that the methods wait
 * for response corresponding to the request.
 * The corresponding response is recognized using sequence number of the sent
 * PDU and a corresponding response command id.<br>
 * The session can work in assynchronous manner, i.e. it doesn't wait
 * for response for the sent request, instead all responses are handled
 * by instance of callback class <code>ServerPDUEventListener</code>
 * whenever they are received.<br>
 * The <code>Session</code> class checks if operations invoked are valid in
 * the current state of the session. If not, then such operation throws
 * <code>WrongSessionStateException</code> expcetion. For example it's incorrect
 * to try to submit a message if the session is bound as receiver. The checking
 * if the operation is valid in the current state of session is turned off
 * by default.
 * 
 * @author Logica Mobile Networks SMPP Open Source Team
 * @version $Revision: 1.4 $
 * @see Connection
 * @see Transmitter
 * @see Receiver
 * @see ServerPDUEventListener
 */
public class Session extends SmppObject {
	/**
	 * Status of the connection. It's set by <code>open</code> method,
	 * which is called from <code>bind</code> method.
	 * @see #open()
	 * @see #bind(BindRequest)
	 */
	private boolean opened = false;

	/**
	 * Status of bounding. It's set by <code>bind</code> methdod if
	 * the binding is successfull.
	 * @see #bind(BindRequest)
	 */
	private boolean bound = false;

	/** Special state for actions which are never allowed for the session. */
	public static final int STATE_NOT_ALLOWED = 0x00; // 00000b

	/** The connection is closed (or not opened yet) and session isn't bound. */
	public static final int STATE_CLOSED = 0x01; // 00001b

	/** The connection is opened, but the session isn't bound. */
	public static final int STATE_OPENED = 0x02; // 00010b

	/** The session is bound as transmitter. */
	public static final int STATE_TRANSMITTER = 0x04; // 00100b

	/** The session is bound as receiver. */
	public static final int STATE_RECEIVER = 0x08; // 01000b

	/** The session is bound as transceiver. */
	public static final int STATE_TRANSCEIVER = 0x10; // 10000b

	/** Special state for actions which are always allowed (e.g. generic_nack.) */
		public static final int STATE_ALWAYS = // 11111b
	STATE_OPENED | STATE_TRANSMITTER | STATE_RECEIVER | STATE_TRANSCEIVER;

	/**
	 * Table with command id's and session states in which they can be used.
	 * For session on ESME side.
	 * @see #initialiseStateMatrix()
	 */
	private static Hashtable esmeStateMatrix;

	/**
	 * Table with command id's and session states in which they can be used.
	 * For session on MC side. Note that even if this is from the MC side
	 * the bind states are still entered from the EMSE point of veiw.
	 * E.g. for deliver_sm this table contains states receiver and transceiver,
	 * which means that MC can send PDU with deliver_sm command id only in case
	 * the ESME is bound as receiver or transceiver.<br>
	 * <emp>Note:</emp> The MC state matrix is not completly supported by
	 * the current implementation of session, so it's currently altered
	 * to reflect the impplementation.
	 * @see #initialiseStateMatrix()
	 */
	private static Hashtable mcStateMatrix;

	/**
	 * If PDU with unknown command id is probed this says if this PDU is
	 * allowed or not. Generaly it's not good idea to allow unknown PDUs, but
	 * for backward compatiblity we leave it set to false.
	 */
	private boolean disallowUnknownPDU = false;

	/**
	 * The current state of this Session.
	 * @see #esmeStateMatrix
	 * @see #mcStateMatrix
	 * @see #setState(int)
	 * @see #getState()
	 */
	private int state = STATE_CLOSED;

	/**
	 * If the checking of states is active. It's generaly good idea to leave it
	 * set to true, it'll save you communication bandwidth (MC should reject your
	 * PDU if you are in wrong state) and it'll discover bad logic in your application.
	 * For backward compatibility we set that the state is NOT checked.
	 * @see #enableStateChecking()
	 * @see #disableStateChecking()
	 */
	private boolean stateChecking = false;

	/**
	 * Indicates that the session is session for ESME 'point of view.'
	 * @see #type
	 */
	public static final int TYPE_ESME = 1;

	/**
	 * Indicates that the session is session for MC 'point of view.'
	 * MC is Message Center and it is a term for generic Message Centre such as SMSC.
	 * @see #type
	 */
	public static final int TYPE_MC = 2;

	/**
	 * If this session is ESME session or if it is used in MC (or simulator
	 * or routing entity, simply the other side of normal ESME).
	 * Normally this would be equal to TYPE_ESME as mostly this library will be used
	 * for developing ESME applications and not MCs. If you don't understand
	 * what is this variable for, just leave it as it is.
	 * @see #setType(int)
	 * @see #getType()
	 */
	private int type = TYPE_ESME;

	/**
	 * The connection object. It's created outside of the <code>Session</code>
	 * class and passed as a parameter during the <code>Session</code>
	 * creation. It's then passed to <code>Transmitter</code> and
	 * <code>Receiver</code>.
	 * @see Connection
	 * @see TCPIPConnection
	 * @see Transmitter
	 * @see Receiver
	 */
	private Connection connection;

	/**
	 * Object used for transmitting of PDUs over connection.
	 * @see Transmitter
	 */
	private Transmitter transmitter;

	/**
	 * Object used for receiving of PDU from connection.
	 * @see Receiver
	 */
	private Receiver receiver;

	/**
	 * If the receiving is asynchronous, <code>pduListener</code> must
	 * contain the callback object used for processing of PDUs received
	 * from the SMSC. <code>Receiver</code> after receiving a PDU passes
	 * the received PDU to apropriate member function of the processor.
	 * @see #asynchronous
	 * @see #setServerPDUEventListener(ServerPDUEventListener)
	 * @see #bind(BindRequest)
	 * @see Receiver
	 */
	private ServerPDUEventListener pduListener = null;

	/**
	 * Indicates that the sending of PDUs to the SMSC is asynchronous, i.e.
	 * the session doesn't wait for a response to the sent request as well as
	 * the <code>receive</code> functions will return null as all received
	 * PDUs are passed to the <code>pduListener</code> object in
	 * the <code>receiver</code>.
	 * @see #pduListener
	 * @see #setServerPDUEventListener(ServerPDUEventListener)
	 * @see #bind(BindRequest)
	 * @see Receiver
	 */
	private boolean asynchronous = false;

	/**
	 * Default constructor made protected as it's not desirable to
	 * allow creation of <code>Session</code> without providing 
	 * <code>Connection</code>.
	 */
	protected Session() {
	}

	/**
	 * Creates <code>Session</code> which uses provided <code>Connection</code>.
	 * In most cases the <code>connection</code> parameter will be an instance
	 * of <code>TCPIPConnection</code> class.
	 *
	 * @param   connection   connection used for transmitting and receiving
	 *                       the data
	 */
	public Session(Connection connection) {
		this.connection = connection;
	}

	/**
	 * Opens the connection for communication.
	 * Sets indication that the connection is opened.
	 *
	 * @exception IOException exception during communication
	 */
	public void open() throws IOException, WrongSessionStateException {
		checkState(STATE_CLOSED);
		if (!opened) {
			connection.open();
			opened = true;
			setState(STATE_OPENED);
		}
	}

	/**
	 * Closes the connection for communication.
	 * Sets indication that the connection is not opened.
	 *
	 * @exception IOException exception during communication
	 */
	public void close() throws IOException, WrongSessionStateException {
		checkState(STATE_OPENED);
		if (connection.isOpened()) {
			connection.close();
			opened = false;
			setState(STATE_CLOSED);
		}
	}

	/**
	 * Returns of the connection is opened.
	 * @return current status of connection
	 */
	public boolean isOpened() {
		return opened && connection.isOpened();
	}

	/**
	 * Returns if the session is bound to SMSC.
	 * @return current status of bound
	 */
	public boolean isBound() {
		return bound;
	}

	/**
	 * Sets the listener which is passed all PDUs received by the
	 * <code>Receiver</code> from the SMSC.
	 * Note that this method implicitly sets asynchronous type of
	 * receiving.
	 * @param pduListener the listener which processes the received PDUs
	 */
	private void setServerPDUEventListener(ServerPDUEventListener pduListener) {
		this.pduListener = pduListener;
		receiver.setServerPDUEventListener(pduListener);
		asynchronous = pduListener != null;
	}

	/**
	 * Returns the current <code>ServerPDUEventListener</code> set for
	 * this session.
	 */
	private ServerPDUEventListener getServerPDUEventListener() {
		return pduListener;
	}

	/**
	 * Sets the type of the session. The type can be either ESME or MC viewed
	 * from the side where the instance of the <code>Session</code> is used.
	 * Set the type of the session before opening the session.
	 * @param type the new type of the session
	 * @see #getType()
	 * @see #TYPE_ESME
	 * @see #TYPE_MC
	 */
	public void setType(int type) {
		this.type = type;
	}

	/**
	 * Returns the type of the session.
	 * @return the current type of the session.
	 * @see #setType(int)
	 * @see #TYPE_ESME

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产一区二区国模嫣然| 久久99国产精品久久| 91在线国产福利| 国产精品国产三级国产普通话三级| 国产激情一区二区三区| 欧美激情综合在线| 色综合色综合色综合色综合色综合 | 最新国产精品久久精品| 色综合久久天天综合网| 日日嗨av一区二区三区四区| 久久综合久久综合亚洲| 国产成人在线影院| 亚洲女人的天堂| 91精品国产手机| 国产成人av一区二区三区在线观看| 国产视频一区在线播放| 粉嫩高潮美女一区二区三区| 一区二区三区在线视频观看| 欧美精品电影在线播放| 国产一区二区免费视频| 亚洲日本丝袜连裤袜办公室| 欧美三级日本三级少妇99| 蜜臀久久久99精品久久久久久| 久久久99免费| 欧美性受极品xxxx喷水| 日本网站在线观看一区二区三区| 日韩欧美区一区二| 91猫先生在线| 蓝色福利精品导航| 亚洲老司机在线| 精品理论电影在线| 欧美性生活大片视频| 精品一区二区三区av| 亚洲一区二区中文在线| 国产午夜亚洲精品羞羞网站| 欧美性欧美巨大黑白大战| 国产做a爰片久久毛片| 亚洲一二三四久久| 国产精品乱码人人做人人爱| 9191精品国产综合久久久久久| 成人黄色大片在线观看| 久久精品国产**网站演员| 亚洲欧美日韩中文字幕一区二区三区| 日韩欧美一级二级三级| 欧美唯美清纯偷拍| 99热这里都是精品| 国产在线视频精品一区| 免费一级片91| 亚洲精品视频自拍| 中文一区在线播放| 欧美videossexotv100| 欧美性生活一区| 色老汉av一区二区三区| 成人免费高清在线| 国内精品自线一区二区三区视频| 三级欧美在线一区| 亚洲第四色夜色| 日韩毛片视频在线看| 国产精品午夜在线| 欧美精品一区二区三区久久久| 欧美日韩国产在线观看| 精品视频在线免费观看| 色综合色狠狠天天综合色| 99免费精品在线| av在线不卡网| 91色porny| 99久久99久久综合| 成人动漫在线一区| 99久久精品99国产精品| 成a人片亚洲日本久久| www.性欧美| 99久久99久久精品免费观看 | 欧美国产综合一区二区| 久久午夜电影网| 国产欧美日韩一区二区三区在线观看 | 欧美一区二区成人| 欧美精品在线一区二区| 欧美丝袜丝交足nylons| 欧美主播一区二区三区美女| 91网址在线看| 色噜噜狠狠色综合中国| 欧美私模裸体表演在线观看| 欧美性色黄大片| 在线不卡的av| 日韩免费观看2025年上映的电影| 日韩欧美第一区| 久久伊99综合婷婷久久伊| 久久婷婷国产综合精品青草 | 91福利在线导航| 欧美日韩亚洲综合在线 欧美亚洲特黄一级 | 精品久久久久久久久久久院品网| 精品日韩99亚洲| 国产精品色一区二区三区| 国产精品乱码一区二三区小蝌蚪| 一区二区视频在线| 丝袜美腿亚洲一区二区图片| 欧美aaa在线| 国产精品一二三| 色综合一区二区| 欧美日韩国产片| 久久久噜噜噜久久中文字幕色伊伊| 国产精品久久99| 亚洲一级二级在线| 精品一区二区三区香蕉蜜桃| 成人不卡免费av| 欧美精品久久天天躁| 欧美tickling网站挠脚心| 综合电影一区二区三区| 日韩福利电影在线观看| 成人一区在线看| 欧美网站一区二区| 国产日本欧美一区二区| 亚洲一二三专区| 丁香另类激情小说| 欧美日韩国产高清一区| 亚洲国产激情av| 亚洲国产毛片aaaaa无费看 | 国产午夜精品一区二区三区嫩草| 欧美久久婷婷综合色| 欧美mv日韩mv国产| 一区二区三区自拍| 日韩精品专区在线影院观看| 欧美伦理影视网| 欧美日韩国产bt| 欧美综合久久久| 三级久久三级久久| 欧美日韩国产一二三| 大美女一区二区三区| 91精品婷婷国产综合久久竹菊| 青青草成人在线观看| 亚洲线精品一区二区三区| 日韩一区国产二区欧美三区| 国产激情91久久精品导航| 精品第一国产综合精品aⅴ| 久久久久久夜精品精品免费| 午夜视频在线观看一区| 成人黄色av电影| 久久综合一区二区| 日韩美女久久久| 久久国产精品色婷婷| 日韩一区二区精品在线观看| 九色|91porny| 日韩欧美亚洲另类制服综合在线| 亚洲一区二区在线免费观看视频| 毛片av一区二区| 久久精品人人做人人综合| 99久免费精品视频在线观看| 一区二区三区在线看| 久久婷婷久久一区二区三区| 日本韩国视频一区二区| 亚洲不卡在线观看| 日韩一区二区在线看| 精品亚洲aⅴ乱码一区二区三区| 日韩天堂在线观看| www.一区二区| 婷婷综合五月天| 精品久久久久久最新网址| 日韩影院精彩在线| 国产精品网站在线播放| 激情伊人五月天久久综合| 国产精品久久久久9999吃药| 日本aⅴ免费视频一区二区三区| 精品欧美久久久| 国产夫妻精品视频| 亚洲电影欧美电影有声小说| 91久久久免费一区二区| 亚洲第一福利一区| 欧美久久久久久久久久| 国产大片一区二区| 一区二区三区久久| 91精品国产色综合久久不卡电影 | 久久国产乱子精品免费女| 久久人人超碰精品| 日韩一级高清毛片| 精品处破学生在线二十三| 91丝袜美腿高跟国产极品老师 | 日本欧美加勒比视频| 欧美精品一区二区在线播放 | 亚洲三级免费观看| 一区二区三区四区视频精品免费| 久久精品人人做人人爽人人| 日韩午夜电影在线观看| 欧美成人精精品一区二区频| 久久精品国产网站| 国产三级三级三级精品8ⅰ区| 成人理论电影网| 亚洲免费在线观看| 69精品人人人人| 久久福利资源站| 中文字幕国产一区二区| 日本精品一级二级| 亚州成人在线电影| 精品少妇一区二区三区免费观看| 国产精品综合一区二区三区| 成人欧美一区二区三区| 欧美精三区欧美精三区| 国产精品1区二区.| 依依成人精品视频| 日韩视频在线一区二区| 国产a视频精品免费观看|