/protocols/ss7/map/map-api/src/main/java/org/mobicents/protocols/ss7/map/api/MAPDialog.java

http://mobicents.googlecode.com/ · Java · 246 lines · 44 code · 30 blank · 172 comment · 0 complexity · f44421684340f4c779544ded97d9141e 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.ss7.map.api;
  23. import org.mobicents.protocols.ss7.map.api.dialog.MAPDialogState;
  24. import org.mobicents.protocols.ss7.map.api.dialog.MAPUserAbortChoice;
  25. import org.mobicents.protocols.ss7.map.api.dialog.Reason;
  26. import org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessage;
  27. import org.mobicents.protocols.ss7.map.api.primitives.AddressString;
  28. import org.mobicents.protocols.ss7.map.api.primitives.IMSI;
  29. import org.mobicents.protocols.ss7.map.api.primitives.MAPExtensionContainer;
  30. import org.mobicents.protocols.ss7.tcap.api.tc.dialog.Dialog;
  31. import org.mobicents.protocols.ss7.tcap.asn.comp.Invoke;
  32. import org.mobicents.protocols.ss7.tcap.asn.comp.Problem;
  33. import org.mobicents.protocols.ss7.tcap.asn.comp.ReturnResult;
  34. import org.mobicents.protocols.ss7.tcap.asn.comp.ReturnResultLast;
  35. /**
  36. *
  37. * @author amit bhayani
  38. *
  39. */
  40. public interface MAPDialog {
  41. public static int _Timer_s = 10000;
  42. public static int _Timer_m = 30000;
  43. public static int _Timer_ml = 600000;
  44. public static int _Timer_l = 136800000;
  45. public static int _Timer_Default = -1;
  46. /**
  47. * Returns the current {@link MAPDialogState} of this Dialog
  48. *
  49. * @return
  50. */
  51. public MAPDialogState getState();
  52. /**
  53. * Remove MAPDialog without sending any messages and invoking events
  54. */
  55. public void release();
  56. /**
  57. * This method can be called on timeout of dialog, inside
  58. * {@link MAPDialogListener#onDialogTimeout(Dialog)} callback. If its
  59. * called, dialog wont be removed in case application does not perform
  60. * 'send'.
  61. */
  62. public void keepAlive();
  63. /**
  64. * Returns this Dialog's ID. This ID is actually TCAP's Dialog ID.
  65. * {@link org.mobicents.protocols.ss7.tcap.api.tc.dialog.Dialog}
  66. *
  67. * @return
  68. */
  69. public Long getDialogId();
  70. /**
  71. * Returns the MAP service that serve this dialog
  72. *
  73. * @return
  74. */
  75. public MAPServiceBase getService();
  76. /**
  77. * Set ExtentionContainer that will be send in 1) T-BEGIN 2) T-CONTINUE or
  78. * T-END if it is response to the T-BEGIN 3) T-ABORT If no Dialogue control
  79. * APDU is sending - ExtentionContainer will also not be sent
  80. */
  81. public void setExtentionContainer(MAPExtensionContainer extContainer);
  82. /**
  83. * This is equivalent of MAP User issuing the MAP_DELIMITER Service Request.
  84. * send() is called to explicitly request the transfer of the MAP protocol
  85. * data units to the peer entities.
  86. */
  87. public void send() throws MAPException;
  88. /**
  89. * This is equivalent of MAP User issuing the MAP_CLOSE Service Request.
  90. * This service is used for releasing a previously established MAP dialogue.
  91. * The service may be invoked by either MAP service-user depending on rules
  92. * defined within the service-user.
  93. *
  94. * <br/>
  95. *
  96. * If prearrangedEnd is false, all the Service Primitive added to MAPDialog
  97. * and not sent yet, will be sent to peer.
  98. *
  99. * <br/>
  100. *
  101. * If prearrangedEnd is true, all the Service Primitive added to MAPDialog
  102. * and not sent yet, will not be sent to peer.
  103. *
  104. * @param prearrangedEnd
  105. */
  106. public void close(boolean prearrangedEnd) throws MAPException;
  107. /**
  108. * This is equivalent to MAP User issuing the MAP_U_ABORT Service Request.
  109. *
  110. * @param userReason
  111. */
  112. public void abort(MAPUserAbortChoice mapUserAbortChoice) throws MAPException;
  113. /**
  114. * Send T_U_ABORT with MAP-RefuseInfo
  115. */
  116. public void refuse(Reason reason) throws MAPException;
  117. /**
  118. * Sends the TC-INVOKE component
  119. *
  120. * @param invoke
  121. * @throws MAPException
  122. */
  123. public void sendInvokeComponent(Invoke invoke) throws MAPException;
  124. /**
  125. * Sends the TC-RESULT-NL component
  126. *
  127. * @param returnResult
  128. * @throws MAPException
  129. */
  130. public void sendReturnResultComponent(ReturnResult returnResult) throws MAPException;
  131. /**
  132. * Sends the TC-RESULT-L component
  133. *
  134. * @param returnResultLast
  135. * @throws MAPException
  136. */
  137. public void sendReturnResultLastComponent(ReturnResultLast returnResultLast) throws MAPException;
  138. /**
  139. * Sends the TC-U-ERROR component
  140. *
  141. * @param invokeId
  142. * @param mapErrorMessage
  143. * @throws MAPException
  144. */
  145. public void sendErrorComponent(Long invokeId, MAPErrorMessage mapErrorMessage) throws MAPException;
  146. /**
  147. * Sends the TC-U-REJECT component
  148. *
  149. * @param invokeId
  150. * This parameter is optional and may be the null
  151. * @param problem
  152. * @throws MAPException
  153. */
  154. public void sendRejectComponent(Long invokeId, Problem problem) throws MAPException;
  155. /**
  156. * Reset the Invoke Timeout timer for the Invoke. (TC-TIMER-RESET)
  157. *
  158. * @param invokeId
  159. * @throws MAPException
  160. */
  161. public void resetInvokeTimer(Long invokeId) throws MAPException;
  162. /**
  163. * Causes local termination of an operation invocation (TC-U-CANCEL)
  164. *
  165. * @param invokeId
  166. * @return true:OK, false: Invoke not found
  167. * @throws MAPException
  168. */
  169. public boolean cancelInvocation(Long invokeId) throws MAPException;
  170. /**
  171. * Getting from the MAPDialog a user-defined object to save relating to the
  172. * Dialog information
  173. *
  174. * @return
  175. */
  176. public Object getUserObject();
  177. /**
  178. * Store in the MAPDialog a user-defined object to save relating to the
  179. * Dialog information
  180. *
  181. * @param userObject
  182. */
  183. public void setUserObject(Object userObject);
  184. public MAPApplicationContext getApplicationContext();
  185. /**
  186. * Return the maximum MAP message length (in bytes) that are allowed for
  187. * this dialog
  188. *
  189. * @return
  190. */
  191. public int getMaxUserDataLength();
  192. /**
  193. * Return the MAP message length (in bytes) that will be after encoding if
  194. * TC-BEGIN or TC-CONTINUE cases This value must not exceed
  195. * getMaxUserDataLength() value
  196. *
  197. * @return
  198. */
  199. public int getMessageUserDataLengthOnSend() throws MAPException;
  200. /**
  201. * Return the MAP message length (in bytes) that will be after encoding
  202. * if TC-END case
  203. * This value must not exceed getMaxUserDataLength() value
  204. * @param prearrangedEnd
  205. * @return
  206. */
  207. public int getMessageUserDataLengthOnClose(boolean prearrangedEnd) throws MAPException;
  208. /**
  209. * This method should be invoked after MAPDialog creation
  210. * if Ericsson-style ASN.1 syntax is used
  211. *
  212. * @param imsi
  213. * @param vlrNo
  214. */
  215. public void addEricssonData(IMSI imsi, AddressString vlrNo);
  216. }