📄 tag.java
字号:
/* * Java SMPP API * Copyright (C) 1998 - 2002 by Oran Kelly * * 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 * * A copy of the LGPL can be viewed at http://www.gnu.org/copyleft/lesser.html * Java SMPP API author: orank@users.sf.net * Java SMPP API Homepage: http://smppapi.sourceforge.net/ * * $Id: Tag.java,v 1.8 2005/05/09 21:04:51 orank Exp $ */package ie.omk.smpp.message.tlv;import java.util.BitSet;import java.util.HashMap;import java.util.Map;/** * Enumeration class for optional parameter tag values. * * @author Oran Kelly <orank@users.sf.net> */public class Tag implements java.io.Serializable { /** * Look-up table of statically defined tags. This <b>must </b> be defined * before all the tags as the Tag constructor expects this object to be * created. */ private static Map tagTable = new HashMap(); public static final Tag DEST_ADDR_SUBUNIT = new Tag(0x05, Number.class, 1); public static final Tag DEST_NETWORK_TYPE = new Tag(0x06, Number.class, 1); public static final Tag DEST_BEARER_TYPE = new Tag(0x07, Number.class, 1); public static final Tag DEST_TELEMATICS_ID = new Tag(0x08, Number.class, 2); public static final Tag SOURCE_ADDR_SUBUNIT = new Tag(0x0d, Number.class, 1); public static final Tag SOURCE_NETWORK_TYPE = new Tag(0x0e, Number.class, 1); public static final Tag SOURCE_BEARER_TYPE = new Tag(0x0f, Number.class, 1); public static final Tag SOURCE_TELEMATICS_ID = new Tag(0x10, Number.class, 1); public static final Tag QOS_TIME_TO_LIVE = new Tag(0x17, Number.class, 4); public static final Tag PAYLOAD_TYPE = new Tag(0x19, Number.class, 1); public static final Tag ADDITIONAL_STATUS_INFO_TEXT = new Tag(0x1d, String.class, 1, 256); public static final Tag RECEIPTED_MESSAGE_ID = new Tag(0x1e, String.class, 1, 65); public static final Tag MS_MSG_WAIT_FACILITIES = new Tag(0x30, BitSet.class, 1); public static final Tag PRIVACY_INDICATOR = new Tag(0x201, Number.class, 1); public static final Tag SOURCE_SUBADDRESS = new Tag(0x202, byte[].class, 2, 23); public static final Tag DEST_SUBADDRESS = new Tag(0x203, byte[].class, 2, 23); public static final Tag USER_MESSAGE_REFERENCE = new Tag(0x204, Number.class, 2); public static final Tag USER_RESPONSE_CODE = new Tag(0x205, Number.class, 2); public static final Tag SOURCE_PORT = new Tag(0x20a, Number.class, 2); public static final Tag DESTINATION_PORT = new Tag(0x20b, Number.class, 2); public static final Tag SAR_MSG_REF_NUM = new Tag(0x20c, Number.class, 2); public static final Tag LANGUAGE_INDICATOR = new Tag(0x20d, Number.class, 1); public static final Tag SAR_TOTAL_SEGMENTS = new Tag(0x20e, Number.class, 1); public static final Tag SAR_SEGMENT_SEQNUM = new Tag(0x20f, Number.class, 1); public static final Tag SC_INTERFACE_VERSION = new Tag(0x210, Number.class, 1); public static final Tag CALLBACK_NUM_PRES_IND = new Tag(0x302, BitSet.class, 1); public static final Tag CALLBACK_NUM_ATAG = new Tag(0x303, byte[].class, 0, 65); public static final Tag NUMBER_OF_MESSAGES = new Tag(0x304, Number.class, 1); public static final Tag CALLBACK_NUM = new Tag(0x381, byte[].class, 4, 19); public static final Tag DPF_RESULT = new Tag(0x420, Number.class, 1); public static final Tag SET_DPF = new Tag(0x421, Number.class, 1); public static final Tag MS_AVAILABILITY_STATUS = new Tag(0x422, Number.class, 1); public static final Tag NETWORK_ERROR_CODE = new Tag(0x423, byte[].class, 3); public static final Tag MESSAGE_PAYLOAD = new Tag(0x424, byte[].class, -1); public static final Tag DELIVERY_FAILURE_REASON = new Tag(0x425, Number.class, 1); public static final Tag MORE_MESSAGES_TO_SEND = new Tag(0x426, Number.class, 1); public static final Tag MESSAGE_STATE = new Tag(0x427, Number.class, 1); public static final Tag USSD_SERVICE_OP = new Tag(0x501, byte[].class, 1); public static final Tag DISPLAY_TIME = new Tag(0x1201, Number.class, 1); public static final Tag SMS_SIGNAL = new Tag(0x1203, Number.class, 2); public static final Tag MS_VALIDITY = new Tag(0x1204, Number.class, 1); public static final Tag ALERT_ON_MESSAGE_DELIVERY = new Tag(0x130c, null, 0); public static final Tag ITS_REPLY_TYPE = new Tag(0x1380, Number.class, 1); public static final Tag ITS_SESSION_INFO = new Tag(0x1383, byte[].class, 2); /** * Integer value of this tag. */ private Integer tag = null; /** * The minimum length a value of this tag type can be. */ private int minLength = -1; /** * The maximum length a value of this tag type can be. */ private int maxLength = -1; /** * The Java type a value of this tag type must be. */ private Class type = null; /** * The class used for encoding and decoding values of this tag type. * * @see ie.omk.smpp.message.tlv.Encoder */ private Encoder encoder = null; /** * Create a new Tag. The encoder type will be chosen from the set of known * built-in encoders. * * @param tag * The integer value of the tag. * @param type * The allowed Java type for the value. * @param fixedLength * The fixed length allowed for the value. * @throws ie.omk.smpp.message.tlv.TagDefinedException * If a tag with integer value <code>tag</code> has already * been defined. */ private Tag(int tag, Class type, int fixedLength) throws TagDefinedException { this(tag, type, null, fixedLength, fixedLength); } /** * Create a new Tag. he encoder type will be chosen from the set of known * built-in encoders. * * @param tag * The integer value of the tag. * @param type * The allowed Java type of the value. * @param minLength * The minimum length allowed for the value. * @param maxLength * The maximum length allowed for the value. * @throws ie.omk.smpp.message.tlv.TagDefinedException * If a tag with integer value <code>tag</code> has already * been defined. */ private Tag(int tag, Class type, int minLength, int maxLength) throws TagDefinedException { this(tag, type, null, minLength, maxLength); } /** * Create a new Tag. * * @param tag * The integer value of the tag. * @param type * The allowed Java type for the value * @param enc * The encoding class to use to encode and decode values. * @param fixedLength * The fixed length allowed for the value. * @throws ie.omk.smpp.message.tlv.TagDefinedException * If a tag with integer value <code>tag</code> has already * been defined. */ private Tag(int tag, Class type, Encoder enc, int fixedLength) throws TagDefinedException { this(tag, type, enc, fixedLength, fixedLength); } /** * Create a new Tag. * * @param tag * The integer value of the tag. * @param type * The allowed Java type for the value * @param enc * The encoding class to use to encode and decode values. * @param minLength * The minimum length allowed for the value. * @param maxLength
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -