src/jdk.sctp/share/classes/com/sun/nio/sctp/SendFailedNotification.java
changeset 47216 71c04702a3d5
parent 34894 3248b89d1921
equal deleted inserted replaced
47215:4ebc2e2fb97c 47216:71c04702a3d5
       
     1 /*
       
     2  * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.  Oracle designates this
       
     8  * particular file as subject to the "Classpath" exception as provided
       
     9  * by Oracle in the LICENSE file that accompanied this code.
       
    10  *
       
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    14  * version 2 for more details (a copy is included in the LICENSE file that
       
    15  * accompanied this code).
       
    16  *
       
    17  * You should have received a copy of the GNU General Public License version
       
    18  * 2 along with this work; if not, write to the Free Software Foundation,
       
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    20  *
       
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    22  * or visit www.oracle.com if you need additional information or have any
       
    23  * questions.
       
    24  */
       
    25 package com.sun.nio.sctp;
       
    26 
       
    27 import java.nio.ByteBuffer;
       
    28 import java.net.SocketAddress;
       
    29 
       
    30 /**
       
    31  * Notification emitted when a send failed notification has been received.
       
    32  *
       
    33  * <P> A send failed notification indicates that a message cannot be delivered.
       
    34  * Typically this is because the association has been shutdown with unsent data
       
    35  * in the socket output buffer, or in the case of a {@link SctpMultiChannel}
       
    36  * the association failed to setup.
       
    37  *
       
    38  * @since 1.7
       
    39  */
       
    40 public abstract class SendFailedNotification implements Notification {
       
    41     /**
       
    42      * Initializes a new instance of this class.
       
    43      */
       
    44     protected SendFailedNotification() {}
       
    45 
       
    46     /**
       
    47      * Returns the association that this notification is applicable to.
       
    48      *
       
    49      * @return  The association that failed to send, or {@code null} if
       
    50      *          there is no association, that is, the notification follows a
       
    51      *          {@linkplain
       
    52      *          com.sun.nio.sctp.AssociationChangeNotification.AssocChangeEvent#CANT_START}
       
    53      */
       
    54     @Override
       
    55     public abstract Association association();
       
    56 
       
    57     /**
       
    58      * Returns the address.
       
    59      *
       
    60      * @return  The peer primary address of the association or the address that
       
    61      *          the message was sent to
       
    62      */
       
    63     public abstract SocketAddress address();
       
    64 
       
    65     /**
       
    66      * Returns the data that was to be sent.
       
    67      *
       
    68      * @return  The user data. The buffers position will be {@code 0} and its
       
    69      *          limit will be set to the end of the data.
       
    70      */
       
    71     public abstract ByteBuffer buffer();
       
    72 
       
    73     /**
       
    74      * Returns the error code.
       
    75      *
       
    76      * <P> The errorCode gives the reason why the send failed, and if set, will
       
    77      * be a SCTP protocol error code as defined in RFC2960 section 3.3.10
       
    78      *
       
    79      * @return  The error code
       
    80      */
       
    81     public abstract int errorCode();
       
    82 
       
    83     /**
       
    84      * Returns the stream number that the messge was to be sent on.
       
    85      *
       
    86      * @return  The stream number
       
    87      */
       
    88     public abstract int streamNumber();
       
    89 }