/protocols/smpp/src/main/java/org/mobicents/protocols/smpp/gsm/UserData.java

http://mobicents.googlecode.com/ · Java · 80 lines · 9 code · 8 blank · 63 comment · 0 complexity · 661fb1e8adeaee1ee57ad8b19b4c7de1 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. package org.mobicents.protocols.smpp.gsm;
  23. /**
  24. * Interface for objects that can represent TP-User-Data as defined
  25. * by 3GPP TS 23.040.
  26. *
  27. * <p>
  28. * <strong>Experimental API</strong>: <tt>UserData</tt> and its supporting
  29. * classes and implementations are an experimental API and can change or
  30. * be removed at any time.
  31. * </p>
  32. * @version $Id: UserData.java 484 2010-02-08 16:08:50Z orank $
  33. */
  34. public interface UserData {
  35. /**
  36. * Add a {@link HeaderElement} to this user data implementation.
  37. * @param element The header element to add.
  38. */
  39. void addHeaderElement(HeaderElement element);
  40. /**
  41. * Calculate if this user data requires multiple SMS segments.
  42. * @return <tt>true</tt> if the user data requires multiple SMS
  43. * segments, <tt>false</tt> if the data requires only a single SMS.
  44. */
  45. boolean isMultiMessage();
  46. /**
  47. * Get the user data as a single message. This method only returns
  48. * normally if {@link #isMultiMessage()} returns <tt>false</tt>.
  49. * @return A byte array containing the encoded user data.
  50. * @throws IllegalStateException If this user data requires more
  51. * than one SMS segment.
  52. */
  53. byte[] toSingleSms();
  54. /**
  55. * Get the user data SMS segments.
  56. * @return An array of byte arrays, each element contains a single
  57. * SMS segment.
  58. */
  59. byte[][] toSegments();
  60. /**
  61. * Get the payload of this user data. This is the data that is
  62. * included in the message after the user data header has been encoded.
  63. * @return The payload of this user data.
  64. */
  65. byte[] getData();
  66. /**
  67. * Set the payload of this user data.
  68. * @param data The payload of this user data.
  69. * @see #getData()
  70. */
  71. void setData(byte[] data);
  72. }