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

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

?? session.java

?? Short Message Peer to Peer
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:
	private void safeGenericNack(int commandStatus, int sequenceNumber) throws IOException {
		try {
			genericNack(commandStatus, sequenceNumber);
		} catch (SmppException e) {
			debug.write("Ignoring unexpected SmppException caught sending generic nack.");
			event.write(e, "Ignoring unexpected exception caught sending generic nack.");
		}
	}

	/** 
	 * Sets the state of the session.
	 * It's private as it's only for use by the methods of the session.
	 * @param state the new state of the session
	 * @see #checkState(int)
	 * @see #checkState(PDU)
	 * @see WrongSessionStateException
	 */
	private void setState(int state) {
		this.state = state;
	}

	/**
	 * Returns the current state of the session.
	 * It's public to allow the user to check the state of the session if necessary.
	 * @return the current state of the session
	 * @see #checkState(int)
	 * @see #checkState(PDU)
	 * @see WrongSessionStateException
	 */
	public int getState() {
		return state;
	}

	/**
	 * Enables checking if the session allows certain operation in the current state.
	 */
	public void enableStateChecking() {
		this.stateChecking = true;
	}

	/**
	 * Disables checking if the session allows certain operation in the current state.
	 */
	public void disableStateChecking() {
		this.stateChecking = false;
	}

	/**
	 * Checks if the session is in the state which is required by the parameter.
	 * If not, then exception <code>WrongSessionStateException</code> is thrown.
	 * Note that the states are bit values in integer, so there can be a "set"
	 * of states required, the session must be in one of the states required.
	 * The checking can be turned off, see
	 * <a href="#disableStateChecking()">disableStateChecking</a>.
	 * @param requestedState the state(s) in which the session is expected to be; if it
	 *                       is not, then exception is thrown
	 * @throws WrongSessionStateException if the session is not in the state
	 *         required
	 * @see WrongSessionStateException
	 */
	public void checkState(int requestedState) throws WrongSessionStateException {
		if (stateChecking) {
			debug.write(
				DSESS,
				"checking state current=0x"
					+ Integer.toHexString(state)
					+ " requested esme=0x"
					+ Integer.toHexString(requestedState));
			if ((state & requestedState) == 0) {
				throw new WrongSessionStateException(type, requestedState, state);
			}
		}
	}

	/**
	 * Checks if the session's state allows sending the PDU provided.
	 * If not, then exception <code>WrongSessionStateException</code> is thrown.
	 * For each state there is only a subset of PDUs which can be sent over the
	 * session. For example, if the session is bound as a receiver, it cannot
	 * submit messages, but it can send enquire link, generic nack etc.
	 * This method checks the PDU type (command id) aganst matrix of allowed states.
	 * The checking can be turned off, see
	 * <a href="#disableStateChecking()">disableStateChecking</a>.
	 * @param pdu the pdu which has to be checked if it's allowed in the current
	 *            state
	 * @throws WrongSessionStateException if the session is not in the state
	 *         required
	 * @see #checkState(int)
	 * @see WrongSessionStateException
	 */
	public void checkState(PDU pdu) throws WrongSessionStateException {
		if (stateChecking) {
			Hashtable pduMatrix = getStateMatrix(type);
			Integer commandIdInteger = new Integer(pdu.getCommandId());
			Integer requestedStateInteger = pduMatrix == null ? null : (Integer) pduMatrix.get(commandIdInteger);
			if (requestedStateInteger != null) {
				checkState(requestedStateInteger.intValue());
			} else {
				if (disallowUnknownPDU) {
					throw new WrongSessionStateException();
				}
			}
		}
	}

	/**
	 * Checks if the session is in the state which is required by the parameter.
	 * Note that this method doesn't throw an exception rather it returns false
	 * if the session is not in one of the provided states.
	 * @param requestedState the state(s) which have to be checked
	 * @return if the session is in on of the provided states
	 * @see #checkState(int)
	 */
	public boolean isStateAllowed(int requestedState) {
		boolean stateAllowed = true;
		try {
			checkState(requestedState);
		} catch (WrongSessionStateException e) {
			stateAllowed = false;
		}
		return stateAllowed;
	}

	/**
	 * Checks if the pdu provided is allowed in the current session state.
	 * Note that this method doesn't throw an exception rather it returns false
	 * if the pdu is not alloewd in the current session state.
	 * @param pdu the pdu which has to be checked if it's allowed in the current
	 *            state
	 * @return if the pdu is allowed to be sent in the current session state
	 * @see #checkState(PDU)
	 */
	public boolean isPDUAllowed(PDU pdu) {
		boolean pduAllowed = true;
		try {
			checkState(pdu);
		} catch (WrongSessionStateException e) {
			pduAllowed = false;
		}
		return pduAllowed;
	}

	/**
	 * Initialises state matrices for checking if PDU is allowed in a certain session
	 * state.
	 */
	static {
		initialiseStateMatrix();
	}

	/**
	 * Initialise list containing which operations (PDUs) valid in which state.
	 * @see #checkState(PDU)
	 * @see #type
	 */
	private static void initialiseStateMatrix() {
		esmeStateMatrix = new Hashtable();
		addValidState(esmeStateMatrix, Data.BIND_TRANSMITTER, STATE_CLOSED);
		addValidState(esmeStateMatrix, Data.BIND_TRANSMITTER_RESP, STATE_NOT_ALLOWED);
		addValidState(esmeStateMatrix, Data.BIND_RECEIVER, STATE_CLOSED);
		addValidState(esmeStateMatrix, Data.BIND_RECEIVER_RESP, STATE_NOT_ALLOWED);
		addValidState(esmeStateMatrix, Data.BIND_TRANSCEIVER, STATE_CLOSED);
		addValidState(esmeStateMatrix, Data.BIND_TRANSCEIVER_RESP, STATE_NOT_ALLOWED);
		addValidState(esmeStateMatrix, Data.OUTBIND, STATE_NOT_ALLOWED);
		addValidState(esmeStateMatrix, Data.UNBIND, STATE_TRANSMITTER | STATE_RECEIVER | STATE_TRANSCEIVER);
		addValidState(esmeStateMatrix, Data.UNBIND_RESP, STATE_TRANSMITTER | STATE_RECEIVER | STATE_TRANSCEIVER);
		addValidState(esmeStateMatrix, Data.SUBMIT_SM, STATE_TRANSMITTER | STATE_TRANSCEIVER);
		addValidState(esmeStateMatrix, Data.SUBMIT_SM_RESP, STATE_NOT_ALLOWED);
		addValidState(esmeStateMatrix, Data.SUBMIT_MULTI, STATE_TRANSMITTER | STATE_TRANSCEIVER);
		addValidState(esmeStateMatrix, Data.SUBMIT_MULTI_RESP, STATE_NOT_ALLOWED);
		addValidState(esmeStateMatrix, Data.DATA_SM, STATE_TRANSMITTER | STATE_TRANSCEIVER);
		addValidState(esmeStateMatrix, Data.DATA_SM_RESP, STATE_RECEIVER | STATE_TRANSCEIVER);
		addValidState(esmeStateMatrix, Data.DELIVER_SM, STATE_NOT_ALLOWED);
		addValidState(esmeStateMatrix, Data.DELIVER_SM_RESP, STATE_RECEIVER | STATE_TRANSCEIVER);
		addValidState(esmeStateMatrix, Data.QUERY_SM, STATE_TRANSMITTER | STATE_TRANSCEIVER);
		addValidState(esmeStateMatrix, Data.QUERY_SM_RESP, STATE_NOT_ALLOWED);
		addValidState(esmeStateMatrix, Data.CANCEL_SM, STATE_TRANSMITTER | STATE_TRANSCEIVER);
		addValidState(esmeStateMatrix, Data.CANCEL_SM_RESP, STATE_NOT_ALLOWED);
		addValidState(esmeStateMatrix, Data.REPLACE_SM, STATE_TRANSMITTER | STATE_TRANSCEIVER);
		addValidState(esmeStateMatrix, Data.REPLACE_SM_RESP, STATE_NOT_ALLOWED);
		addValidState(esmeStateMatrix, Data.ENQUIRE_LINK, STATE_TRANSMITTER | STATE_RECEIVER | STATE_TRANSCEIVER);
		// STATE_ALWAYS);
		addValidState(esmeStateMatrix, Data.ENQUIRE_LINK_RESP, STATE_TRANSMITTER | STATE_RECEIVER | STATE_TRANSCEIVER);
		// STATE_ALWAYS);
		addValidState(esmeStateMatrix, Data.ALERT_NOTIFICATION, STATE_NOT_ALLOWED);
		addValidState(esmeStateMatrix, Data.GENERIC_NACK, STATE_TRANSMITTER | STATE_RECEIVER | STATE_TRANSCEIVER);
		// STATE_ALWAYS);

		mcStateMatrix = new Hashtable();
		addValidState(mcStateMatrix, Data.BIND_TRANSMITTER, STATE_NOT_ALLOWED);
		addValidState(
			mcStateMatrix,
			Data.BIND_TRANSMITTER_RESP,
			STATE_TRANSMITTER | STATE_RECEIVER | STATE_TRANSCEIVER);
		// STATE_OPENED);
		addValidState(mcStateMatrix, Data.BIND_RECEIVER, STATE_NOT_ALLOWED);
		addValidState(mcStateMatrix, Data.BIND_RECEIVER_RESP, STATE_TRANSMITTER | STATE_RECEIVER | STATE_TRANSCEIVER);
		// STATE_OPENED);
		addValidState(mcStateMatrix, Data.BIND_TRANSCEIVER, STATE_NOT_ALLOWED);
		addValidState(
			mcStateMatrix,
			Data.BIND_TRANSCEIVER_RESP,
			STATE_TRANSMITTER | STATE_RECEIVER | STATE_TRANSCEIVER);
		// STATE_OPENED);
		addValidState(mcStateMatrix, Data.OUTBIND, STATE_TRANSMITTER | STATE_RECEIVER | STATE_TRANSCEIVER);
		// STATE_OPENED);
		addValidState(mcStateMatrix, Data.UNBIND, STATE_TRANSMITTER | STATE_RECEIVER | STATE_TRANSCEIVER);
		addValidState(mcStateMatrix, Data.UNBIND_RESP, STATE_TRANSMITTER | STATE_RECEIVER | STATE_TRANSCEIVER);
		addValidState(mcStateMatrix, Data.SUBMIT_SM, STATE_NOT_ALLOWED);
		addValidState(mcStateMatrix, Data.SUBMIT_SM_RESP, STATE_TRANSMITTER | STATE_TRANSCEIVER);
		addValidState(mcStateMatrix, Data.SUBMIT_MULTI, STATE_NOT_ALLOWED);
		addValidState(mcStateMatrix, Data.SUBMIT_MULTI_RESP, STATE_TRANSMITTER | STATE_TRANSCEIVER);
		addValidState(mcStateMatrix, Data.DATA_SM, STATE_RECEIVER | STATE_TRANSCEIVER);
		addValidState(mcStateMatrix, Data.DATA_SM_RESP, STATE_TRANSMITTER | STATE_TRANSCEIVER);
		addValidState(mcStateMatrix, Data.DELIVER_SM, STATE_RECEIVER | STATE_TRANSCEIVER);
		addValidState(mcStateMatrix, Data.DELIVER_SM_RESP, STATE_NOT_ALLOWED);
		addValidState(mcStateMatrix, Data.QUERY_SM, STATE_NOT_ALLOWED);
		addValidState(mcStateMatrix, Data.QUERY_SM_RESP, STATE_TRANSMITTER | STATE_TRANSCEIVER);
		addValidState(mcStateMatrix, Data.CANCEL_SM, STATE_NOT_ALLOWED);
		addValidState(mcStateMatrix, Data.CANCEL_SM_RESP, STATE_TRANSMITTER | STATE_TRANSCEIVER);
		addValidState(mcStateMatrix, Data.REPLACE_SM, STATE_NOT_ALLOWED);
		addValidState(mcStateMatrix, Data.REPLACE_SM_RESP, STATE_TRANSMITTER | STATE_TRANSCEIVER);
		addValidState(mcStateMatrix, Data.ENQUIRE_LINK, STATE_TRANSMITTER | STATE_RECEIVER | STATE_TRANSCEIVER);
		// STATE_ALWAYS);
		addValidState(mcStateMatrix, Data.ENQUIRE_LINK_RESP, STATE_TRANSMITTER | STATE_RECEIVER | STATE_TRANSCEIVER);
		// STATE_ALWAYS);
		addValidState(mcStateMatrix, Data.ALERT_NOTIFICATION, STATE_RECEIVER | STATE_TRANSCEIVER);
		addValidState(mcStateMatrix, Data.GENERIC_NACK, STATE_TRANSMITTER | STATE_RECEIVER | STATE_TRANSCEIVER);
		// STATE_ALWAYS);
	}

	/**
	 * Adds to the matrix a set of states in which can be sent a PDU with the 
	 * provided command id.
	 * @param matrix the matrix to add the mapping to
	 * @param commandId the commandId of the PDU the mapping is created for
	 * @param state the state(s) in which is the PDU valid
	 * @see #checkState(PDU)
	 * @see #isStateAllowed(int)
	 */
	private static void addValidState(Hashtable matrix, int commandId, int state) {
		matrix.put(new Integer(commandId), new Integer(state));
	}

	/**
	 * Returns the state matrix for the requested session type.
	 * @see #type
	 * @see #TYPE_ESME
	 * @see #TYPE_MC
	 * @see #initialiseStateMatrix()
	 */
	private static Hashtable getStateMatrix(int type) {
		switch (type) {
			case TYPE_ESME :
				return esmeStateMatrix;
			case TYPE_MC :
				return mcStateMatrix;
			default :
				return null;
		}
	}

	/**
	 * God, I would never think that to keep unbind synchronous in
	 * an asynchronous enviroment would be so funny. Here is the replacement
	 * listener which encapsulates the original listener and hunts for the 
	 * unbind pdu. Good luck, you source code reader!<br>
	 * The problem is that we want to return a response from session's unbind()
	 * even if the session is asynchronous, i.e. all pdus from the smsc
	 * are passed to an implementation of <code>ServerPDUEventListener</code>
	 * event responses. We can't simply stop the asynchronicity
	 * as there can still be some responses expected, so we need a bridge
	 * which allows us to wait for the unbind response and still serve
	 * the other pdus from the smsc in asynchronous manner. Thus this
	 * encapsulating listener, which exactly does the thing.
	 */
	private class UnbindServerPDUEventListener extends SmppObject implements ServerPDUEventListener {
		Session session;
		ServerPDUEventListener origListener;
		Unbind unbindReq;
		UnbindResp expectedResp;
		UnbindResp unbindResp = null;

		public UnbindServerPDUEventListener(Session session, ServerPDUEventListener origListener, Unbind unbindReq) {
			this.session = session;
			this.origListener = origListener;
			this.unbindReq = unbindReq;
			expectedResp = (UnbindResp) unbindReq.getResponse();
		}

		public void handleEvent(ServerPDUEvent event) {
			PDU pdu = event.getPDU();
			if (pdu.getSequenceNumber() == unbindReq.getSequenceNumber()) {
				synchronized (this) {
					try {
						unbindResp = (UnbindResp) (session.checkResponse(pdu, expectedResp));
					} catch (Exception e) {
						debug.write(DSESS, "exception handling unbind " + e);
						SmppObject.event.write(e, "exception handling unbind");
					}
					// notify as session waits for the notification
					this.notify();
				}
			} else {
				// all other pdus are processed by the original handler,
				// if any
				if (origListener != null) {
					origListener.handleEvent(event);
				}
			}
		}

		public UnbindResp getUnbindResp() {
			return unbindResp;
		}
	}
}
/*
 * $Log: Session.java,v $
 * Revision 1.4  2006/03/09 16:24:14  sverkera
 * Removed compiler and javadoc warnings
 *
 * Revision 1.3  2006/02/22 16:45:01  paoloc
 * UnbindServerPDUEventListener: if (pdu.equals(unbindReq)): as reported by users, this is incompatible with the new improved PDU.equals(); fixed.
 *
 * Revision 1.2  2004/09/10 23:03:44  sverkera
 * Added isOpened method
 *
 * Revision 1.1  2003/07/23 00:28:39  sverkera
 * Imported
 *
 * 
 * Old changelog:
 * 08-08-01 ticp@logica.com added asynchronous processing capability
 * 02-10-01 ticp@logica.com tracing now belongs to DSESS group
 * 20-11-01 ticp@logica.com the receiver thread is now started even for
 *                          the transmitter session - before transmitter
 *                          sessions couldn't receive anything
 * 20-11-01 ticp@logica.com receiver thread is started after the bind request
 *                          is sent to the MC, before it was started before the bind
 *                          req was sent to MC, therefore the response could be processed
 *                          by the listener
 * 22-11-01 ticp@logica.com implemented session states with checking if certain
 *                          operation is allowed in the current session state
 */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美国产精品中文字幕| 精品国产乱子伦一区| 久久日韩粉嫩一区二区三区| 亚洲久草在线视频| 国产福利一区二区三区视频在线| 欧美特级限制片免费在线观看| 久久综合色一综合色88| 亚洲国产精品欧美一二99| 粉嫩aⅴ一区二区三区四区 | 天堂av在线一区| 成人18视频在线播放| 久久综合给合久久狠狠狠97色69| 亚洲香肠在线观看| 色婷婷久久综合| 国产婷婷色一区二区三区 | 欧美高清在线精品一区| 日本不卡一二三| 欧美天堂一区二区三区| 亚洲日本青草视频在线怡红院| 国产一区二区网址| 日韩视频国产视频| 天天操天天综合网| 欧美午夜片在线看| 伊人开心综合网| 91视视频在线观看入口直接观看www | 亚洲一区二区视频在线观看| 99麻豆久久久国产精品免费 | 日韩欧美国产综合在线一区二区三区| 一区二区三区日韩欧美精品| 成+人+亚洲+综合天堂| 国产午夜亚洲精品理论片色戒 | 怡红院av一区二区三区| av一区二区三区四区| 午夜精品一区在线观看| www.亚洲精品| 中文字幕一区二区三区不卡| 大陆成人av片| 国产精品女主播av| 成人av电影免费观看| 中文字幕第一页久久| 国产69精品久久久久毛片| 国产三级精品在线| 国产iv一区二区三区| 国产亚洲综合av| 国产成人av网站| 国产精品午夜春色av| 99免费精品视频| 一区二区三区在线视频免费 | 色综合视频在线观看| 亚洲人成精品久久久久| 91高清视频在线| 亚洲成人1区2区| 在线播放91灌醉迷j高跟美女| 免费一级欧美片在线观看| 精品欧美乱码久久久久久| 精品一区二区在线播放| 久久蜜桃一区二区| 成人丝袜高跟foot| 日韩美女视频一区二区| 日本久久一区二区三区| 亚洲午夜在线电影| 日韩写真欧美这视频| 久久国产精品色| 欧美精彩视频一区二区三区| 99久久久免费精品国产一区二区| 日韩美女久久久| 欧美日本精品一区二区三区| 欧美aaaaaa午夜精品| 国产亚洲精品久| 99精品视频一区| 婷婷久久综合九色综合绿巨人| 欧美成人video| 国产成人精品亚洲午夜麻豆| 亚洲天堂a在线| 在线播放91灌醉迷j高跟美女 | 99免费精品视频| 亚洲444eee在线观看| 精品国产青草久久久久福利| 成人综合婷婷国产精品久久蜜臀| 亚洲美女视频在线观看| 欧美一区二区精美| 成人一区二区三区中文字幕| 亚洲综合图片区| 精品国产一区二区三区av性色| 丁香婷婷综合网| 亚洲自拍偷拍九九九| 精品国产乱码久久久久久免费| 91污在线观看| 裸体一区二区三区| 国产精品高清亚洲| 4438x亚洲最大成人网| 丁香另类激情小说| 日韩精品成人一区二区三区| 国产女人18水真多18精品一级做| 欧美亚洲动漫精品| 国产成人精品亚洲日本在线桃色 | 久久久影视传媒| 欧美在线影院一区二区| 国产在线精品视频| 亚洲v日本v欧美v久久精品| 久久综合九色综合欧美亚洲| 在线免费观看成人短视频| 久久国产欧美日韩精品| 亚洲伦在线观看| 337p粉嫩大胆色噜噜噜噜亚洲 | 91在线看国产| 久久99久久精品| 亚洲午夜视频在线观看| 国产亚洲欧美色| 91精品国产综合久久精品| 99久久精品国产一区二区三区| 久久精品国产精品亚洲精品| 亚洲一区影音先锋| 中文一区在线播放| 日韩欧美第一区| 欧美三级一区二区| 国产成人精品免费看| 日本不卡123| 一区二区三区四区av| 国产视频一区二区在线| 日韩免费观看高清完整版| 在线免费观看日本一区| 96av麻豆蜜桃一区二区| 国产精品一色哟哟哟| 日本亚洲电影天堂| 亚洲欧美日韩人成在线播放| 久久精品欧美日韩| 日韩欧美一级精品久久| 欧美日本韩国一区| 亚洲国产高清在线观看视频| 在线播放国产精品二区一二区四区| 一本一道久久a久久精品| 国产成人午夜视频| 久久99最新地址| 日本在线观看不卡视频| 亚洲国产sm捆绑调教视频| 国产日韩欧美一区二区三区综合| 久草这里只有精品视频| 91超碰这里只有精品国产| 久久精品国产999大香线蕉| 一区二区三区资源| 亚洲欧洲一区二区三区| 国产偷国产偷亚洲高清人白洁| 欧美一二区视频| 欧美精品高清视频| 色噜噜狠狠成人中文综合| av亚洲产国偷v产偷v自拍| 成人一区二区三区在线观看 | 亚洲人成精品久久久久久| 国产精品久久久久久久久果冻传媒 | 精品国产亚洲在线| 日韩精品一区国产麻豆| 欧美一区二区三区在线| 欧美久久一二区| 精品视频一区二区三区免费| 91亚洲永久精品| 色综合中文字幕国产 | 性做久久久久久免费观看欧美| 久久蜜桃一区二区| 2021国产精品久久精品| 欧洲av一区二区嗯嗯嗯啊| 麻豆91精品视频| 美美哒免费高清在线观看视频一区二区| 五月综合激情网| 男男gaygay亚洲| 久久99久久99精品免视看婷婷 | 国产一区二区三区观看| 国产精品一区三区| 国产成人精品亚洲午夜麻豆| 成人午夜在线视频| 91日韩在线专区| 在线观看成人小视频| 欧美丰满嫩嫩电影| 欧美xxxxxxxxx| 国产拍欧美日韩视频二区 | 制服丝袜中文字幕一区| 日韩欧美自拍偷拍| 精品久久久久久久久久久久久久久| 久久美女高清视频| 国产精品伦一区| 亚洲一区成人在线| 日本91福利区| 国产一区二区精品久久91| 成人福利视频在线看| 在线一区二区三区四区五区 | 欧美一区二区三区视频在线观看 | 色琪琪一区二区三区亚洲区| 欧美亚洲国产怡红院影院| 欧美一区二区三区视频在线观看| 久久女同性恋中文字幕| 自拍偷自拍亚洲精品播放| 亚洲va韩国va欧美va精品| 久久精工是国产品牌吗| 粉嫩在线一区二区三区视频| 色婷婷久久久亚洲一区二区三区| 欧美美女激情18p| 欧美国产丝袜视频| 亚洲成人免费电影| 精品亚洲国内自在自线福利| 综合av第一页|