01: /**
02: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
03: * Unpublished - rights reserved under the Copyright Laws of the United States.
04: * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
05: * Copyright © 2005 BEA Systems, Inc. All rights reserved.
06: *
07: * Use is subject to license terms.
08: *
09: * This distribution may include materials developed by third parties.
10: *
11: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12: *
13: * Module Name : JSIP Specification
14: * File Name : IOExceptionEvent.java
15: * Author : M. Ranganathan
16: *
17: * HISTORY
18: * Version Date Author Comments
19: * 1.2 05/03/2005 M. Ranganathan Initial version
20: *
21: *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22: */package javax.sip;
23:
24: import java.util.EventObject;
25:
26: /**
27: * This object is used to signal to the application that an IO Exception has
28: * occured. The transaction state machine requires to report asynchronous IO Exceptions to
29: * the application immediately (according to RFC 3261).
30: * This class represents an IOExceptionEvent that is passed from a SipProvider to its SipListener.
31: * This event enables an implementation to propagate the asynchronous handling
32: * of IO Exceptions to the application. An application (SipListener) will
33: * register with the SIP protocol stack (SipProvider) and listen for
34: * IO Exceptions from the SipProvider.
35: * In many cases, when sending a SIP message, the sending function will return before
36: * the message was actually sent.
37: * This will happen for example if there is a need to wait for a response from a DNS server
38: * or to perform other asynchronous actions such as connecting a TCP connection.
39: * Later on if the message sending fails an IO exception event will be given to the application.
40: * IO Exception events may also be reported asynchronously when the Transaction State machine
41: * attempts to resend a pending request. Note that synchronous IO Exceptions
42: * are presented to the caller as SipException.
43: *
44: * @author BEA Systems, NIST
45: * @since v1.2
46: */
47: public class IOExceptionEvent extends EventObject {
48:
49: /** Constructor
50: *
51: * @param source -- the object that is logically deemed to have caused the IO Exception (dialog/transaction/provider).
52: * @param remoteHost -- host where the request/response was heading
53: * @param port -- port where the request/response was heading
54: * @param transport -- transport ( i.e. UDP/TCP/TLS).
55: */
56: public IOExceptionEvent(Object source, String remoteHost, int port,
57: String transport) {
58: super (source);
59: this .m_host = remoteHost;
60: this .m_port = port;
61: this .m_transport = transport;
62: }
63:
64: /**
65: * Return the host where Socket was pointing.
66: *
67: * @return host
68: *
69: */
70: public String getHost() {
71: return m_host;
72: }
73:
74: /**
75: * Returns the port where the socket was trying to send amessage.
76: *
77: * @return port associated with the IOException
78: */
79: public int getPort() {
80: return m_port;
81: }
82:
83: /**
84: * Return transport used for the failed write attempt.
85: *
86: * @return the transaction associated with the IOException
87: */
88: public String getTransport() {
89: return this .m_transport;
90: }
91:
92: private String m_host;
93: private int m_port;
94: private String m_transport;
95:
96: }
|