/protocols/smpp/src/main/java/org/mobicents/protocols/smpp/version/SMPPVersion.java
Java | 134 lines | 39 code | 14 blank | 81 comment | 0 complexity | 5b29d3a1baacceaad7db50158532db01 MD5 | raw file
1/* 2 * JBoss, Home of Professional Open Source 3 * Copyright 2011, Red Hat, Inc. and individual contributors 4 * by the @authors tag. See the copyright.txt in the distribution for a 5 * full listing of individual contributors. 6 * 7 * This is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU Lesser General Public License as 9 * published by the Free Software Foundation; either version 2.1 of 10 * the License, or (at your option) any later version. 11 * 12 * This software is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this software; if not, write to the Free 19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org. 21 */ 22 23package org.mobicents.protocols.smpp.version; 24 25import java.io.Serializable; 26 27import org.mobicents.protocols.smpp.Address; 28 29/** 30 * Representation of an SMPP version. 31 * @version $Id: SMPPVersion.java 457 2009-01-15 17:37:42Z orank $ 32 */ 33public interface SMPPVersion extends Serializable { 34 /** 35 * SMPP version 3.3. 36 */ 37 SMPPVersion VERSION_3_3 = new SMPPVersion33(); 38 39 /** 40 * SMPP version 3.4. 41 */ 42 SMPPVersion VERSION_3_4 = new SMPPVersion34(); 43 44 /** 45 * SMPP version 5.0. 46 */ 47 SMPPVersion VERSION_5_0 = new SMPPVersion50(); 48 49 /** 50 * Get an integer value representing this SMPP version. At present, the 51 * SMPP specification uses a hex representation to identify versions; 52 * version 3.3 is represented by <code>0x33</code>, version 3.4 is 53 * <code>0x34</code>. 54 * @return An integer value that represents this integer version. 55 */ 56 int getVersionID(); 57 58 /** 59 * Determine if this SMPP version is older than another version. 60 * @param otherVersion The version to test against. 61 * @return <code>true</code> if this version is older than 62 * <code>otherVersion</code>, <code>false</code> if it 63 * newer than it. 64 */ 65 boolean isOlderThan(SMPPVersion otherVersion); 66 67 /** 68 * Determine if this SMPP version is equal to or newer than another 69 * version. 70 * @param otherVersion The version to test against. 71 * @return <code>true</code> if this version is newer than 72 * <code>otherVersion</code>, <code>false</code> if it is equal to or 73 * older than it. 74 */ 75 boolean isNewerThan(SMPPVersion otherVersion); 76 77 /** 78 * Determine if the specified <code>versionID</code> matches this 79 * version's ID. 80 * @param versionID The version ID to test against. 81 * @return <code>true</code> if this version's ID matches 82 * <code>versionID</code>. 83 */ 84 boolean equals(int versionID); 85 86 /** 87 * Get the maximum allowed length for a specified field. 88 * @param mandatoryParameter The enumerated field identifier to get the 89 * maximum length for. 90 * @return The maximum length of the specified field. 91 */ 92 int getMaxLength(MandatoryParameter mandatoryParameter); 93 94 /** 95 * Determine if this SMPP version supports the specified command. 96 * @param commandId The command ID of the packet. 97 * @return <code>true</code> if the command is supported, <code>false 98 * </code> otherwise. 99 */ 100 boolean isSupported(int commandId); 101 102 /** 103 * Determine if this SMPP version supports TLVs. This will 104 * be false for SMPP version 3.3 and true for versions 3.4 and later. 105 * @return <code>true</code> if this version supports TLV parameters, 106 * <code>false</code> otherwise. 107 */ 108 boolean isSupportTLV(); 109 110 void validateAddress(Address address); 111 void validateTon(int ton); 112 void validateNpi(int npi); 113 void validateAddressRange(String addressRange); 114 void validateEsmClass(int c); 115 void validateProtocolID(int id); 116 void validateDataCoding(int dc); 117 void validateDefaultMsg(int id); 118 void validateMessage(byte[] message, int start, int length); 119 void validateServiceType(String type); 120 void validateMessageId(String id); 121 void validateMessageState(int state); 122 void validateErrorCode(int code); 123 void validatePriorityFlag(int flag); 124 void validateRegisteredDelivery(int flag); 125 void validateReplaceIfPresent(int flag); 126 void validateNumberOfDests(int num); 127 void validateNumUnsuccessful(int num); 128 void validateDistListName(String name); 129 void validateSystemId(String sysId); 130 void validatePassword(String password); 131 void validateSystemType(String sysType); 132 void validateParamName(String paramName); 133 void validateParamValue(String paramValue); 134}